Skip to main content

Detection rules

Detection rules decide which kinds of findings FossID reports. Every rule is on by default; only Include Dev Dependencies is off. Turn off the rules that don't matter for your project.

The Detection Rules editor​

Open the FossID side bar and select Detection Rules in the Policies view, or run FossID: Open Detection Rules.

SwitchWhat it controlsDefault
License FindingsFindings for prohibited licenses and licenses that need review. They cover source files and the license a manifest declares for your own project. They follow your license policy.On
License ModificationsModified license text findings. Also sets Detect when modified more than N %.On, 5%
CVEs in Matched ComponentsKnown vulnerabilities of whole components matched in your files. This is the lowest-confidence vulnerability rule: turn it off to cut component-level noise while keeping snippet and dependency vulnerabilities.On
Vulnerability Snippet Finder (VSF)Code snippets that match known-vulnerable upstream code.On
Vulnerable DependenciesKnown vulnerabilities in the resolved versions of declared dependencies, direct or transitive.On
License Policy in DependenciesDependencies under licenses your policy flags.On
Include Dev DependenciesWhether resolved dev dependencies are checked. See Dev dependencies.Off

The editor also holds your custom scan volumes. A volume that a repository lists gets your sign-in only after you allow its server. See Which volumes get your sign-in.

See Reading findings for what each rule reports.

Company policy or repository settings​

Detection rules are part of your license policy. The editor's banner shows which one you are looking at:

  • Repository settings, when your organization has no company policy (no banner, or No company policy): changes take effect immediately and are saved to .fossid/policy.json. Existing findings are re-evaluated without rescanning. The banner is also missing while the policy service can't be reached; see If the policy service can't be reached.
  • Company policy (Managed by your organization): the rules come from your organization.
    • With the policy-write permission, you can change them. Until you select Publish, your changes apply only in this window, to files FossID scans from then on. Publish publishes the detection rules and custom volumes for everyone, and existing findings are then re-graded. See Publishing changes.
    • Without it, the switches are read-only.

With no company policy and policy-write, and the repository's folder open, you can also make your repository's settings the organization's with Create company policy…. See Creating a company policy.

Dev dependencies​

Dev dependencies usually don't ship in your product, so by default FossID doesn't check them, or anything they pull in.

Include Dev Dependencies is the only switch that controls this. A fossid.conf file on your machine has no effect on it. FossID resolves dev-only sections only while a dependency rule includes them. It then checks the dev dependencies for:

  • Vulnerabilities (Vulnerable Dependencies rule);
  • Policy-flagged licenses (License Policy in Dependencies rule).

Each rule checks them only when its own Include Dev Dependencies is on. A dev dependency that one rule doesn't check shows only the other rule's findings. With none, it gets a muted annotation instead of the green ✓. The parent checkbox turns both on or off together. It shows a mixed state when they differ.

When a change to the switch starts or stops the resolving of dev dependencies, FossID restarts its scanner and scans your open manifests again. You don't need to do anything.

A dependency counts as a dev dependency when it is declared only in one of these sections:

ManifestDev section
package.json, bower.jsondevDependencies
Cargo.toml[dev-dependencies]
pom.xml<scope>test</scope>
Pipfile[dev-packages]

A dependency declared in both a production section and a dev section counts as production.

go.mod, NuGet projects and requirements.txt have no section that reliably means "dev only", so their dependencies always count as production.

Where the settings are stored​

When no company policy applies, the Detection Rules editor saves to the settings section of .fossid/policy.json in your workspace. The settings are committed with your code and shared with your team:

{
"version": 1,
"policy": [ … ],
"settings": {
"licenses": {
"prohibited_license": true,
"conditional_license": true,
"modified_license_text": true,
"modified_license_threshold": 0.05,
"policy_license_dependency": true,
"policy_license_dependency_include_dev": false
},
"vulnerabilities": {
"cve_in_component": true,
"vuln_snippet": true,
"vulnerable_dependency": true,
"vulnerable_dependency_include_dev": false
}
}
}

In the file, modified_license_threshold is a fraction: 0.05 means 5%.

For each value, FossID uses:

  1. the value in your organization's company policy, if one applies. The repository file is then ignored;
  2. otherwise, the value in .fossid/policy.json, if there is one;
  3. otherwise, the default.

A value that the policy leaves out takes its default, so a file that sets only a few values is fine. VS Code settings don't change the rules. Earlier versions of FossID read fossid.detectionRules.* settings. They have no effect now. See Settings.

Without a company policy, the editor writes all values to .fossid/policy.json when you change a switch. Saving from the License Policies editor does the same.

If no folder is open and no company policy applies, the Detection Rules editor can't save a change. It shows Open a folder to change the detection rules: they are kept in its .fossid/policy.json. Custom volumes can't be changed either. The License Policies editor needs an open folder: without one, it shows no rules and doesn't take edits.