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

log: redact sensitive data in logs #12673

Open
BugenZhao opened this issue Oct 8, 2023 · 6 comments
Open

log: redact sensitive data in logs #12673

BugenZhao opened this issue Oct 8, 2023 · 6 comments
Assignees
Labels
no-issue-activity type/enhancement Improvements to existing implementation.

Comments

@BugenZhao
Copy link
Member

BugenZhao commented Oct 8, 2023

We log user data in various scenarios. Some logs, such as (slow) query logs, can be enabled or disabled by users. However, there are other logs that will always be recorded without the users' explicit permission.

For example, we always log an error message on parsing or handling failure in pgwire, which contains the original SQL statement from users.

let mut stmts = Parser::parse_sql(sql)
.inspect_err(|e| tracing::error!("failed to parse sql:\n{}:\n{}", sql, e))?;

.inspect_err(|e| tracing::error!("failed to handle sql:\n{}:\n{}", sql, e))?;

It's possible that there are sensitive literals in the SQL statement, or even some secrets for the connector definition.

For potential security policy considerations in the future, we may now carefully review all occurrences and replace them with redacted versions, including but not limited to SQL, and preferably in a type-safe manner. Redaction itself could be simple though: replacing all literals should be enough.

@BugenZhao BugenZhao added the type/enhancement Improvements to existing implementation. label Oct 8, 2023
@github-actions github-actions bot added this to the release-1.3 milestone Oct 8, 2023
@xxchan
Copy link
Member

xxchan commented Oct 8, 2023

found a ref: pingcap/tidb#18566 Seemingly this can only be enforced/fixed one by one.

@BugenZhao
Copy link
Member Author

BugenZhao commented Oct 26, 2023

Some type-safe helpers:

@kwannoel
Copy link
Contributor

As a general example of when to reveal secrets: #13034 (comment).

@fuyufjh
Copy link
Member

fuyufjh commented Dec 6, 2023

I guess we can only do this case by case manually. No way to automatically identify the occurrences. Feel free to open tasks for any cases disconvered.

@zwang28
Copy link
Contributor

zwang28 commented Dec 20, 2023

FYI, crdb's comprehensive and conservative approach to achieve log and error redaction, which provides APIs that "try to minimize the work needed by CockroachDB programmers, but sometimes extra care must be taken".
https://cockroachlabs.atlassian.net/wiki/spaces/CRDB/pages/1824817806/Log+and+error+redactability

"we consider anything unsafe until we have very good reasons not to; everything gets redacted except for those bits which we know are safe." I think this white list approach is too heavy for us at the moment.

Copy link
Contributor

This issue has been open for 60 days with no activity. Could you please update the status? Feel free to continue discussion or close as not planned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-issue-activity type/enhancement Improvements to existing implementation.
Projects
None yet
Development

No branches or pull requests

5 participants