From 82fa45ffd0a7321b9ff02b0328e26f43b4fc9301 Mon Sep 17 00:00:00 2001 From: aryainguz Date: Fri, 23 Oct 2026 20:10:23 +0530 Subject: [PATCH 1/2] fix(api): close the fluentforward receiver when collector auth is enforced --- .changeset/fluentforward-collector-auth.md | 9 +++++++ .../__tests__/opampController.test.ts | 27 +++++++++++++++++++ .../src/opamp/controllers/opampController.ts | 7 ++++- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .changeset/fluentforward-collector-auth.md diff --git a/.changeset/fluentforward-collector-auth.md b/.changeset/fluentforward-collector-auth.md new file mode 100644 index 0000000000..a6f7601dd9 --- /dev/null +++ b/.changeset/fluentforward-collector-auth.md @@ -0,0 +1,9 @@ +--- +'@hyperdx/api': patch +--- + +fix: Stop the collector accepting unauthenticated Fluent Forward logs when +collector authentication is enforced. The `fluentforward` receiver (port 24225) +has no way to check an API key, so it is now left out of the OpAMP config for +teams that enforce collector authentication, which is the default for teams +created at registration. diff --git a/packages/api/src/opamp/controllers/__tests__/opampController.test.ts b/packages/api/src/opamp/controllers/__tests__/opampController.test.ts index b6d274e970..a76a1a7dea 100644 --- a/packages/api/src/opamp/controllers/__tests__/opampController.test.ts +++ b/packages/api/src/opamp/controllers/__tests__/opampController.test.ts @@ -169,6 +169,33 @@ describe('opampController', () => { }); }); + describe('buildOtelCollectorConfig fluentforward receiver', () => { + it('keeps the fluentforward receiver when collector authentication is not enforced', () => { + const cfg = buildOtelCollectorConfig([ + { apiKey: 'k1', collectorAuthenticationEnforced: false }, + ]); + + expect(cfg.receivers.fluentforward).toEqual({ + endpoint: '0.0.0.0:24225', + }); + expect(cfg.service.pipelines['logs/in'].receivers).toContain( + 'fluentforward', + ); + }); + + it('removes the fluentforward receiver when collector authentication is enforced', () => { + const cfg = buildOtelCollectorConfig([ + { apiKey: 'k1', collectorAuthenticationEnforced: true }, + ]); + + // The receiver cannot authenticate, so it must not listen at all. + expect(cfg.receivers.fluentforward).toBeUndefined(); + expect(cfg.service.pipelines['logs/in'].receivers).toEqual([ + 'otlp/hyperdx', + ]); + }); + }); + describe('buildOtelCollectorConfig datadog receiver', () => { it('omits the datadog receiver when the flag is off (default)', () => { configState.ENABLE_DATADOG_RECEIVER = false; diff --git a/packages/api/src/opamp/controllers/opampController.ts b/packages/api/src/opamp/controllers/opampController.ts index 22325ad2bc..6ffba09143 100644 --- a/packages/api/src/opamp/controllers/opampController.ts +++ b/packages/api/src/opamp/controllers/opampController.ts @@ -318,7 +318,6 @@ export const buildOtelCollectorConfig = ( exporters: ['clickhouse'], }, 'logs/in': { - // TODO: fluentforward needs to be authenticated receivers: ['fluentforward'], exporters: ['routing/logs'], }, @@ -381,6 +380,12 @@ export const buildOtelCollectorConfig = ( authenticator: 'bearertokenauth/hyperdx', }; otelCollectorConfig.service.extensions = ['bearertokenauth/hyperdx']; + + // fluentforward has no authenticator option, so while it is listening + // anyone who can reach :24225 can ingest without an API key. + delete otelCollectorConfig.receivers.fluentforward; + const logsIn = otelCollectorConfig.service.pipelines['logs/in']; + logsIn.receivers = logsIn.receivers.filter(r => r !== 'fluentforward'); } } From c87f9e210067fd4478c2a72fb7a9f738db0a74f1 Mon Sep 17 00:00:00 2001 From: aryainguz Date: Fri, 23 Oct 2026 21:14:39 +0530 Subject: [PATCH 2/2] test(api): cover fluentforward with no API keys and with the datadog receiver --- .../__tests__/opampController.test.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/api/src/opamp/controllers/__tests__/opampController.test.ts b/packages/api/src/opamp/controllers/__tests__/opampController.test.ts index a76a1a7dea..9c03cdfd0f 100644 --- a/packages/api/src/opamp/controllers/__tests__/opampController.test.ts +++ b/packages/api/src/opamp/controllers/__tests__/opampController.test.ts @@ -194,6 +194,22 @@ describe('opampController', () => { 'otlp/hyperdx', ]); }); + + it('keeps the fluentforward receiver when enforcement is on but no API keys exist', () => { + const cfg = buildOtelCollectorConfig([ + { apiKey: '', collectorAuthenticationEnforced: true }, + ]); + + // Without keys nothing is authenticated (otlp/hyperdx is not attached + // either), and fluentforward is the only logs/in receiver: removing it + // would leave the pipeline empty, which the collector rejects. + expect(cfg.receivers.fluentforward).toEqual({ + endpoint: '0.0.0.0:24225', + }); + expect(cfg.service.pipelines['logs/in'].receivers).toEqual([ + 'fluentforward', + ]); + }); }); describe('buildOtelCollectorConfig datadog receiver', () => { @@ -271,6 +287,11 @@ describe('opampController', () => { expect(cfg.service.extensions).toContain('bearertokenauth/datadog'); // The otlp/hyperdx auth extension stays intact alongside it. expect(cfg.service.extensions).toContain('bearertokenauth/hyperdx'); + // Only authenticated receivers feed logs/in; fluentforward is gone. + expect(cfg.service.pipelines['logs/in'].receivers).toEqual([ + 'otlp/hyperdx', + 'datadog', + ]); }); }); });