snyk / policy

Snyk policy parser and matching logic
Other
8 stars 8 forks source link

Load command ignores files with names different from .snyk #129

Open valerio-castelli opened 1 year ago

valerio-castelli commented 1 year ago

Expected behaviour

The test command uses the content of custom-file.yml as policy.

Actual behaviour

The test command ignores the content of custom-file.yml and runs as if no policy file has been supplied.

Steps to reproduce

  1. Create a valid Snyk policy file with a name other than .snyk (like custom-file.yml)
  2. Run snyk test using the --policy-path option to point to the created policy file

This may be related to this line of code in policy.ts, and similar lines in the same file (here, here). The load method is invoked by the CLI here, and the policy-path is passed as an argument via policyLocations.

It seems that the code expects the file to be called .snyk. This contradicts the README, which states:

The policy is loaded, typically this will be a YAML file named .snyk (but can be loaded from another filename).