fix(security): restrict release workflow to same-repo PRs and block env overrides for internal fields#4977
Open
20000419 wants to merge 1 commit intosupabase:developfrom
Open
fix(security): restrict release workflow to same-repo PRs and block env overrides for internal fields#497720000419 wants to merge 1 commit intosupabase:developfrom
20000419 wants to merge 1 commit intosupabase:developfrom
Conversation
Pull Request Test Coverage Report for Build 23280511206Details
💛 - Coveralls |
- gate release workflow to same-repo PRs before fast-forwarding\n- apply SUPABASE_* overrides only to user-configurable config fields\n- recurse through embedded base config while skipping internal and map-backed fields\n- sync generated API client files to match current infrastructure spec\n- stabilize logout tests by using the Viper YES flag instead of stdin timing
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.
What kind of change does this PR introduce?
Bug fix (security)
What is the current behavior?
The
fast-forwardworkflow (triggered onpull_request_reviewapproval) fast-forwardsmainto the PR head SHA without checking if the head repository matches the base repository, then calls the release workflow withsecrets: inherit.→ An approved PR from a fork could execute attacker-controlled code with release tokens (GitHub App, Slack, etc.).
viper.ExperimentalBindStruct()+AutomaticEnv()inloadFromEnv()binds all struct fields (including internaltoml:"-"fields likeDb.Image,Hostname) toSUPABASE_*environment variables.→ A malicious
.envfile in a repository could override internal Docker image/host settings, leading to arbitrary container execution when runningsupabase start.What is the new behavior?
Added explicit check
github.event.pull_request.head.repo.full_name == github.repositoryinrelease.yml→ release workflow only runs for same-repo PRs.Replaced
ExperimentalBindStruct()with a custombindUserConfigEnv()that:toml:"-"orjson:"-"TestEnvOverridesSkipInternalFieldsAdditional context
This PR fixes two High-severity issues discovered during a security review:
.envfilesBoth changes are minimal, backward-compatible, and include tests.
Closes the corresponding internal security findings.