Skip to content

WAC-exempt app subtrees (appPaths / reservePath) still reach the LDP write wildcards for unhandled paths #611

Description

@melvincarvalho

Surfaced reviewing #607. Both the plugin entry-prefix exemption (#582) and literal reservePath claims mark a URL subtree WAC-exempt, but the LDP write wildcards (PUT/POST/PATCH/DELETE '/*') sit beneath them. So a request under an exempt subtree that the plugin did not register a handler for falls through to the LDP layer with WAC already skipped.

Core already recognizes this exact class for /.well-known/* and installs explicit 405 blocks (src/server.js ~850–895): "without these blocks the wildcard write handlers would still accept unauthenticated writes under this namespace." The app-subtree mechanisms don't have the equivalent guard.

Status after #607

#607 method-gates reservePath (read-only by default), which closes the unlisted-method vector: a PUT under a read-only /xrpc is now WAC-guarded. Verified.

Residual, not yet closed:

  • A widened method at an unhandled path (PUT /api/unhandled when a shim reserved /api with methods:['PUT'] but only handles /api/echo) still routes into the WAC-skipped LDP layer. In a bare pod it 500s (no container) rather than writing, but that's environment-dependent, not a guarantee.
  • The entry-prefix case (appPaths: WAC-hook exemption for application mount points (plugin seam from #206) #582) has no method gate at all: a plugin mounted at /myapp that doesn't handle PUT /myapp/x falls straight through.

Suggested fix

Register a scoped fallback under each exempt subtree — ALL <prefix> + ALL <prefix>/* → 404/405 — so unhandled requests resolve inside the app's namespace instead of reaching /*. Plugin-registered specific routes stay more specific and win; needs care around plugins that register their own wildcard under the prefix (potential FST_ERR_DUPLICATED_ROUTE). Belongs in its own PR because it changes the #582 mechanism, not just reservePath.

Refs #607, #582.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions