Back to skill

Security audit

Safeagentdb

Security checks for vulnerabilities and agentic risk

Overview

The skill is coherent for preview database management, but its bundled scripts handle powerful database secrets and can delete or rewrite cloud database resources with too little scoping.

Review before installing in a real project. Use only with a Supabase/Vercel/GitHub setup you intend it to manage, pin dependencies, require dry-run and explicit execute modes for cleanup, restrict orphan cleanup to managed preview branches, avoid passing service-role keys through CLI arguments, keep service-role values server-only, and enable auth/data/storage copying only after a written hydration policy and user approval.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
templates/scripts/supabase/provision-preview-branch.ts:154
Finding

Supabase Service-Role Key Exposed Through Command-Line Arguments and Error Logs

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
templates/scripts/supabase/provision-preview-branch.ts:365
Finding

TLS Certificate Validation Disabled for Privileged PostgreSQL Connections

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
templates/scripts/supabase/cleanup-orphan-preview-branches.ts:128
Finding

Orphan Cleanup Can Delete Unrelated Supabase Branches

Content
View full analysis
(supabase(['branches', 'list', '--project-ref', parentProjectRef, '-o', 'json'])); const persistentGitBranches = new Set((config.persistentPreviews || []).map((preview) => preview.gitBranch)); const previews = branches.filter((branch): branch is SupabaseBranch & { git_branch: string } => ( !branch.is_default && branch.name !== developBranchName && Boolean(branch.git_branch) && !persistentGitBranches.has(branch.git_branch as string) )); for (const branch of previews) { const exists = await githubBranchExists(branch.git_branch); if (exists) { console.log(`Keeping ${branch.name}: Git branch ${branch.git_branch} exists`); continue; } console.log(`Deleting orphan Supabase branch ${branch.name}; Git branch ${branch.git_branch} no longer exists`); supabase(['branches', 'delete', branch.name, '--project-ref', parentProjectRef, '--yes']); for (const envName of envNames) removeVercelEnv(envName, branch.git_branch); } ``` ### Technical Analysis The script labels every non-default, non-develop, non-persistent Supabase branch with a `git_branch` value as a disposable preview. It does not require: - The configured preview branch-name prefix. - Membership in the configured `previewBranchPrefixes`. - An explicit managed-resource marker. - An allowlist of disposable Supabase branches. - Manual confirmation or a preceding dry run. As a result, staging, release, QA, emergency, or manually managed branches can enter the deletion set. A GitHub `404` is treated as conclusive evidence that the corresponding database branch is disposable, even though the Git branch may have been renamed, moved to another repository, or intentionally deleted while its database remains required ...[truncated 1472 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
templates/package-dev-dependencies.json:3
Finding

Floating Dependency Versions and Registry-Fallback Execution for Credentialed CLI Tools

Content
View full analysis
npx supabase db pull ``` ```bash npx supabase --version npx vercel --version npx supabase init npx supabase link --project-ref ``` The runtime wrappers also execute these tools through `npx`, for example: ```ts function npx(args: string[], options: RunOptions = {}): string { return run(process.platform === 'win32' ? 'npx.cmd' : 'npx', args, options); } function supabase(args: string[]): string { return npx(['supabase', ...args]); } ``` ### Technical Analysis Caret version ranges allow installation of future compatible releases that were not part of the audited artifact. In addition, ordinary `npx` behavior may download and execute a package from the configured registry when the expected local binary is absent. The Supabase and Vercel CLI processes inherit `process.env`, which can contain `SUPABASE_ACCESS_TOKEN`, `VERCEL_TOKEN`, `GITHUB_TOKEN`, database connection strings, and other CI secrets. Therefore, compromise of a newly resolved package release, registry configuration, or package distribution channel could result in credential theft or unauthorized cloud operations. No malicious dependency was identified in the audited files. The vulnerability is the absence of controls that ensure the audited and executed package versions are identical. ### Attack Path 1. A CI runner or developer environment lacks the expected locally installed ...[truncated 1222 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (51)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · references/credentials.md (reported line 45)May include surrounding context.

md
- applying migrations
- linking production for `supabase db push`

Store access tokens in GitHub Actions secrets or local CLI auth. Non-secret project refs can be stored in config if the user approves.

## Vercel

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · references/setup-process.md (reported line 96)May include surrounding context.

md
Keep the default conservative. Enable auth/data/storage copying only after the user chooses a hydration policy.

Pass `--dry-run` to the provision script to print the full plan (create vs reuse, hydration source, what would be copied, which env vars would be set) without making changes. This also smoke-tests the access token and branch listing.

## Persistent Preview Environments

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

md
- Do not point feature or agent branches at production.
- Do not apply feature-branch migrations to shared develop until merge.
- Do not copy production data into preview databases without explicit user approval.
- Do not commit secrets, service role keys, access tokens, preview passwords, or `.env.local`.
- Before changing GitHub Actions, Vercel env vars, Supabase branches, or database hydration behavior, explain the change and the credentials needed.
- When changing database schema, validate migrations locally or in preview before shared environments.

Credential Access

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

