-
Notifications
You must be signed in to change notification settings - Fork 102
fix(security): remove headerless broker-token fallback in appWriterAl... - #1176
Open
Adityakk9031 wants to merge 1 commit into
Open
fix(security): remove headerless broker-token fallback in appWriterAl... #1176Adityakk9031 wants to merge 1 commit into
Adityakk9031 wants to merge 1 commit into
Conversation
Contributor
|
No actionable comments were generated in the recent review. 🎉 i️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughTightens ChangesApp write authorization
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Uh oh!
There was an error while loading. Please reload this page.
Fixes #1175
Summary
Removes the insecure
a.Kind == requestActorKindBroker && actor == ""fallback lane inappWriterAllowed(internal/team/broker_apps.go).Previously, any agent process holding
WUPHF_BROKER_TOKENcould bypass app ownership checks and perform destructive actions (DELETE /apps/{id},POST /apps/{id}/rollback,PATCH /apps/{id}) by omitting the advisoryX-WUPHF-Agentheader on raw HTTP requests.Changes
appWriterAllowed().requestActorKindHuman).Diff Overview
func (b *Broker) appWriterAllowed(r *http.Request, actor string) bool { if strings.EqualFold(strings.TrimSpace(actor), appBuilderSlug) { return true } a, ok := requestActorFromContext(r.Context()) if !ok { return false } - if a.Kind == requestActorKindHuman { - return true - } - return a.Kind == requestActorKindBroker && strings.TrimSpace(actor) == "" + return a.Kind == requestActorKindHuman } <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Strengthened authorization for app modifications. * Restricted app-byte changes to approved App Builder actions and authenticated human sessions. * Removed an unintended fallback access path for app registration, editing, deletion, rollback, improvement, and preview actions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->