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

[Bug] TypeError: unhashable type: 'dict' on AWS Config Messages #1300

Open
rsavjani opened this issue Oct 28, 2020 · 2 comments
Open

[Bug] TypeError: unhashable type: 'dict' on AWS Config Messages #1300

rsavjani opened this issue Oct 28, 2020 · 2 comments

Comments

@rsavjani
Copy link

rsavjani commented Oct 28, 2020

Hi all
I seen a previous fixed bug of Classifier throwing a "TypeError: unhashable type: 'dict'" for AWS Security Hub events.
However this fix does not seem to have fixed my issue. I am getting same error but for AWS Config event. Its throwing error on the source field also.
Below is what the event looks like:

{
    "version": "0",
    "id": "xxxxx",
    "detail-type": "Config Configuration Item Change",
    "source": "aws.config",
    "account": "xxxx",
    "time": "2020-10-27T10:49:09Z",
    "region": "xxxx",
    "resources": ["arn:aws:codebuild:xxxx:xxxx:project/xxxxxxxx"],
    "detail": {
        "recordVersion": "1.3",
        "messageType": "ConfigurationItemChangeNotification",
        "configurationItemDiff": {
            "changedProperties": {
                "Configuration.source.0": {
                    "previousValue": {
                        "type": "CODEPIPELINE",
                        "buildSpec": "{\n  \"version\": \"0.2\",\n  \"env\": {\n    \"variables\": {\n      \"SKIP_TESTS\": \"xxxxUE\",\n}"
                    },
                    "changeType": "DELETE"
                },
                "Configuration.source.1": {
                    "updatedValue": {
                        "type": "CODEPIPELINE",
                        "buildSpec": "{\n  \"version\": \"0.2\",\n  \"env\": {\n    \"variables\": {\n      \"SKIP_TESTS\": \"xxxxE\",\n }\n}"
                    },
                    "changeType": "CREATE"
                }
            },
            "changeType": "UPDATE"
        },
        "notificationCreationTime": "2020-10-27T10:49:09.330Z",
        "configurationItem": {
            "relatedEvents": [],
            "relationships": [{
                "resourceName": "codepipeline_xxxxpipeline",
                "resourceType": "AWS::IAM::Role",
                "name": "with "
            }],
            "configuration": {
                "name": "xxxxxxxx",
                "source": [{
                    "type": "CODEPIPELINE",
                    "buildSpec": "{\n  \"version\": \"0.2\",\n  \"env\": {\n    \"variables\": {\n      \"SKIP_TESTS\": \"xxxxUE\",\n \n    ]\n  }\n}"
                }],
                "artifacts": [{
                    "type": "CODEPIPELINE",
                    "name": "xxxx",
                    "packaging": "NONE",
                    "encryptionDisabled": false
                }],
                "serviceRole": "arn:aws:iam::xxxx:role/xxxx",
                "timeoutInMinutes": 60.0,
                "queuedtimeoutInMinutes": 480.0,
                "environment": {
                    "type": "LINUX_CONTAINER",
                    "image": "xxxx",
                    "computeType": "BUILD_GENERAL1_SMALL",
                    "privilegedMode": false,
                    "environmentVariables": [],
                    "imagePullCredentialsType": "SERVICE_ROLE"
                },
                "encryptionKey": "arn:aws:kms:xxxx:xxxx:alias/aws/s3",
                "tags": [],
                "cache": {
                    "type": "NO_CACHE"
                }
            },
            "supplementaryConfiguration": {},
            "tags": {},
            "configurationItemVersion": "1.3",
            "configurationItemCaptureTime": "2020-10-27T10:49:08.580Z",
            "configurationStateId": xx,
            "awsAccountId": "xxxx",
            "configurationItemStatus": "OK",
            "resourceType": "AWS::CodeBuild::Project",
            "resourceId": "xxxx",
            "resourceName": "xxxx",
            "ARN": "arn:aws:codebuild:xxxx:xxxx:project/xxxx",
            "awsRegion": "xxxx",
            "availabilityZone": "x",
            "configurationStateMd5Hash": "",
            "resourceCreationTime": "2020-10-14T15:41:41.380Z"
        }
    }
}

Not tried the work around of removing Source from SourceAddress in the normalizer types file but raising a bug here so we can get this fixed.
This is coming from a Kineses Data Stream if that makes any difference.

Thanks

@chunyong-lin
Copy link
Contributor

This issue is legit. The quick fix is remove source from sourceAddress in normalized_types.json file.

Hi @rsavjani, if you would like to contribute, feel free to submit a PR based on release-4-0-0, but totally optional. I can do the PR when I get a chance.

@chunyong-lin
Copy link
Contributor

chunyong-lin commented Oct 28, 2020

The issue is normalization doesn't handle well when the source field is a list of dictionary. Or maybe we can have better handling in the code. Open to suggestions.

"source": [{
  "type": "CODEPIPELINE",
  "buildSpec": "{\n "version": "0.2",\n "env": {\n "variables": {\n "SKIP_TESTS": "xxxxUE",\n \n ]\n }\n}"
}]

@chunyong-lin chunyong-lin reopened this Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants