Author a custom Semgrep rule to detect an org-specific insecure coding pattern, using taint mode to track data from source to sink

domain: semgrep.dev · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Write a rule YAML file with an id, languages, message, severity, and metadata block describing the org-specific pattern to detect.
  2. For structural matching, use patterns (AND) or pattern-either (OR) with metavariables (e.g., $USER_INPUT) to abstract over unknown values, refining matches with metavariable-pattern where a captured value must itself match a sub-pattern.
  3. For flows where untrusted input reaches a dangerous function, set mode: taint and nest pattern-sources, pattern-sinks, and any pattern-sanitizers under a top-level taint key rather than trying to express the flow as a single structural pattern.
  4. Test the rule locally against known-vulnerable and known-safe code samples with semgrep --test before rolling it out.
  5. Publish the rule to an internal rule registry or CI-mounted ruleset and run it in CI with a severity-based fail threshold.

Known gotchas

Related routes

Author a custom secret scanning regex pattern at the GitHub organization level, validate it with a dry run, then publish and enable it for push protection
docs.github.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans