Compliance Scanner
Quick Start
Run a compliance assessment on the project in current directory, using Xygeni Scanner:
xygeni compliance -n MyProjectwhich produces an output similar to this:
Stop software supply-chain attacks! xygeni.io
Running xygeni...
2022-11-09 11:52:09.815 [main] INFO Xygeni - Start xygeni
2022-11-09 11:52:35.002 [main] INFO ComplianceEngine - Checkpoints terminated. Duration = 0.000112221s
2022-11-09 11:52:35.008 [main] INFO ComplianceEngine - Analysis complete in 24.180512222s
Compliance for cis_sscs standard: non-compliant (2.67)
Checkpoints run: 13
┌───────────────────────────────────────┬───────┬─────┬────────┬────────────────────────────────┬───┐
│Checkpoint │Status │Level│Severity│Category │Op?│
├───────────────────────────────────────┼───────┼─────┼────────┼────────────────────────────────┼───┤
│cis_sscs/branch_deletions_denied │ fail │ 0 │critical│source_code/code_changes │ │
├───────────────────────────────────────┼───────┼─────┼────────┼────────────────────────────────┼───┤
│cis_sscs/code_in_vcs │ fail │ 0 │critical│source_code/code_changes │ │
├───────────────────────────────────────┼───────┼─────┼────────┼────────────────────────────────┼───┤
│cis_sscs/force_push_denied │ fail │ 0 │critical│source_code/code_changes │ │
├───────────────────────────────────────┼───────┼─────┼────────┼────────────────────────────────┼───┤
│cis_sscs/identity_verified │ fail │ 0 │critical│source_code/contribution_access │ │
├───────────────────────────────────────┼───────┼─────┼────────┼────────────────────────────────┼───┤
│cis_sscs/minimum_approvals │ fail │ 0 │critical│source_code/code_changes │ │
├───────────────────────────────────────┼───────┼─────┼────────┼────────────────────────────────┼───┤
│cis_sscs/anonymous_access │ ok │ 10 │critical│artifacts/access_to_artifacts │ │
├───────────────────────────────────────┼───────┼─────┼────────┼────────────────────────────────┼───┤
│cis_sscs/contain_security_md │ ok │ 10 │critical│source_code/repository │ │
├───────────────────────────────────────┼───────┼─────┼────────┼────────────────────────────────┼───┤
│cis_sscs/minimum_admins_org │ ok │ 10 │critical│source_code/contribution_access │ │
├───────────────────────────────────────┼───────┼─────┼────────┼────────────────────────────────┼───┤
│cis_sscs/package_hooks │ ok │ 10 │critical│artifacts/package_hooks │ │
├───────────────────────────────────────┼───────┼─────┼────────┼────────────────────────────────┼───┤
│cis_sscs/inactive_users │ ok │ 10 │ low │source_code/inactive_users │ │
├───────────────────────────────────────┼───────┼─────┼────────┼────────────────────────────────┼───┤
│cis_sscs/steps_as_code │ ok │ 10 │ low │build_pipelines/pipeline_instruc│ │
├───────────────────────────────────────┼───────┼─────┼────────┼────────────────────────────────┼───┤
│cis_sscs/package_org_mfa │ na │ 0 │critical│artifacts/package_org_mfa │ │
├───────────────────────────────────────┼───────┼─────┼────────┼────────────────────────────────┼───┤
│cis_sscs/inactive_branches │unknown│ 0 │ low │source_code/code_changes │ │
└───────────────────────────────────────┴───────┴─────┴────────┴────────────────────────────────┴───┘You may now log in the Xygeni Dashboard and view the Compliance Assessment results.
Purpose
Compliance Assessment checks compliance with Software Supply-Chain Security standards and guidelines.
A standard is a list of checkpoints, arranged in categories. A software project is compliant with a standard ("passes") only when all the standard’s required checkpoints passed.
The assessment report gives a status (PASS, PARTIAL, FAIL) and a compliance level between 0 (not compliant at all) and 10 (fully compliant).
Standards
See supported standards and guidelines for more details.
Handling results
Remember that for a standard to pass, all its required checkpoints must pass.
A non-compliant checkpoint could be verified following its documented Verification section, and made compliant by following the recommended actions in the Remediation section.
Usage
A Compliance Assessment scan is launched using the compliance command of the xygeni executable.
With --help the usage is displayed:
Configuration
$XYGENI_HOME denotes here the path where the Xygeni scanner is installed.
The Compliance Assessment Scanner is configured in the YAML file $XYGENI_HOME/conf/xygeni.compliance.yml:
Standards are configured with different YAML files located under the $XYGENI_HOME/conf/compliance/standards directory of the xygeni scanner. Each standard provides some information and the list of checkpoints that are to be checked for compliance assessment.
Checkpoints are configured with different YAML files located under the $XYGENI_HOME/conf/compliance/checkpoints directory of the xygeni scanner.
You might use the Policy Administration tool for editing standards to be enforced at the organization.
How to…
This section presents common use-cases for evaluating compliance against a given supply-chain security standard across the software lifecycle.
Exclude certain checkpoints from a standard assessment
There could be certain checkpoints that should not be run for a certain project, or because the practice enforced by the checkpoint does not fit with the organization policy. The list of checkpoints that should be active for a standard to enforce, according to the organization policy, could be set in the Policy page in Xygeni Administration.
Disabling checkpoints could be done, in order of prevalence: - by disabling the intended checkpoint(s), listing their IDs in the --skip-checkpoints option. - with the runCheckpoints / skipCheckpoints properties in the scanner YAML. - at the policy level, - by deactivating the checkpoint at the central configuration level (e.g. by setting enabled: false in the checkpoint YAML configuration).
A common use case is to disable issues with info / low severity (--skip-checkpoints=low) or equivalently enabling only high or critical issues (--checkpoints=high).
Add compliance assessment as a git hook
a) Direct registering script as a git hook
To run Xygeni scanner at client-side, before a commit is applied, you may add a simple pre-commit executable script like this (example for Linux and macOS):
The --fail-on option is configured to make the build fail when at least one issue with critical or high severity is found (so the scanner acts as a security gate).
For running the scan as an optional pipeline check, use --fail-on=never instead.
This example is a similar security gatekeeper, but commits are allowed only when no scan of the given types has a critical issue (only the scanner execution is shown, for brevity):
When a critical issue is detected in any of the scans for secrets, misconfigurations or IaC flaws, the commit will be aborted.
Use compliance command to limit the scope of the scan to compliance assessment.
b) Using pre-commit framework
There are some popular frameworks for improving the hook mechanism provided by Git, mainly aimed at sharing the scripts and simplifying the configuration when multiple actions need to be added for a git event.
One of the most popular frameworks is pre-commit. The list of actions required are listed in a YAML file, and `pre-commit manages the installation and execution of scripts written in any language.
Follow the instructions given in pre-commit quick start for installing the framework. Essentially you need python and pip, and run pip install pre-commit in the node where the git commit will be intercepted.
Then add the following entry to you .pre-commit-config.yaml:
Or, for running the scanner Docker image:
Then install the git hook scripts using
Xygeni scanner will run before each commit. The configuration given above works for setting Xygeni as a security gate to avoid commits having critical security issues. To avoid break the builds, --fail-on=never could be used instead.
Use compliance command to limit the scope of the scan to compliance assessment.
Add compliance assessment to a CI step
You may use compliance results to block a commit.
Under GitHub, you may use Xygeni GitHub Action, running the compliance command only, and with fail_on argument configured to fail the build only when important checkpoints do not pass:
The fail_on is configured to make the build fail when at least one critical checkpoint do not pass. For having the compliance check as optional, use fail_on: never instead.
Define a custom standard
A new standard may be created from existing standards by simply listing the new standard’s checkpoints in `$XYGENI_HOME/conf/compliance/standards/<my_new_standard>.yml:
Where ID_CHECKPOINT_1, ID_CHECKPOINT_2… are the checkpoint identifier. The configuration for each checkpoint is loaded from <custom-standards-dir>/<ID_CHECKPOINT>.yml file, if available, or from a resource loaded from compliance/checkpoints/<ID_CHECKPOINT>.yml path.
The easiest way to define your own standard is using the Policy Administration. This allows to mix-and-match checkpoints from different standards into a new one, possibly changing checkpoint severities and its _optional flag.
An alternative option is to create your standard’s my_standard.yml file, located in a specific $XYGENI_HOME/conf/compliance/custom_standards directory, testing it, and then upload the configuration using the central configuration.
Command-line example:
Last updated