Skip to content

Backport(v1.19): in_http: add <auth> for basic authentication and <security> for client allowlisting - #5503

Merged
Watson1978 merged 1 commit into
v1.19from
backport-3
Sep 28, 2026
Merged

Watson1978 merged 1 commit into
v1.19from
backport-3

Conversation

@Watson1978

@Watson1978 Watson1978 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Which issue(s) this PR fixes:
Fixes #3193

What this PR does / why we need it:

in_http gives operators no way to restrict who may post to it. The only options today are binding to localhost, mTLS via <transport tls>, or fronting fluentd with a reverse proxy. out_http has offered <auth> since long ago, so two fluentd instances still cannot be connected over HTTP without a proxy in between.

<source>
  @type http
  <auth>
    method basic
    username fluentd
    password s3cret
  </auth>
  <security>
    <client>
      network 10.0.0.0/8
    </client>
  </security>
</source>

Docs Changes:
fluent/fluentd-docs-gitbook#700

Release Note:

  • in_http: add <auth> for basic authentication and <security> for client network allowlisting

* Add <security> section to in_http for client network allowlisting

in_http gave operators no way to restrict who may post to it: the only
options were binding to localhost, mTLS via <transport tls>, or putting a
reverse proxy in front of fluentd. in_forward already has <security>, so
mirror it here.

- Add <security> with <client> network, enforced whenever one is given
- Take an address or a CIDR range, IPv4 or IPv6
- Reject unlisted peers in on_server_connect, before reading any byte
- Match the socket peer address, never X-Forwarded-For, which a client sets
- Register a no-op data callback before closing, as the server helper
  requires the connect callback to install one

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>

* Add HTTP basic authentication to in_http

out_http can already send basic credentials through its <auth> section, but
in_http had no way to check them, so two fluentd instances could not be
connected over HTTP without fronting the input with a proxy.

- Add <auth> mirroring out_http: method, username, password
- Reject in on_headers_complete, so the body of a 401 is never buffered
- Compare with OpenSSL.secure_compare and reset the header per request, so
  a keep-alive connection cannot reuse an earlier request's credential
- Drop Authorization from @env so add_http_headers cannot log the credential
- Exempt CORS preflight, which browsers never send Authorization on

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>

* in_http: fix warning message

Co-authored-by: Kentaro Hayashi <hayashi@clear-code.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>

* test_in_http: fix URL

Co-authored-by: Kentaro Hayashi <hayashi@clear-code.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>

* test_in_http: fix URL

Co-authored-by: Kentaro Hayashi <hayashi@clear-code.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>

---------

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Kentaro Hayashi <hayashi@clear-code.com>
@Watson1978
Watson1978 requested a review from kenhys September 28, 2026 02:09
@Watson1978 Watson1978 added this to the v1.19.4 milestone Sep 28, 2026
@Watson1978
Watson1978 merged commit 6bb06d9 into v1.19 Sep 28, 2026
52 of 54 checks passed
@Watson1978
Watson1978 deleted the backport-3 branch September 28, 2026 04:59
kenhys pushed a commit to fluent/fluentd-docs-gitbook that referenced this pull request Sep 29, 2026
fluentd 1.19.4 added two sections to in_http so that it no longer has
to accept requests from anyone (fluent/fluentd#5503). <auth> requires
basic authentication, and <security> limits which client addresses may
connect.

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants