61 Commits

Author SHA1 Message Date
Leif 68177b8830 Merge pull request #32 from semgrep/semgrep/pin-github-actions
Pin GitHub Actions to commit SHAs
2026-07-27 22:28:13 -07:00
semgrep-zcs-prod-semgrep[bot] 0e55025285 Pin GitHub Actions to commit SHAs 2026-07-28 05:27:23 +00:00
Leif 90cc990a53 Merge pull request #16 from semgrep/pnpm-cooldown
pnpm cooldown
2026-04-25 18:38:20 +01:00
Leif 635e340fc3 dependabot 2026-04-25 10:36:28 -07:00
Leif 8d24921981 Merge branch 'main' into pnpm-cooldown 2026-04-25 03:09:14 +01:00
Leif 814baa2b2c Merge pull request #17 from semgrep/rebuild-code-security-outputs
Rebuild code-security AGENTS.md and test cases
2026-04-25 03:08:53 +01:00
Leif dfffdd51ee Refresh date stamp and zip outputs
build.ts stamps the current month/year into AGENTS.md, and the zip
files mtime-rebuild from those. Refreshing here so CI's
no-uncommitted-changes guard passes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 18:55:15 -07:00
Leif 5f56ac765a Bump CI to pnpm 10
The pnpm security settings added in the previous commit
(strictDepBuilds, minimumReleaseAge, trustPolicy) require pnpm >=10.21,
and engines.pnpm gates installation. Bump pnpm/action-setup to v10 in
all three workflows (ci, release, security).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 18:51:51 -07:00
Leif 76e3de2316 Rebuild code-security AGENTS.md and test cases
Rebuilds the generated outputs for skills/code-security after the rule
content updates in #13 (commit ddc19af). The source rule files were
updated but `make` was not run, so the compiled AGENTS.md and extracted
test cases drifted from the rules.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 18:51:32 -07:00
Leif 2347c443c1 pnpm security stuff
pnpm security stuff
2026-04-24 18:40:45 -07:00
Drew Dennison 9dfd4d2ccb Merge pull request #13 from vibhuti5/code-security-rule-updates
Improve code-security rules with safer examples and updated guidance
2026-04-13 05:15:23 -07:00
Vibhuti Patel ddc19af35a Improve code-security rules with safer examples and updated guidance 2026-04-10 02:33:15 +05:30
Isaac Evans df4b53393c Merge pull request #11 from semgrep/semgrep-autofix/1774294178
Fix shell injection vulnerability in release workflow
2026-03-23 12:33:50 -07:00
Semgrep Autofix b5ec9b6c47 Fix shell injection vulnerability in release workflow
Fix potential shell injection in the release workflow by using environment variables instead of direct interpolation.

## Changes
- Move `github.event_name` and `inputs.version` to environment variables (`EVENT_NAME` and `INPUT_VERSION`)
- Reference these environment variables in the shell script instead of using `${{ }}` interpolation directly in the `run:` block

## Why
Direct interpolation of `${{ inputs.version }}` in a `run:` step is vulnerable to shell injection attacks. A malicious actor could craft a version input containing shell metacharacters to execute arbitrary commands, potentially stealing secrets or compromising the runner. By passing values through environment variables, the shell treats them as literal strings rather than executable code, eliminating the injection vector.

## Semgrep Finding Details
Using variable interpolation `${{...}}` with `github` context data in a `run:` step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code. `github` context data can have arbitrary user input and should be treated as untrusted. Instead, use an intermediate environment variable with `env:` to store the data and use the environment variable in the `run:` script. Be sure to use double-quotes the environment variable, like this: "$ENVVAR".

