gcp-bigquery-explicit-exposes-credential
A BigQuery Connection resource stores or proxies credentials to an external data source (Cloud SQL, JDBC, Spark); a principal with bigquery.connections.use gains effective access to that external system.
match (record)
{
"field": "cloudSql | spark | aws | azure | cloudResource",
"resource_type": "google.bigquery.Connection"
}
where
Connection type is cloudSql (username/password), aws (cross-cloud SA), azure (cross-cloud MI), or cloudResource (GCP SA impersonation)
emit
| source type | Secret |
|---|---|
| target type | Credential |
| source | <BigQuery Connection node> |
| target | <external credential / SA / DB credential> |
| permissions | bigquery.connections.use |
| conditions | iam_permission |
| state logic | ACTIVE when bigquery.connections.use is confirmed on the Connection and the Connection type exposes usable credential material; CONDITIONAL(iam_permission) when connections.use is uncertain. |
Narrative
BigQuery Connection {connection.name} proxies credentials to {target.name}; a principal with bigquery.connections.use can run queries that access the external system under those credentials.
Raw rule rules/explicit/gcp/bigquery.yaml
id: gcp-bigquery-explicit-exposes-credential
emits: ExposesCredential
description: A BigQuery Connection resource stores or proxies credentials to an external data source (Cloud
SQL, JDBC, Spark); a principal with bigquery.connections.use gains effective access to that external
system.
match_record:
resource_type: google.bigquery.Connection
field: cloudSql | spark | aws | azure | cloudResource
where:
- Connection type is cloudSql (username/password), aws (cross-cloud SA), azure (cross-cloud MI), or cloudResource
(GCP SA impersonation)
emit:
source_type: Secret
target_type: Credential
source: <BigQuery Connection node>
target: <external credential / SA / DB credential>
permissions:
- bigquery.connections.use
conditions:
- iam_permission
state_logic: ACTIVE when bigquery.connections.use is confirmed on the Connection and the Connection
type exposes usable credential material; CONDITIONAL(iam_permission) when connections.use is uncertain.
false_positive_note: "For IAM-based connections (cloudResource type), the Connection creates a GCP-managed\
\ SA; the API returns the SA email but NOT a raw credential. The SA email enables downstream CanImpersonate\
\ derivation via credential-chains only if the caller also holds iam.serviceAccounts.actAs on that\
\ SA \u2014 the connection.use alone does not grant impersonation. For cloudSql connections, the username/password\
\ is stored encrypted server-side; the BigQuery Connections API does NOT return raw credentials (it\
\ returns only a credential ID). Model this edge as ExposesCredential(Connection -> Credential) with\
\ a note that the credential is accessed SERVER-SIDE by queries using the connection; do not assert\
\ the attacker can extract the raw password via API. JDBC connections (bigquery.connections.create\
\ with a JDBC URL + credentials) store credentials encrypted; same caveat. bigquery.connections.get\
\ metadata does not expose secret material."
narrative: BigQuery Connection {connection.name} proxies credentials to {target.name}; a principal with
bigquery.connections.use can run queries that access the external system under those credentials.
derived_from:
- google.bigquery.Connection resource field (cloudSql/aws/azure/cloudResource)
api_source: bigquery.projects.locations.connections.list + bigquery.projects.locations.connections.get
evidence_field: cloudSql.credential.username, cloudResource.serviceAccountId, aws.accessRole.iamRoleId