Repository navigation
http_server: allow trace http output to allowlisted endpoints - #12593
paulorangeljr wants to merge 3 commits into
Conversation
Store the comma separated list of host:port[/uri] destinations that the trace API may send records to through the http output. The option is unset by default, which keeps the http output disabled for tracing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LXZsVLVGqPB9nAkpgz8cap Signed-off-by: Paulo Rangel <19419559+paulorangeljr@users.noreply.github.com>
The trace API is unauthenticated, so the http output was removed from the trace allowlist. Accept it again only when the destination host, port and, optionally, uri match an entry of chunk_trace_http_allowed_endpoints. Only parameters that select the endpoint and encode the payload are accepted. Proxy, credentials, file based TLS, AWS and OAuth2 options are rejected, as are values referencing environment variables, since output properties expand them and could leak the environment. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LXZsVLVGqPB9nAkpgz8cap Signed-off-by: Paulo Rangel <19419559+paulorangeljr@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LXZsVLVGqPB9nAkpgz8cap Signed-off-by: Paulo Rangel <19419559+paulorangeljr@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
_Requested by Paulo Junior ·
Before: the trace API (
/api/v1/traceand/api/v1/traces) only accepts thestdoutandcalyptiaoutputs. Requestinghttpreturns403, so traced records can only be read from the Fluent Bit log, which is awkward in Kubernetes and mixes trace output with regular logs.After: operators can opt in to sending trace records to specific HTTP endpoints with a new service option,
chunk_trace_http_allowed_endpoints. A trace request with"output": "http"is accepted only when itshost,portand (optionally)urimatch an entry of that list. With the option unset, which is the default, the http output stays rejected exactly as today.How
host:portor[ipv6]:port, optionally followed by a path. With a path, the requestedurimust be exactly that path; without one, anyurion that host and port is allowed. Hosts are compared case-insensitively and are not resolved. A missingportis treated as80and a missingurias/, matchingout_httpdefaults;hostis required. Malformed entries are skipped with a warning.http:host,port,uri,format,json_date_key,json_date_format,header,compress,tls. Everything else (proxy,http_user/http_passwd,tls.*file options,aws_*,oauth2.*,workers,match...) is rejected with403, since those could redirect records elsewhere or read local files and credentials.${are rejected, because output properties expand environment variables and a request could otherwise exfiltrate the environment to the allowed endpoint.stdout/calyptiachecks run before any input lookup, so the batch endpoint reportsreturncode: 403per input as before.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:
New integration tests in
tests/integration/scenarios/internal_http_server:test_internal_http_server_trace_http_output_allowlist: ten rejected variants (wrong uri, port, host, malformed port, missing host,proxy,tls.ca_file,http_user,${HOME}inheaderanduri) return403on both endpoints and nothing reaches the receiver; the allowed endpoint then receives the traced records.test_internal_http_server_trace_http_output_disabled_by_default: with the option unset,httpis still403and the log names the option to set.Log output for rejected requests:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
A docs PR to fluent/fluent-bit-docs will follow, covering the new service option and the security trade-off (the HTTP server has no authentication, so
http_listen 127.0.0.1remains the recommendation).Backporting
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.
🤖 Generated with Claude Code
Summary by CodeRabbit