oauth2: add support client secret file in basic/post authentication methods#12118
oauth2: add support client secret file in basic/post authentication methods#12118fernandoalexandre wants to merge 5 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughAdds ChangesOAuth2 secret file support
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant OAuth2Context
participant ClientSecretFile
participant TokenEndpoint
OAuth2Context->>ClientSecretFile: Load secret during context creation
ClientSecretFile-->>OAuth2Context: Return trimmed secret
OAuth2Context->>ClientSecretFile: Reload secret before token refresh
ClientSecretFile-->>OAuth2Context: Return current secret
OAuth2Context->>TokenEndpoint: Send token request with client secret
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0a93197cf
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Add a new oauth2.client_secret_file option so the client secret can be read from a file on disk instead of being provided inline. The file is re-read whenever its modification time changes, so a rotated secret is picked up on the next token refresh without restarting Fluent Bit. When both client_secret and client_secret_file are set, the file takes precedence. A missing or empty file fails cleanly at context creation. Add internal unit tests covering file load with newline trimming, change detection, file-only validation, precedence, and error handling. Signed-off-by: Fernando Alexandre <fernandoalexandre@users.noreply.github.com>
Register the oauth2.client_secret_file property in the plugin config map and relax the basic/post validation to accept client_secret or client_secret_file. Signed-off-by: Fernando Alexandre <fernandoalexandre@users.noreply.github.com>
Relax the basic/post oauth2 validation to accept client_secret or client_secret_file. The option itself is exposed through the shared oauth2 config map. Code comment cleanup for consistency Signed-off-by: Fernando Alexandre <fernandoalexandre@users.noreply.github.com>
…authentication methods Signed-off-by: Fernando Alexandre <fernandoalexandre@users.noreply.github.com>
Signed-off-by: Fernando Alexandre <fernandoalexandre@users.noreply.github.com>
2b91743 to
2e9711c
Compare
Summary
oauth2.client_secret_fileoption to HTTP output (available forbasic/postauthentication methods)oauth2.client_secret_fileoption to OpenTelemetry output as a quick-win.Motivation
In Kubernetes, mounting secrets as files is considered best practice, widely used for projected tokens and external secret services such as CSI drivers and External Secrets Operator.
Additionally other systems offer similar functionality, for example OpenTelemetry OAuth2 client auth extension.
Validation
cmake --build build -j8 --target flb-it-oauth2 && ./build/bin/flb-it-oauth2- 16 passedclient_secret_file, and calling a Gloo service that validated the resulting token as well.Example Configuration
Note
The size limitation for the secret in
oauth2.auth_method=basichas not been modified, so when using large secrets thepostmethod must be used.Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
N/ARun local packaging test showing all targets (including any new ones) build.N/ASetok-package-testlabel to test for all targets (requires maintainer to do).Documentation
client_secret_fileparameter to http and opentelemetry fluent-bit-docs#2629Backporting
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
Summary of changes
oauth2.client_secret_fileto load OAuth2 client secrets from a file (including OAuth2-enabled outputs).client_secretorclient_secret_file.