Repository navigation
fix(api): validate resolved trigger identity (1.8 backport) - #1627
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
* docs(release): open the v1.8.0-rc.16 changelog entry * docs(release): prepare v1.8.0-rc.16 candidate metadata Prepare opt-in RC16 metadata, current docs, translated READMEs, demo fixtures and release identity checks. Includes: - #1627 trigger alias scope bypass (security) - #1628 scan the running digest (security) - #1639 openssl 3.5.9-r1 pin with a scoped fixed OpenVEX - #1641 static site render
Backport of the 1.9 fix for 1.8.0-rc.16 (pre-existing issue, also in 1.7).
An API key scoped to
triggers:testcould run an agent's action trigger by putting the agent name in the type segment (/triggers/edge1.docker/update), skipping update admission. The route now checks that the resolved trigger's type, name and agent match the path, and scope and dispatch use the resolved trigger's real type. Also brings the container-actions flag to the trigger run routes and fixes the case-sensitive webhook endpoint-secret check.Changelog
🔒 Security
triggers:testcould run an agent action trigger. The route built a trigger key that resolved to an agent-owned component, and the early scope check filed it as notification.runTrigger(local) andrunRemoteTriggernow verify that the resolved component'stype,name, andagentmatch the route. Mismatches return 404.🐛 Fixed
app/api/webhook.ts:getWebhookActionFromRequestlowercases the normalized path before route matching. Path matching is now case-insensitive.runTriggerandrunRemoteTriggerdo not dispatch update actions based on the routetype. They usetriggerToRun.type.✨ Added
app/api/trigger-identity.ts:doesTriggerMatchRoute(component, route). Returns true whentypeandnameare equal and(component.agent ?? '')equalsroute.agent.app/api/trigger.tsrunTrigger: returns 403 for action triggers whenareContainerActionsEnabled()is false.app/api/trigger.tsrunRemoteTrigger: returns 403 for action triggers before agent lookup. The check uses the routetriggerType.app/api/container/triggers.tsrunTrigger: returns 403 for action triggers when actions are disabled. Required scope iscontainers:updatefor actions andtriggers:testotherwise.app/api/trigger-routes-alias.test.ts(new, 71 lines): aliased notification-trigger routes return 404. No proxy, update, or agent lookup runs.app/api/container/triggers.test.ts(+171): agent-qualified route rejection, mismatched agent refusal, disabled-action 403 for Docker and command triggers, notification triggers still run.app/api/trigger.test.ts(+256/-1): alias handling, canonical explicit-agent update, disabled-action 403 before agent lookup, scope recheck after resolution.app/api/webhook-auth.integration.test.ts(new, 164 lines): per-endpoint token selection across mixed-case paths and trailing slashes. Disabled webhooks return 403.app/api/container.test.ts(+19/-?):runTriggermock fixtures includetype,name, andagent.🔧 Changed
app/api/container/triggers.ts: importsareContainerActionsEnabled,CONTAINER_ACTIONS_DISABLED_MESSAGE, anddoesTriggerMatchRoute.app/api/trigger.ts: imports the same helpers plusdoesTriggerMatchRoute.Concerns
runRemoteTrigger(app/api/trigger.ts) checks the disabled-actions gate using the routetriggerType, not the resolved component type. Confirm the scope check in that handler also keys off the resolved type. This was not visible in the diff hunks reviewed.requiredScopeForTriggerType(...)intrigger.tsand an inline ternary incontainer/triggers.ts. Consolidate into one helper.getTriggerCategoryForTypeis called in both files. Consider a shared guard.doesTriggerMatchRouteis used in three call sites with the same shape. Consider one wrapper that builds the route object.webhook.tschange lowercases only the request path used for action routing. Verify the endpoint-secret comparison in the same module also uses the normalized path. The diff does not show that code.runRemoteTriggerroute validation: the explicit-agent test asserts the update request runs once. Confirm no direct proxy path remains reachable with a mismatched agent.trigger.test.ts255 vs 256). Use the diff stat values.