Skip to content

Add marketplace security audit gate for prompt injection & malicious functions - #7

Merged
criptogus merged 2 commits into
mainfrom
claude/audit-marketplace-skills-security-8CxQf
May 16, 2026
Merged

Add marketplace security audit gate for prompt injection & malicious functions#7
criptogus merged 2 commits into
mainfrom
claude/audit-marketplace-skills-security-8CxQf

Conversation

@criptogus

Copy link
Copy Markdown
Owner

What does this PR add?

A pre-publication security audit script that scans all marketplace packages (skills, playbooks, souls, integrations) for prompt-injection signals and malicious embedded functions before they can be released.

Type

  • Platform code or docs

Description

This PR introduces audit-skills.mjs, a security gate that runs on every content PR and blocks packages containing:

  1. Prompt injection / jailbreak signals — reuses the production prompt-injection-guard so the gate and runtime stay in sync
  2. Malicious functions — detects patterns for:
    • Remote code execution (curl … | sh, wget | bash)
    • Destructive filesystem operations (rm -rf /, dd, mkfs)
    • Credential/dotenv exfiltration
    • Reverse shells and network beacons
    • Hardcoded private keys and tokens
    • Obfuscated payloads (base64/hex blobs)
    • Dynamic code evaluation of decoded payloads

Key features:

  • Configurable rejection threshold (default: high, can be set to critical via AUDIT_REJECT_AT)
  • Field-aware scanning (harvests all LLM-readable text from description, system_prompt, examples, etc.)
  • Security fixture support: packages tagged with security, red-team, or adversarial can quote attack strings in examples without being blocked
  • Allowlisted hosts for legitimate documentation links (GitHub, MDN, OWASP)
  • JSON output mode for CI integration
  • High-precision heuristics ordered by severity

Testing:

  • Added comprehensive unit tests covering clean packages, injection detection, malicious function patterns, and security fixture handling
  • Tests verify both blocking behavior and field-aware demotion logic

CI Integration:

  • Updated validate-content.yml to run audit:skills on every PR touching content or security-related files
  • Added npm script audit:skills to package.json
  • Updated CONTRIBUTING.md with security gate documentation

Notes for reviewers

The audit gate is intentionally conservative to avoid false positives:

  • "Outbound request" findings are demoted to low if they target allowlisted hosts (docs)
  • Security fixtures can safely include attack strings in examples/descriptions (demoted to medium or low)
  • Only findings at or above the configured threshold block the build; lower severities are warnings

The script reuses the production inspectContent guard from prompt-injection-guard.ts to ensure the gate and runtime detection stay synchronized.

https://claude.ai/code/session_01AenqS67aBze9evLvp3gqdH

Adds scripts/audit-skills.mjs: a high-precision gate that scans every
content package for prompt-injection/jailbreak signals (reusing the
runtime prompt-injection-guard) and for malicious functions embedded in
instructions (curl|sh RCE, dotenv/credential exfiltration, reverse
shells, webhook beacons, hardcoded keys, obfuscated payloads). Packages
with a high/critical finding fail the build; declared security/red-team
fixtures may quote attack strings in examples without being blocked.

Wired into the validate-content CI workflow and test suite. Audited all
77 current skills + playbooks/souls/integrations: none contain malicious
content; the only signals are expected low-severity test fixtures in the
prompt-injection-tester skill.

https://claude.ai/code/session_01AenqS67aBze9evLvp3gqdH

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a325aa00d0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/audit-skills.mjs
Comment on lines +169 to +170
if (isFixture && (field === "examples" || field === "description" || field === "long_description")
&& DEMOTE_IN_EXAMPLES.has(f.category)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restrict fixture demotion to examples only

Demoting injection findings for security fixtures in description/long_description creates a bypass: a package can self-tag as security and place instruction-override text in those fields, which drops severity below the block threshold and passes audit. Those fields are still fed into LLM prompts elsewhere (for example, package descriptions are embedded into the matching prompt in src/lib/match/match.functions.ts), so this effectively allows prompt-injection content through the gate outside examples.

Useful? React with 👍 / 👎.

Comment thread scripts/audit-skills.mjs
severity = worse(severity, sev);
}
}
const blocked = SEVERITY_RANK[severity] >= SEVERITY_RANK[REJECT_AT];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate AUDIT_REJECT_AT before blocking logic

The reject threshold is taken directly from AUDIT_REJECT_AT without validation, and the block check compares against SEVERITY_RANK[REJECT_AT]. If the env var is misspelled (for example critcal), the right-hand side is undefined, so the comparison is always false and no package is ever blocked. This silently disables the security gate in misconfigured CI or local runs.

Useful? React with 👍 / 👎.

@criptogus

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

Co-authored-by: criptogus <128640021+criptogus@users.noreply.github.com>

Copilot AI commented May 16, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Done — I merged origin/main into this branch and resolved the package.json conflicts, preserving both the new audit script entries and main’s latest test/validation updates. Included in commit 5d647f8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants