Give every api v3 route one explicit authority classification Route authority lived implicitly in which scope block a route happened to sit in, so a new route could silently inherit whatever pipeline the block above it used. ApiRouteAuthority now names every /api/v3 route with its principal — anonymous, optional bearer, or required bearer — and a test compares that inventory against the router both ways: an unclassified or removed route fails CI. A second test dispatches an anonymous request at every classified route and asserts the enforcing plug answers as the classification promises: required-bearer routes refuse with 401 before any controller code runs, while anonymous and optional-bearer routes never do. The sweep surfaced real 500s: five controllers called String.to_integer on path segments and crashed with ArgumentError on malformed identifiers. A shared integer_param! helper routes those through each controller's existing NoResultsError rescue into stable 404s.
Give every api v3 route one explicit authority classification
Deploy story
What this commit did to the running system — joined from the forge receipt chain, the part a commit page elsewhere cannot show.
- built
- 12 modules in 14.3 s
- deployed
- live · 12 modules on 3 nodes · push→live —
- deployed
- needs_rolling_replace · 12 modules on 0 nodes · push→live —
Changed files
-
added
lib/openagents_web/api_route_authority.ex -
modified
lib/openagents_web/controllers/comment_controller.ex -
added
lib/openagents_web/controllers/controller_helpers.ex -
modified
lib/openagents_web/controllers/issue_assignee_controller.ex -
modified
lib/openagents_web/controllers/issue_controller.ex -
modified
lib/openagents_web/controllers/issue_label_controller.ex -
modified
lib/openagents_web/controllers/milestone_controller.ex -
added
test/openagents_web/api_route_authority_test.exs
Diff
8 files changed, +287 -16
lib/openagents_web/controllers/comment_controller.ex modified +18 -5
@@ -10,7 +10,13 @@ defmodule OpenAgentsWeb.CommentController do
| 10 | 10 |
|
| 11 | 11 |
|
| 12 | 12 |
|
| 13 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 14 | 20 |
|
| 15 | 21 |
|
| 16 | 22 |
|
@@ -29,7 +35,12 @@ defmodule OpenAgentsWeb.CommentController do
| 29 | 35 |
|
| 30 | 36 |
|
| 31 | 37 |
|
| 32 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 33 | 44 |
|
| 34 | 45 |
|
| 35 | 46 |
|
@@ -50,7 +61,9 @@ defmodule OpenAgentsWeb.CommentController do
| 50 | 61 |
|
| 51 | 62 |
|
| 52 | 63 |
|
| 53 |
|
|
| 64 |
|
|
| 65 |
|
|
| 66 |
|
|
| 54 | 67 |
|
| 55 | 68 |
|
| 56 | 69 |
|
@@ -61,7 +74,7 @@ defmodule OpenAgentsWeb.CommentController do
| 61 | 74 |
|
| 62 | 75 |
|
| 63 | 76 |
|
| 64 |
|
|
| 77 |
|
|
| 65 | 78 |
|
| 66 | 79 |
|
| 67 | 80 |
|
@@ -81,7 +94,7 @@ defmodule OpenAgentsWeb.CommentController do
| 81 | 94 |
|
| 82 | 95 |
|
| 83 | 96 |
|
| 84 |
|
|
| 97 |
|
|
| 85 | 98 |
|
| 86 | 99 |
|
| 87 | 100 |
|
lib/openagents_web/controllers/controller_helpers.ex added +22
@@ -0,0 +1,22 @@
| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
lib/openagents_web/controllers/issue_assignee_controller.ex modified +21 -3
@@ -5,7 +5,13 @@ defmodule OpenAgentsWeb.IssueAssigneeController do
| 5 | 5 |
|
| 6 | 6 |
|
| 7 | 7 |
|
| 8 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 9 | 15 |
|
| 10 | 16 |
|
| 11 | 17 |
|
@@ -23,7 +29,13 @@ defmodule OpenAgentsWeb.IssueAssigneeController do
| 23 | 29 |
|
| 24 | 30 |
|
| 25 | 31 |
|
| 26 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 27 | 39 |
|
| 28 | 40 |
|
| 29 | 41 |
|
@@ -51,7 +63,13 @@ defmodule OpenAgentsWeb.IssueAssigneeController do
| 51 | 63 |
|
| 52 | 64 |
|
| 53 | 65 |
|
| 54 |
|
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
|
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| 55 | 73 |
|
| 56 | 74 |
|
| 57 | 75 |
|
lib/openagents_web/controllers/issue_controller.ex modified +13 -2
@@ -94,7 +94,13 @@ defmodule OpenAgentsWeb.IssueController do
| 94 | 94 |
|
| 95 | 95 |
|
| 96 | 96 |
|
| 97 |
|
|
| 97 |
|
|
| 98 |
|
|
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
|
|
| 98 | 104 |
|
| 99 | 105 |
|
| 100 | 106 |
|
@@ -112,7 +118,12 @@ defmodule OpenAgentsWeb.IssueController do
| 112 | 118 |
|
| 113 | 119 |
|
| 114 | 120 |
|
| 115 |
|
|
| 121 |
|
|
| 122 |
|
|
| 123 |
|
|
| 124 |
|
|
| 125 |
|
|
| 126 |
|
|
| 116 | 127 |
|
| 117 | 128 |
|
| 118 | 129 |
|
lib/openagents_web/controllers/issue_label_controller.ex modified +21 -3
@@ -5,7 +5,13 @@ defmodule OpenAgentsWeb.IssueLabelController do
| 5 | 5 |
|
| 6 | 6 |
|
| 7 | 7 |
|
| 8 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 9 | 15 |
|
| 10 | 16 |
|
| 11 | 17 |
|
@@ -23,7 +29,13 @@ defmodule OpenAgentsWeb.IssueLabelController do
| 23 | 29 |
|
| 24 | 30 |
|
| 25 | 31 |
|
| 26 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 27 | 39 |
|
| 28 | 40 |
|
| 29 | 41 |
|
@@ -49,7 +61,13 @@ defmodule OpenAgentsWeb.IssueLabelController do
| 49 | 61 |
|
| 50 | 62 |
|
| 51 | 63 |
|
| 52 |
|
|
| 64 |
|
|
| 65 |
|
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
|
| 69 |
|
|
| 70 |
|
|
| 53 | 71 |
|
| 54 | 72 |
|
| 55 | 73 |
|
lib/openagents_web/controllers/milestone_controller.ex modified +13 -3
@@ -37,7 +37,11 @@ defmodule OpenAgentsWeb.MilestoneController do
| 37 | 37 |
|
| 38 | 38 |
|
| 39 | 39 |
|
| 40 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 41 | 45 |
|
| 42 | 46 |
|
| 43 | 47 |
|
@@ -58,7 +62,10 @@ defmodule OpenAgentsWeb.MilestoneController do
| 58 | 62 |
|
| 59 | 63 |
|
| 60 | 64 |
|
| 61 |
|
|
| 65 |
|
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
|
| 62 | 69 |
|
| 63 | 70 |
|
| 64 | 71 |
|
@@ -84,7 +91,10 @@ defmodule OpenAgentsWeb.MilestoneController do
| 84 | 91 |
|
| 85 | 92 |
|
| 86 | 93 |
|
| 87 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
|
| 97 |
|
|
| 88 | 98 |
|
| 89 | 99 |
|
| 90 | 100 |
|