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

Fixes #25555: #5903

Merged
merged 1 commit into from
Sep 27, 2024
Merged

Fixes #25555: #5903

merged 1 commit into from
Sep 27, 2024

Conversation

amousset
Copy link
Member

@amousset amousset commented Sep 26, 2024

https://issues.rudder.io/issues/25555

The problem was that the log message used the raw token and not the typed ApiToken (which has a custom toString). But it is useful to be able to identify an unknown token, and we can afford to lose a bit of randomness.

@amousset amousset requested a review from fanf September 26, 2024 19:26
@amousset
Copy link
Member Author

PR updated with a new commit

// Show the first 4 chars: enough to disambiguate, and preserves 166 bits of randomness.
def exposeSecretBeginning: String = {
val acceptableToReveal = 4
value.take(acceptableToReveal) + '*'.toString() * (value.size - acceptableToReveal)
Copy link
Member

Choose a reason for hiding this comment

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

You don't actually need to use the real length of * here, it might be already a valuable information. A fixed 6 * or whatever would be better.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I wondered about it. As it is a Rudder token is should always be 32 chars long, and I wanted to avoid provided "false information" about the length that would hamper debugging. I'll try to find a suitable format.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated with a bit different solution

@amousset
Copy link
Member Author

PR updated with a new commit

@fanf
Copy link
Member

fanf commented Sep 27, 2024

OK, squash merging this PR

@fanf fanf merged commit f6e8644 into Normation:branches/rudder/8.1 Sep 27, 2024
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