Skip to content

feat(NOJIRA-1): add optional custom-rules check running opengrep - #225

Draft
trapped wants to merge 1 commit into
mainfrom
feat/NOJIRA-1_custom_rules_opengrep
Draft

trapped wants to merge 1 commit into
mainfrom
feat/NOJIRA-1_custom_rules_opengrep

Conversation

@trapped

@trapped trapped commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

NOJIRA-1

Adds an optional custom-rules check that runs our own code rules with Opengrep, the open-source fork of Semgrep. Rules live in rules/ in this repo, so new rules reach every repo with the next v1 release. Opengrep covers Go, TypeScript/JavaScript, Bash, Dockerfile, YAML/JSON and Terraform, and its taint mode lets rules check how a value is used, not only the shape of the code.

How it works: scripts/custom-rules/run.sh downloads a pinned, checksum-verified Opengrep binary (x86 or aarch64) and scans the repo. On pull requests it only reports findings introduced since the merge base. Findings show as annotations, and only rules with severity ERROR fail the check. Repos opt in with enableChecks: 'custom-rules'. It also runs on draft PRs.

First rule: launchdarkly-init-error-aborts flags Go code that aborts on any error from LaunchDarkly's MakeClient/MakeCustomClient instead of only on a nil client (the fix from Typeform/autonomous-coding-workflows#86). It starts as a warning.

Also: rule tests in CI (run.sh test), a .semgrepignore so this repo's own scan skips the rule test files, and a Custom rules section in the README.

Tested: the rule flags exactly the call sites found in the campaign (user-service, workspace-service, webhooks-api, typekit-kit, brownie, forms-api) and none on the two fixed PR branches. A PR touching a file with existing violations reports nothing; a PR adding one fails when the rule is an ERROR. yarn run all passes. In this repo's CI, the check ran on ubuntu-latest (x86); the aarch64 path hasn't run on our Graviton runners yet.

Runs the Opengrep (Semgrep-syntax) rules in rules/ against the repo. On pull requests only findings introduced since the merge base are reported. Findings become annotations and only ERROR rules fail the check. Optional: enable with enableChecks custom-rules. Includes a first rule for LaunchDarkly client construction aborting on init errors (Typeform/autonomous-coding-workflows#86).
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.

1 participant