feat(AF-939): table and schema deny-lists alongside allow-lists - #1097
Merged
Merged
Conversation
Add denied_schemas / denied_tables to user and group datasource grants (V190). A denial always beats the allow-list, so an admin can allow a whole schema and carve out a few tables; new tables in the schema are allowed automatically unless denied. Denials merge by union across a user's grants — the inverse of the allow-list merge — so a permissive group grant can never lift one, and a JIT approval carries the replaced row's denials over. One fail-closed matcher (core.api.DeniedTables) backs submission, the recurring recheck, break-glass, dry-run, the access simulator, effective access, query suggestions, table preview, schema introspection and request-group members. Unqualified references are refused under any schema denial; db..table, @dblink suffixes and index patterns cannot slip past.
Contributor
Contributor
Coverage Report for Frontend Coverage (frontend)
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
Contributor
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #939
What
Datasource grants gain
denied_schemas/denied_tablesalongside the allow-lists, so an admin can say "all ofcrmexceptcrm.salary" instead of enumerating every other table. That enumeration would go stale, and fail open, whenever someone adds a table.allowed_schemas=[crm]+denied_tables=[crm.salary]permitscrm.customerand any table created later incrm, and rejectscrm.salary. Denials also work with no allow-list at all.DatasourceUserPermissionLookupServiceJavadoc andmerge(). A permissive group grant cannot lift a direct grant's denial (DefaultDatasourceUserPermissionLookupServiceTest,DeniedTablesEnforcementIntegrationTest). When an approved JIT request replaces an expiring direct row, that row's denials (tables, schemas and columns) carry over onto the JIT grant.core.api.DeniedTables:salarydenies it in every schema, andcrm.salaryalso denies an unqualifiedsalary.denied_schemasentry refuses unqualified references, so users must schema-qualify (confirmed design decision).db..table, Oracle@dblinksuffixes and Elasticsearch-style patterns (sal*) cannot slip past.schema.*indenied_tablesmeans the whole schema.error.permission.table_denied.denied_tablesdetail and DENY step.@Size(50)/@Size(200)with@NotBlankitems.@Patternrefuses entries that could never match anything: a dotted or wildcard schema, empty segments, or a stray*.Form.Itemrules.schema.*.V190__add_denied_tables_to_permissions.sqladds nullableTEXT[]columns.Docs & website
docs/03-data-model.md,docs/04-api-spec.md,docs/05-backend.md,docs/06-frontend.md,docs/07-security.md: the authorization flow diagram gets a deny step, plus a section on known engine limits.README.mdwebsite/docs/configuration/datasources/,website/docs/configuration/users-roles/,website/docs/guides/datasource/,website/docs/guides/team/, andwebsite/sitemap.xml.help-corpus/is regenerated.Tests
mvn verify -Pcoverage: 10,387 tests, 0 failures. That includesApplicationModulesTest,ApiPackageDependencyTestandMessagesParityTest.DeniedTablesTestandDeniedTablesEnforcementIntegrationTest.test:coverage(2,653+ tests, 96% lines / 87.7% branches) and build all pass.datasource-denied-tables.spec.ts. It passed locally together withdatasource-denied-columns,datasource-settingsand the access-simulation specs.Review notes
The
af-verifier,af-reviewer,af-java-reviewer,af-frontend-reviewerandaf-content-revieweragents reviewed the branch before this PR.db..tableandsal*index patterns could get past a denial. Also fixed: the Oracle@dblinkconcern, and entries that could never match (now refused by validation).granted=falsewithout a reason." The reverse index only returns granted rows (DefaultEffectiveAccessService:88), so a denied user is simply not listed.@NotBlankparity (frontend-form rule).$lookup/$unionWith/$graphLookup, Neo4jMATCH (n)and RedisKEYSglobs.denied_schemasentry refuses every query.denied_columns(proxy: column-level authorization — block, not just mask #935) still merges by intersection. This asymmetry is documented.Screenshots