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.
Add fetch metadata module #2271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 5.4.x
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Add fetch metadata module #2271
Changes from all commits
790e98c0341e3357736606174fbd36fb47e455d9c74ac826e2c1af472d1abb2d35f1b82c6ae282bf97346329a6b807e42ac1264ad18b9bde6072698316a4d3197caa9File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An empty
patternsilently disables the filter.This reads the raw property placeholder, and nothing in the module injects
FetchMetadataFilterConfiguration— so neithersetPattern's empty-guard nor the@NotBlankon the field is in the request path.Set
micronaut.security.fetch-metadata.filter.pattern: ""(a plausible typo or a mis-substituted env var) and the placeholder resolves to the empty string:@ServerFilter("")matches nothing, the filter never runs, and there is no warning. Fail-open from a config typo is a rough failure mode for a security filter.FetchMetadataFilterConfigurationPropertiesTest.usesDocumentedDefaultsAndIgnoresEmptyPatternsasserts the setter guard, which gives false confidence — that code path is never exercised in production.Injecting the configuration bean and deriving the pattern from it would make the guard real.
Check failure on line 77 in security-fetch-metadata/src/main/java/io/micronaut/security/fetchmetadata/FetchMetadataFilter.java
Refactor this method to reduce its Cognitive Complexity from 17 to the 15 allowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rejection is a bare
403with no body and no extension point. Elsewhere in this repo rejections go throughRejectionHandler, so applications can render a page, redirect, or add a header.Even just a
@DefaultImplementation-backed seam here would let applications customize the response without forking the filter.Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.