tektoncd / tektoncd/pipelines-as-code
/debug/queue endpoint is always on and leaks names across namespaces
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 214
- Forks
- 144
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 27
Description
📝 Description
#2890 added a /debug/queue endpoint to the watcher that lists, for every
namespace, the Repository names, their concurrency limits, and the names of
running and pending PipelineRuns.
The PR description says the endpoint is off unless explicitly switched on.
The code does not match: cmd/pipelines-as-code-watcher/main.go:36 registers
the handler unconditionally, with no flag, no environment variable and no
authentication. It listens on the probe port (8080), which is declared as a
container port and reachable at the pod IP from anywhere in the cluster.
The Service only publishes 9090, but that does not block direct pod
connections, and the project ships no NetworkPolicy.
The comment in pkg/queue/debug.go argues callers could already list these
names through the Kubernetes API. For PipelineRun pods that is usually false:
they commonly run with no API permissions at all, yet they can open network
connections. Pipelines-as-Code exists to run code from pull requests, so
untrusted code running curl <watcher-ip>:8080/debug/queue gets a cluster-wide
inventory of repository and PipelineRun names it could not otherwise see.
🛠️ Suggested fix
Register the route only when an explicit setting enables it, for example an
environment variable PAC_ENABLE_QUEUE_DEBUG parsed with strconv.ParseBool,
default off, failing closed on an invalid value. Leaving the route absent is
better than answering 403.
Two things depend on the endpoint today and need to opt in:
- the E2E helper
QueueSnapshot(test/pkg/kubestuff/watcher.go:100) - the documentation at
docs/content/docs/advanced/concurrency.md, which
currently shows a plaincurlwith no enablement step
🧪 Testing Strategy
- Unit tests: route absent when disabled, present when enabled
- End-to-end tests: E2E install sets the variable so QueueSnapshot keeps working
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at cmd/pipelines-as-code-watcher/main.go:36 and read pkg/queue/debug.go to trace route registration and the existing debug endpoint behavior. Check the watcher unit tests, test/pkg/kubestuff/watcher.go:100, and docs/content/docs/advanced/concurrency.md for the enablement contract. Done means the route is absent by default, available only after explicit opt-in, and the helper and documentation reflect that setting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- backend-api-design, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100