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
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.
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.
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.