Document opt-in OAuth scopes for api-keys, app-keys, service-accounts | DAL-958 - #702
Draft
srosenthal-dd wants to merge 2 commits into
Draft
Conversation
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.
/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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
api-keys,app-keys, andusers service-accountsall already send the OAuth bearer viamake_api!, but their required scopes (api_keys_read/write/delete,user_app_keys,org_app_keys_read/write,service_account_write) aren't indefault_scopes().AUTHENTICATIONhelp block using the same--extra-scopesopt-in pattern already used forlogs-restriction/data-deletion/datasets.service-accounts(create/app-keys) also needs server-side OAuth support -- noted in the help text so--extra-scopesalone isn't mistaken for a full fix. Tracked in DAL-958; server-side companion PRs: dogweb#1492, dd-source#42089./api/v2/api_keysand/api/v2/application_keysfromOAUTH_EXCLUDED_ENDPOINTS(src/raw_client.rs). Both paths already accept OAuth server-side (DAL-514), but these entries were still forcing the genericpup apipassthrough command to use API+App key auth on them even with a bearer token present. The typedapi-keys/app-keyscommands weren't affected (they usemake_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 buildsucceedscargo fmt --checkcleancargo clippy --bin pup --no-depscleancargo test --bin pup raw_client:: commands::api::passes (64 tests)--helpoutput forapi-keys,app-keys,users