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

feat: display policy's exclude entries #3057

Merged
merged 1 commit into from
Mar 25, 2022

Conversation

danlucian
Copy link
Member

@danlucian danlucian commented Mar 24, 2022

What does this PR do?

  • include the 'exclude' rules on the demunge implementation
  • exclude might contain 2 categories/ids: global and code
  • the entries for exclude.global/code might be simple paths (strings) or objects (including metadata like reason, creation/expiration dates).

The changes on the policy library were done here: snyk/policy#70

Screenshots

Screenshot 2022-03-24 at 18 21 55

@danlucian danlucian requested review from a team as code owners March 24, 2022 16:23
@danlucian danlucian self-assigned this Mar 24, 2022
@danlucian danlucian force-pushed the feat/display-policy-exclude-entries branch 3 times, most recently from d76a676 to 9418699 Compare March 24, 2022 16:45
@danlucian danlucian requested a review from a team as a code owner March 24, 2022 16:45
@danlucian danlucian force-pushed the feat/display-policy-exclude-entries branch 2 times, most recently from cc2685c to 60eed28 Compare March 25, 2022 08:22
src/lib/display-policy.ts Outdated Show resolved Hide resolved
@danlucian danlucian force-pushed the feat/display-policy-exclude-entries branch from 60eed28 to c189dc8 Compare March 25, 2022 10:37
Copy link
Contributor

@aron aron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can approve the change to the IaC fixture here, but wanted to make sure you're aware of the Snyk IaC functionality under the exclude field that was introduced here #3018. It doesn't look from the description like we've tested what the output of this looks like?

These excluded fields are not file paths but cloud resources, so the text may need to be adapted.

@danlucian danlucian force-pushed the feat/display-policy-exclude-entries branch from c189dc8 to c1561b3 Compare March 25, 2022 12:34
@danlucian
Copy link
Member Author

I can approve the change to the IaC fixture here, but wanted to make sure you're aware of the Snyk IaC functionality under the exclude field that was introduced here #3018. It doesn't look from the description like we've tested what the output of this looks like?

These excluded fields are not file paths but cloud resources, so the text may need to be adapted.

In order to support also the iac-drift entries I updated the message that we use for printing out the items to something like Exclude the following <entry_name> items/paths.

Below is an example:

.snyk policy file used as input:

# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
ignore:
exclude:
  global:
    - some/excluded/file/file-to-exclude.cpp:
        reason: False positive
        expires: 2022-04-17T12:57:47.569Z
        created: 2022-03-18T12:57:47.576Z
    - some/excluded/folder:
        reason: None Given
        expires: 2022-04-17T12:57:47.569Z
        created: 2022-03-18T12:57:47.576Z
  code:
    - some/path
    - some/file
  iac-drift:
     - '*'
     - '!aws_iam_*'
     - 'aws_s3_*'
     - 'aws_s3_bucket.*'
     - 'aws_s3_bucket.name*'
version: v1.22.2
patch: {}

the output:
Screenshot 2022-03-25 at 14 36 08

I also updated the tests to include the iac-drift entries.
Thanks a lot, @aron ! 🙏

- include the 'exclude' rules on the demunge implementation
- exclude might contain 2 categories/ids: global and code
- the entries for exclude.global/code might be simple paths (strings) or
objects (including metadata like reason, creation/expiration dates).
@danlucian danlucian force-pushed the feat/display-policy-exclude-entries branch from c1561b3 to dee758c Compare March 25, 2022 13:38
@danlucian danlucian merged commit 4645578 into master Mar 25, 2022
@danlucian danlucian deleted the feat/display-policy-exclude-entries branch March 25, 2022 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants