Repository navigation
Commit f7e2667
authored
fix(catalog/rest): sign SigV4 with credentials from catalog properties (#1999)
* fix(catalog/rest): sign SigV4 with credentials from catalog properties
The REST catalog's SigV4 signer only used the AWS default credential chain
(config.LoadDefaultConfig), ignoring the s3.* credential properties passed to
the catalog. This forced callers targeting AWS SigV4 REST catalogs (S3 Tables,
Glue) to export AWS_* environment variables even when they supplied credentials
via catalog properties.
Build a static credentials provider from s3.access-key-id / s3.secret-access-key
/ s3.session-token when present, and only fall back to the default chain
otherwise. An explicitly provided aws.Config (WithAwsConfig) still wins.
This mirrors the same gap tracked for the Python client in
apache/iceberg-python#2070.
Signed-off-by: iremcaginyurtturk <[email protected]>
* test(catalog/rest): pin SigV4 props-cred signing; error on partial creds
Address review feedback:
- Add TestSigV4SignsWithPropsCredentials, which asserts the SigV4 Authorization
header is signed with the credentials from catalog properties. This pins the
wiring: removing the cfg.Credentials assignment makes the test fail.
- staticCredsFromProps now returns an error when only one of the access-key /
secret-access-key pair is set, instead of silently falling back to the ambient
default identity. Neither set still falls back to the default chain.
Signed-off-by: iremcaginyurtturk <[email protected]>
* docs(catalog/rest): document SigV4 signing credential precedence
Address review feedback (minor): the SigV4 signing identity resolves as
WithAwsConfig > s3.* catalog properties > AWS default credential chain. Document
this on WithSigV4 and in the rest.sigv4-enabled configuration reference.
Signed-off-by: iremcaginyurtturk <[email protected]>
* fix(catalog/rest): error on incomplete SigV4 creds via ValidateStaticCredentials
Delegate staticCredsFromProps to internal/awsconfig.ValidateStaticCredentials so
a token-only s3.session-token (no access/secret key) returns the
ErrIncompleteStaticCredentials sentinel instead of silently dropping to the
default credential chain. Add a token-only test case and assert the sentinel via
errors.Is. Document the s3.* vs Java rest.* divergence in the WithSigV4 godoc and
configuration.md.
* feat(catalog/rest): accept Java rest.* SigV4 credential aliases
Accept rest.access-key-id / rest.secret-access-key / rest.session-token as
aliases for the s3.* signing-credential properties, resolved per field with the
s3.* keys taking precedence. This lets operators migrating from the Java client
configure SigV4 signing with the property names they already use instead of
silently falling through to the AWS default credential chain.
* fix(catalog/rest): harden SigV4 credential boundaries
Two credential-boundary fixes for the props-based SigV4 signing path:
- Resolve the credential tuple atomically per namespace. Resolving each field
independently let a partial s3.* pair be completed with a rest.* field (or
inherit an unrelated rest.* token), signing as a hybrid identity that still
passed validation. Now if any s3.* field is set we validate and use only the
s3.* tuple, otherwise only the rest.* tuple; never backfill across namespaces.
- Do not re-sign a cross-origin redirect. sessionTransport signed every hop, so
a redirect to a different origin exposed the SigV4 Authorization header and
session token to an unconfigured host. Signing is now skipped when the request
origin (scheme/host/effective port) differs from the configured catalog origin.
Tests cover the mixed-partial and s3-pair-plus-rest-token cases and assert a
cross-origin redirect target receives neither the Authorization header nor the
session token. Also closes a response body left open in an existing test.
Signed-off-by: iremcaginyurtturk <[email protected]>
---------
Signed-off-by: iremcaginyurtturk <[email protected]>1 parent dd935d8 commit f7e2667
4 files changed
Lines changed: 237 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
91 | 99 | | |
92 | 100 | | |
93 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| |||
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
95 | 103 | | |
96 | 104 | | |
97 | 105 | | |
| |||
243 | 251 | | |
244 | 252 | | |
245 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
246 | 279 | | |
247 | 280 | | |
248 | 281 | | |
| |||
292 | 325 | | |
293 | 326 | | |
294 | 327 | | |
295 | | - | |
| 328 | + | |
296 | 329 | | |
297 | 330 | | |
298 | 331 | | |
| |||
1107 | 1140 | | |
1108 | 1141 | | |
1109 | 1142 | | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
1110 | 1149 | | |
1111 | | - | |
1112 | 1150 | | |
1113 | 1151 | | |
1114 | 1152 | | |
1115 | 1153 | | |
1116 | 1154 | | |
1117 | 1155 | | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
1118 | 1161 | | |
1119 | 1162 | | |
1120 | 1163 | | |
1121 | 1164 | | |
1122 | 1165 | | |
1123 | 1166 | | |
1124 | 1167 | | |
| 1168 | + | |
1125 | 1169 | | |
1126 | 1170 | | |
1127 | 1171 | | |
1128 | 1172 | | |
1129 | 1173 | | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
1130 | 1201 | | |
1131 | 1202 | | |
1132 | 1203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
55 | 210 | | |
56 | 211 | | |
57 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
0 commit comments