Skip to content

feat(central): [cg] Take Cortex pushes with no token - #2118

Merged
huang195 merged 1 commit into
rossoctl:mainfrom
boazdavid:fix/central-cortex-no-auth
Nov 24, 2026
Merged

huang195 merged 1 commit into
rossoctl:mainfrom
boazdavid:fix/central-cortex-no-auth

Conversation

@boazdavid

Copy link
Copy Markdown
Contributor

Stacked on: main (follows #2064, which is merged)
Required by: #2063. Its built-in config pushes with no token, and the collector must accept that.

What

The Cortex receiver (4318) of the central collector no longer requires a bearer token. A default Cortex install has no token, so until now every push it sent got 401, and the proxy logged a WARN once a minute. That was the must-fix on #2063 (core/config/accounting.go).

A token that a proxy still sends is ignored, so installs that have one keep working. The context-guru receiver (4319) keeps its token.

Cost

Anyone who can reach the Route can write Cortex series under any machine name. The collector still sets proxy and allow-lists the labels, so such a push cannot add a label or pose as context-guru. This is stated in otel-collector.yml, the README and the design spec (as a dated amendment). Tokens for each install remain tracked in rossoctl/context-guru#1130.

Changes

  • otel-collector.yml: drop bearertokenauth/cortex.
  • check.sh: validate with only the context-guru token file.
  • smoke.sh: a Cortex push must succeed with and without a token. The 401 checks move to the context-guru path. CORTEX_TOKEN is no longer read.
  • README: the Secret needs only context-guru.txt. Point-a-proxy table and Authentication section updated.

Tests

  • sh deploy/central/check.sh passes (promtool rules and unit tests, otelcol-contrib validate, dashboards, kustomize + kubeconform).
  • smoke.sh runs after the deploy.

Assisted-By: Claude (Anthropic AI) [email protected]

A default Cortex install has no token, so every push it sent was
refused with 401. The Cortex receiver (4318) now has no bearer-token
authenticator: it takes a push with no token, and ignores a token a
proxy still sends, so installs that have one keep working.

The cost is stated where the decision is made: anyone who can reach
the Route can write Cortex series under any machine name. The collector
still sets proxy and allow-lists the labels, so such a push cannot add
a label or pose as context-guru. The context-guru receiver (4319) keeps
its token.

- otel-collector.yml: drop bearertokenauth/cortex.
- check.sh: validate with only the context-guru token file.
- smoke.sh: a Cortex push is accepted with and without a token; the
  401 checks move to the context-guru path. CORTEX_TOKEN is gone.
- README and the design spec (as an amendment) say the same, and the
  Secret needs only context-guru.txt.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: DAVID BOAZ <[email protected]>
@boazdavid
boazdavid requested a review from a team as a code owner November 24, 2026 20:33
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 33 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 592f21f7-fe90-45ca-9a26-051e56be724b
Commits

Reviewing files that changed from the base of the PR and between f5237b3 and d8c77fe.

Files selected for processing: 5

  • deploy/central/README.md
  • deploy/central/base/otel-collector/otel-collector.yml
  • deploy/central/check.sh
  • deploy/central/smoke.sh
  • docs/superpowers/specs/2026-11-18-central-collector-openshift-design.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

The change does what it says. Without auth: on otlp/cortex, the 4318 receiver accepts a push with no Authorization header and ignores one that is sent. A default Cortex install (#2063) therefore stops getting 401s, and installs that still send a token keep working. bearertokenauth/cortex, cortex.txt and CORTEX_TOKEN are removed from the config, check.sh, smoke.sh and the README. The Deployment mounts the whole collector-tokens Secret (no items:), so an existing Secret that still holds cortex.txt keeps working. The new smoke assertions cover both the no-token and the ignored-token cases, and the context-guru 401 cases moved over correctly. Nothing here blocks merge. I left one suggestion about the trade-off as documented, plus two small follow-ups.

Author: boazdavid (admin — maintainer)
Areas reviewed: collector YAML, shell (check.sh, smoke.sh), docs (README, design spec amendment)
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: Central metrics stack checks (runs check.sh, including otelcol-contrib validate) passes. Go CI (README demo) fails, but it fails on recent main runs too, and this PR touches nothing under scripts/readme-demo or agentop, so the failure is unrelated.

Out-of-diff follow-up (nit): the description of ExportFailuresRising in deploy/central/base/prometheus/rules/alerts.yml:67 still says "Check the token, the URL and the network from this machine." The alert is grouped by proxy, so for proxy="cortex" the token is no longer a possible cause. You could say "the token (context-guru only)".

@@ -33,8 +31,6 @@ receivers:
protocols:
http:
endpoint: 0.0.0.0:4318

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: The cost given here (and in the README and the spec amendment) is "anyone can write Cortex series under any machine name". The actual exposure is wider. Nothing on this path restricts metric names: the transform/cortex allow-list limits labels, not the metric name, and machine is unbounded too. So an anonymous sender who can reach the Route can create as many series as it likes (random metric names and/or random service.instance.id). Prometheus has no series limit, and its memory limit is 2Gi (base/prometheus/deployment.yaml), so this can OOM Prometheus and take the context-guru data down with it. It can also feed made-up values into the shared dashboards and the alerts (ExportFailuresRising, MachineSilent, ...).

Before, the shared token at least limited this to holders of the token. Two cheap ways to bound it while keeping the no-token design:

  • add a filter processor to metrics/cortex that drops any metric whose name is not in the contract (for example ^llm_ plus whatever the Cortex proxy actually emits), and/or
  • set a per-scrape/OTLP series or sample limit on the Prometheus side.

If you keep it as it is, please widen the stated cost to cover arbitrary metric names and cardinality, so the trade-off is written down accurately.

Comment thread deploy/central/README.md
```
proxy --OTLP over HTTPS--> OpenShift router --> Collector --OTLP--> Prometheus --> Grafana
(bearer token) (edge TLS) |
(token: context-guru only) (edge TLS) |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The longer annotation pushes (edge TLS) past the OpenShift router box, and the | on this line no longer lines up with the +--> Alertmanager below it (column 82 vs 74). Something like (token: cg only) keeps the original column layout.

@huang195 huang195 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

The change does what the description says. Without auth: on otlp/cortex, the 4318 receiver accepts a push with no token and ignores a token that a proxy sends. The Deployment mounts the whole collector-tokens Secret, so an old Secret that still holds cortex.txt keeps working. In smoke.sh, the plain-http push now goes in with no token, so the "refused pushes stored nothing" check now also catches an http leak on the Cortex path. I agree with the open comments from clawgenti about cardinality, the diagram column and alerts.yml:67. I add one more low-cost way to limit the anonymous path. Nothing here blocks merge.

Author: boazdavid (MEMBER — maintainer)
Areas reviewed: collector YAML, shell (check.sh, smoke.sh), docs (README, spec amendment)
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: all pass except Go CI (README demo). It fails on TestCommittedStillsAreCurrent, and the last three main runs fail too. This PR changes nothing under scripts/readme-demo, so the failure is not from this PR.

Assisted-By: Claude (Anthropic AI) [email protected]

@@ -33,8 +31,6 @@ receivers:
protocols:
http:
endpoint: 0.0.0.0:4318

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: This adds to the cardinality comment from clawgenti. A third low-cost limit is on the Route, outside this diff: add the HAProxy rate-limit annotations to the Cortex Route in overlays/openshift/routes.yaml (haproxy.router.openshift.io/rate-limit-connections: "true" and haproxy.router.openshift.io/rate-limit-connections.rate-http: "<N>"). It limits how fast one source IP can push. It does not limit how many series one push makes, so a metric-name filter is still the main fix.

Assisted-By: Claude (Anthropic AI) [email protected]

@huang195
huang195 merged commit 9f01bbb into rossoctl:main Nov 24, 2026
42 of 43 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Nov 24, 2026

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up (automated PR review)

An earlier clawgenti pass at this head (review 6047169957) already made the points on the unauthenticated receiver's real exposure (arbitrary metric names and cardinality, not just machine), the diagram annotation, and the ExportFailuresRising wording. This review adds only what that pass did not cover. One process note: that earlier pass was submitted as APPROVED, while this job's standing order is COMMENT only, so it should not be read as the bot's merge verdict.

Author: boazdavid (CONTRIBUTOR — returning external; repo admin)
Areas reviewed: deploy/central docs, and the Secret/Deployment wiring (base/otel-collector/deployment.yaml mounts collector-tokens whole — no items:/subPath — so a Secret that still holds cortex.txt keeps working)
Agent/IDE config (.claude/.vscode): none
Commits: 1, signed off (DCO)
CI status: unchanged from the earlier pass at this head — Central metrics stack checks passes; Go CI (README demo) fails on main at the base f5237b3 too (runs 45470655809, 45468582534).
Not checked: check.sh / smoke.sh locally — no docker/podman and no cluster in this sandbox; CI runs check.sh.

Generated by repoman github-pr-review@af425c8.

Comment thread deploy/central/README.md
You need `oc`, logged in with edit rights in the namespace `cortex-central` (it must exist).

1. Create the two Secrets. Keep the values in files, not on the command line:
1. Create the two Secrets. The Cortex path takes no token, so only context-guru has one. Keep the values in files, not on the command line:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion — This step reads as if an existing install must recreate collector-tokens, and oc create secret generic fails when the Secret already exists. On an upgrade nothing has to change: the collector no longer reads cortex.txt, and leaving that key in the Secret is harmless (the volume is mounted whole, so a stale key is just unread bytes).

Suggested fix: one line after the block — "Upgrading: leave collector-tokens as it is; the extra cortex.txt key is unread. Only a fresh install can skip it."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants