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

Content
View full analysis

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` ✓
text

```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.

text

```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
View 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
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 41)May include surrounding context.

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

text

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 136)May include surrounding context.

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

text

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 143)May include surrounding context.

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

text

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 156)May include surrounding context.

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

text

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 157)May include surrounding context.

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

text

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 177)May include surrounding context.

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

text

Credential Access

High
Category
Privilege Escalation
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.

Content

Scanner excerpt · SKILL.md (reported line 105)May include surrounding context.

md
- Group by category with comment headers
- Add `🔴 SECRET` warning on sensitive vars

### 5. Validate Current .env

If `.env` exists, compare against discovered variables:

Credential Access

High
Category
Privilege Escalation
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.

Content

Scanner excerpt · SKILL.md (reported line 110)May include surrounding context.

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

Credential Access

High
Category
Privilege Escalation
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.

Content

Scanner excerpt · SKILL.md (reported line 116)May include surrounding context.

md
- `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

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 137)May include surrounding context.

text
# Environment files
.env
.env.local
.env.*.local

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 143)May include surrounding context.

text
# Environment files
.env
.env.local
.env.*.local

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 143)May include surrounding context.

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.

Credential Access

High
Category
Privilege Escalation
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.

Content

Scanner excerpt · SKILL.md (reported line 166)May include surrounding context.

md
- **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`

Credential Access

High
Category
Privilege Escalation
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.

Content

Scanner excerpt · SKILL.md (reported line 167)May include surrounding context.

md
- **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

Credential Access

High
Category
Privilege Escalation
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.

Content

Scanner excerpt · SKILL.md (reported line 175)May include surrounding context.

md
| 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 |

Vague Triggers

Medium
Category
Not specified by scanner
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.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
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.

Content

No source excerpt is available for this finding.

Unsafe Defaults

Medium
Category
Tool Misuse
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.

Content

Scanner excerpt · SKILL.md (reported line 84)May include surrounding context.

md
# ============================================

# --- App Configuration ---
NODE_ENV=development
PORT=3000
LOG_LEVEL=info

Static analysis

No suspicious patterns detected.