When I tried to upload policies with panther_analysis_tool
(PAT), the upload failed with the error:
Failed to upload a policy: cannot save an enabled policy with failing unit tests: ...
To resolve this issue, make sure all of the global helper functions included in the upload are up to date.
This issue occurs when a policy uses a global helper function that is out of date. Panther attempts unit tests on uploaded policies, and out-of-date functions cause these tests to fail.
This issue may also occur when using PAT validate
, but not PAT test
. This is because running tests locally uses your local version of the globals, and uploading and validating uses the global helper functions that were passed in with the upload, or the ones in the Panther system if none were included with the upload.