Failure trying to iterate over policy code (Mock data)

Error message: only a list or map can be indexed, got string
I was able to fix the error with (json_holder.Statement[0][“Resource”][0]) but this fails when objects in the list are rearranged.
aws-iam-restrict-full-access.txt (1.6 KB)
mock-fail.txt (44.1 KB)

@okcnduka it’s hard to provide useful feedback without seeing the contents of the reusable modules that you have included in the policy. You might have more success in getting a response if you share your policy example (including the modules as mocks) via the Sentinel Playground.

In the meantime, I am sharing an example that may help you clean up the logic in your policy.

1 Like

Hello @hcrhall,
I have been able to resolve the issue with the example you shared.
I only tweaked it a little.
Thank you.