Skip to content

auth: document opt-in scopes for api-keys, app-keys, service-accounts, org-group | DAL-958 DAL-973 - #702

Merged
platinummonkey merged 3 commits into
DataDog:mainfrom
srosenthal-dd:stephen.rosenthal/oauth-extra-scopes-docs
Aug 19, 2026
Merged

auth: document opt-in scopes for api-keys, app-keys, service-accounts, org-group | DAL-958 DAL-973#702
platinummonkey merged 3 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, service_account_write) aren't in default_scopes().
  • organizations policies/policy-overrides/policy-configs subcommands need org_group_read/org_group_write, also not in default_scopes().
  • Documents all of these in each command's AUTHENTICATION help block using the same --extra-scopes opt-in pattern already used for logs-restriction/data-deletion/datasets.
  • Removed the client-side cfg.validate_api_and_app_keys()? hard-block on app-keys list --all. The org-wide endpoint already accepts OAuth server-side (gated by org_app_keys_read); the block was stale and contradicted the AUTHENTICATION doc, which already claimed OAuth2 capability for it. Removed the now-dead validate_api_and_app_keys helper (this was its only call site).
  • 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, 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. 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).
  • Fixed a stale docs/EXTENSIONS.md example that cited /api/v2/api_keys as a guaranteed-fallback endpoint (no longer true after the above); genericized the wording instead of naming other examples likely to change too.

Test plan

  • cargo build succeeds, no warnings
  • cargo fmt --check clean
  • cargo clippy --bin pup --no-deps clean
  • cargo test --bin pup raw_client:: commands::api:: config:: passes (one pre-existing unrelated failure, test_from_env_default_site_when_no_org, reproduces on main too -- missing tokio runtime in that test, not touched by this PR)
  • Manually verified rendered --help output for api-keys, app-keys, users, organizations
  • e2e tested against staging with --extra-scopes:
    • api-keys list/create/delete -- created and deleted a throwaway key
    • app-keys list/create/delete -- created and deleted a throwaway key
    • app-keys list --all -- confirmed working over OAuth (org_app_keys_read)
    • users service-accounts create -- created a throwaway service account, then disabled it
    • users service-accounts app-keys list/create/delete -- created and deleted a throwaway app key on that service account
    • organizations policies list -- confirmed working with org_group_read/org_group_write

@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
@srosenthal-dd srosenthal-dd changed the title Document opt-in OAuth scopes for api-keys, app-keys, service-accounts | DAL-958 Document opt-in OAuth scopes for api-keys, app-keys, service-accounts, org-group | DAL-958 DAL-973 Aug 19, 2026
@srosenthal-dd srosenthal-dd changed the title Document opt-in OAuth scopes for api-keys, app-keys, service-accounts, org-group | DAL-958 DAL-973 auth: document opt-in scopes for api-keys, app-keys, service-accounts, org-group | DAL-958 DAL-973 Aug 19, 2026
@srosenthal-dd
srosenthal-dd marked this pull request as ready for review August 19, 2026 21:08
@srosenthal-dd
srosenthal-dd requested a review from a team as a code owner August 19, 2026 21:08

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dad773cef6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/raw_client.rs
Comment thread src/raw_client.rs
@srosenthal-dd
srosenthal-dd force-pushed the stephen.rosenthal/oauth-extra-scopes-docs branch from bdb3449 to cfc9724 Compare August 19, 2026 21:41

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cfc9724b6f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/main.rs Outdated
list --all only calls the org-wide read (list_application_keys); nothing
in pup uses the org-wide write/delete/update endpoints (those are all
current_user-scoped, gated by user_app_keys instead). Requesting write
unnecessarily grants more than the command needs.

Also trims a stale historical comment in commands::api's test.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb5925f213

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/main.rs
@platinummonkey
platinummonkey merged commit ce0d71b into DataDog:main Aug 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants