Skip to content

auth status can report read_only: true while a preserved scope still grants write access #233

Backlog

Description

@omriariav

Problem

gws auth login and gws auth status report read_only: true when no service in the per-service access map holds a write scope. That map is derived from gws's own scope tables (internal/auth/scopes.go), so a scope outside those tables is not counted.

--add deliberately preserves every scope the stored login already holds, including ones gws does not itself request. So this sequence overstates the protection:

  1. An older login holds gmail.readonly plus https://mail.google.com/ (full mailbox access, not in the built-in tables).
  2. gws auth login --add --services tasks --readonly
  3. Login and auth status report read_only: true, although the token still carries full Gmail access.

Where

  • allReadOnly and deriveGrantedAccess in cmd/auth.go
  • The complete granted scope list is already recorded in granted_access.json.

Suggested fix

Derive read_only from the complete granted scope list rather than from the access map alone: any granted scope that is not a known read-only scope (and not an identity scope) makes read_only false, or reports it as unknown. Add a regression test with a preserved scope outside the built-in tables.

Notes

Raised as a warning by the Codex review on #230 and deferred from v1.44.0. Only affects logins that carry scopes gws never requests.

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