Skip to content

Commit 700dcfc

Browse files
committed
cloud-auth: document opt-in OAuth scopes for persona-mappings | DAL-981
pup's cloud-auth persona-mappings commands already send the OAuth bearer token automatically. The routes now accept it server-side, but require workload_identity_federation_read/write -- permissions only ever granted to admins, so they're opt-in via --extra-scopes rather than added to default_scopes(), matching the existing precedent for other admin-only scopes (api_keys_*, app_keys_*, service_account_write).
1 parent 591a121 commit 700dcfc

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

src/auth/types.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,23 @@ mod tests {
400400
assert!(!ro.contains(&"logs_write_pipelines"));
401401
}
402402

403+
#[test]
404+
fn test_default_scopes_excludes_workload_identity_federation() {
405+
let scopes = default_scopes();
406+
// workload_identity_federation_read/write are only ever granted to
407+
// admins, so they're opt-in only (see 'pup cloud-auth' AUTHENTICATION
408+
// doc) rather than requested by default.
409+
assert!(!scopes.contains(&"workload_identity_federation_read"));
410+
assert!(!scopes.contains(&"workload_identity_federation_write"));
411+
}
412+
413+
#[test]
414+
fn test_read_only_scopes_excludes_workload_identity_federation() {
415+
let ro = read_only_scopes();
416+
assert!(!ro.contains(&"workload_identity_federation_read"));
417+
assert!(!ro.contains(&"workload_identity_federation_write"));
418+
}
419+
403420
#[test]
404421
fn test_read_only_scopes_subset_of_default() {
405422
let default: std::collections::HashSet<&str> = default_scopes().into_iter().collect();

src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7902,7 +7902,13 @@ enum IntegrationActions {
79027902
#[derive(Subcommand)]
79037903
enum IntegrationAwsActions {
79047904
/// Manage AWS cloud authentication
7905-
#[command(name = "cloud-auth")]
7905+
///
7906+
/// AUTHENTICATION:
7907+
/// Requires OAuth2 (via 'pup auth login') or API + Application keys.
7908+
/// OAuth2 requires the workload_identity_federation_read/write scopes,
7909+
/// which are not requested by default -- opt in with:
7910+
/// pup auth login --extra-scopes workload_identity_federation_read,workload_identity_federation_write
7911+
#[command(name = "cloud-auth", verbatim_doc_comment)]
79067912
CloudAuth {
79077913
#[command(subcommand)]
79087914
action: CloudAuthActions,

0 commit comments

Comments
 (0)