@409041 requested Semgrep Assistant generate this pull request to fix [a finding](https://semgrep.dev/orgs/semgrep/findings/698924849) from the detection rule [yaml.github-actions.security.run-shell-injection.run-shell-injection](https://semgrep.dev/r/yaml.github-actions.security.run-shell-injection.run-shell-injection).
2026-03-23 19:29:56 +00:00
Drew Dennison 1932e6d984 Bump GitHub Actions and dependencies
- Upgrade actions/setup-node v4 → v6
- Upgrade actions/checkout v4 → v6
- Upgrade actions/upload-artifact v4 → v7
- Bump unist-util-visit 5.0.0 → 5.1.0
- Bump @types/node 20.19.29 → 25.0.10

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 22:31:50 -08:00
Drew Dennison 327da93b17 Improve all 3 skill SKILL.md files for better triggering and guidance
- code-security: Add language-specific priority rules table, proactive/reactive
  workflow, inline rule file paths, pushier description
- llm-security: Add "What Are You Building?" task-to-rule mapping, proactive
  workflow, inline rule file paths, broader trigger phrases
- semgrep: Add MCP tools documentation section, broader trigger phrases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 22:29:06 -08:00
Drew Dennison 6e373835d1 regen 2026-02-05 17:38:15 -08:00
Drew Dennison fb6a820d4e Add Semgrep Rules License to LICENSE file 2026-02-05 17:30:37 -08:00
Isaac Evans c011c534a1 Change title to 'Agent Skills [Beta]'
Updated README to reflect beta status of agent skills.
2026-02-05 08:57:18 -08:00
Drew Dennison 61ecff2a24 Add CI, release, and security GitHub Actions workflows
- CI workflow: validates and builds on PRs, fails if generated files are out of sync
- Release workflow: creates GitHub releases with skill zips on version tags
- Security workflow: weekly pnpm audit and outdated dependency checks
- Dependabot config: automated weekly dependency updates for npm and actions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 09:20:16 -08:00
Drew Dennison 0b86cf46ee Merge pull request #2 from semgrep/add-claude-github-actions-1769154178101
Add Claude Code GitHub Workflow
2026-01-22 23:43:25 -08:00
Drew Dennison f22c03f2cb "Claude Code Review workflow" 2026-01-22 23:43:02 -08:00
Drew Dennison 2e3e84dc32 "Claude PR Assistant workflow" 2026-01-22 23:43:00 -08:00
Drew Dennison b47191a021 Add pre-commit instruction to always run make
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 11:58:22 -08:00
Drew Dennison 69ce5427dd Add official Semgrep rule syntax docs and schema references
- Link to https://semgrep.dev/docs/writing-rules/rule-syntax
- Link to https://github.com/semgrep/semgrep-interfaces/blob/main/rule_schema_v1.yaml
- Updated SKILL.md, workflow.md, and quick-reference.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 11:57:11 -08:00
Drew Dennison 62dd371c73 Update CLAUDE.md to reflect actual repo structure
- Document two skill types: guideline skills (rules/) and reference skills (references/)
- Add build system documentation with Makefile targets
- Update install command to npx skills add semgrep/skills
- Remove outdated script-focused template
- Add section on adding rules to guideline skills

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 11:02:04 -08:00
Drew Dennison c2ddd2fb50 Remove data flow command from SKILL.md
Removed a command for showing data flow in semgrep.
2026-01-20 10:55:10 -08:00
Drew Dennison 74e48e451e update zip 2026-01-20 10:54:01 -08:00
Drew Dennison 1e1d6c9712 Update SKILL.md 2026-01-20 10:53:34 -08:00
Drew Dennison 5e52e0cb69 update zip files 2026-01-20 10:28:32 -08:00
Drew Dennison 2366e9fda4 improve semgrep skill 2026-01-20 10:28:07 -08:00
Drew Dennison 603e9e278f Fix install command to npx skills add semgrep/skills
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 10:20:50 -08:00
Drew Dennison 0ee9a5f44a Standardize install command to npx skills semgrep/skills
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 10:20:19 -08:00
Drew Dennison f67bfacece Add README to semgrep skill
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 10:17:52 -08:00
Drew Dennison b9eac31076 Add semgrep skill for static analysis and custom rule creation
Combines functionality from Trail of Bits' semgrep and semgrep-rule-creator skills:
- Running Semgrep scans with curated rulesets
- Creating custom detection rules with pattern matching and taint mode
- Test-driven rule development workflow
- CI/CD integration examples

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 10:14:47 -08:00
Drew Dennison a338b9f908 update install command 2026-01-20 09:53:50 -08:00
Drew Dennison b8aa65bada Update installation command for skills 2026-01-20 09:52:19 -08:00
Drew Dennison 6befb8a586 Update README.md 2026-01-17 11:49:19 -08:00
Drew Dennison f99267b67e Update README.md 2026-01-17 11:48:33 -08:00
Drew Dennison 16ebae6d46 Update README.md 2026-01-17 11:47:59 -08:00
Drew Dennison 823e429b92 Add llm-security skill and make build tooling generic
- Add llm-security skill covering OWASP Top 10 for LLM Applications 2025
  - 10 rules: Prompt Injection, Sensitive Disclosure, Supply Chain,
    Data Poisoning, Output Handling, Excessive Agency, System Prompt
    Leakage, Vector/Embedding Weaknesses, Misinformation, Unbounded
    Consumption
  - Python code examples with vulnerable/secure patterns

- Rename packages/code-security-build to packages/skill-build
  - Accept skill name as CLI argument: `pnpm validate llm-security`
  - Auto-discover skills with rules/ directories
  - Support Vulnerable/Secure labels (in addition to Incorrect/Correct)

- Update Makefile to build all skills automatically
  - `make validate` - validates all skills
  - `make build` - builds AGENTS.md for all skills
  - `make validate-skill SKILL=name` - single skill operations

- Update READMEs with llm-security documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 14:59:55 -08:00
Drew Dennison 769eb809d6 remove 2026-01-15 14:31:39 -08:00
Drew Dennison e6d279659f Expand sql-injection.md with multi-language examples
Based on semgrep-rules test cases, now covers:
- Python (psycopg2): concatenation, .format(), f-strings
- JavaScript (pg): template literals, concatenation
- Java (JDBC): Statement vs PreparedStatement
- Go (database/sql): concatenation, fmt.Sprintf
- Ruby (pg): concatenation, interpolation
- C# (SqlCommand): String.Format, SqlParameter

Test cases: 347 → 364 (+17 examples)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 14:23:17 -08:00
Drew Dennison cd382c1c40 Extract section parsing into shared module
- Create sections.ts to parse _sections.md dynamically
- Eliminate hardcoded section map from parser.ts (was 28 entries)
- Replace duplicate parsing code in build.ts with shared module
- _sections.md is now the single source of truth for section metadata

Adding a new rule now only requires updating _sections.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 14:17:35 -08:00
Drew Dennison bfa8941893 Fix section mapping for security rules
- Replace React performance section map with security categories (1-28)
- Fix _sections.md parsing to use ### headings instead of ##
- Each rule now maps to its proper section by filename

Now generates 28 sections organized by impact level:
- Critical (1-9): SQL injection, XSS, secrets, etc.
- High (10-22): Crypto, SSRF, Terraform, K8s, etc.
- Medium (23-25): Regex DoS, race conditions
- Low (26-28): Best practices, performance

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 14:14:33 -08:00
Drew Dennison 2e12e64d4d Improve rule consistency and rewrite parser with remark/unified
Rule consistency:
- Add missing impactDescription and tags to 15 rule files
- Standardize reference format to **References:** across all rules
- Update _template.md with correct reference format

Parser improvements:
- Replace regex-based parser with AST-based parsing using remark/unified
- Add unified, remark-parse, remark-frontmatter, unist-util-visit, js-yaml
- More robust extraction of frontmatter, examples, and code blocks

Validation improvements:
- Add warnings for missing optional fields (impactDescription, tags)
- Report all errors/warnings instead of stopping on first error

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 14:11:57 -08:00
Drew Dennison 2ea1e704b3 Fix nested code fence in README breaking numbered list
Use 4 backticks for outer fence so inner code blocks don't break it.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 13:18:23 -08:00
Drew Dennison 8bcf9f1ce7 Regenerate zip with updated READMEs 2026-01-15 13:13:57 -08:00
Drew Dennison ffaf3d2612 Update READMEs and add build package documentation
- skills/code-security/README.md: Simplified, added categories summary
- packages/code-security-build/README.md: New - documents build tooling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 13:13:57 -08:00
Drew Dennison 3cd507999b Regenerate zip with updated README 2026-01-15 13:10:41 -08:00