T09 · Insecure Skill Coding Practices
- Location
scripts/check_environment.py:157- Finding
Potential Disclosure of API Credentials Through Unredacted Configuration Output
- Content
View full analysis
Vulnerability Details
File Location:
scripts/check_environment.py:157-168
Vulnerability Type: Sensitive configuration disclosure
Risk Level: Mediumpython def inspect_configs(_verbose: bool): global_configs = _load_configs(SKILLS_DIR) if global_configs is None: print( "❌ Cannot import Configs from sn-image-base, skipping config inspection", file=sys.stderr, ) return print("Resolved configs:") if hasattr(global_configs, "to_string"): print(indent(global_configs.to_string(), " * ")) else: print(indent(str(global_configs), " * "))Technical Analysis
The function serializes and prints the complete resolved configuration without locally redacting sensitive fields. The documented configuration contains credential-bearing variables such as
SN_API_KEYandSN_IMAGE_GEN_API_KEY.Configuration inspection is invoked during every environment check at line 151, regardless of whether
--verbosewas supplied. Protection therefore depends entirely on the externalglobal_configs.to_string()implementation. The fallback tostr(global_configs)similarly provides no explicit redaction guarantee.If either representation includes credential values, secrets will be written in plaintext to standard output. Diagnostic output is commonly retained in CI logs, terminal transcripts, support records, or Agent-visible conversation context.
Attack Path
- A user configures an API key in the process environment or another source consumed by
sn-image-base. - The user or an automated job runs
python scripts/check_environment.py. check_env_vars()invokesinspect_configs()unconditionally.inspect_configs()loads the resolved configuration object.- The object is serialized through
to_string()or the fallbackstr()and printed without local field-level redaction. - If the external repre ...[truncated 823 chars]
- A user configures an API key in the process environment or another source consumed by
- Remediation
View remediation
Remediation Suggestions
- Do not serialize the complete configuration object for diagnostic output.
- Define an explicit allowlist of non-sensitive fields that may be displayed.
- For credential-bearing fields, print only presence status, such as
configuredormissing. - Explicitly redact field names containing terms such as
key,token,secret,password,credential, orauthorization. - Remove the unrestricted
str(global_configs)fallback because its output contract does not guarantee redaction. - Restrict detailed non-secret diagnostics to
--verbose; the current_verboseparameter is unused. - Add automated tests using sentinel secrets and assert that neither normal nor verbose output contains those values.
- Document that diagnostic output is safe to share only after verifying that all sensitive values are redacted.
