refactor(router): enforce instance identity positively instead of str… - #2
Merged
Merged
Conversation
…ipping input The previous fix conditionally ran the subtractive `sanitizeUntrustedInput` based on whether a URL param happened to be present. That inferred a route's scope indirectly and still relied on blanket field-stripping. Replace it with a positive invariant: capture the guard-authenticated `:instanceName` from the URL up front, then after hydrating the DTO from query/body, force that value back onto the DTO + schema ref and drop any instanceId supplied via query/body. The URL identity is thus the single source of truth on scoped routes — a caller can never redirect the request to another instance (cross-instance auth bypass, CVE-2435 / evolution-foundation#2549) — while param-less listing routes (GET /instance/fetchInstances?instanceId=…) keep their query filters, so the manager opens the instance it was asked for. Verified: fetchInstances?instanceId=X returns exactly X; a scoped route with a conflicting ?instanceName= override still operates on the URL instance. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
…ipping input
The previous fix conditionally ran the subtractive
sanitizeUntrustedInputbased on whether a URL param happened to be present. That inferred a route's scope indirectly and still relied on blanket field-stripping.Replace it with a positive invariant: capture the guard-authenticated
:instanceNamefrom the URL up front, then after hydrating the DTO from query/body, force that value back onto the DTO + schema ref and drop any instanceId supplied via query/body. The URL identity is thus the single source of truth on scoped routes — a caller can never redirect the request to another instance (cross-instance auth bypass, CVE-2435 / evolution-foundation#2549) — while param-less listing routes (GET /instance/fetchInstances?instanceId=…) keep their query filters, so the manager opens the instance it was asked for.Verified: fetchInstances?instanceId=X returns exactly X; a scoped route with a conflicting ?instanceName= override still operates on the URL instance.
📋 Description
🔗 Related Issue
Closes #(issue_number)
🧪 Type of Change
🧪 Testing
📸 Screenshots (if applicable)
✅ Checklist
📝 Additional Notes