Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid false positives in self-generated SBOM #21

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

chmeliik
Copy link
Member

The Syft tests include many package files. Syft reports the packages (used only as unit test data) in the SBOM. Exclude them.

Tested on the redhat-latest branch with

dist/syft . -o cyclonedx-json 2>/dev/null |
jq '.components[].purl | try match("pkg:[^/]*").string catch "<no purl>"' |
sort | uniq -c | sort -n

Before:

  1 "pkg:rpm"
  2 "pkg:ebuild"
  2 "pkg:github"
  2 "pkg:nix"
  2 "pkg:otp"
  4 "pkg:composer"
 10 "pkg:swift"
 13 "pkg:cargo"
 13 "pkg:pub"
 14 "<no purl>"
 20 "pkg:conan"
 28 "pkg:nuget"
 39 "pkg:pypi"
 44 "pkg:hex"
 46 "pkg:cocoapods"
 54 "pkg:generic"
 55 "pkg:hackage"
 57 "pkg:maven"
 57 "pkg:npm"
109 "pkg:gem"
424 "pkg:golang"

After:

408 "pkg:golang"

chmeliik added a commit to chmeliik/build-definitions that referenced this pull request Feb 21, 2024
STONEBLD-2095

Syft makes many things configurable:
https://github.com/anchore/syft#configuration

For example, users can take advantage of this to get rid of false
positives. This will be useful for the Syft build itself:
redhat-appstudio/rh-syft#21

