out_http: Added support for http_bearer_token_file option - #12165
out_http: Added support for http_bearer_token_file option#12165fernandoalexandre wants to merge 2 commits into
http_bearer_token_file option#12165Conversation
📝 WalkthroughWalkthroughAdds file-backed Bearer authentication to ChangesOut_http bearer authentication
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant http_request
participant http_bearer_token_file_auth
participant TokenFile
participant HTTPClient
http_request->>http_bearer_token_file_auth: load bearer token
http_bearer_token_file_auth->>TokenFile: read and trim token
http_bearer_token_file_auth->>HTTPClient: set Authorization header
http_request->>HTTPClient: send request
Possibly related PRs
Suggested reviewers: 🚥 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/integration/scenarios/out_http/tests/test_out_http_001.py`:
- Around line 249-253: Wrap the service lifecycle in the test around
service.start(), configure_http_response(), and wait_for_requests() with a
try/finally block, and move service.stop() into finally so it always executes on
assertion or timeout failures. Match the cleanup structure used by the rotation
and failure-path tests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 74f2aeae-ddb2-4718-91ed-a780af8155c0
📒 Files selected for processing (6)
plugins/out_http/http.cplugins/out_http/http.hplugins/out_http/http_conf.ctests/integration/scenarios/out_http/config/out_http_bearer_token_file.yamltests/integration/scenarios/out_http/tests/test_out_http_001.pytests/runtime/out_http.c
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d843d89f8
ℹ️ 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".
… allows a bearer token to be used in an Authorization header Signed-off-by: Fernando Alexandre <fernandoalexandre@users.noreply.github.com>
4d843d8 to
9e4d503
Compare
…teardown. Added a guard when the `Authorization` header fails to be set. Fixed integration test to ensure the service properly stops on failure. Signed-off-by: Fernando Alexandre <fernandoalexandre@users.noreply.github.com>
Summary
http_bearer_token_fileoption that allows a bearer token to be used in an Authorization header (Authorization: Bearer <token>)Motivation
In Kubernetes, mounting secrets as files is considered best practice, with 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 Bearer token extension.
Validation
cmake --build build -j8 && cd tests/integration/ && ./run_tests.py -k bearer_token_token- 4 passedcmake --build build -j8 && cd tests/integration/ && ./run_tests.py -k out_http- 24 passedExample Configuration
Infrastructure deployment
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
http_bearer_token_fileoption to http fluent-bit-docs#2633Backporting
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 by CodeRabbit