Skip to content

MAS doesn't accept Synapse migrated macaroons #4090

@benbz

Description

@benbz

Describe the bug

MAS doesn't accept Synapse migrated macaroons. When one is used with Synapse MAS responds with e.g.2025-02-23T15:36:38.073459+00:00 lon2 synapse-main-mas[1032]: 2025-02-23T15:36:38.073059Z ERROR http.server.request{otel.kind="server" otel.name="POST /oauth2/introspect" network.protocol.name="http" network.protocol.version="1.1" http.re quest.method="POST" url.path="/oauth2/introspect" url.scheme="http" http.route="/oauth2/introspect" user_agent.original="curl/8.7.1"}:handlers.oauth2.introspection.post{client.id="01JKN8KGSHZ5JS8H183VTT9W42"}: mas_handlers::oauth2::intros pection: crates/handlers/src/oauth2/introspection.rs:160: error=invalid token format

I've replicated directly with MAS hitting the introspection API directly. If I reduce the amount of the Macaroon I pass across in the request I eventually get error=unknown compat access token instead. This Macaroon has - in it which isn't a standard base64 character, so I suspect #3797 needed to only try and decode a subset of the passed Macaroon.

I can provide the migrated Macaroon on request (and will rotate it afterwards)

To Reproduce

  • Attempt to interact with Synapse with a Macaroon as the bearer token
  • Request fails

Expected behavior

The request succeeds

Additional context

MAS 0.14.1. DB was migrated with syn2mas 0.14.0 or 0.14.1 I can't 100% recall sorry

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