Repository navigation
fix(api): require INGESTION_API_KEY on the app image before any team exists #3760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| '@hyperdx/api': patch | ||
| --- | ||
|
|
||
| fix: require `INGESTION_API_KEY` on the app image before any team exists | ||
|
|
||
| With `ENABLE_INGESTION_API_KEY` set and no team created yet, the collector's OTLP | ||
| receiver accepted data without authentication. It now requires the preset key. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -195,8 +195,13 @@ export const buildOtelCollectorConfig = ( | |
| } | ||
| } | ||
|
|
||
| // Before any team exists, an opted-in INGESTION_API_KEY is the only key, | ||
| // so enforce it rather than open the receiver without auth. | ||
| const collectorAuthenticationEnforced = | ||
| teams[0]?.collectorAuthenticationEnforced; | ||
| teams[0]?.collectorAuthenticationEnforced ?? | ||
| (teams.length === 0 && | ||
| config.ENABLE_INGESTION_API_KEY && | ||
| !!config.INGESTION_API_KEY); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 P2 — With no team, Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond |
||
|
|
||
| const otelCollectorConfig: CollectorConfig = { | ||
| extensions: {}, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 P2 — New no-team test skips the Datadog receiver and never checks that the auth extension is enabled
The fix also changes the Datadog receiver. With
ENABLE_DATADOG_RECEIVERset, thebearertokenauth/datadogblock at opampController.ts:426 reads the samecollectorAuthenticationEnforced, so with no team that receiver now requires the preset key inDD-API-KEY. No test covers this. Separately, the new test checks the tokens and the receiverauthfields but notservice.extensions. If theservice.extensions = ['bearertokenauth/hyperdx']assignment were removed, the collector would reject the config and the test would still pass. Addexpect(cfg.service.extensions).toContain('bearertokenauth/hyperdx'), plus aENABLE_DATADOG_RECEIVER+ no-team case that assertsbearertokenauth/datadoghas tokens['ingest-key'].Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond