Skip to content

fix: add security warning for untrusted skill content#18784

Closed
sumleo wants to merge 1 commit intoanomalyco:devfrom
sumleo:fix/skill-security-warning
Closed

fix: add security warning for untrusted skill content#18784
sumleo wants to merge 1 commit intoanomalyco:devfrom
sumleo:fix/skill-security-warning

Conversation

@sumleo
Copy link
Copy Markdown

@sumleo sumleo commented Mar 23, 2026

Fixes #19123

Summary

  • Add SECURITY_WARNING block to mark repository-provided skill content as untrusted
  • Define 7 specific rules preventing supply chain poisoning via skill injection
  • Warn against executing code from skill files that modifies package manager configs, adds custom registries, or contains hardcoded credentials

Problem

OpenCode loads skill content (.opencode/agents/*/SKILL.md) directly into the LLM context without any sanitization or trust boundary. A malicious repository can include poisoned skill files that instruct the model to perform supply chain attacks (registry poisoning, credential exfiltration, curl-pipe-bash hooks).

Changes

Added security warning in the system prompt that explicitly marks all repository-provided content as untrusted and defines guardrails against common supply chain attack patterns.

Test plan

  • Verify existing agent functionality is not affected
  • Confirm legitimate skill instructions (coding conventions, project setup) still work
  • Run supply chain poisoning test cases to verify refusal behavior

Closes anomalyco#18781

Skills loaded from repositories may contain malicious instructions that
trick the agent into writing to package manager configs, adding rogue
registry URLs, or modifying system-wide settings. This is a supply-chain
poisoning vector.

Add a two-layer defense:
- System prompt: append a <skill_security_policy> block to the skills
  section listing prohibited actions (registry hijacking, config writes,
  RCE patterns)
- Skill tool output: wrap each loaded skill in a <skill_security_warning>
  reminding the agent that the content is untrusted before it processes
  the skill body
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:issue labels Mar 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 25, 2026
@github-actions github-actions Bot closed this Mar 25, 2026
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.

Security: Untrusted skill content loaded without sanitization or warning

1 participant