Currently, our SBOM generation does not respect the user configuration.
Syft reads the config from the current working directory, not from the
target directory (anchore/syft#2465).

Set the working directory to the root of the user's repository to ensure
we respect the configuration.

Signed-off-by: Adam Cmiel <[email protected]>
chmeliik added a commit to chmeliik/build-definitions that referenced this pull request Feb 21, 2024
STONEBLD-2095

Syft makes many things configurable:
https://github.com/anchore/syft#configuration

For example, users can take advantage of this to get rid of false
positives. This will be useful for the Syft build itself:
redhat-appstudio/rh-syft#21

Currently, our SBOM generation does not respect the user configuration.
Syft reads the config from the current working directory, not from the
target directory (anchore/syft#2465).

Set the working directory to the root of the user's repository to ensure
we respect the configuration.

Signed-off-by: Adam Cmiel <[email protected]>
chmeliik added a commit to chmeliik/build-definitions that referenced this pull request Feb 21, 2024
STONEBLD-2095

Syft makes many things configurable:
https://github.com/anchore/syft#configuration

For example, users can take advantage of this to get rid of false
positives. This will be useful for the Syft build itself:
redhat-appstudio/rh-syft#21

Currently, our SBOM generation does not respect the user configuration.
Syft reads the config from the current working directory, not from the
target directory (anchore/syft#2465).

Set the working directory to the root of the user's repository to ensure
we respect the configuration.

Signed-off-by: Adam Cmiel <[email protected]>
chmeliik added a commit to chmeliik/build-definitions that referenced this pull request Feb 28, 2024
STONEBLD-2095

Syft makes many things configurable:
https://github.com/anchore/syft#configuration

For example, users can take advantage of this to get rid of false
positives. This will be useful for the Syft build itself:
redhat-appstudio/rh-syft#21

Currently, our SBOM generation does not respect the user configuration.
Syft reads the config from the current working directory, not from the
target directory (anchore/syft#2465).

Set the working directory to the root of the user's repository to ensure
we respect the configuration.

---

This also allows the user to - intentionally or otherwise - exclude
packages that should be reported, causing false negatives. That seems
like an acceptable tradeoff, given that:

* For hermetic builds, the SBOM should still report everything that got
  in from outside, regardless of Syft configuration.
* We should assume some level of co-operation from the user, we don't
  have to design accurate SBOMs for users that actively sabotage the
  proces

Signed-off-by: Adam Cmiel <[email protected]>
chmeliik added a commit to chmeliik/build-definitions that referenced this pull request Mar 1, 2024
STONEBLD-2095

Syft makes many things configurable:
https://github.com/anchore/syft#configuration

For example, users can take advantage of this to get rid of false
positives. This will be useful for the Syft build itself:
redhat-appstudio/rh-syft#21

Currently, our SBOM generation does not respect the user configuration.
Syft reads the config from the current working directory, not from the
target directory (anchore/syft#2465).

Set the working directory to the root of the user's repository to ensure
we respect the configuration.

---

This also allows the user to - intentionally or otherwise - exclude
packages that should be reported, causing false negatives. That seems
like an acceptable tradeoff, given that:

* For hermetic builds, the SBOM should still report everything that got
  in from outside, regardless of Syft configuration.
* We should assume some level of co-operation from the user, we don't
  have to design accurate SBOMs for users that actively sabotage the
  proces

Signed-off-by: Adam Cmiel <[email protected]>
chmeliik added a commit to chmeliik/build-definitions that referenced this pull request Mar 1, 2024
STONEBLD-2095

Syft makes many things configurable:
https://github.com/anchore/syft#configuration

For example, users can take advantage of this to get rid of false
positives. This will be useful for the Syft build itself:
redhat-appstudio/rh-syft#21

Currently, our SBOM generation does not respect the user configuration.
Syft reads the config from the current working directory, not from the
target directory (anchore/syft#2465).

Set the working directory to the root of the user's repository to ensure
we respect the configuration.

---

This also allows the user to - intentionally or otherwise - exclude
packages that should be reported, causing false negatives. That seems
like an acceptable tradeoff, given that:

* For hermetic builds, the SBOM should still report everything that got
  in from outside, regardless of Syft configuration.
* We should assume some level of co-operation from the user, we don't
  have to design accurate SBOMs for users that actively sabotage the
  proces

Signed-off-by: Adam Cmiel <[email protected]>
chmeliik added a commit to chmeliik/build-definitions that referenced this pull request Mar 4, 2024
STONEBLD-2095

Syft makes many things configurable:
https://github.com/anchore/syft#configuration

For example, users can take advantage of this to get rid of false
positives. This will be useful for the Syft build itself:
redhat-appstudio/rh-syft#21

Currently, our SBOM generation does not respect the user configuration.
Syft reads the config from the current working directory, not from the
target directory (anchore/syft#2465).

Set the working directory to the root of the user's repository to ensure
we respect the configuration.

---

This also allows the user to - intentionally or otherwise - exclude
packages that should be reported, causing false negatives. That seems
like an acceptable tradeoff, given that:

* For hermetic builds, the SBOM should still report everything that got
  in from outside, regardless of Syft configuration.
* We should assume some level of co-operation from the user, we don't
  have to design accurate SBOMs for users that actively sabotage the
  proces

Signed-off-by: Adam Cmiel <[email protected]>
chmeliik added a commit to chmeliik/build-definitions that referenced this pull request Mar 5, 2024
STONEBLD-2095

Syft makes many things configurable:
https://github.com/anchore/syft#configuration

For example, users can take advantage of this to get rid of false
positives. This will be useful for the Syft build itself:
redhat-appstudio/rh-syft#21

Currently, our SBOM generation does not respect the user configuration.
Syft reads the config from the current working directory, not from the
target directory (anchore/syft#2465).

Set the working directory to the root of the user's repository to ensure
we respect the configuration.

---

This also allows the user to - intentionally or otherwise - exclude
packages that should be reported, causing false negatives. That seems
like an acceptable tradeoff, given that:

* For hermetic builds, the SBOM should still report everything that got
  in from outside, regardless of Syft configuration.
* We should assume some level of co-operation from the user, we don't
  have to design accurate SBOMs for users that actively sabotage the
  proces

Signed-off-by: Adam Cmiel <[email protected]>
chmeliik added a commit to chmeliik/build-definitions that referenced this pull request Mar 5, 2024
STONEBLD-2095

Syft makes many things configurable:
https://github.com/anchore/syft#configuration

For example, users can take advantage of this to get rid of false
positives. This will be useful for the Syft build itself:
redhat-appstudio/rh-syft#21

Currently, our SBOM generation does not respect the user configuration.
Syft reads the config from the current working directory, not from the
target directory (anchore/syft#2465).

Set the working directory to the root of the user's repository to ensure
we respect the configuration.

---

This also allows the user to - intentionally or otherwise - exclude
packages that should be reported, causing false negatives. That seems
like an acceptable tradeoff, given that:

* For hermetic builds, the SBOM should still report everything that got
  in from outside, regardless of Syft configuration.
* We should assume some level of co-operation from the user, we don't
  have to design accurate SBOMs for users that actively sabotage the
  proces

Signed-off-by: Adam Cmiel <[email protected]>
chmeliik added a commit to chmeliik/build-definitions that referenced this pull request Mar 6, 2024
STONEBLD-2095

Syft makes many things configurable:
https://github.com/anchore/syft#configuration

For example, users can take advantage of this to get rid of false
positives. This will be useful for the Syft build itself:
redhat-appstudio/rh-syft#21

Currently, our SBOM generation does not respect the user configuration.
Syft reads the config from the current working directory, not from the
target directory (anchore/syft#2465).

Set the working directory to the root of the user's repository to ensure
we respect the configuration.

---

This also allows the user to - intentionally or otherwise - exclude
packages that should be reported, causing false negatives. That seems
like an acceptable tradeoff, given that:

* For hermetic builds, the SBOM should still report everything that got
  in from outside, regardless of Syft configuration.
* We should assume some level of co-operation from the user, we don't
  have to design accurate SBOMs for users that actively sabotage the
  proces

Signed-off-by: Adam Cmiel <[email protected]>
chmeliik added a commit to chmeliik/build-definitions that referenced this pull request Mar 7, 2024
STONEBLD-2095

Syft makes many things configurable:
https://github.com/anchore/syft#configuration

For example, users can take advantage of this to get rid of false
positives. This will be useful for the Syft build itself:
redhat-appstudio/rh-syft#21

Currently, our SBOM generation does not respect the user configuration.
Syft reads the config from the current working directory, not from the
target directory (anchore/syft#2465).

Set the working directory to the root of the user's repository to ensure
we respect the configuration.

---

This also allows the user to - intentionally or otherwise - exclude
packages that should be reported, causing false negatives. That seems
like an acceptable tradeoff, given that:

* For hermetic builds, the SBOM should still report everything that got
  in from outside, regardless of Syft configuration.
* We should assume some level of co-operation from the user, we don't
  have to design accurate SBOMs for users that actively sabotage the
  proces

Signed-off-by: Adam Cmiel <[email protected]>
The Syft tests include many package files. Syft reports the packages
(used only as unit test data) in the SBOM. Exclude them.

Tested on the redhat-latest branch with

    dist/syft . -o cyclonedx-json 2>/dev/null |
    jq '.components[].purl | try match("pkg:[^/]*").string catch "<no purl>"' |
    sort | uniq -c | sort -n

Before:

      1 "pkg:rpm"
      2 "pkg:ebuild"
      2 "pkg:github"
      2 "pkg:nix"
      2 "pkg:otp"
      4 "pkg:composer"
     10 "pkg:swift"
     13 "pkg:cargo"
     13 "pkg:pub"
     14 "<no purl>"
     20 "pkg:conan"
     28 "pkg:nuget"
     39 "pkg:pypi"
     44 "pkg:hex"
     46 "pkg:cocoapods"
     54 "pkg:generic"
     55 "pkg:hackage"
     57 "pkg:maven"
     57 "pkg:npm"
    109 "pkg:gem"
    424 "pkg:golang"

After:

    408 "pkg:golang"

Signed-off-by: Adam Cmiel <[email protected]>
@chmeliik chmeliik force-pushed the midstream/no-false-positives branch from bb9a202 to b5c69f1 Compare March 13, 2024 13:32
@chmeliik chmeliik marked this pull request as ready for review March 13, 2024 13:34
@chmeliik chmeliik merged commit 9839dfe into main Mar 14, 2024
1 check passed
@chmeliik chmeliik deleted the midstream/no-false-positives branch March 14, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant