Skip to content

id(web): validate axum route syntax and renamed-capture conflicts in app_interface (#4795) - #4803

Merged
dezren39 merged 1 commit into
mainfrom
queue/6798-4795-axum-route-syntax
Nov 3, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/6798-4795-axum-route-syntax

Conversation

@dezren39

@dezren39 dezren39 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Fixes #4795.

What

web_interface_from_app_toml (pkgs/id/src/web/app_interface.rs) validated only leading slashes, exact host-reserved hits, the /api/world/* prefix, and route==socket (#4779). Invalid axum capture syntax and renamed-capture pattern overlaps still parsed Ok and panicked router construction in create_router_inner (routes.rs:322) / world_routes_at (world_ws.rs:60).

Change

  • New RouteInvalid / SocketInvalid variants: unbalanced braces, empty/invalid capture names, repeated capture names, wildcard outside the final segment, legacy :/*-leading segments.
  • Structural shape check (parse_path_shape / shapes_conflict): captures at the same level under different names (e.g. /edit/{*other}, /hash/{other}), root catch-all /{*path}, and route-vs-socket pattern overlap now map to the existing RouteReserved / SocketReserved / RouteSocketOverlap variants.
  • Regression tests: all seven issue shapes (route) + socket syntax shapes; controls arena, api/{name}, api/{*rest}, foo//bar, arena/{*rest} still parse.

Verification

  • cargo test --lib --features web app_interface: 18 passed.
  • cargo test --lib --features web web::: 527 passed.
  • cargo clippy --lib --features web: clean for the touched file; rustfmt applied.
  • Throwaway axum-registration probe (full host table + merge path, removed after): confirmed panics for {bar, {}, {*}, /edit/{*other}, /hash/{other}, :-leading segments; confirmed no registration panic for /{*path}, {bar}/{bar}, /api/{*rest} — still rejected at parse time per the issue spec (root catch-all / ambiguous duplicates are never legitimate bindings). Note: /: DOES panic on this stack (axum v07-legacy guard), contrary to the issue draft's exclusion list, so it is now rejected; bar:baz-style mid-segment colons remain accepted.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ts in app_interface (#4795)

web_interface_from_app_toml now validates capture syntax (balanced
braces, non-empty names, no repeated names, no legacy :/* segments,
wildcard last) with RouteInvalid/SocketInvalid, and rejects structural
overlaps with host capture routes (renamed captures, root catch-all)
plus route/socket pattern conflicts with the existing Reserved and
RouteSocketOverlap variants. Adds regression tests for the verified
shapes; /arena + /ws/arena and other non-conflicting shapes still
parse.
@dezren39
dezren39 requested a review from a team as a code owner November 3, 2026 08:25
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-03T08:25:40.057902Z
We couldn’t complete this review. Comment @codex review to try again.
2c5ff3e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3e1846d4-6eaf-45d9-9f68-bf7b4d0f5890
Commits

Reviewing files that changed from the base of the PR and between eeb8764 and 2c5ff3e.

Files selected for processing: 1
  • pkgs/id/src/web/app_interface.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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

Labels

None yet

Projects

None yet

1 participant