ci: fix Security Checks by adding .safety-policy.yml#3375
Merged
Conversation
safety 3.x CLI auto-looks for a .safety-policy.yml in cwd even when ignores are passed inline. Without the file, `safety check` errors with "Invalid value for '--policy-file': Policy file YAML is not valid / No such file or directory: '.safety-policy.yml'". Add an empty policy file and pass --policy-file explicitly to keep CI runs deterministic. The existing 39642 / 39659 ignores stay on the CLI so they remain visible in workflow output. This unblocks the Security Checks workflow on master.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Security Checks is failing on master (run 26038577932) with 'Invalid value for --policy-file: Policy file YAML is not valid / No such file or directory: .safety-policy.yml'.
The safety 3.x CLI auto-looks for a .safety-policy.yml in cwd even when --ignore is passed inline. Without the file, safety check errors out before running. This affects every Python minor on the matrix.
Fix: Add an empty .safety-policy.yml at repo root to satisfy the auto-lookup, and pass --policy-file explicitly in [testenv:safety]. The existing 39642 / 39659 ignores stay on the CLI so they remain visible in workflow output.
Test: Local 'python3 -m tox -e safety' no longer errors at the policy-file check (it gets past that step and then fails on a downstream network call, which works on GHA runners).
Followup (separate PR): 'safety check' is deprecated as of 2024-06 in favor of 'safety scan'.