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

Redact sensitive values in stream_data rpcauth logs #355

Merged
merged 5 commits into from
Oct 17, 2023

Conversation

sfc-gh-elinardi
Copy link
Collaborator

@sfc-gh-elinardi sfc-gh-elinardi commented Oct 16, 2023

#343 doesn't handle proxy anypb messages, so they don't get redacted.

This PR adds anypb log redaction by unmarshaling its content and redact it
Testing

{
    "caller": {
        "file": "rpcauth.go",
        "line": 128
    },
    "input": {
        "environment": null,
        "extensions": null,
        "host": {
            "cert": null,
            "net": {
                "address": "127.0.0.1",
                "network": "tcp",
                "port": "50043"
            },
            "principal": null
        },
        "message": {
            "stream_data": {
                "payload": {
                    "@type": "type.googleapis.com/HTTPOverRPC.HostHTTPRequest",
                    "hostname": "...",
                    "port": ...,
                    "protocol": "http",
                    "request": {
                        "headers": [
                            {
                                "key": "Accept",
                                "values": [
                                    "--REDACTED--"
                                ]
                            },
                            {
                                "key": "User-Agent",
                                "values": [
                                    "--REDACTED--"
                                ]
                            },
                            {
                                "key": "Authorization",
                                "values": [
                                    "--REDACTED--"
                                ]
                            },
                            {
                                "key": "Content-Type",
                                "values": [
                                    "--REDACTED--"
                                ]
                            }
                        ],
                        "method": "POST"
                    }
                },
                "stream_ids": [
                    "6992800144101358512"
                ]
            }
        },
        "method": "/Proxy.Proxy/Proxy",
    },
    "level": 2,
    "logger": "sansshell-proxy",
    "method": "/Proxy.Proxy/Proxy",
    "msg": "evaluating authz policy post hooks",
    "peer": {
        "cert": {
            "dnsnames": [
                "test.example.com"
            ],
            "issuer": "CN=example.com",
            "spiffeid": "",
            "subject": "CN=test.example.com"
        },
        "net": {
            "address": "127.0.0.1",
            "network": "tcp",
            "port": "52917"
        },
        "principal": null
    },
    "ts": "2023-10-16 15:52:41.328650"
}

@sfc-gh-elinardi sfc-gh-elinardi merged commit 3e76142 into main Oct 17, 2023
4 checks passed
@sfc-gh-elinardi sfc-gh-elinardi deleted the elinardi-redact-proxy-stream branch October 17, 2023 18:29
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

Successfully merging this pull request may close these issues.

2 participants