Skip to content

Harden JWT resource-server sessions and template reads #179

Description

@akazemier-godaddy

We are using @platformatic/mcp@2.2.0 as an OAuth resource server and found three gaps in the published implementation.

  1. TokenValidator validates signature and optional audience but does not constrain iss or require sub and exp. Configure the existing fast-jwt verifier with allowedIss: config.authorizationServers and require ["sub", "iss", "exp"].

  2. /mcp creates sessions without persisting the verified subject. A second valid OAuth user can reuse a first user’s session ID and receive its stored authorization context. Persist the verified context when creating the session, and reject an existing session when its owner differs from request.tokenPayload.sub.

  3. mcpAddResource({ uriPattern }) accepts a template, but resources/read only performs an exact map lookup. A concrete URI such as guardrails://support/request/req-123 therefore returns METHOD_NOT_FOUND. Match registered template placeholders with slash-bounded parameters before returning not-found.

I can provide the small compiled-dist patch and reproduction tests if useful. Related Redis error-listener work is tracked separately in #59.

Activity

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

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