Repository navigation
Throw Error for Empty Database Policies - #3865
Open
RubenCerna2079 wants to merge 5 commits into
Open
RubenCerna2079 wants to merge 5 commits into
RubenCerna2079 wants to merge 5 commits into
Conversation
RubenCerna2079
marked this pull request as ready for review
October 22, 2026 01:16
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Nonempty policy text can still produce a null filter during parsing, bypassing the production safeguard.
1 open issue
What changed in this PR
This PR adds protection against configured database authorization policies that resolve to empty text, warning in development and rejecting requests in production.
Changes:
- Adds structured audit logging and production authorization errors for empty resolved policies.
- Allows authorization tests to inject a logger.
- Adds tests for host-mode behavior and valid or unconfigured policies.
| File | Description |
|---|---|
| src/Service.Tests/Authorization/AuthorizationResolverUnitTests.cs | Tests empty-policy handling and audit contents. |
| src/Service.Tests/Authorization/AuthorizationHelpers.cs | Supports logger injection for tests. |
| src/Core/Authorization/AuthorizationResolver.cs | Adds empty-policy detection, auditing, and production rejection. |
Review effort: Balanced
Souvik Ghosh (souvikghosh04)
approved these changes
Oct 22, 2026
Mohit G (gmohit21)
approved these changes
Oct 22, 2026
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.

Why make this change?
What is this change?
Checks that the database policy didn't compile to an empty predicate, in case that it does it will send a log warning message in development mode or throw an error in production mode.
Created the new
AuditDatabasePolicyFailOpenfunction to create the log message and throw an error in case DAB is in production mode.How was this tested?
Added tests to ensure that an empty policy will return the expected log message and throw an error only if it is in production mode.
Sample Request(s)