Skip to content

exporter_exporter: fix panic when using default module - #507

Open
inqrphl wants to merge 1 commit into
mainfrom
exporterexporter-security-fixes-1
Open

inqrphl wants to merge 1 commit into
mainfrom
exporterexporter-security-fixes-1

Conversation

@inqrphl

@inqrphl inqrphl commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix a remote crash in the exporter_exporter /proxy endpoint.

If a default module is configured and a request has no module query parameter, the reverse proxy rewrite sliced a nil slice:

qvs["module"] = qvs["module"][1:]

This panicked with slice bounds out of range [1:0]. The listener's logPanicExit recover then stopped the whole agent with exit code 2.

Fix

Remove the first module value only when at least one value exists. An absent key stays absent, and the request reaches the configured default exporter.

Maintainer decision

The first module query value is the SNClient routing parameter. Additional module values belong to the exporter and must be kept. The [1:] behavior therefore stays. This change only guards the absent-key case.

Test

Add TestExporterExporterProxyDefaultModuleWithoutModuleQuery. It starts a local backend, configures a default HTTP module, sends GET /proxy without ?module=, and checks that the backend receives /metrics with no module parameter.

Validation

  • make test
  • make golangci
  • make fmtcheck

make citest reached docscheck. That stage needs to write the Go module cache and start Docker, which this sandbox blocks. All earlier stages passed.

AI disclaimer

This PR contains AI-generated code. A human reviewed the implementation and the test before submission.

Guard the module query slice in the reverse proxy rewrite. Requests without a module query parameter and a configured default module no longer panic and exit the agent.

The first module value selects the exporter. Any additional values are forwarded to the exporter.
@inqrphl
inqrphl requested a review from sni November 26, 2026 16:49
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.

1 participant