fix(security): encrypt missing secret-like plugin fields at rest#13389
Merged
shreemaan-abhishek merged 2 commits intoJun 2, 2026
Merged
Conversation
The Redis-backed session storage introduced in 3.16.0 added a `session.redis.password` field. Unlike `client_secret`, this field was not included in `encrypt_fields`, so the Redis password was persisted in plaintext in etcd and surfaced through backups, snapshots, and diagnostic exports. Add `session.redis.password` to `encrypt_fields` so it follows the same encryption path that already protects `client_secret` and `client_rsa_private_key`.
APISIX's schema-driven encryption only processes fields explicitly listed in each plugin's `encrypt_fields`. Several credential-bearing fields were never registered, so even with `apisix.data_encryption.enable_encrypt_fields: true` they remained in etcd as plaintext, visible in backups, snapshots, and diagnostic exports. Bring the following fields under `encrypt_fields`: - http-logger.auth_header - openfunction.authorization.service_token - azure-functions.authorization.apikey - azure-functions metadata: master_apikey - splunk-hec-logging.endpoint.token - kafka-logger.brokers[].sasl_config.password - loggly.customer_token - ai-aws-content-moderation.comprehend.secret_access_key - openid-connect.session.secret - error-log-logger metadata: kafka.brokers[].sasl_config.password Add regression tests for the four distinct schema shapes -- top-level string (loggly), nested dotted path (splunk-hec-logging), array of tables (kafka-logger), and plugin_metadata with an array of tables (error-log-logger). Each test round-trips a plaintext value through the Admin API and asserts the value stored in etcd is encrypted.
AlinsRan
approved these changes
Jun 2, 2026
nic-6443
approved these changes
Jun 2, 2026
Baoyuantop
approved these changes
Jun 2, 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
APISIX's schema-driven data encryption only processes fields explicitly listed in each plugin's
encrypt_fields. Several credential-bearing fields were never registered, so even when an operator setsapisix.data_encryption.enable_encrypt_fields: true, those values remain in etcd as plaintext. They also surface in etcd backups, snapshots, and diagnostic exports. This was originally opened foropenid-connect.session.redis.passwordalone, then broadened after the same root cause was found across many plugins.Type of change
Changes
Add the following to the corresponding plugin/metadata
encrypt_fields:http-loggerauth_headeropenfunctionauthorization.service_tokenazure-functionsauthorization.apikeyazure-functions(plugin metadata)master_apikeysplunk-hec-loggingendpoint.tokenkafka-loggerbrokers[].sasl_config.passwordlogglycustomer_tokenai-aws-content-moderationcomprehend.secret_access_keyopenid-connectsession.secretopenid-connectsession.redis.passworderror-log-logger(plugin metadata)kafka.brokers[].sasl_config.passwordFor
openfunctionandazure-functions, which build their schemas via the sharedserverless.generic-upstreamfactory,encrypt_fieldsis assigned on the returnedplugin.schemaafter the factory call (same pattern asaws-lambda.lua).Regression tests cover the four distinct schema shapes that exercise the encryption path:
t/plugin/loggly.tTEST 21 (customer_token)t/plugin/splunk-hec-logging.tTEST 14 (endpoint.token)t/plugin/kafka-logger3.tTEST 2 (brokers[].sasl_config.password)t/plugin/error-log-logger-kafka.tTEST 7 (kafka.brokers[].sasl_config.password)t/plugin/openid-connect2.tcontinues to coversession.redis.password.Each test PUTs a plaintext value through the Admin API, GETs it back (asserts decrypted round-trip), and reads the raw etcd value (asserts the stored value is encrypted, i.e. non-empty and not equal to the plaintext).
Checklist