fix: redact sensitive data from plugin log output#13123
Merged
Conversation
- jwt-auth-more-algo.t: update error_log patterns from JSON format '"alg":"XXX"' to plain text 'parsed jwt alg: XXX' - wolf-rbac.t: reduce grep_error_log_out expected count from 3 to 2 since res.body log was removed - ext-plugin/sanity.t: remove ' conf: [...]' from regex since conf is no longer logged after token redaction Co-authored-by: Copilot <[email protected]>
- proxy-cache/proxy-mirror: revert over-restrictive log changes; cache key and mirror conf contain no sensitive data (per review comments) - wolf-rbac: remove wolf_token from perm_item to prevent accidental serialization, remove consumers dump, strip request body/headers/ response body from request_to_wolf_server logs, replace consumer object dump with appid-only log in wolf_rbac_login - ai-aliyun-content-moderation: replace str_to_sign debug log (which contained AccessKeyId and user content) with params count only Co-authored-by: Copilot <[email protected]>
The wolf server returns error codes (e.g., ERR_USERNAME_MISSING) in body.reason. Log this non-sensitive field instead of 'ok=false' so that existing grep_error_log test patterns continue to match. Co-authored-by: Copilot <[email protected]>
nic-6443
previously approved these changes
Apr 7, 2026
| local token = fetch_token(unique_key) | ||
| if token then | ||
| core.log.info("fetch token from shared dict, token: ", token) | ||
| core.log.info("fetch token from shared dict, token: [REDACTED]") |
Contributor
There was a problem hiding this comment.
how about this?
Suggested change
| core.log.info("fetch token from shared dict, token: [REDACTED]") | |
| core.log.info("successfully fetched token from shared dict.") |
| if token then | ||
| lock:unlock() | ||
| core.log.info("fetch token from shared dict, token: ", token) | ||
| core.log.info("fetch token from shared dict, token: [REDACTED]") |
| token = pcr:ConfToken() | ||
|
|
||
| core.log.notice("get conf token: ", token, " conf: ", core.json.delay_encode(conf.conf)) | ||
| core.log.notice("get conf token: [REDACTED]") |
Contributor
There was a problem hiding this comment.
ditto
we don't need to mention "REDACTED" as it serves no real purpose, instead removing it entirely makes more sense.
| local function content_moderation(ctx, conf, provider, model, content, length_limit, | ||
| stream, usage, service_name) | ||
| core.log.debug("execute content moderation, content: ", content) | ||
| core.log.debug("execute content moderation") |
Address review feedback: remove [REDACTED] tokens from log output as they serve no real purpose. Replace with clear status messages: - 'successfully fetched token from shared dict.' - 'successfully obtained conf token.' Co-authored-by: Copilot <[email protected]>
shreemaan-abhishek
approved these changes
Apr 7, 2026
nic-6443
approved these changes
Apr 7, 2026
AlinsRan
approved these changes
Apr 7, 2026
wistefan
pushed a commit
to wistefan/apisix
that referenced
this pull request
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
I reviewed all the code and removed any instances where the key might have been printed in the logs.
Which issue(s) this PR fixes:
Fixes #13118
Checklist