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

feat: redact store values from logs #1176

Merged
merged 20 commits into from
Sep 27, 2024
Merged

feat: redact store values from logs #1176

merged 20 commits into from
Sep 27, 2024

Conversation

cmwylie19
Copy link
Collaborator

@cmwylie19 cmwylie19 commented Sep 26, 2024

Description

Optionally do not expose store values in logs

End to End Test: defenseunicorns/pepr-excellent-examples#78

[15:54:39.347] DEBUG (19402): Sending updates to Pepr store
    add:/data/hello-pepr-v2-password:**redacted**: {
      "op": "add",
      "path": "/data/hello-pepr-v2-password",
      "value": "**redacted**"
    }
[15:54:39.373] DEBUG (19402): Pepr Store update
    apiVersion: "pepr.dev/v1"
    data: {
      "__pepr_do_not_delete__": "**redacted**",
      "hello-pepr-v2-password": "**redacted**"
    }
    kind: "PeprStore"
    metadata: {
      "creationTimestamp": "2024-09-26T19:54:36Z",
      "generation": 2,
      "managedFields": [
        {
          "apiVersion": "pepr.dev/v1",
          "fieldsType": "FieldsV1",
          "fieldsV1": {
            "f:data": {
              "f:__pepr_do_not_delete__": {}
            }
          },
          "manager": "pepr",
          "operation": "Apply",
          "time": "2024-09-26T19:54:36Z"
        },
        {
          "apiVersion": "pepr.dev/v1",
          "fieldsType": "FieldsV1",
          "fieldsV1": {
            "f:data": {
              "f:hello-pepr-v2-password": {}
            }
          },
          "manager": "kubernetes-fluent-client",
          "operation": "Update",
          "time": "2024-09-26T19:54:39Z"
        }
      ],
      "name": "pepr-static-test-store",
      "namespace": "pepr-system",
      "resourceVersion": "1088",
      "uid": "b51c4a6a-2150-4e0a-8254-55a5687c443d"
    }
[15:54:44.375] INFO (19402): getItem
    password: "***DECLASSIFIED***"
[15:54:44.375] INFO (19402): DONE
[15:54:49.349] DEBUG (19402): Sending updates to Pepr store
    remove:**redacted**: {
      "op": "remove",
      "path": "/data/hello-pepr-v2-password"
    }
[15:54:49.366] DEBUG (19402): Pepr Store update
    apiVersion: "pepr.dev/v1"
    data: {
      "__pepr_do_not_delete__": "**redacted**"
    }
    kind: "PeprStore"
    metadata: {
      "creationTimestamp": "2024-09-26T19:54:36Z",
      "generation": 3,
      "managedFields": [

Related Issue

Fixes #1173

Relates to #

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Other (security config, docs update, etc)

Checklist before merging

Signed-off-by: Case Wylie <cmwylie19@defenseunicorns.com>
Copy link

codecov bot commented Sep 26, 2024

Codecov Report

Attention: Patch coverage is 86.36364% with 3 lines in your changes missing coverage. Please review.

Project coverage is 85.81%. Comparing base (6cd300b) to head (1dd34b8).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/lib/controller/store.ts 86.36% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1176      +/-   ##
==========================================
- Coverage   93.98%   85.81%   -8.18%     
==========================================
  Files          28       29       +1     
  Lines        1281     1431     +150     
  Branches      303      332      +29     
==========================================
+ Hits         1204     1228      +24     
- Misses         71      185     +114     
- Partials        6       18      +12     
Files with missing lines Coverage Δ
src/lib/storage.ts 85.29% <ø> (-0.43%) ⬇️
src/lib/controller/store.ts 17.10% <86.36%> (ø)

Signed-off-by: Case Wylie <cmwylie19@defenseunicorns.com>
@cmwylie19 cmwylie19 added the uds Tracked by UDS project. Adds to UDS Inbox when applied. label Sep 26, 2024
@cmwylie19 cmwylie19 self-assigned this Sep 26, 2024
@cmwylie19 cmwylie19 changed the title chore: no expose store values in logs feat: redact store values from logs Sep 26, 2024
Signed-off-by: Case Wylie <cmwylie19@defenseunicorns.com>
Copy link
Collaborator

@btlghrants btlghrants left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the demo / walkthrough this morning -- and (mostly) renaming the env var -- it looks good; should meet needs while still allowing us easy access to values in the e2es.

Just need to roll-in those two places in the test titles where the rename didn't happen & I'll approve.

src/lib/controller/store.test.ts Outdated Show resolved Hide resolved
src/lib/controller/store.test.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@btlghrants btlghrants left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

n/m -- I was able to commit the suggestions myself after the review completed. Test titles updated & LGTM.

@btlghrants btlghrants merged commit f97935f into main Sep 27, 2024
16 checks passed
@btlghrants btlghrants deleted the 1173 branch September 27, 2024 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
uds Tracked by UDS project. Adds to UDS Inbox when applied.
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Obscure pepr store calls / add a "sensitive" parameter
2 participants