Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Logging of Secret data#1983

shawkins started this conversation inGeneral
Jul 27, 2023· 4 comments· 10 replies
Discussion options

When the operator is creating a secret it will log at a debug level something like:

2023-07-27 18:31:50,503 DEBUG [io.jav.ope.pro.dep.AbstractDependentResource] (pool-18-thread-1) Creating dependent Secret(apiVersion=v1, data={username=YWRtaW4=, password=OWI0NDliZjM5MTI1NGNlMzg3OWFkNDBkOGYzM2E5MjE=}, immutable=null, kind=Secret, metadata=ObjectMeta(annotations={}, creationTimestamp=null, deletionGracePeriodSeconds=null, deletionTimestamp=null, ...

Should the data / stringData be redacted?

cc@vmuzikar

You must be logged in to vote

Replies: 4 comments 10 replies

Comment options

Definitely. Seems almost like a weakness in JOSDK, IMHO secrets should never be leaked in a log.

You must be logged in to vote
0 replies
Comment options

Yep, not on debug level, will issue a fix.

You must be logged in to vote
7 replies
@vmuzikar
Comment options

Hmmmm, isn't leaking credentials at any log level considered an antipattern? ;)

@csviri
Comment options

Well, depends, don't have strong opinion on this, historically framework logs for example requests/response pairs (in terms of WS) on trace level. While doing this generally, req/resp might contain any sensitive data. To my knowledge the approach to log such sensitive data on trace level is quite widely accepted. It's true that secret is not just any object but specifically there to hold sensitive data. Not sure if we should make an exception for that. But don't have strong opinion :) fine to have not logging the resource, just this is very handy sometimes.

@vmuzikar
Comment options

As far as I can tell, it's a good practice any data that's explicitly considered as credentials to be redacted in logs (AFAIK e.g. Jenkins does it). Unless explicitly printed on purpose (initial admin e.g.).

@csviri
Comment options

Jenkins replaces the credetial occurences in all logs (with some mask), this makes sense since it is hard to prevent logging the credential into the logs in first place (given the nature how these build scripts work on Jenkins). What I'm saying that for dev purposes logging k8s objects is handy on these cases, and trace level logging should never be turned on in production.
But I see the point, that since k8s gives this object this explicit semantics is not nice to have it logged anyway. I'm kinda also leaning toward the approach that credentials should not be there, especially in this case when we can nicely identify the case, so the solution is bulletproof.

@csviri
Comment options

removed the log, just the simplified without the actual data will be logged on debug level

Comment options

shawkins
Aug 7, 2023
Collaborator Author

@csviri SSABasedGenericKubernetesResourceMatcher has the same issue:

and it looks like a couple of trace logs as well.

You must be logged in to vote
3 replies
@csviri
Comment options

ahh, ok but it is really needed there, can't we agree that we will log those on trace levels?

@csviri
Comment options

#2002

@csviri
Comment options

maybe something like this as alternative:#2003

Comment options

More generally speaking, maybe we should consider reworking the logging in JOSDK for v5 to align better with observability requirements?

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
General
Labels
None yet
4 participants
@shawkins@metacosm@csviri@vmuzikar

[8]ページ先頭

©2009-2025 Movatter.jp