Set a default branch
The findings, metrics, and data shown on the dashboard and the project listing page are based on scanning the default branch, which is also known as the main context.Important recommendation
If you are scanning multiple branches, it is essential to select and set one as the default branch. When performing the endorctl scan, use the flag
If you are scanning multiple branches, it is essential to select and set one as the default branch. When performing the endorctl scan, use the flag
--as-default-branch to designate a project branch as the default branch and view its findings.as-default-branch, the first branch you scan is automatically considered as the default branch.
After a scan, if you switch the default branch to another using --as-default-branch, scans from the previous branches are erased, and their findings will no longer be available.
You do not need to set a default branch if you are using the Endor Labs GitHub App or not scanning multiple branches.
Testing and monitoring different versions of your code
Across the software engineering lifecycle it is important that continuous testing is separated from what is monitored and reported on regularly. Often, engineering organizations want to test each and every change that enters a code base, but if security teams reported on each test they would quickly find themselves overwhelmed with noise. Endor Labs enables teams to separate what should be reported on relative to what should be tested but not reported on. Endor Labs allows teams to select reporting strategies for their software applications when integrated into CI/CD pipelines. Here are the primary scanning and reporting strategies:- Reporting on the default branch - All pull request commits are tested and all pushes or merges to the default branch are reported on and monitored by security and management teams.
- Reporting on the latest release - All reporting and monitoring is performed against tagged release versions. This requires each team have a mature release tagging strategy.
How to deploy a strategy for reporting
Theendorctl scan command by default will continuously monitor a version of your code for new findings such as unmaintained, outdated or vulnerable dependencies in the bill of materials for a package. To test a version of your code without monitoring and reporting on it, use the flag --pr or environment variable ENDOR_SCAN_PR as part of your scan.
When adopting a strategy such as reporting on the default branch, you will want to run any push or merge event to the default branch without the --pr flag and run any pull_request or merged_request event with the --pr flag. This allows you to test changes before they have been approved and report what has been merged to the default branch as your closest proxy to what is in production.
Let’s use the following GitHub Actions workflow as an example! In this workflow any push event will be scanned without the --pr flag but any pull_request event is scanned as a point in time test of that specific version of your code.
Scanning detached refs
In some CI/CD based environments, each time code is pushed to the default branch the exact commit SHA is checked out as a detached Git Reference. This is notably the case with Jenkins, CircleCI and GitLab Pipelines. In these scenarios, on push or merge events Endor Labs must be told that the reference should be monitored as the default branch. You can do this with the--detached-ref-name flag or ENDOR_SCAN_DETACHED_REF_NAME environment variable. You should also couple this flag with the --as-default-branch flag or ENDOR_SCAN_AS_DEFAULT_BRANCH environment variable. This allows you to set this version of code as a version that should be monitored as well as define the name associated with the branch.
This strategy may be used for both a strategy reporting on the default branch on push events and a strategy reporting on tag creation event for that version of code.
You can see in the below GitLab Pipelines example defining the logic to manage a detached reference on GitLab.
Implementing baseline scans
One of the common concerns software development teams have when adopting preventative controls is ownership of issues. Often, software has accrued significant technical debt, or new vulnerabilities arise that don’t directly impact their changes. Security teams want to have all known issues addressed while the development teams are focused on fixing issues or delivering core business value. They can’t be hindered each time a new issue impacts their entire code base. To prevent new issues from entering the environment, security teams sometimes set policies that may break the build or return a non-zero exit code that can fail automated tests. This creates friction as there is no context around what changes a developer is responsible for versus what technical debt exists in a codebase on that day. Establishing a baseline of what issues already exist in a software project and what issues may occur because of new updates is crucial to enabling preventative control adoption.Accelerating preventative control adoption with CI baselines
The high-level steps to establish and measure policies against a baseline scan are as follows:- Establish a baseline scan of your default branch or any other branch that undergoes regular testing
- Integrate baseline scans into your automated workflows
- Evaluate policy violations within the context of the branches to which you routinely merge
Implementing baseline scan into your program
Development teams often have different delivery strategies. Some merge changes to a default branch. Others merge to a release branch that is then released to their environment. While these strategies differ across organizations, a baseline scan must exist to measure against attribute ownership. To establish a baseline scan, your team must perform regular scans on the branch to which you merge. This often means that you scan each push of your default branch to monitor your environment and you test each pull request using the--pr and --pr-baseline flags.
The --pr flag is a user’s declaration that they are testing their code as they would in a CI pipeline. The --pr-baseline flag tells Endor Labs which Git reference to measure any changes.
For this example, we will use the default branch as a merging strategy. In this strategy, you’ll want to scan the default branch on each push event to re-establish your baseline. You’ll also want to establish your CI baseline as the default branch.
The following GitHub workflow illustrates this strategy.
- See the GitHub Actions documentation for GitHub default variables.
- See the GitLab CI/CD documentation for the GitLab default variables.
Understand SARIF files
SARIF (Static Analysis Results Interchange Format) is an OASIS standard format for reporting static analysis results. This standardized format allows you to:- Integrate with multiple platforms: Upload results to GitHub Security, Azure DevOps, or other tools that support SARIF.
- Consolidate findings: Combine results from different security tools in a unified format.
- Automate workflows: Process and act on security findings programmatically.
- Track remediation: Monitor the status of security issues over time.
SARIF file structure
A SARIF file contains several key components:- Runs: Each scan execution creates a run with metadata about the scan.
- Results: Individual findings with details about dependency vulnerabilities, SAST findings, and secrets.
- Rules: Descriptions of the checks that were performed.
- Artifacts: Information about the files and dependencies that were analyzed.
Generate SARIF output using endorctl
SARIF files standardize security findings, enabling CI/CD integration, unified dashboards, and compliance reporting. They provide PR-level feedback, support long-term monitoring, and preserve historical data for auditing and tool migration. To generate SARIF output with Endor Labs, use the--sarif-file or -s flag with the endorctl scan command:
Upload SARIF files to GitHub
GitHub Security supports SARIF file uploads, allowing you to view Endor Labs findings directly in your repository’s Security tab. You can upload SARIF files automatically using the GitHub App (Pro), through GitHub Actions, or manually.Automatic upload using GitHub App (Pro)
When you configure Endor Labs GitHub App (Pro) with a GHAS SARIF exporter, findings are automatically exported and uploaded to GitHub after each scan. See Export findings to GitHub Advanced Security for detailed setup instructions.Automated upload using GitHub Actions
Use the following GitHub Actions workflow step to automatically upload SARIF files.Manual upload via GitHub
To manually upload a SARIF file to GitHub:- Navigate to your GitHub repository.
- Go to Security > Code scanning > Upload SARIF.
- Select your SARIF file and upload it.
Endor-specific SARIF extensions
Endor Labs extends the standard SARIF format with custom fields that provide additional context for vulnerability analysis and remediation. These properties are included in theproperties field of each SARIF result.
The following fields are available in SARIF results generated by Endor Labs:
action-policies-triggered: List of action policies triggered by this finding.categories: List of categories the finding belongs to.cvss-score: Common Vulnerability Scoring System (CVSS) score, ranging from 0.0 to 10.0.cvss-vector: CVSS vector string describing the characteristics of the vulnerability.cvss-version: The version of the CVSS score used.epss-percentile-score: EPSS percentile score, showing how severe the vulnerability is compared to others.epss-probability-score: Exploit Prediction Scoring System (EPSS) probability score, indicating likelihood of exploitation.explanation: Detailed explanation of the finding and its implications.finding-url: URL to view the finding in Endor Labs.finding-uuid: Unique identifier for the finding.impact-score: Custom impact score assigned to the finding.project-uuid: Unique identifier for the project where the finding was discovered.remediation: Recommended steps to fix or mitigate the finding.tags: List of tags associated with the finding, used for categorization and filtering.
- SCA findings
- Secrets detection
- SAST findings