Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/auth/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ pub fn read_only_scopes() -> Vec<&'static str> {
"built_in_features",
"data_scanner_read",
"dbm_read",
"ddsql_editor_read",
"error_tracking_read",
"events_read",
"feature_flag_config_read",
Expand Down Expand Up @@ -165,6 +166,8 @@ pub fn default_scopes() -> Vec<&'static str> {
"data_scanner_read",
// Data Streams
"data_streams_monitoring_capture_messages",
// DDSQL Editor
"ddsql_editor_read",
Comment thread
platinummonkey marked this conversation as resolved.
// Database Monitoring
// built_in_features is required on US1/EU1 while the DBM team migrates to dbm_read.
// Both are requested so the command works on all sites during the transition.
Expand Down
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1145,8 +1145,7 @@ enum Commands {
/// pup ddsql schema columns --table-id public.aws.ec2_instance
///
/// AUTHENTICATION:
/// Query commands support OAuth2 (via 'pup auth login') or API key + Application key.
/// Discovery commands (`spec`, `schema ...`) currently require DD_API_KEY + DD_APP_KEY.
/// All ddsql commands support OAuth2 (via 'pup auth login') or API key + Application key.
#[command(verbatim_doc_comment)]
Ddsql {
#[command(subcommand)]
Expand Down
49 changes: 20 additions & 29 deletions src/raw_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,6 @@ static OAUTH_EXCLUDED_ENDPOINTS: &[EndpointRequirement] = &[
path: "/api/unstable/fleet/",
method: "GET",
},
// DDSQL editor tools (3)
EndpointRequirement {
path: "/api/unstable/ddsql-editor/tools/ddsql-docs",
method: "GET",
},
EndpointRequirement {
path: "/api/unstable/ddsql-editor/tools/table-names",
method: "GET",
},
EndpointRequirement {
path: "/api/unstable/ddsql-editor/tools/table-data",
method: "POST",
},
// Profiling (4)
// No OAuth scope is declared for Continuous Profiler endpoints; force API-key auth.
EndpointRequirement {
Expand Down Expand Up @@ -725,6 +712,26 @@ mod tests {
));
}

#[test]
fn test_no_fallback_for_ddsql_editor_tools() {
// DDSQL editor tools now accept OAuth server-side (DAL-960); removing
// them from OAUTH_EXCLUDED_ENDPOINTS means `pup ddsql spec`/`schema
// tables`/`schema columns` should send the OAuth bearer instead of
// forcing API-key fallback.
assert!(!requires_api_key_fallback(
"GET",
"/api/unstable/ddsql-editor/tools/ddsql-docs"
));
assert!(!requires_api_key_fallback(
"GET",
"/api/unstable/ddsql-editor/tools/table-names"
));
assert!(!requires_api_key_fallback(
"POST",
"/api/unstable/ddsql-editor/tools/table-data"
));
}

#[tokio::test]
async fn test_raw_get_obs_pipelines_uses_oauth_bearer() {
let _lock = lock_env().await;
Expand Down Expand Up @@ -862,22 +869,6 @@ mod tests {
));
}

#[test]
fn test_requires_api_key_fallback_ddsql_editor_tools() {
assert!(requires_api_key_fallback(
"GET",
"/api/unstable/ddsql-editor/tools/ddsql-docs"
));
assert!(requires_api_key_fallback(
"GET",
"/api/unstable/ddsql-editor/tools/table-names"
));
assert!(requires_api_key_fallback(
"POST",
"/api/unstable/ddsql-editor/tools/table-data"
));
}

#[test]
fn test_no_fallback_for_error_tracking() {
assert!(!requires_api_key_fallback(
Expand Down