Commit 7a4dc89
committed
fix(api): update InternalRBACRules SPIFFE identifiers to nico-* prefix
After the carbide → nico platform rename, all newly deployed services
present SPIFFE identifiers with the nico-* prefix, but InternalRBACRules
in crates/api/src/auth/internal_rbac_rules.rs still matched against
hardcoded carbide-* strings. Every internal service-to-api gRPC call
failed mTLS authorization with HTTP 403, silently breaking all
service-to-service communication.
Switch RuleInfo::new from `map(|x| -> Principal)` to
`flat_map(|x| -> Vec<Principal>)` so each rule can accept multiple
acceptable SPIFFE identifiers, then have each renamed variant emit
BOTH the new nico-* and the legacy carbide-* identifier via an
svc_compat helper:
Dns -> nico-dns, carbide-dns
Dhcp -> nico-dhcp, carbide-dhcp
Ssh -> nico-ssh-console, carbide-ssh-console
SshRs -> nico-ssh-console-rs, carbide-ssh-console-rs
Pxe -> nico-pxe, carbide-pxe
BmcProxy -> nico-bmc-proxy, carbide-bmc-proxy
Health -> nico-hardware-health, carbide-hardware-health
Flow -> nico-flow, carbide-flow
MaintenanceJobs -> nico-maintenance-jobs, carbide-maintenance-jobs
DsxExchangeConsumer -> nico-dsx-exchange-consumer,
carbide-dsx-exchange-consumer
The `allowed()` matcher already walks this Vec with `.any(...)`, so the
change is transparent to callers: deployed sites still presenting a
carbide-* cert continue to authorize, and freshly deployed sites with
nico-* certs work too. The carbide-* aliases should be dropped once
every site has rotated to a nico-* cert.
Failure mode before this fix: inbound gRPC from e.g. nico-dns to nico-api
surfaced as
WARN auth::internal_rbac_rules — principal SpiffeServiceIdentifier("nico-dns")
not authorized for method LookupRecordLegacy — no matching rule
with no TLS-level error, masking the root cause. Impact spanned DNS
resolution, DHCP lease lookups, PXE GetCloudInitInstructions, SSH console
access, hardware health reporting, and maintenance job scheduling — every
internal principal that authenticates via SpiffeServiceIdentifier.
Follow-up (not in this PR): these identifiers are stringly-typed with no
compile-time link to the actual deployed service names. Worth deriving
them from a shared constant or asserting consistency in an integration
test that round-trips each principal through cert subject + RBAC lookup.
Fixes #18911 parent 573ddb2 commit 7a4dc89
1 file changed
Lines changed: 79 additions & 60 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
899 | 899 | | |
900 | 900 | | |
901 | 901 | | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
902 | 913 | | |
903 | 914 | | |
904 | 915 | | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | | - | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
916 | 923 | | |
917 | | - | |
918 | | - | |
919 | | - | |
920 | | - | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
921 | 932 | | |
922 | | - | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
| 933 | + | |
| 934 | + | |
927 | 935 | | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
928 | 939 | | |
929 | | - | |
930 | | - | |
931 | | - | |
932 | | - | |
933 | | - | |
934 | | - | |
935 | | - | |
| 940 | + | |
936 | 941 | | |
| 942 | + | |
| 943 | + | |
937 | 944 | | |
938 | | - | |
939 | | - | |
940 | | - | |
941 | | - | |
| 945 | + | |
942 | 946 | | |
| 947 | + | |
943 | 948 | | |
944 | | - | |
| 949 | + | |
945 | 950 | | |
946 | | - | |
947 | | - | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
948 | 954 | | |
949 | | - | |
| 955 | + | |
950 | 956 | | |
951 | 957 | | |
952 | 958 | | |
| |||
1033 | 1039 | | |
1034 | 1040 | | |
1035 | 1041 | | |
1036 | | - | |
1037 | | - | |
1038 | | - | |
| 1042 | + | |
1039 | 1043 | | |
1040 | 1044 | | |
1041 | 1045 | | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
| 1046 | + | |
1045 | 1047 | | |
1046 | 1048 | | |
1047 | 1049 | | |
| |||
1059 | 1061 | | |
1060 | 1062 | | |
1061 | 1063 | | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
| 1064 | + | |
1065 | 1065 | | |
1066 | 1066 | | |
1067 | 1067 | | |
| |||
1086 | 1086 | | |
1087 | 1087 | | |
1088 | 1088 | | |
1089 | | - | |
| 1089 | + | |
1090 | 1090 | | |
1091 | 1091 | | |
1092 | 1092 | | |
| |||
1109 | 1109 | | |
1110 | 1110 | | |
1111 | 1111 | | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
| 1112 | + | |
1115 | 1113 | | |
1116 | 1114 | | |
1117 | 1115 | | |
1118 | | - | |
1119 | | - | |
1120 | | - | |
| 1116 | + | |
1121 | 1117 | | |
1122 | 1118 | | |
1123 | 1119 | | |
1124 | | - | |
1125 | | - | |
1126 | | - | |
| 1120 | + | |
1127 | 1121 | | |
1128 | 1122 | | |
1129 | 1123 | | |
1130 | | - | |
1131 | | - | |
1132 | | - | |
| 1124 | + | |
1133 | 1125 | | |
1134 | 1126 | | |
1135 | 1127 | | |
1136 | 1128 | | |
1137 | 1129 | | |
1138 | 1130 | | |
1139 | | - | |
| 1131 | + | |
1140 | 1132 | | |
1141 | 1133 | | |
1142 | 1134 | | |
| |||
1148 | 1140 | | |
1149 | 1141 | | |
1150 | 1142 | | |
1151 | | - | |
1152 | | - | |
| 1143 | + | |
| 1144 | + | |
1153 | 1145 | | |
1154 | 1146 | | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
1155 | 1174 | | |
1156 | 1175 | | |
1157 | 1176 | | |
| |||
0 commit comments