[8.x](backport #2540) Handle password policy not found error #2542
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.
Summary of your changes
There is a bug on aws (based on After reading aws/aws-cli#7265 and aws/aws-cli#8402 reading), which in case of a user deleting the password policy, an
NoSuchEntityException
will be thrown - while that isn't true because password policies have default values in place.The impact of such a bug to us is that we receive the API error, log the error and doesn't evaluate the policy on OPA layer, missing this finding on such case.
This PR handles the error, and in case of
NoSuchEntityException
, creates an empty password policy, which will then fail on the OPA layer.it's important to notice, tho that an empty password policy doesn't represent reality, because there is a password policy in place, it just isn't returned
Screenshot/Data
Manual Test of the aws bug
Proof that we have a failing finding if the password policy is deleted
Related Issues
Checklist
This is an automatic backport of pull request Handle password policy not found error #2540 done by Mergify.