fix: avoid logging plaintext value when encrypt/decrypt fails#13298
Merged
nic-6443 merged 1 commit intoApr 27, 2026
Conversation
There was a problem hiding this comment.
Pull request overview
Prevents sensitive plaintext from being written to error logs when encryption/decryption fails for newly encrypt_fields-marked plugin fields.
Changes:
- Remove logging of raw key material/plaintext values in
apisix/ssl.luaencryption/decryption error paths. - Apply the same log-sanitization in the test helper
t/lib/test_admin.lua. - Add
no_error_logassertions int/node/data_encrypt.tto ensure plaintext does not appear in logs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
apisix/ssl.lua |
Removes plaintext from encryption/decryption failure logs. |
t/lib/test_admin.lua |
Updates test helper logging to avoid printing plaintext on encrypt failure. |
t/node/data_encrypt.t |
Adds assertions intended to ensure plaintext isn’t leaked to error logs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nic-6443
force-pushed
the
fix/encrypt-fields-plaintext-log-leak
branch
from
April 25, 2026 03:18
71d1920 to
f2d8872
Compare
When a plugin field is newly marked as encrypt_fields, pre-existing plaintext configs in etcd will fail to decrypt. The base64 decode and encrypt failure paths in ssl.lua previously logged the original value (e.g. 'key[<plaintext>]'), leaking sensitive data to the error log. Remove the raw value from all error log messages in encrypt() and aes_decrypt_pkey().
nic-6443
force-pushed
the
fix/encrypt-fields-plaintext-log-leak
branch
from
April 25, 2026 03:21
f2d8872 to
89fe41a
Compare
nic-6443
requested review from
AlinsRan,
Baoyuantop,
moonming,
nic-chen and
shreemaan-abhishek
April 25, 2026 03:37
nic-chen
approved these changes
Apr 25, 2026
moonming
approved these changes
Apr 25, 2026
AlinsRan
approved these changes
Apr 27, 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.
When a plugin field is newly marked as
encrypt_fields, pre-existing plaintext configs in etcd will fail to decrypt. The base64 decode and encrypt failure paths inssl.luapreviously logged the original value (e.g.key[<plaintext>]), leaking sensitive data to the error log.This PR removes the raw value from all error log messages in
encrypt()andaes_decrypt_pkey().Changes
apisix/ssl.lua: Removeoriginfrom error logs inencrypt()andaes_decrypt_pkey()t/lib/test_admin.lua: Same fix in the test helper'saes_encrypt()t/node/data_encrypt.t: Addno_error_logassertions to verify plaintext is not loggedFixes #11565