Skip HTTP workflow route matching outside base path - #7757
Conversation
|
|
@copilot resolve the merge conflicts in this pull request |
|
@copilot Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes. Issue 1 of 1src/modules/Elsa.Http/Middleware/HttpWorkflowsMiddleware.cs:48-51 This early check compares the raw request path to |
…path-short-circuit # Conflicts: # test/unit/Elsa.Http.UnitTests/Middleware/HttpWorkflowsMiddlewareTests.cs Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
A critical unresolved issue could allow unrelated prefixed URLs to execute a workflow.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This pull request adds HTTP workflow base-path gating while preserving valid route resolution and adding middleware test coverage.
Changes:
- Bypasses matching outside the configured base path.
- Preserves direct and tenant-prefixed routing.
- Adds unit tests for bypass and route resolution.
File summaries
| File | Summary |
|---|---|
test/unit/Elsa.Http.UnitTests/Middleware/HttpWorkflowsMiddlewareTests.cs |
Adds middleware behavior tests. |
src/modules/Elsa.Http/Middleware/HttpWorkflowsMiddleware.cs |
Implements base-path gating and route handling; a critical issue remains with validating tenant-prefixed matches. |
Review details
Suppressed comments (1)
src/modules/Elsa.Http/Middleware/HttpWorkflowsMiddleware.cs:321
CouldContainBasePathconsiders a match at any segment index. As a result, requests such as/api/v1/workflows/status—which are outside the configured base path and cannot use the supported one-segment tenant prefix—still callGetMatchingRouteand scan the route table beforeTryStripBasePathrejects the match. Restrict this pre-check to a base path at segment 0 or with exactly one leading tenant segment, and add a matcher-invocation assertion to the non-tenant regression test.
private static bool CouldContainBasePath(string route, string basePath) =>
FindSegmentSequence(GetRouteSegments(route), GetRouteSegments(basePath)) >= 0;
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite (auto)
Note
Copilot is running an experiment and ran this review at Lite.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@greptile review Disposition for the two findings in the latest 4/5 summary:
This PR intentionally contains only the base-path route-gating change and directly related tests. Please reassess the current-head diff on that scope; the prior sibling-prefix finding is fixed in e118017 and its thread is resolved. |
|
Fixed Copilot’s current-head finding in dfa7ee3. The precheck now permits the configured base path only directly or after exactly one leading tenant segment. The new @greptile review Please reassess only the current-head diff. The two exception-path concerns from the preceding Greptile summary are unchanged from current |
There was a problem hiding this comment.
🟡 Changes recommended
Validate tenant prefixes and add an unknown-prefix regression test before approval.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite (auto)
Note
Copilot is running an experiment and ran this review at Lite.
|
@greptile review Current head d360307 removes unsafe raw tenant-prefix inference and short-circuits every Request.Path outside the configured BasePath before route matching. Valid tenant routing is preserved in its source-grounded post-resolution PathBase/Path form. Current-source tests pass 7/7 focused and 37/37 for the full Elsa.Http.UnitTests project. Please assess the current-head diff for issue #7709 only. The two exception-path concerns previously reported are unchanged from current main and absent from this PR diff. |
There was a problem hiding this comment.
🟢 Approved
No unresolved review issues remain, and the relevant bypass and routing behaviors are covered.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite (auto)
Note
Copilot is running an experiment and ran this review at Lite.
Summary
Fixes #7709
Tests