Repository navigation
fix: fail closed when admin key is unset - #8401
Closed
JustSamyog wants to merge 2 commits into
Closed
JustSamyog wants to merge 2 commits into
JustSamyog wants to merge 2 commits into
Conversation
Contributor
Pull request changelogAppAddedChangedDeprecatedRemovedFixedSecurityWebsiteAddedChangedDeprecatedRemovedFixedSecurityHostingAddedChangedDeprecatedRemovedFixedSecurity |
|
This pull request is closed, so it cannot be queued. Reopen it to get the box back. |
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.
admin_key_guardcompares theModrinth-Adminheader againstLABRINTH_ADMIN_KEYwith no check that a key is configured. The env default is the empty string, so when no key is set an attacker can pass the guard by simply sending an emptyModrinth-Adminheader (empty bytes match empty bytes in the constant-time comparison). Every route protected by this guard (internal search tasks, privacy, force reindex, Delphi ingest/file, blocked users, pprof, project creation override) is then reachable without a secret.Mirror
subscriptions_key_guardand fail closed when the configured key is empty: the guard now returnsfalsebefore comparing, so the routes are unmatched (404) until a real key is configured.CI and local test environments set
LABRINTH_ADMIN_KEY=feedbeef(.env.local), and the test API helpers send that same value as the header, so existing tests are unaffected.