Skip to content

Navigation Menu

Sign in
Sign up

fix(security): remove headerless broker-token fallback in appWriterAl... - #1176

Open
Adityakk9031 wants to merge 1 commit into
najmuzzaman-mohammad:main from
Adityakk9031:#1175
Open

fix(security): remove headerless broker-token fallback in appWriterAl... #1176
Adityakk9031 wants to merge 1 commit into
najmuzzaman-mohammad:main from
Adityakk9031:#1175

Conversation

@Adityakk9031

@Adityakk9031 Adityakk9031 commented Jul 20, 2026
edited by coderabbitai Bot
Loading

Copy link
Copy Markdown

Fixes #1175

Summary

Removes the insecure a.Kind == requestActorKindBroker && actor == "" fallback lane in appWriterAllowed (internal/team/broker_apps.go).

Previously, any agent process holding WUPHF_BROKER_TOKEN could bypass app ownership checks and perform destructive actions (DELETE /apps/{id}, POST /apps/{id}/rollback, PATCH /apps/{id}) by omitting the advisory X-WUPHF-Agent header on raw HTTP requests.

Changes

  • Removed the broker-token fallback lane from appWriterAllowed().
  • Restricted non-App-Builder app mutations strictly to verified human sessions (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 -->

Adityakk9031 requested review from a team and FranDias as code owners July 20, 2026 19:05

coderabbitai Bot commented Jul 20, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

i️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 70db4490-a112-48d5-87cc-88638f487a89

📥 Commits

Reviewing files that changed from the base of the PR and between 2aa53c1 and 85491c6.

📒 Files selected for processing (1)
  • internal/team/broker_apps.go

📝 Walkthrough

Walkthrough

Tightens appWriterAllowed so app-byte mutations remain available to the App Builder identity and human callers, while removing the broker/empty-actor fallback authorization path.

Changes

App write authorization

Layer / File(s) Summary
Tighten app writer authorization
internal/team/broker_apps.go
Updates the authorization comment and restricts non-App Builder callers to human request actors, removing the broker fallback lane.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: frandias, najmuzzaman-mohammad

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the security fix to remove the headerless broker-token fallback.
Linked Issues check ✅ Passed The change matches #1175 by blocking broker-token callers without X-WUPHF-Agent while keeping the App Builder exception.
Out of Scope Changes check ✅ Passed No unrelated code changes are present beyond the app write-authorization fix in broker_apps.go.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@FranDias FranDias Awaiting requested review from FranDias

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

security: broker-token actor bypasses appWriterAllowed gate — any agent can delete/rollback/rename apps

1 participant

AltStyle によって変換されたページ (->オリジナル) /