Skip to content

refactor(router): enforce instance identity positively instead of str… - #2

Merged
burhan-wesolves merged 1 commit into
developfrom
feat/native-flow-galaxy-message
Aug 1, 2026
Merged

refactor(router): enforce instance identity positively instead of str…#2
burhan-wesolves merged 1 commit into
developfrom
feat/native-flow-galaxy-message

Conversation

@burhan-wesolves

Copy link
Copy Markdown
Owner

…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.

📋 Description

🔗 Related Issue

Closes #(issue_number)

🧪 Type of Change

  • [ * ] 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧹 Code cleanup
  • 🔒 Security fix

🧪 Testing

  • Manual testing completed
  • Functionality verified in development environment
  • No breaking changes introduced
  • Tested with different connection types (if applicable)

📸 Screenshots (if applicable)

✅ Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have manually tested my changes thoroughly
  • I have verified the changes work with different scenarios
  • Any dependent changes have been merged and published

📝 Additional Notes

…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>
@burhan-wesolves
burhan-wesolves merged commit e2ca512 into develop Aug 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants