Back to skill

Security audit

Env Setup

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it advertises, but it can inspect secret-bearing environment files and git history without clear redaction or consent safeguards.

Install only if you are comfortable with the agent inspecting local environment configuration. Before use, require it to read only variable names, never print values, avoid production .env files unless explicitly approved, skip elevated access, and confirm before creating or editing .env, .env.example, or .gitignore files.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (1)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:110
Finding
Unrestricted Access to Secret-Bearing Environment Files and Git History## Vulnerability Details **File Location**: `SKILL.md`, lines 110–177 **Vulnerability Type**: Insufficient least-privilege and secret-handling controls **Risk Level**: Medium ### Vulnerable Instructions ```markdown ### 5. Validate Current .env If `.env` exists, compare against discovered variables: ```markdown ## .env Validation Report ### ❌ Missing (required by code but not in .env) - `STRIPE_SECRET_KEY` — referenced in src/billing.ts:14 - `SMTP_PASSWORD` — referenced in src/email.ts:8 ### ⚠️ Unused (in .env but not referenced in code) - `OLD_API_ENDPOINT` — may be safe to remove ### ✅ Present and referenced - `DATABASE_URL` ✓ - `PORT` ✓ - `NODE_ENV` ✓ ``` ``` ```markdown Also check git history for accidentally committed `.env` files: ```bash git log --all --diff-filter=A -- .env .env.local .env.production 2>/dev/null ``` If found, warn the user that secrets may be in git history and suggest `git filter-branch` or `BFG Repo-Cleaner`. ``` ```markdown - **Multiple .env files**: `.env.development`, `.env.production`, `.env.test` — validate all - **No .env exists**: Generate both `.env.example` and a starter `.env` ``` ```markdown | Permission denied on .env | Check file permissions; may need elevated access | ``` ### Technical Analysis The Skill instructs the Agent to inspect `.env` files and search repository history for environment files. These resources commonly contain passwords, API keys, access tokens, database connection strings, and other credentials. The instructions do not explicitly require the Agent to: - Read only environment-variable names rather than values. - Redact values before including results in tool output, context, logs, or reports. - Obtain confirmation before examining additional environment variants or Git history. - Remain within the repository and its existing permission boundary. - Refuse to elevate privileges when an environment file can ...[truncated 1988 chars]
Remediation
## Remediation Suggestions 1. Require metadata-only parsing of environment files. Extract variable names and syntax status without returning or retaining values. 2. Mandate replacement of every parsed value with a fixed marker such as `[REDACTED]` before producing output or adding data to Agent context. 3. Explicitly prohibit printing raw `.env` lines, Git diffs, historical blobs, connection strings, tokens, passwords, or private keys. 4. Require explicit user confirmation before reading each environment file beyond the default `.env`, and separately before inspecting Git history. 5. Restrict all scanning to the repository root after resolving canonical paths. Reject symlinks or paths that resolve outside that boundary. 6. Remove the recommendation to use elevated access. If a file cannot be read with existing permissions, report it as inaccessible and allow the user to resolve permissions manually. 7. For Git-history checks, initially report only file paths and commit identifiers. Do not retrieve historical file contents unless the user expressly authorizes a redacted local scan. 8. Generate `.env.example` from discovered variable names and safe placeholders only. Never copy values from an existing `.env`. 9. Before creating a starter `.env`, request user approval, apply restrictive filesystem permissions where supported, and ensure the file is ignored by Git. 10. Add explicit safeguards stating that sensitive values must never be included in reports, command transcripts, telemetry, persistent memory, or external requests.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (18)

Credential Access

High
Category
Privilege Escalation
Content
# Docker / docker-compose
grep -rn "\${.*}" --include="*.yml" --include="*.yaml" docker-compose* 2>/dev/null

# General .env references in config files
grep -rn "env\." --include="*.toml" --include="*.yaml" --include="*.yml" . 2>/dev/null
```
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
# Docker / docker-compose
grep -rn "\${.*}" --include="*.yml" --include="*.yaml" docker-compose* 2>/dev/null

# General .env references in config files
grep -rn "env\." --include="*.toml" --include="*.yaml" --include="*.yml" . 2>/dev/null
```
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
# Docker / docker-compose
grep -rn "\${.*}" --include="*.yml" --include="*.yaml" docker-compose* 2>/dev/null

# General .env references in config files
grep -rn "env\." --include="*.toml" --include="*.yaml" --include="*.yml" . 2>/dev/null
```
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
# Docker / docker-compose
grep -rn "\${.*}" --include="*.yml" --include="*.yaml" docker-compose* 2>/dev/null

# General .env references in config files
grep -rn "env\." --include="*.toml" --include="*.yaml" --include="*.yml" . 2>/dev/null
```
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
# Docker / docker-compose
grep -rn "\${.*}" --include="*.yml" --include="*.yaml" docker-compose* 2>/dev/null

# General .env references in config files
grep -rn "env\." --include="*.toml" --include="*.yaml" --include="*.yml" . 2>/dev/null
```
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
# Docker / docker-compose
grep -rn "\${.*}" --include="*.yml" --include="*.yaml" docker-compose* 2>/dev/null

# General .env references in config files
grep -rn "env\." --include="*.toml" --include="*.yaml" --include="*.yml" . 2>/dev/null
```
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
- Group by category with comment headers
- Add `🔴 SECRET` warning on sensitive vars

### 5. Validate Current .env

If `.env` exists, compare against discovered variables:
Confidence
76% confidence
Finding
The instruction to validate the current `.env` implies reading a file that often contains live secrets. While this is aligned with the skill’s purpose, handling `.env` without explicit safeguards can expose credentials in logs, reports, or agent output if values are displayed rather than just keys.

Credential Access

High
Category
Privilege Escalation
Content
If `.env` exists, compare against discovered variables:

```markdown
## .env Validation Report

### ❌ Missing (required by code but not in .env)
- `STRIPE_SECRET_KEY` — referenced in src/billing.ts:14
Confidence
83% confidence
Finding
The sample validation report shows enumerating missing variables from `.env` comparisons, which requires reading sensitive configuration files and code references. In context this is legitimate, but it still creates credential-access risk if the implementation reports, stores, or transmits actual secret contents rather than only variable names.

Credential Access

High
Category
Privilege Escalation
Content
- `STRIPE_SECRET_KEY` — referenced in src/billing.ts:14
- `SMTP_PASSWORD` — referenced in src/email.ts:8

### ⚠️ Unused (in .env but not referenced in code)
- `OLD_API_ENDPOINT` — may be safe to remove

### ✅ Present and referenced
Confidence
80% confidence
Finding
Listing unused variables in `.env` again requires reading a secret-bearing file and can expose sensitive inventory information about deployed integrations and credentials. Even without values, revealing the existence of secret variables can increase attack surface intelligence if shared broadly.

Credential Access

High
Category
Privilege Escalation
Content
```
# Environment files
.env
.env.local
.env.*.local
```
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
```
# Environment files
.env
.env.local
.env.*.local
```
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
Also check git history for accidentally committed `.env` files:
```bash
git log --all --diff-filter=A -- .env .env.local .env.production 2>/dev/null
```

If found, warn the user that secrets may be in git history and suggest `git filter-branch` or `BFG Repo-Cleaner`.
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
- **Framework-specific env**: Next.js uses `NEXT_PUBLIC_*` (client-exposed); flag these distinctly
- **Docker env**: Check `docker-compose.yml` `environment:` section too
- **Multiple .env files**: `.env.development`, `.env.production`, `.env.test` — validate all
- **No .env exists**: Generate both `.env.example` and a starter `.env`
- **Interpolated vars**: `${VAR:-default}` in shell scripts — extract `VAR`
Confidence
78% confidence
Finding
The instruction to generate both `.env.example` and a starter `.env` is more sensitive than documentation-only generation because it creates a real environment file that may later be populated with secrets or be accidentally committed. In this skill’s context, creating `.env` without explicit consent increases the chance of mishandling credentials.

Credential Access

High
Category
Privilege Escalation
Content
- **Framework-specific env**: Next.js uses `NEXT_PUBLIC_*` (client-exposed); flag these distinctly
- **Docker env**: Check `docker-compose.yml` `environment:` section too
- **Multiple .env files**: `.env.development`, `.env.production`, `.env.test` — validate all
- **No .env exists**: Generate both `.env.example` and a starter `.env`
- **Interpolated vars**: `${VAR:-default}` in shell scripts — extract `VAR`

## Error Handling
Confidence
77% confidence
Finding
Validating multiple `.env` variants broadens access to potentially sensitive environment-specific credentials across development, test, and production contexts. This is legitimate for auditing, but it increases exposure if outputs are not tightly controlled or if the skill runs without explicit scope confirmation.

Credential Access

High
Category
Privilege Escalation
Content
| Error | Resolution |
|-------|-----------|
| No env vars found | Project may not use env vars — confirm with user |
| .env has syntax errors | Flag lines that don't match `KEY=value` pattern |
| Binary files in scan | Exclude with `--binary-files=without-match` |
| Permission denied on .env | Check file permissions; may need elevated access |
Confidence
74% confidence
Finding
Flagging `.env` syntax errors implies parsing a secret-bearing file, which is acceptable for this skill but still sensitive. Poorly designed implementations may echo malformed lines back to the user, inadvertently exposing secret values.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The trigger phrase set includes broad terms like "check env" and "environment setup," which can cause the skill to activate in situations where a user did not specifically intend file inspection or environment-file generation. In this skill’s context, unintended invocation matters because the workflow includes scanning for secrets-related configuration and potentially creating or modifying local files.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill immediately presents actions that scan the codebase, inspect `.env` content, and generate environment files without a clear up-front warning or user-confirmation requirement. That increases the chance of surprise access to sensitive configuration and unintended local file changes, especially because `.env` files commonly contain credentials.

Unsafe Defaults

Medium
Category
Tool Misuse
Content
# ============================================

# --- App Configuration ---
NODE_ENV=development
PORT=3000
LOG_LEVEL=info
Confidence
85% confidence
Finding
Using `NODE_ENV=development` as a generated default can be unsafe if users copy `.env.example` or starter values into real deployments without review. Development mode often enables verbose errors, weaker protections, or debug behavior that can increase exposure in production.

Static analysis

No suspicious patterns detected.