Repository navigation
[Server] Add a migration flag for stricter privilege checks - #2023
Conversation
fb9ca74 to
fd9d70d
Compare
|
/review |
fd9d70d to
fe4eed8
Compare
|
/review |
| The setting does not disable authorization. It selects the previous rules for these checks, | ||
| including access that the corrected rules would deny. Use `false` only while updating applications | ||
| and grants. Set it back to `true` when the migration is complete. |
There was a problem hiding this comment.
[AI Assisted] Which checks are "these checks"? false re-allows access, and the doc asks operators to use it only while updating applications and grants, but they can't tell which grants to update, or whether they need the flag at all. Can we list the checks it covers? From the stack, roughly:
- Grants ([Server] Reject privilege grants on invalid object types #2014):
updatePermissionsaccepts privileges that don't apply to the securable type. - Iceberg credential vending ([Server] Check read access before returning Iceberg credentials #2015): table credentials are vended under the
GET_TABLErule, withoutUSE_CATALOG,USE_SCHEMA, andSELECTorOWNER. - Table details ([Server] Remove MODIFY from table metadata checks #2016):
MODIFYalone is enough to read table details. - Volume rename ([Server] Require schema creation permission for volume rename #2017): no
OWNER, orUSE_SCHEMA+CREATE_VOLUME, needed on the schema. - Model rename ([Server] Require schema creation permission for model rename #2018): no schema
OWNER, orUSE_SCHEMA+CREATE_MODEL/CREATE_FUNCTION, needed.
To keep it in sync, this PR could add the heading and each dependent PR its own bullet. Also worth one sentence on scope: the expression-based checks only apply when server.authorization=enable, while the grant validation in #2014 applies either way.
There was a problem hiding this comment.
yeah, ive added it per dependent PR now.
|
|
||
| resourceIds.forEach((k, v) -> context.setVariable(k.name().toLowerCase(), v)); | ||
| nonResourceValues.forEach(context::setVariable); | ||
| // A request value must not override the server's migration setting. |
There was a problem hiding this comment.
This comment is unnecessary as no code is setting strictPrivilegeChecks in nonResourceValues
| resourceIds.forEach((k, v) -> context.setVariable(k.name().toLowerCase(), v)); | ||
| nonResourceValues.forEach(context::setVariable); | ||
| // A request value must not override the server's migration setting. | ||
| context.setVariable("strictPrivilegeChecks", strictPrivilegeChecks); |
There was a problem hiding this comment.
Should use strict_privilege_checks
There was a problem hiding this comment.
sounds good, renamed to strict_privilege_checks
eb6a7f9 to
4f805b5
Compare
| Use wildcard issuers only where necessary, only for domains you control, and avoid patterns that | ||
| cover internal or sensitive hosts. Prefer exact issuer URLs and `https://` issuers when possible. | ||
|
|
||
| ### Permission-check migration |
There was a problem hiding this comment.
Can we say here that this flag is temporary, and when it goes away? For example: "This setting is temporary and will be removed before the first stable (1.0) release. Set it to false only while you update applications and grants."
Right now the docs say to use false only during a migration but give no deadline, and the PR description says the fallback "can be deleted after the migration" with no date. A removal target tells operators when they must have fixed their grants and scripts. It also tells contributors when the fallback conditions in the follow-up PRs can be deleted. main is at 0.8.0-SNAPSHOT, so the flag first ships in the next release.
There was a problem hiding this comment.
Added that it’s temporary. I’d leave the removal version open for now.
| void evaluateSkipsRefreshWhenExpressionAllows() throws Exception { | ||
| UnityCatalogAuthorizer authorizer = mock(UnityCatalogAuthorizer.class); | ||
| UnityAccessEvaluator evaluator = new UnityAccessEvaluator(authorizer); | ||
| UnityAccessEvaluator evaluator = new UnityAccessEvaluator(authorizer, true); |
There was a problem hiding this comment.
Should we parameterize these tests so both true and false run until we remove the flag?
These four tests hard-code true, and none of them reads #strict_privilege_checks, so false is only exercised by the new evaluateUsesServerPrivilegeChecksSetting. The refresh and deny logic should behave the same in both modes. A parameterized run would catch a future change that accidentally ties that logic to the flag.
JUnit is 5.13.4 here, so @ParameterizedClass with @ValueSource(booleans = {true, false}) on the class (as in BaseCredRenewITTest) runs every test in both modes with one change. The new test could then use the parameter instead of its manual loop. We would delete the parameter together with the flag.
There was a problem hiding this comment.
I’d leave these as is. The flag doesn’t affect refresh, and the new test already checks both values.
4f805b5 to
7e4d213
Compare
Signed-off-by: Timothy Wang <[email protected]>
7e4d213 to
d63e701
Compare
|
@timothyw553 Merged. Please rebase the other stacked PRs. |
🥞 Stacked PR
Use this link to review incremental changes.
PR Checklist
docsis updatedDescription of changes
Add
server.authorization.strict-privilege-checks, which defaults totrue.The following permission fixes use this setting so deployments can keep the previous rules
temporarily while updating their applications and grants. Setting it to
falseretains theprevious behavior, including access that the corrected checks would deny.
This PR adds the validated setting and passes it to authorization expressions as the trusted
#strict_privilege_checksvariable. Request values cannot change it. The setting also reachesresponse filtering through the shared evaluator. This base PR does not change permission decisions.
Use the same value on every server instance and restart each instance after changing it.
The fallback conditions and the setting can be deleted after the migration.
Tests passed with JDK 17:
33 tests passed.
Combined validation with all five dependent fixes:
build/sbt -J-Xmx2G javafmtAll "server/test": 923 tests passed.