md
- Do not point feature or agent branches at production.
- Do not apply feature-branch migrations to shared develop until merge.
- Do not copy production data into preview databases without explicit user approval.
- Do not commit secrets, service role keys, access tokens, preview passwords, or `.env.local`.
- Before changing GitHub Actions, Vercel env vars, Supabase branches, or database hydration behavior, explain the change and the credentials needed.
- When changing database schema, validate migrations locally or in preview before shared environments.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · references/agent-operating-rules.md (reported line 18)May include surrounding context.

md
- Do not point feature or agent branches at production.
- Do not apply feature-branch migrations to shared develop until merge.
- Do not copy production data into preview databases without explicit user approval.
- Do not commit secrets, service role keys, access tokens, preview passwords, or `.env.local`.
- Before changing GitHub Actions, Vercel env vars, Supabase branches, or database hydration behavior, explain the change and the credentials needed.
- When changing database schema, validate migrations locally or in preview before shared environments.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · templates/agent-instructions/AGENTS.md (reported line 11)May include surrounding context.

md
- Do not point feature or agent branches at production.
- Do not apply feature-branch migrations to shared develop until merge.
- Do not copy production data into preview databases without explicit user approval.
- Do not commit secrets, service role keys, access tokens, preview passwords, or `.env.local`.
- Before changing GitHub Actions, Vercel env vars, Supabase branches, or database hydration behavior, explain the change and the credentials needed.
- When changing database schema, validate migrations locally or in preview before shared environments.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · templates/agent-instructions/CLAUDE.md (reported line 11)May include surrounding context.

md
- Do not point feature or agent branches at production.
- Do not apply feature-branch migrations to shared develop until merge.
- Do not copy production data into preview databases without explicit user approval.
- Do not commit secrets, service role keys, access tokens, preview passwords, or `.env.local`.
- Before changing GitHub Actions, Vercel env vars, Supabase branches, or database hydration behavior, explain the change and the credentials needed.
- When changing database schema, validate migrations locally or in preview before shared environments.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The function begins a replication-mode session and truncates target public tables with restart identity cascade before repopulating them from the source branch. This is a destructive, irreversible data operation, but the code provides no confirmation prompt or explicit warning before execution beyond generic row-count logs after the fact.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script pushes the Supabase service-role key into Vercel preview environment variables, making a highly privileged secret available to preview deployments. If preview application code, build steps, logs, third-party integrations, or contributors with preview access are compromised, the key could be abused to bypass RLS and fully administer the preview database and related services.

Content

No source excerpt is available for this finding.

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 · templates/scripts/supabase/use-branch-env.ts (reported line 154)May include surrounding context.

ts
// the Supabase CLI token out of .env(.local) ourselves if it isn't already set.
function loadAccessTokenFromEnvFiles(): void {
  if (process.env.SUPABASE_ACCESS_TOKEN) return;
  for (const path of ['.env.local', '.env']) {
    if (!existsSync(path)) continue;
    const match = readFileSync(path, 'utf8').match(/^\s*SUPABASE_ACCESS_TOKEN\s*=\s*(.*)$/m);
    if (match) {

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 · templates/scripts/supabase/use-branch-env.ts (reported line 197)May include surrounding context.

ts
// the Supabase CLI token out of .env(.local) ourselves if it isn't already set.
function loadAccessTokenFromEnvFiles(): void {
  if (process.env.SUPABASE_ACCESS_TOKEN) return;
  for (const path of ['.env.local', '.env']) {
    if (!existsSync(path)) continue;
    const match = readFileSync(path, 'utf8').match(/^\s*SUPABASE_ACCESS_TOKEN\s*=\s*(.*)$/m);
    if (match) {

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 · templates/scripts/supabase/use-branch-env.ts (reported line 154)May include surrounding context.

ts
// the Supabase CLI token out of .env(.local) ourselves if it isn't already set.
function loadAccessTokenFromEnvFiles(): void {
  if (process.env.SUPABASE_ACCESS_TOKEN) return;
  for (const path of ['.env.local', '.env']) {
    if (!existsSync(path)) continue;
    const match = readFileSync(path, 'utf8').match(/^\s*SUPABASE_ACCESS_TOKEN\s*=\s*(.*)$/m);
    if (match) {

Credential Access

High
Category
Privilege Escalation
Confidence
85% confidence
Finding

This script writes SUPABASE_SERVICE_ROLE_KEY, along with the URL and anon key, into .env.local. The service-role key is a highly privileged server secret; placing it into a generic project-local env file increases the chance it is accidentally consumed by the wrong runtime, exposed to local tooling, leaked in logs, or committed/mishandled by developers.

Content

Scanner excerpt · templates/scripts/supabase/use-branch-env.ts (reported line 180)May include surrounding context.

ts
}

function updateEnvLocal(values: Record<string, string>): void {
  const path = '.env.local';
  const existing = existsSync(path) ? readFileSync(path, 'utf8') : '';
  const { lines, seenKeys } = parseEnvFile(existing);
  const nextLines = lines.map((line) => {

Credential Access

High
Category
Privilege Escalation
Confidence
88% confidence
Finding

In local mode, the script retrieves local Supabase branch details and persists the service-role key into .env.local. Even in a dev context, automatically materializing a privileged database secret into a common local env file expands the attack surface and makes accidental disclosure more likely.

Content

Scanner excerpt · templates/scripts/supabase/use-branch-env.ts (reported line 208)May include surrounding context.

ts
[config.envKeys.supabaseAnonKey]: details.SUPABASE_ANON_KEY,
      [config.envKeys.supabaseServiceRoleKey]: details.SUPABASE_SERVICE_ROLE_KEY,
    });
    console.log(`.env.local now points to local Supabase: ${details.SUPABASE_URL}`);
    return;
  }

Credential Access

High
Category
Privilege Escalation
Confidence
88% confidence
Finding

For remote branch switching, the script fetches branch credentials and writes the service-role key into .env.local. In the context of a tool designed to manage preview/develop/production database workflows, this is more dangerous because it automates distribution of a high-privilege secret across multiple branch environments, increasing the chance of misuse or accidental exposure.

Content

Scanner excerpt · templates/scripts/supabase/use-branch-env.ts (reported line 225)May include surrounding context.

ts
[config.envKeys.supabaseServiceRoleKey]: details.SUPABASE_SERVICE_ROLE_KEY,
  });

  console.log(`.env.local now points to Supabase branch "${branch.name}" for Git branch "${gitBranch}".`);
}

try {

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 · templates/scripts/supabase/use-branch-env.ts (reported line 233)May include surrounding context.

ts
} catch (error) {
  if ((process.argv[2] || 'status') === 'auto') {
    console.warn(`Skipping Supabase env auto-switch: ${error instanceof Error ? error.message : String(error)}`);
    console.warn('Continuing with existing .env / .env.local values.');
    process.exit(0);
  }
  console.error(error instanceof Error ? error.message : String(error));

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 · templates/scripts/supabase/use-branch-env.ts (reported line 233)May include surrounding context.

ts
} catch (error) {
  if ((process.argv[2] || 'status') === 'auto') {
    console.warn(`Skipping Supabase env auto-switch: ${error instanceof Error ? error.message : String(error)}`);
    console.warn('Continuing with existing .env / .env.local values.');
    process.exit(0);
  }
  console.error(error instanceof Error ? error.message : String(error));

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill clearly contemplates environment-variable handling, external credential use, and cloud/CI interactions, but it does not declare an explicit tool scope such as allowed tools or permissions. In an agent environment, that ambiguity can lead to broader-than-necessary access being granted at runtime, increasing the chance of unintended network calls or secret exposure during execution.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

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

md
## Credential Rule

Before running commands that require external access, explain what credentials are needed, why they are needed, where they will be stored, and ask the user for permission. Do not ask the user to paste secrets into committed files.

Read `references/credentials.md` for the exact checklist.

Rp1

Medium
Category
MCP Rug Pull
Confidence
81% confidence
Finding

Referencing npx skills add without a pinned package version introduces supply-chain risk because the command may fetch the latest published package at execution time. A compromised or newly malicious release could be installed and run in the user's environment with little visibility.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

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

For npx skills add Aidan945/SafeAgentDB, keep the canonical skill at:

text
skills/safeagentdb/SKILL.md

The skills CLI discovers SKILL.md files at the repository root and under top-level skill container folders such as skills/ and .agents/skills/.

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

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

For npx skills add Aidan945/SafeAgentDB, keep the canonical skill at:

text
skills/safeagentdb/SKILL.md

The skills CLI discovers SKILL.md files at the repository root and under top-level skill container folders such as skills/ and .agents/skills/.

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

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

For npx skills add Aidan945/SafeAgentDB, keep the canonical skill at:

text
skills/safeagentdb/SKILL.md

The skills CLI discovers SKILL.md files at the repository root and under top-level skill container folders such as skills/ and .agents/skills/.

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

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

For npx skills add Aidan945/SafeAgentDB, keep the canonical skill at:

text
skills/safeagentdb/SKILL.md

The skills CLI discovers SKILL.md files at the repository root and under top-level skill container folders such as skills/ and .agents/skills/.

Static analysis

Detected: suspicious.dangerous_exec, suspicious.env_credential_access, suspicious.insecure_tls_verification

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
templates/scripts/supabase/apply-migrations.ts:25

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
templates/scripts/supabase/cleanup-orphan-preview-branches.ts:52

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
templates/scripts/supabase/cleanup-preview-branch.ts:74

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
templates/scripts/supabase/provision-preview-branch.ts:148

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
templates/scripts/supabase/use-branch-env.ts:70

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
templates/scripts/supabase/cleanup-orphan-preview-branches.ts:36

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
templates/scripts/supabase/provision-preview-branch.ts:100

HTTPS certificate verification is disabled.

Warn
Code
suspicious.insecure_tls_verification
Location
templates/scripts/supabase/apply-migrations.ts:69

HTTPS certificate verification is disabled.

Warn
Code
suspicious.insecure_tls_verification
Location
templates/scripts/supabase/provision-preview-branch.ts:373