aws-samples / siem-on-amazon-opensearch-service

A solution for collecting, correlating and visualizing multiple types of logs to help investigate security incidents.
MIT No Attribution
573 stars 189 forks source link

Cloudtrailのログを取り込む際、HIDDEN_DUE_TO_SECURITY_REASONSという文字列で秘匿化処理がかかったフィールドが混じったログの取り込みが失敗する #431

Closed tmat-s closed 9 months ago

tmat-s commented 9 months ago

Summary

cloudtrailには一部の機微な情報を HIDDEN_DUE_TO_SECURITY_REASONS という文字列で置換する機能が存在するが、この処理が適用されたログをes-loaderで取り込もうとした際、型不一致エラーが発生します。

Details

上記機能は下記のような形でマスキング処理を行っている模様。

# BEFORE
{
    "requestParameters" : {
        "overrides" : {
            "containerOverrides" : {
                "environment" : { # object型
                    "key": "value",
                    "key2": "value"
                }
            }
        }
    }
}

# AFTER
{
    "requestParameters" : {
        "overrides" : {
            "containerOverrides" : {
                "environment" : "HIDDEN_DUE_TO_SECURITY_REASONS" # string型になっている
            }
        }
    }
}

OpenSearch側は上記ログの requestParameters.overrides.containerOverrides.environment がobject型であることを期待ていますが、秘匿化処理がされたログはkeyword型となっています。 その結果、 object mapping for [requestParameters.overrides.containerOverrides.environment] tried to parse field [environment] as object, but found a concrete value というエラーが発生し、取り込みが失敗します。

弊社環境では、同様のエラーは requestParameters.* responseElements.* 以下の色々な階層で発生しています。

tmat-s commented 9 months ago

This seems to be the exactly same issue with #430