Skip to content

Document opt-in OAuth scopes for api-keys, app-keys, service-accounts | DAL-958 - #702

Draft
srosenthal-dd wants to merge 2 commits into
DataDog:mainfrom
srosenthal-dd:stephen.rosenthal/oauth-extra-scopes-docs
Draft

Document opt-in OAuth scopes for api-keys, app-keys, service-accounts | DAL-958#702
srosenthal-dd wants to merge 2 commits into
DataDog:mainfrom
srosenthal-dd:stephen.rosenthal/oauth-extra-scopes-docs

Conversation

@srosenthal-dd

@srosenthal-dd srosenthal-dd commented Aug 3, 2026

Copy link
Copy Markdown
Member

Summary

  • api-keys, app-keys, and users service-accounts all already send the OAuth bearer via make_api!, but their required scopes (api_keys_read/write/delete, user_app_keys, org_app_keys_read/write, service_account_write) aren't in default_scopes().
  • Documents them in each command's AUTHENTICATION help block using the same --extra-scopes opt-in pattern already used for logs-restriction/data-deletion/datasets.
  • service-accounts (create/app-keys) also needs server-side OAuth support -- noted in the help text so --extra-scopes alone isn't mistaken for a full fix. Tracked in DAL-958; server-side companion PRs: dogweb#1492, dd-source#42089.
  • Removed 9 stale entries for /api/v2/api_keys and /api/v2/application_keys from OAUTH_EXCLUDED_ENDPOINTS (src/raw_client.rs). Both paths already accept OAuth server-side (DAL-514), but these entries were still forcing the generic pup api passthrough command to use API+App key auth on them even with a bearer token present. The typed api-keys/app-keys commands weren't affected (they use make_api!, not this table), but the passthrough was silently blocked. Updated the two tests that used these paths as "still excluded" examples to use Fleet Automation instead, since it remains genuinely excluded today (not a claim it's meant to stay that way).

Test plan

  • cargo build succeeds
  • cargo fmt --check clean
  • cargo clippy --bin pup --no-deps clean
  • cargo test --bin pup raw_client:: commands::api:: passes (64 tests)
  • Manually verified rendered --help output for api-keys, app-keys, users

These commands already send the OAuth bearer via make_api!, but the
required scopes (api_keys_*, user_app_keys, org_app_keys_*,
service_account_write) aren't in default_scopes(). Document them using
the same --extra-scopes opt-in pattern used for logs-restriction, so
users know how to unlock OAuth for these commands instead of hitting an
unexplained permission failure.

service-accounts (create/app-keys) also needs server-side OAuth support,
tracked separately in DAL-958 -- noted in the help text so --extra-scopes
alone isn't mistaken for a full fix.
@srosenthal-dd srosenthal-dd changed the title Document opt-in OAuth scopes for api-keys, app-keys, service-accounts Document opt-in OAuth scopes for api-keys, app-keys, service-accounts | DAL-958 Aug 3, 2026
/api/v2/api_keys and /api/v2/application_keys (org-wide) already accept
OAuth server-side (DAL-514), but 9 entries for these paths were still
sitting in the raw-client OAuth-exclusion table, forcing the generic
`pup api` passthrough to use API+App key auth on them even when a
bearer token is present. The typed api-keys/app-keys commands
(make_api!-based) were never affected, but this table is the only auth
routing the passthrough command has.

Updated the tests that used these paths as examples of "still excluded"
behavior to use Fleet Automation instead, since it's still genuinely
excluded today.
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.

1 participant