Repository navigation
Description
Summary
fluree iceberg info <gs> and fluree info <gs> print the full graph-source config as pretty JSON to stdout — including catalog.auth.client_secret, i.e. the raw Snowflake PAT / OAuth2 client secret.
ConfigValue has a carefully hand-written redacting Debug impl, but the redaction only covers Debug. Serialize is derived, so every JSON print path bypasses it. The presence of the redacting Debug actively gives false assurance that the type is safe to print.
Evidence
The print sites (each dumps the whole config via serde_json::to_string_pretty):
fluree-db-cli/src/commands/iceberg.rs:571-575fluree-db-cli/src/commands/iceberg.rs:602-605fluree-db-cli/src/commands/info.rs:200fluree-db-cli/src/commands/info.rs:232
The type:
-
fluree-db-iceberg/src/config_value.rs:45-62—#[derive(Clone, Deserialize, Serialize, PartialEq, Eq)]+#[serde(untagged)]onenum ConfigValue { Literal(String), Dynamic { .. } }. Untagged +Literal(String)⇒ serializes to the bare secret string. -
fluree-db-iceberg/src/config_value.rs:64-68— the redactingDebug, whose own doc comment states the intent:Redacting
Debug:ConfigValuecarries auth secrets (bearer tokens, OAuth2 client secrets), so a{:?}in a log or error must never leak them. The environment-variable name is shown (it aids debugging and is not secret); the literal value and any inline default are redacted.
So the invariant the Debug impl asserts ("must never leak them") is not upheld on the Serialize path.
Reproduction
Verified live at a8de70e0f:
$ fluree iceberg map my-gs \
--catalog-uri https://<acct>.snowflakecomputing.com/polaris/api/catalog \
--oauth2-token-url https://<acct>.snowflakecomputing.com/polaris/api/catalog/v1/oauth/tokens \
--oauth2-client-secret "$PAT" \
--oauth2-scope session:role:ICEBERG_READER \
--r2rml customer.ttl --warehouse LAB --s3-region us-east-2
$ fluree info my-gs
Configuration:
{
"catalog": {
"type": "rest",
"auth": {
"type": "oauth2_client_credentials",
"client_id": "",
"client_secret": "eyJraWQiOi...<FULL PAT IN PLAINTEXT>",
"scope": "session:role:ICEBERG_READER",
...
Impact
- The PAT / client secret is echoed to the terminal, and thence to shell scrollback,
scriptlogs, and CI job output. - Affects
AuthConfig::Bearer { token }identically — sameConfigValue, same path. fluree infois a natural "what is this graph source?" command, so it is likely to be run and pasted into issues/support threads by users who have no reason to expect it emits a live credential.- Anything that persists or forwards the serialized config inherits the same exposure; the CLI printer is the surface found so far, not necessarily the only one.
Suggested fix
The bug is that redaction lives in the wrong place — a print-site fix would leave the next JSON path exposed. Preferred: make the type safe, so no caller can leak it.
Options, roughly in order of preference:
- Custom
SerializeforConfigValuemirroring theDebugimpl (emit"<redacted>"forLiteral, keepenv_varnames). Fixes every current and future print path at once. Requires a separate, explicit path for round-tripping the real value where persistence genuinely needs it — a#[serde(serialize_with = ...)]escape hatch on the persisted struct, or a distinctConfigValueOwned/unredacted()accessor used only by the storage writer. - Redact at the print sites (all four above) by walking the JSON and blanking known secret keys. Cheaper, but fails open on the next new print site and re-creates the denylist-vs-allowlist problem.
- Serialize-side allowlist on a dedicated display DTO for
info.
Option 1 is the one that makes the Debug impl's stated invariant actually true. Worth checking whether the persisted graph-source record itself stores the secret in plaintext — if so that is a related but distinct issue.
Notes
Found while smoke-testing Snowflake Horizon + customer-managed S3 at a8de70e0f. The PAT exposed during that testing was ICEBERG_READER-restricted and has been revoked.
Activity
aaj3f commentedon Jul 15, 2026
Correction from implementation grounding (DB session,
eee643572): Option 1 (redactingSerialize) is not implementable as stated — it breaks a CI-locked contract.The persistence path stores
IcebergGsConfig::to_json()(derivedSerialize) verbatim intoGraphSourceRecord.config, and query-time auth re-reads it;ledger_info.rs:2758-2762explicitly asserts the stored JSON contains the secret ("storage serialization must be lossless"), as doroutes/iceberg.rs:770,773andcli/iceberg.rs:873. A redactingSerializewould persist"[redacted]"and break every catalog auth at query time.What actually exists: every server emit path already redacts through a fail-closed, allowlist-based JSON-tree redactor (
redact_graph_source_config,ledger_info.rs:1038;SECRET_CONFIG_KEYS:981-991; exhaustive per-variant canary test at:2797). The only unpatched leaks are the two local CLI print sites —cli/commands/info.rs:203/:235andcli/commands/iceberg.rs:574/:605. The remote CLI paths echo the server's already-redacted config and are safe.So the fix landing here is: export the existing redactor from
fluree-db-apiand route those two local print sites through it (fail-closed, same allowlist, canary-tested), rather than making the type'sSerializelossy. The "next new print site fails open" residual is real but mitigated: the type-level fix that actually closes it isConfigValue::SecretRef(db#1500 §3) — once the stored form is a reference, there is no secret in the config to leak on any print path, which is the disease-level fix per fluree/solo#782.fix(cli): redact secrets in local info/iceberg-info config output (#1497