Configure PR scans in SCM apps
The Endor Labs SCM integrations let you scan pull requests or merge requests when they are opened or updated. In the integration settings, enable PR or MR scans to run them automatically and, optionally, enable pull request comments to post findings as review comments. Action policies apply to PR scans the same way as to other scan types. The following describe platform-specific setup and configuration options:- Endor Labs GitHub App PR scans
- GitLab App MR scans
- Bitbucket Cloud App
- Bitbucket Data Center App
- Azure DevOps App
Run PR scans from CI
PR scans can be run from a continuous integration pipeline by invokingendorctl scan with pull request flags in jobs triggered by pull request or merge request events. This approach provides control over when scans run, supports posting findings as PR or MR comments, and allows policies to be enforced, such as failing builds or blocking merges. The scan profile assigned to the project determines the toolchains and environment used for the scan.
- See CI scans for platform-specific pipeline configuration.
- See Pull request flags for available flags.
Scan profiles for PR scans
A scan profile defines the configuration applied to PR scans for a project, including languages, toolchains, path filters, and parameters such asenable_automated_pr_scans and enable_pr_comments. For CI-initiated PR scans, the scan profile determines the toolchains and environment configuration used to execute the scan.
App-triggered PR scans run only when both of the following are true.
- Pull Request scans or Merge Request scans are enabled during SCM app installation so the app receives PR or MR events.
- Pull request scans or
enable_automated_pr_scansis enabled in the scan profile assigned to the project.
Enable PR scans on monitored non-default branches
By default, Endor Labs scopes automated PR scans to pull requests into the project’s default branch. You can extend that scope to any other branch that is already a monitored version of the project, such asrelease or develop. Pull requests into a monitored branch that isn’t allowed as a PR scan target are not scanned.
The following conditions are required before you can allow a branch as a PR scan target branch:
- The branch is already a monitored version of the project. See Testing and monitoring different versions of your code to add a branch as a monitored version.
- A baseline scan already exists on the branch.
- PR scans are enabled for the project through the SCM app installation, scan profile, or scan workflow. See Scan profiles for PR scans.
- Select Projects from the left sidebar.
- Search for and select your project from the list.
- Select Settings.
- Under Monitored versions, find the branch you want to scan.
-
Select the vertical three dots for that branch, and select Allow as PR scan target branch.
Enabling PR scans on a non-default monitored branch consumes additional scan credits. See Endor Labs licenses for more information.
- In the confirmation dialog, click Allow.
- Optionally, select the vertical three dots next to the branch count, and select Add another repository branch to add another branch or reference.
Ignore files in PR scans
Ignore files let you dismiss findings by committing a file in your repository as part of a pull or merge request. During a PR scan, Endor Labs applies the ignore file from the repository version being scanned. Findings that match entries in the ignore file are excluded from PR Runs, do not appear in Pull Request comments, and do not trigger action policies.Tenant setting required for ignore filesYou must allow ignore files to dismiss findings in Settings > SYSTEM SETTINGS > Developer Workflows for scans to process ignore files.
endorctl ignore and validate the file with endorctl validate ignore. See Dismiss findings using an ignore file for more details on ignore file format and structure.
Pull Request comments
PR comments are automated comments posted on pull or merge requests when Endor Labs detects policy violations during a PR scan. Enable them in your SCM integration or using--enable-pr-comments in CI, then configure an action policy with Branch Type Pull Request. See Pull Request comments and Action policies for setup and configuration.