Commit af31aab
authored
inbound: Return HTTP-level authorization errors (#1220)
The initial policy/authorization implementation only operates on
connections. When an connection is not authorized, the connection is
dropped and no information is passed back to the client. This also means
that all authorizations are made at connect-time and policy
changes--especially those that revoke access--are not observed
until a new connection is established. This is at the very least
awkward when trying to test policies.
This change modifies the inbound proxy's behavior for HTTP connections:
when a server configures a port to use (or be detected) as HTTP, the
authorization decision is now deferred until a request is processed. As
each request is handled, the policy's state is checked to determine
whether the connection is still permitted. If the connection is not
authorized, a `403 Forbidden` status code is returned for HTTP
requests (and the grpc-status `PermissionDenied` is used for gRPC
requests). The http error metrics also now reflect an `unauthorized`
reason.
This change, unfortunately, adds some wrinkles to our transport metric
labeling: HTTP connections will no longer have a `saz_name`
annotation--as no authorization policy is associated with these
connections (though they will continue to include the `srv_name` from
when the connection was established).1 parent acc6e47 commit af31aab
File tree
15 files changed
+348
-205
lines changed- linkerd/app
- core/src
- inbound/src
- http
- policy
- integration/src/tests
- src
15 files changed
+348
-205
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| |||
307 | 309 | | |
308 | 310 | | |
309 | 311 | | |
310 | | - | |
| 312 | + | |
311 | 313 | | |
312 | 314 | | |
313 | 315 | | |
| |||
351 | 353 | | |
352 | 354 | | |
353 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
354 | 363 | | |
355 | 364 | | |
356 | 365 | | |
| |||
433 | 442 | | |
434 | 443 | | |
435 | 444 | | |
| 445 | + | |
| 446 | + | |
436 | 447 | | |
437 | 448 | | |
438 | 449 | | |
| |||
466 | 477 | | |
467 | 478 | | |
468 | 479 | | |
| 480 | + | |
469 | 481 | | |
470 | 482 | | |
471 | 483 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
0 commit comments