Skip to content

Set up company-wide read access for Junior #2233

Closed

Description

@sentry-junior

Set up [email protected] on company-wide services to provide default read access through the egress proxy.

  • Initial services raised: Notion and Linear.
  • PagerDuty access was requested to support on-call handoffs (who is rotating in and out); plugin availability is unverified and may warrant a child issue.
  • Identify any other services that can use this access.

via David Cramer.

--

View Junior Session [Sentry]

Activity

  1. sentry-junior commented on Oct 27, 2026

    @sentry-junior
    ContributorAuthor

    Service-account model and the plain OAuth gap

    Status update from the work in #2245. This records the agreed model and the part that is harder for regular OAuth plugins.

    Model

    • Per-user OAuth is the default.
    • A plugin can have an optional shared service account (for example [email protected]). An admin connects it from the dashboard Admin page. The CLI is a fallback.
    • The service account lists exactly what it may use. A person's own connection always wins.
    • user-oauth: false turns off personal OAuth. Junior then hides everything the service account does not list.
    accounts:
      user-oauth: true # default
      service-account:
        tools: [notion-search, notion-fetch] # MCP tool names
        # grants: [...]                      # future: egress grant names for OAuth plugins

    What #2245 covers

    MCP plugins that register their own OAuth client, such as Notion. Junior's server makes these MCP calls, so the tool manager enforces service-account.tools there. Linear also uses a hosted MCP server, so it should fit the same path with only a tools list.

    PagerDuty already uses one deployment-level API key (PAGERDUTY_API_KEY). It does not need a service account.

    Why plain OAuth plugins are harder

    Plain oauth: plugins send requests through the egress proxy. For MCP, a tool name is a clear unit to allow. Egress requests have no such unit:

    • Only custom plugins name their grants. GitHub (user-read, user-write, installation-read, installation-write), Sentry (org-read) and Google (one grant per operation) define grants in a grantForEgress hook.
    • Plain oauth: plugins have no grant names. Core gives every request one grant named default. Its access is read for GET, HEAD and OPTIONS, and write for all other methods (defaultGrantForProvider in packages/junior/src/chat/sandbox/egress/credentials.ts). A grants: [default] list would allow every request.

    Proposed path

    1. Core names its built-in grants read and write, based on the HTTP method, instead of default. Then service-account: { grants: [read] } works for every OAuth plugin. Custom plugins list their own grant names. One rule covers both cases.
    2. Pass the request's grant to the credential broker. The broker uses the service account only when the person has no token and the grant is in service-account.grants. Today CredentialBroker.issue() does not get this value. grantAccess in egress/credentialed.ts already works it out.
    3. Add a regular OAuth connect flow to chat/credentials/service-account.ts. It uses the plugin's existing endpoints and client secret. The dashboard routes and UI do not change.
    4. Store service-account tokens per provider. Renew them under the same lock as personal tokens.

    Caveats

    • The HTTP method does not always match the action. GraphQL APIs and many search endpoints read with POST. A [read] service account refuses these requests. That failure is safe, but a read-only account is then almost useless for these providers. Each such provider needs a small grantForEgress hook that labels its read requests. The method also cannot catch a GET that writes, but that is rare.
    • Callback URLs. Regular OAuth apps do not register their own client. Each provider's OAuth app must add /api/service-accounts/<plugin>/callback as an allowed callback URL.
    • MCP plugins with a fixed oauth-client are also out of scope in feat(plugins): Add optional service accounts for plugins #2245. This is a smaller fix.
    • Scope of access. Anyone who can talk to Junior can read what the service account can see. Give the account only access that everyone may have.

    Still open

  2. sentry-junior commented on Nov 9, 2026

    @sentry-junior
    ContributorAuthor

    Closing: the named services have service accounts now (Notion #2245, Linear #2249, PagerDuty #2236). Service accounts for plain OAuth plugins aren't built; open a narrow issue if one is needed. Always-on Slack search is #1400.

    Closed during a tracker cleanup. Reopen if this still matters.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions