Commit d2393c4
committed
fix: add logging to authentication errors in controller and router
Log authentication failures across the controller service (Listen,
GetLease, RequestLease, ReleaseLease, ListLeases, Register, Unregister,
Status, Dial), the Auth helpers (AuthClient, AuthExporter) which cover
all ClientService call sites, the router service, and the Python
exporter's PassphraseInterceptor.
The peer IP address is extracted from the gRPC context and included in
every auth log entry. For ClientService paths the peer is attached via
peerAddr(); for ControllerService unary handlers logContext() is called
at the start of each method so the peer propagates into all subsequent
log entries including the auth failure.
Log level: Info (not Error) is used intentionally, following the
convention established by kube-apiserver. Authentication rejections are
expected adversarial events, not controller bugs. Using Error would
conflate "something is broken in the controller" with "a caller sent a
bad token", muddying alerts. The controller-runtime/logr interface has
no native Warn level (the backend is zapr, which maps logr.Info ->
zap INFO and logr.Error -> zap ERROR with no WARN in between), so Info
at the default V=0 verbosity is the correct choice for security-relevant
but operationally normal events.
Also fix the router JWT validation gRPC status code from
codes.InvalidArgument to codes.Unauthenticated, which is the
semantically correct code for a failed authentication.
Fixes #8111 parent f19e473 commit d2393c4
4 files changed
Lines changed: 57 additions & 8 deletions
File tree
- controller/internal/service
- auth
- python/packages/jumpstarter/jumpstarter/exporter
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
16 | 33 | | |
17 | 34 | | |
18 | 35 | | |
| |||
35 | 52 | | |
36 | 53 | | |
37 | 54 | | |
| 55 | + | |
| 56 | + | |
38 | 57 | | |
39 | 58 | | |
40 | 59 | | |
| |||
44 | 63 | | |
45 | 64 | | |
46 | 65 | | |
| 66 | + | |
47 | 67 | | |
48 | 68 | | |
49 | 69 | | |
50 | 70 | | |
51 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
52 | 74 | | |
53 | 75 | | |
54 | 76 | | |
55 | 77 | | |
56 | 78 | | |
57 | 79 | | |
| 80 | + | |
| 81 | + | |
58 | 82 | | |
59 | 83 | | |
60 | 84 | | |
| |||
64 | 88 | | |
65 | 89 | | |
66 | 90 | | |
| 91 | + | |
67 | 92 | | |
68 | 93 | | |
69 | 94 | | |
70 | 95 | | |
71 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
72 | 99 | | |
73 | 100 | | |
74 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| 243 | + | |
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
247 | | - | |
| 248 | + | |
248 | 249 | | |
249 | 250 | | |
250 | 251 | | |
| |||
311 | 312 | | |
312 | 313 | | |
313 | 314 | | |
314 | | - | |
| 315 | + | |
315 | 316 | | |
316 | 317 | | |
317 | 318 | | |
| |||
524 | 525 | | |
525 | 526 | | |
526 | 527 | | |
| 528 | + | |
527 | 529 | | |
528 | 530 | | |
529 | 531 | | |
| |||
613 | 615 | | |
614 | 616 | | |
615 | 617 | | |
616 | | - | |
| 618 | + | |
617 | 619 | | |
618 | 620 | | |
619 | 621 | | |
| |||
747 | 749 | | |
748 | 750 | | |
749 | 751 | | |
750 | | - | |
| 752 | + | |
751 | 753 | | |
752 | 754 | | |
753 | 755 | | |
| |||
898 | 900 | | |
899 | 901 | | |
900 | 902 | | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
901 | 906 | | |
902 | 907 | | |
| 908 | + | |
903 | 909 | | |
904 | 910 | | |
905 | 911 | | |
| |||
977 | 983 | | |
978 | 984 | | |
979 | 985 | | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
980 | 989 | | |
981 | 990 | | |
| 991 | + | |
982 | 992 | | |
983 | 993 | | |
984 | 994 | | |
| |||
1031 | 1041 | | |
1032 | 1042 | | |
1033 | 1043 | | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
1034 | 1047 | | |
1035 | 1048 | | |
| 1049 | + | |
1036 | 1050 | | |
1037 | 1051 | | |
1038 | 1052 | | |
| |||
1062 | 1076 | | |
1063 | 1077 | | |
1064 | 1078 | | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
1065 | 1082 | | |
1066 | 1083 | | |
| 1084 | + | |
1067 | 1085 | | |
1068 | 1086 | | |
1069 | 1087 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| |||
0 commit comments