fix(safegres): L4 counts views, so a view-only read path is not dead schema USAGE - #1607
Merged
Merged
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
Reconciles the L4/L8 interaction surfaced by #1606: on corpus case
25-definer-view-bypass, L8 reported thatcorpus_anonreads a table through a view in a schema while L4 reported, on the same run, that the role'sUSAGEon that schema is dead and revokable.checkDeadSchemaUsagecounted onlyTableSnapshots, so a role whose only reachable object in a schema is a view looked like it reached nothing — a recommend-a-revoke on a grant the API is actively serving through, which is exactly what the lattice is not allowed to do.The parameter is optional so existing callers keep compiling, but the audit always passes it:
needsViewsnow includes L4, so the singleintrospectViewscall added by #1606 (already shared by the perf paths and L8) also feeds L4. The view ACL composes through the same PUBLIC/inheritance closure as a table's —effectiveGrantswas widened toPick<TableSnapshot, 'grants'>in #1606, so no new closure logic.Pinned negatively where it was found: corpus case 25 now carries
"L4"inforbid, so the false positive cannot come back silently. Unit test covers both directions (a view in the schema clears L4; a view in another schema does not).pnpm build,pnpm lint,pnpm test(336) pass inpackages/safegres.Link to Devin session: https://app.devin.ai/sessions/f340c08768814b278a179aea7994f924
Requested by: @pyramation