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

filepath not always returning same ARN that was provided for filepath #131

Open
tekdj7 opened this issue Jun 13, 2020 · 2 comments
Open

Comments

@tekdj7
Copy link

tekdj7 commented Jun 13, 2020

I have a function where I loop through users, groups, roles, and policies, and run the analyze_policy_string(policy_document, filepath=arn). I pass it the arn of the policy being assessed. In maybe 20% of the policies, the findings returned appear all to be valid, but in some of the findings of a given policy, it will reports some findings with the ARN I passed as filepath, while other findings for same policy, it reports a different ARN for filepath. For now, in my script, I'm doing a check and if filepath returned in finding is not the same as ARN I passed in as filepath, I use the ARN. Please take a look at the code to determine where is filepath being set incorrectly the ARN of a different role/policy for some findings, while actually using the ARN I passed as filepath correctly in other findings.

@tekdj7
Copy link
Author

tekdj7 commented Jun 13, 2020

to test loop through user, group, role, and policies in account, using the analyze_policy_string function. Then run code similar to below, and you should see the inconsistencies, and maybe it helps you find where in the code something is going wrong.

if finding.location.get("filepath") == arn:
    filepath = finding.location.get("filepath")
if not location.get("filepath") == arn:
    print(f"WRONG FILEPATH: {finding.location.get('filepath')}")
    filepath = arn
    print(f"FIXED FILEPATH: {filepath}")

@0xdabbad00
Copy link
Collaborator

Can you provide an example of which finding had an issue and a sample policy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants