Skip to content

scrub secrets when it is split in 2+ writes #4864

Closed as not planned
Closed as not planned

Description

@dolanor

if a secret is written to the log/file in more than 1 writes, it risks not being scrubbed as our logic does work for full values.
It shouldn't be a usual behavior, but it could happen, therefore we need to handle it.

Implementation idea

Concourse implementation for reference: #4518 (comment)

Alternate implementation: better streaming capabilities, might allow some timing attack to discover some part of secrets

Regarding this subject, I was thinking about flushing some data that has no beginning of secrets in it, but if it had, then I would buffer until I can be sure no secrets are being written.

Let's say I have a secret this is secret.
We get Write("that is cool and this")
As this is the beginning of the secret, I could either flush that is cool and and conserve this as the future buffer.

Scenario 1: next one is Write("is secret, so don't leak it").
I get this + is secret, so don't leak it, I replace this is secret by *** and send the whole scrubbed data: ***, so don't leak it.

Scenario 2: we get Write("is creative. Nice work").
The rest of the string doesn't match the secret, so we cancel the buffering for now until another match.

I think it would be nice, and avoid the lack of streaming if there is no secret match.
The only thing I fear, is people abusing the system to discover secrets by executing the pipeline with specific strings and check via timing or other analysis that some secret starts with a specific word.
The risk can be reduced by adding some random reslicing of the flushed data: instead of flushing the whole "that is cool and " and buffering this, we could randomly flush "that is cool a" and buffer nd this, so it doesn't completely break the streaming and we don't completely leak some info about the secret as well.

What do you think about this approach? @vito @aluzzardi @sipsma

Activity

  1. self-assigned this
    on Apr 13, 2023
  2. linked a pull request that will close this issuefeat: secret scrub multi write #4944on Apr 13, 2023
  3. grouville commented on May 30, 2023

    @grouville
    Member

    Currently being addressed by @matiasinsaurralde in #5149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/engine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions