Skip to content

fix: exclude cloud-platform from the all scopes preset - #13

Open
Mr-Neutr0n wants to merge 1 commit into
Google-Health-API:mainfrom
Mr-Neutr0n:fix/scopes-preset-all-cloud-platform
Open

fix: exclude cloud-platform from the all scopes preset#13
Mr-Neutr0n wants to merge 1 commit into
Google-Health-API:mainfrom
Mr-Neutr0n:fix/scopes-preset-all-cloud-platform

Conversation

@Mr-Neutr0n

Copy link
Copy Markdown

Fixes #3

Problem

auth login --scopes-preset all returned every scope in AllScopes, including cloud-platform. The data-plane endpoints reject any token carrying it, so the resulting credentials could not run a single data command (403 "Request contains disallowed OAuth scope(s)"). The incompatibility was documented only in webhooks --help, nothing near the preset itself.

Change

  • ScopePreset("all") now skips the cloud-platform suffix, so the preset covers health-data scopes only. Comment on the case explains why, so the next reader does not reintroduce it.
  • auth login help text and the --scopes-preset flag description state what all covers and point at ghealth webhooks --help for the separate-login pattern.
  • New pkg/auth/auth_test.go: regression test that all excludes cloud-platform but still contains every other registered scope, plus coverage for readonly, category expansion, unknown presets, and a count guard against future scopes being silently dropped.

Verification

go build -o /dev/null .
go vet ./...
go test ./pkg/auth/ ./cmd/   # ok 0.4s / ok 0.8s
gofmt clean

This change was prepared with AI assistance under human direction and review.

Data-plane endpoints reject any token carrying cloud-platform, so auth
login --scopes-preset all produced credentials that could not read any
health data (403 disallowed OAuth scope). The preset now covers only
health-data scopes; webhook admin keeps working through a separate
--scopes cloud-platform login as the webhooks docs already describe.

The auth login help text and flag description now say what 'all'
actually covers and point at 'ghealth webhooks --help' for the
webhook-credential pattern. Adds regression tests for the preset.

Fixes Google-Health-API#3

Signed-off-by: Mr-Neutr0n <64578610+Mr-Neutr0n@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--scopes-preset all produces a token that can't read any data (includes cloud-platform)

1 participant