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

chore_: ignore sensitive fields of WalletConfig when logging #5677

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

qfrank
Copy link
Contributor

@qfrank qfrank commented Aug 8, 2024

We used env to hide sensitive configuration, but there's a chance to write the sensitive data into log file, this PR fixed it.

@qfrank qfrank self-assigned this Aug 8, 2024
@status-im-auto
Copy link
Member

status-im-auto commented Aug 8, 2024

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ f6c0e39 #1 2024-08-08 08:41:05 ~2 min tests-rpc 📄log
✔️ f6c0e39 #1 2024-08-08 08:42:28 ~3 min linux 📦zip
✔️ f6c0e39 #1 2024-08-08 08:42:57 ~4 min ios 📦zip
✔️ f6c0e39 #1 2024-08-08 08:44:02 ~5 min android 📦aar
✔️ f6c0e39 #1 2024-08-08 09:22:45 ~44 min tests 📄log

Copy link
Collaborator

@igor-sirotin igor-sirotin left a comment

Choose a reason for hiding this comment

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

Good catch! Thank you!

Though I there's a drawback here. Adding a field that should be logged, will require user to keep in mind to add it to Marshal function.

I googled this solution, it looks much cleaner and scalable:

type SensitiveString string {}

func (SensitiveString s) String () string {
    return "****"
}

func (SensitiveString s) Value() string {
    return s
}

I guess we can merge as is and open an issue to fix all places for to use such approach.
cc @osmaczko

@osmaczko
Copy link
Contributor

osmaczko commented Aug 8, 2024

Good catch! Thank you!

Though I there's a drawback here. Adding a field that should be logged, will require user to keep in mind to add it to Marshal function.

I googled this solution, it looks much cleaner and scalable:

type SensitiveString string {}

func (SensitiveString s) String () string {
    return "****"
}

func (SensitiveString s) Value() string {
    return s
}

I guess we can merge as is and open an issue to fix all places for to use such approach. cc @osmaczko

Nice 👍 Although, it is not a silver bullet. It will not work with third-party types, including generated protobufs and ecdsa.PrivateKey, for instance.

@cammellos cammellos merged commit 085d022 into develop Aug 8, 2024
10 checks passed
@cammellos cammellos deleted the fix/prevent_credential_leak_from_log branch August 8, 2024 12:43
@igor-sirotin
Copy link
Collaborator

Nice 👍 Although, it is not a silver bullet. It will not work with third-party types, including generated protobufs and ecdsa.PrivateKey, for instance.

@osmaczko for ecdsa.PrivateKey I once proposed this idea:

Maybe we could also add some String() method that would return it as *** string for private key

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.

5 participants