Skip to content

If the user ip address contains an invalid IP address, it will get leaked in the redaction error message #1740

Closed

Description

@TBS1996

If the user IP address contains an invalid IP address as seen here:

"ip_address": "should be stripped despite lacking ip address",

then in the redaction it will contain the entire value:

"val": "should be stripped despite lacking ip address"

If it contained an incorrectly formatted IP address it would get leaked in this redaction.

Activity

  1. jan-auer commented on Jan 23, 2023

    @jan-auer
    Member

    Can you please provide a repro for this case?

  2. jjbayer commented on Jan 30, 2023

    @jjbayer
    Member

    @TBS1996 please add a second repro case with an actual IP address.

  3. TBS1996 commented on Feb 3, 2023

    @TBS1996
    ContributorAuthor
      #[test]
        fn test_ip_stripped() {
            let mut data = Event::from_value(
                serde_json::json!({
                    "user": {
                        "username": "73.133.27.120", // should be stripped despite not being "known ip field"
                        "ip_address": "is this an ip address? 73.133.27.120", //  <--------
                        "data": sensitive_vars()
                    },
                    "breadcrumbs": {
                        "values": [
                            {
                                "message": "73.133.27.120",
                                "data": {
                                    "test_data": "73.133.27.120" // test deep wildcard stripping
                                    }
                            },
                        ],
                    },
                    "sdk": {
                        "client_ip": "should also be stripped"
                    }
                })
                .into(),
            );

    this turns into:

      {
        "user": {
          "ip_address": {
            "": {
              "err": [
                [
                  "invalid_data",
                  {
                    "reason": "expected an ip address"
                  }
                ]
              ],
              "val": "is this an ip address? 73.133.27.120"   //  <--------
            }
          },
          "username": {
            "": {
              "rem": [
                [
                  "@ip:replace",
                  "s",
                  0,
                  4
                ]
              ],
              "len": 13
            }
          }
        }
      }
    

    notice the ip address is leaked in the error message

  4. added this to the Maintenance milestone on Feb 6, 2023
  5. olksdr commented on Feb 13, 2023

    @olksdr
    Contributor

    Ideas:

    • always scrub the val in meta for the scrubbed field
    • do not put the original value in the meta for PII enabled fields (pii = true, pii = maybe)
    • just fix normalization for client_ip field
  6. linked a pull request that will close this issuefeat(general): Fix leaked ip address #1892on Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions