At GuardRails, we focus on security that doesn't get in your way. That means supporting a quick and easy installation, without any additional configuration.
Nonetheless, we understand that one size doesn't fit all. A great developer experience requires flexibility to configure GuardRails to your needs.
You can override the default configuration for your account/organization in the Settings tab of the dashboard. By default, the config is:
bundles: "auto" report: pullRequest: findings: "onChangedLinesOnly" comment: true notifications: slack: enabled: false useGitClone: false
Bundles are set of tools we use to detect security issues in repositories, typically grouped by programming language.
Currently, we support the following bundles:
By default, we run the
general bundle, along with the bundle(s) matching the language(s) we detect in your repository.
It may happen that we don't detect (all) the language(s) of your repository. In that case you can override the
bundles attribute to serve your needs:
You can even go further by overriding the tools that run within a bundle:
This will run the full
General bundle, along with just the Mythx tool from the
Solidity bundle (which by default runs both
You can also exclude engines from being run. The below configuration would allow you to run all detected engines, but not run the Java engines
spotbugs (it would still run semgrep), and completely avoid any PHP engines (including future engines that may be added).
bundles: "auto" excludeBundles: - java: - dependency-check - spotbugs - php
To know more about the tools of a bundle, please refer to the Tools section.
Here are all the possibilities:
This attribute enables you to control the behavior of GuardRails in your pull requests. Per default, we only notify you of security issues detected in the lines that changed in your pull requests (
true (default) or
By default, we post a comment in your pull requests if we find any security issues. If you prefer to review the reports via our dashboard and want to disable the comments, set this attribute to
GuardRails supports Monorepos and can be granularly configured to represent virtually any monorepo structure. If you have requirements that are not supported by our current configuration, please send us an email to [email protected].
Note: This configuration can also be done via the repository settings page, without requiring to add the config file to the repository.
Let's assume the following monorepo structure:
├── app1/ │ ├── src/ │ └── index.js ├── java/ │ ├── java-app1/ │ ├── java-app2/ │ ├── java-app3/ │ ├── java-app4/ │ └── java-app5/ ├── php │ ├── php-app1/ │ ├── php-app2/ │ ├── php-app3/ │ ├── php-app4/ │ └── README.md ├── docs │ └── README.md └── README.md
app1 folder contains a Node.js application, the
java folder contains 5 apps in sub-folders, and the
php folder contains 4 apps in sub-folders. There is a
doc folder as well containing a
An example configuration for that structure can be found below:
monorepo: - /app1 - /java/*: bundles: - java: - semgrep - /php/*: bundles: - php report: pullRequest: findings: "onChangedFilesOnly"
This configuration treats the
app1/ folder as a dedicated repo and will apply the default configuration. The
java/ folder will be considered as root container and all sub-folders will be considered as standalone repositories. A specific configuration will be applied to all sub-folders, in this case only the java engine
semgrep will be run against any changes. Do note that a change in for example the
java/java-app1 repo, will only trigger a scan for that sub-folder, not any other folders. Similarly the
php/ folder will be treat all sub-folders as standalone repositories and will apply a special config that runs all
php engines as well as report vulnerabilities in all files that have changes, not just in the lines that changed.
All files and folders that are not specifically mentioned in the
monrepo config directive will be considered as "one repo". For example, the
/docs/ folder and the
/README.md file would be scanned if there are changes in either. Especially, if you don't configure a folder containing sub-repositories (e.g. the
/java folder), any other changes such as to a README file would result in all sub-folders being scanned.
Ignoring Config Files
GuardRails supports configuration via the
.guardrails/config.yml for each repository. In addition, it is possible to configure most settings on an org-wide level, via the
Settings tab on the dashboard. It is also possible to configure GuardRails on a per-repo level via the
Repository Settings tab in the dashboard. The enforcement of config options is happening according to this hierarchy. Global settings will be applied, unless there are settings defined on the repository setting level in the dashboard. Repository settings will be applied, unless there are settings defined in the
.guardrails/config.yml on the repository code.
The ignoring config files toggle can be set on both the org-wide as well as the repo specific level. Once it's active, the
.guardrails/config.yml file will always be ignored and the config from the either global or repo level setting will be applied.
In order to enable Slack notifications for GuardRails, you first have to set up incoming Webhooks for Slack. There are 5 steps to follow:
- Create a Slack app (if you don't already have one).
Incoming Webhooksfrom the settings page.
- After the settings page refreshes, click
Add New Webhook to Workspace.
- Pick a channel that the app will post to, then click
- Copy the value of the Incoming Webhook URL
You can either configure Slack notifications in GuardRails on account level or on repostiory level. If you configure on account level the slack configuration will be the default values for all of the repositories under that account. If you configure on repository level the slack configuration will only be set for that specific repository and will override any configurations made on account level.
Configure Slack on account level
- Navigate to the GuardRails dashboard.
- Go to the account settings page.
- Fill in the configuration that should be the default for all repositories under the account (you can override these values in each repository, see below for more info).
Configure Slack on repository level
For repository level configurations you can either configure it in the GuardRails dashboard or by creating a config file in you Git repository (
.guardrails/config.yml). All values entered on the repository level will override any configuration made on the account level, and any configuration made in the Git repository will override all configurations made in the dashboard (even those made in the repository settings).
To configure Slack using the GuardRails dashboard follow these steps:
- Navigate to the GuardRails dashboard.
- Go to the repostiory that you want to configure Slack notifications for and click on settings.
- Fill in your Slack configuration.
To configure Slack in the Git repository follow these steps:
- Create the file
.guardrails/config.ymlin your Git repository (if it doesn't already exist).
- Open the file and add your configuration (see below for example of a valid configuration).
notifications: slack: notify: whenScanHasFindingsOnly enabled: true webhookUrl: >- https://hooks.slack.com/services/XXXXXXXXX/YYYYYYYYY/xyxyxyxyxyxyxyxyxyxyxyxy
The Slack webhook url contains the secret that is needed to authenticate and send Slack notifications. This means that if your Git repository is public, malicious people might find your webhook url and send Slack notifications to you. We therefore do not recommend that you enter the Slack webhook url in your Git repository, instead you should configure the url in the GuardRails dashboard.
A valid URL corresponding to a Slack Incoming Webhook.
Scanning with .git directory
By default scans are done on contents of a git repository without including
.git directory itself. You can override this behavior with
Ignoring files and folders
The ignore file can come handy if you notice GuardRails is alerting you on some code you deliberately know is vulnerable, or causes false positives. The ignore file follows the gitignore file pattern. Refer to the gitignore docs for more details. One example file is:
If you want to disable one line in particular, you need to add
guardrails-disable-line on the concerned line, usually as a comment.
const highEntropyStringThatIsNotASecret = "e32kdjksw'(&dej+"; // guardrails-disable-line