jmespath / jmespath/jmespath.js

Unable to search output of `get-bucket-policy` for AWS CLI

Open
#38 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
847
Forks
101
PR merge metrics
No merged PRs in 30d

Description

Hello, I am trying to parse the output of `get-bucket-policy` on `s3api` which looks like this:

```
{
"Policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"AWSCloudTrailAclCheck20150319\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"cloudtrail.amazonaws.com\"},\"Action\":\"s3:GetBucketAcl\",\"Resource\":\"arn:aws:s3:::anothersillys3bucketwhichcanbedeletedlater\"},{\"Sid\":\"AWSCloudTrailWrite20150319\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"cloudtrail.amazonaws.com\"},\"Action\":\"s3:PutObject\",\"Resource\":\"arn:aws:s3:::anothersillys3bucketwhichcanbedeletedlater/AWSLogs/1234567/*\",\"Condition\":{\"StringEquals\":{\"s3:x-amz-acl\":\"bucket-owner-full-control\"}}}]}"
}
```

Unfortunately, the usual filters won't work. Is there a way to parse this mess of stringified JSON automatically?

I have tried
`Policy.Version` and `Policy.\"Version\"` both of which fail.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.