Back to skill

Security audit

Env Config Validator

Security checks for vulnerabilities and agentic risk

Overview

The skill is a legitimate local .env validator, but it can expose secrets in generated schemas and JSON diff reports despite claiming secret masking.

Use only on env files you are allowed to inspect, and do not commit or share generated schemas, JSON reports, CI logs, or artifacts until you have verified they contain no secrets. Prefer sanitized .env.example files for schema generation.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/validate_env.py:209
Finding
Generated schemas store sensitive environment values in plaintext## Vulnerability Details **File Location**: `scripts/validate_env.py:209-213` **Vulnerability Type**: Plaintext disclosure of sensitive configuration values **Risk Level**: High ### Vulnerable Code ```python var_def = { 'type': var_type, 'required': True, } if value: var_def['example'] = value if any(s in key.upper() for s in ['SECRET', 'PASSWORD', 'KEY', 'TOKEN', 'API_KEY']): var_def['sensitive'] = True schema['variables'][key] = var_def ``` ### Technical Analysis Schema generation copies every nonempty environment value into the schema's `example` field. This occurs before or independently of the sensitive-key classification. Setting `sensitive` to `True` only adds metadata and does not redact, omit, or encrypt the value. Consequently, variables such as `DATABASE_PASSWORD`, `API_KEY`, `ACCESS_TOKEN`, and connection strings containing credentials are written verbatim to generated schema output. The documented workflow in `SKILL.md` advises users to generate a schema from a working `.env` file and add that schema to a repository, making accidental credential publication a realistic outcome. ### Attack Path 1. A working `.env` file contains active passwords, API keys, tokens, or credential-bearing connection strings. 2. The user follows the documented workflow and runs: ```bash python3 scripts/validate_env.py --generate-schema .env -o env-schema.json ``` 3. `generate_schema()` copies each populated value into the corresponding `example` property. 4. The generated schema is committed to source control, uploaded as a CI artifact, or shared with another party. 5. Anyone able to access that artifact can recover the credentials in plaintext and use them against the associated services. ### Impact Assessment This issue compromises the confidentiality of every populated value in the input `.env` file. An attacker does not gain local privilege escalation through the validator itse ...[truncated 429 chars]
Remediation
## Remediation Suggestions - Never copy the value of a sensitive variable into an auto-generated schema. - Determine sensitivity before assigning the `example` field and omit that field for sensitive variables: ```python sensitive = any( marker in key.upper() for marker in ['SECRET', 'PASSWORD', 'KEY', 'TOKEN', 'API_KEY'] ) var_def['sensitive'] = sensitive if value and not sensitive: var_def['example'] = value ``` - Prefer neutral placeholders such as `REDACTED` or `your-secret-here` only if an example is required. - Expand sensitive-key detection to cover common names such as `CREDENTIAL`, `PRIVATE`, `AUTH`, and credential-bearing connection strings. - Display a warning that generated schema files must be reviewed before being committed or shared. - Document that schemas should be generated from sanitized template files such as `.env.example`, not production `.env` files. - Add tests confirming that generated schema output never contains known secret fixture values. - If affected schemas have already been published, remove them from repository history and artifact storage, then rotate all exposed credentials.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/validate_env.py:519
Finding
JSON environment diff output exposes all values without secret masking## Vulnerability Details **File Location**: `scripts/validate_env.py:359-373` and `scripts/validate_env.py:519-522` **Vulnerability Type**: Inconsistent output redaction causing plaintext secret disclosure **Risk Level**: High ### Vulnerable Code The diff result retains complete values from both files: ```python return { 'file1': str(path1), 'file2': str(path2), 'only_in_file1': only_in_1, 'only_in_file2': only_in_2, 'different_values': different, 'identical': [k for k in common if k not in different], 'vars1': vars1, 'vars2': vars2, } ``` JSON output then serializes that result directly: ```python if args.output == 'json': result = json.dumps(diff_result, indent=2) elif args.output == 'markdown': result = format_diff_text(diff_result) else: result = format_diff_text(diff_result) ``` ### Technical Analysis `diff_env_files()` places the complete key-value maps from both environment files into `vars1` and `vars2`. In JSON mode, `main()` directly serializes the entire result with `json.dumps()`. No redaction is performed before serialization. Secret masking is implemented only inside the text formatter and therefore does not protect JSON output. Furthermore, JSON exposes values for identical variables and variables unique to either file, not merely changed secrets. This contradicts the advertised secret-masking behavior and is especially dangerous because JSON output is intended for CI and machine-readable reports, where results are commonly retained in logs or artifacts. The schema's `sensitive` property is not consulted during diff processing, so it cannot prevent this disclosure. ### Attack Path 1. Development and production environment files contain passwords, tokens, keys, or other confidential values. 2. A user or CI job invokes: ```bash python3 scripts/validate_env.py --diff .env.development .env.production --output json ``` ...[truncated 1130 chars]
Remediation
## Remediation Suggestions - Do not include raw `vars1` or `vars2` dictionaries in the default diff result. - Return only key names and comparison status unless values are explicitly needed. - Apply redaction before constructing any formatter-specific output so text, JSON, and markdown share the same security guarantees. - Use a centralized masking function and ensure that it returns no secret prefix; partial masking that retains the first three characters still leaks information. - Support schema-driven sensitivity while retaining conservative key-name detection as a fallback. - Treat connection strings and URLs containing user information as sensitive even when their variable names lack common secret markers. - If raw-value output is required, place it behind an explicit warning-bearing option and prevent its use by default in CI. - Add regression tests for changed, identical, and file-specific sensitive variables in every output format. - Document that existing JSON reports and CI logs created by affected versions may contain secrets, and advise users to delete affected artifacts and rotate exposed credentials.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (36)

Credential Access

High
Category
Privilege Escalation
Content
---
name: env-config-validator
description: Validate .env files against schemas, compare environments (dev vs prod), detect common mistakes (trailing spaces, placeholders, invalid ports, missing protocols, duplicate keys, unquoted spaces), auto-generate schemas, and type-check values. Supports text, JSON, and markdown output with CI-friendly exit codes. Use when asked to validate environment config, check .env files for errors, compare env files, diff environments, detect env misconfigurations, generate env schema, audit .env variables, check for missing env vars, or ensure env consistency across environments. Triggers on "validate env", "check .env", "compare environments", "env diff", "env schema", "env audit", "missing env vars", "environment config".
---

# Env Config Validator
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
python3 scripts/validate_env.py .env --schema env-schema.json

# Compare dev vs prod
python3 scripts/validate_env.py --diff .env.development .env.production

# Generate schema from existing .env
python3 scripts/validate_env.py --generate-schema .env -o env-schema.json
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
python3 scripts/validate_env.py .env --schema env-schema.json

# Compare dev vs prod
python3 scripts/validate_env.py --diff .env.development .env.production

# Generate schema from existing .env
python3 scripts/validate_env.py --generate-schema .env -o env-schema.json
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
#!/usr/bin/env python3
"""Validate .env files against schemas, compare environments, and detect common mistakes.

Usage:
    python3 validate_env.py .env                          # Validate with auto-detected rules
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Static analysis

No suspicious patterns detected.