out_azure_kusto: stop logging federated and access tokens - #12224
Open
tanmaya-panda1 wants to merge 1 commit into
Open
out_azure_kusto: stop logging federated and access tokens#12224tanmaya-panda1 wants to merge 1 commit into
tanmaya-panda1 wants to merge 1 commit into
Conversation
The workload identity auth path logged the raw federated token at info level right after reading it from the projected token file, so a valid Entra ID client assertion was written to the log on every token exchange. The token exchange debug log leaked the same assertion through the request body, and the MSI debug log leaked the issued access token through the response payload. Log only the token file path and the body/payload sizes, so the auth flow stays debuggable without writing credentials to the log. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1176b3da-527b-494b-8ef3-7f29904ad29e Signed-off-by: Tanmaya Panda <tanmayapanda@microsoft.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAzure authentication debug logs no longer expose token or token-exchange payload contents. The logs now report payload sizes and, for federated tokens, the source path. ChangesAzure authentication logging
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
3 tasks
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.
Problem
plugins/out_azure_kusto/azure_msiauth.cwrites Azure credentials into theFluent Bit log in three places.
1. The federated token is logged at
infolevel — i.e. with the defaultlog level, no debug required:
federated_tokenis the projected service account token read from/var/run/secrets/azure/tokens/azure-identity-token. It is a live Entra IDclient assertion that can be exchanged for an access token for the Kusto
ingestion identity. On a Kubernetes deployment using Azure Workload Identity,
this JWT is emitted on every token refresh and ends up wherever the pod logs are
shipped.
2. The token exchange request body is logged, which embeds the same
assertion via
client_assertion=:3. The managed identity token response payload is logged, which contains the
issued
access_token:Fix
Log the token file path and the body/payload sizes instead of the contents, so
the auth flow stays debuggable without writing credentials to the log. The
federated token log is also demoted from
infotodebug, matching thesurrounding auth logging.
The non-200 branches are deliberately left untouched: those payloads carry the
Entra ID / IMDS error description, which is what you actually need when auth
fails, and contain no credential.
Before / after
Before, at default
log_level info:After:
Scope
plugins/out_azure_kusto/azure_msiauth.cCompatibility
Fully backward compatible. Nothing parses these debug lines; only their text
changes. Users who were relying on the payload dump for troubleshooting still
get status codes, sizes and the full error payload on failures.
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
See the before/after section above. Build and focused runtime test:
[N/A] Attached Valgrind output that shows no leaks or memory corruption was found
Valgrind is unavailable on the macOS arm64 host used here. The change only
removes format arguments from existing
flb_debug()/flb_info()calls andallocates nothing, so it cannot affect memory behavior.
[N/A] Run local packaging test showing all targets (including any new ones) build.
[N/A] Set
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Backport to latest stable release.
This is a credential-disclosure fix and applies to every release line that
ships
out_azure_kustowith managed identity / workload identity auth. Happyto open backport PRs for the active branches if maintainers want them.
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I
understand that this code will be released under the terms of that license.
Summary by CodeRabbit