Skip to main content
A rule is a plain-language instruction that Gecko reads on every scan, including pull request scans. Use rules to tell Gecko what it can’t see in the code, such as a gateway that enforces auth, or to point it at a pattern that matters to your organization.

Create a rule

1

Open Rules

In the sidebar, go to Context > Rules.
2

Click Create Rule

Fill in:
  • Rule title: a short name, for example “Auth is enforced at the gateway”.
  • Description: describe what the scanner should look for, or the fact about your environment it should take into account.
  • Repositories: All repositories, or only the ones the rule applies to.
3

Re-scan

Rules apply to scans that start after you save them. Re-scan to see their effect on existing results.

Writing good rules

A good rule states a fact and where it’s enforced, or names a specific pattern to check:
Examples
See False positives and context for when to write a rule and when to dismiss a single finding instead.

Docs and repository rules

Besides written rules, you can add context from a docs page or a repository. Click Create Rule and pick a type:
  • Docs: enter the page’s URL.
  • Files or repository: pick a Repository, and optionally the Files in it to use.
For both, set Used when scanning to the repositories the rule applies to, and add a Note on what the scanner should take from it. The Rules list shows each entry’s type, and they track usage the same way as written rules.

See where a rule is used

Every scan records which rules it ran with, so you can check that a rule is reaching the scans you expect.
  • Usage column: the Rules list shows how many scans invoked each rule per day over the last 14 days. Hover the line for the total scan count and when the rule was last invoked. A rule no scan has run with shows as Unused.
  • Activity tab: open a rule and select Activity to see the latest scans that invoked it, with their repository and time. Click a scan to open it.
Docs and repository sources show usage the same way: a scan counts for every source that applies to the repository it scanned. A rule or source scoped to specific repositories only counts scans of those repositories. Usage only includes repositories you have access to.

Plans and permissions

Creating rules requires the Pro or Enterprise plan. Admins, Managers, and Members create and edit rules; Read Only users can view them. See Teams & permissions.
AI agents connected through MCP can list, read, create, and update rules when you grant them the rules scopes.