Repository navigation
Description
Problem
In the Renovate CronJob (#4905, PR #6014), the renovate container reads the installation token from /token/github-token (a memory emptyDir, mode 0600, uid 12021), and the postUpgradeTasks run in the same container as the same uid (k8s/devops/renovate/cronjob.yaml, about lines 176-178; configmap.yaml, about line 41). The token has contents: write and workflows: write on every repository of the App installation (CONST_RENOVATE_GITHUB_APP_TOKEN_PERMISSIONS). A task such as devops install-tools --tool openspec installs a new upstream release, so a bad release can read the token file and send it out over public 443 (networkpolicy.yaml, about lines 44-58). The App private key stays in the token init container and is safe. ADR 0027 (about line 57) says that "a repository command that goes wrong reaches no key", which is not true for the token. Found in the review of PR #6014; no harm while RENOVATE_DRY_RUN=lookup is set, because no task runs.
Expected behavior
- A task of
postUpgradeTaskscannot read the installation token: for exampleconfig.jsreads the token and removes the file before any task runs, or the tasks run with a filesystem view that has no/token. Check that a child process of the same uid cannot read the parent's memory under the node's ptrace setting. - A test proves that a task command cannot open the token path.
- ADR 0027 lists the residual risk under "Bad" (a token in memory of the Renovate process, one hour of life) and line 57 says what is true.
- This lands before chore(k8s): measure the first Renovate runs in the cluster #4909 removes
RENOVATE_DRY_RUN.
Related
- feat(k8s): run self-hosted Renovate as a CronJob in devops #4905, feat(k8s): run self-hosted Renovate as a CronJob in devops #6014, chore(k8s): measure the first Renovate runs in the cluster #4909, feat(deps): track regular version updates with Renovate #4893, ADR 0027.
Alternatives check of 2026-11-17: rejected.
Rejected by ADR 0018. A newer fact can change an ADR.
Tool: containers/bubblewrap (https://github.com/containers/bubblewrap), NOASSERTION, last activity 2026-10-14, maintained.
Reason: Searches found no tool that isolates Renovate's postUpgradeTasks; bubblewrap gives a command a mount view without /token, but ADR 0018 rejected it and it needs user namespaces this pod refuses.
Covers:
- Runs one command in a private mount namespace
- Masks a path such as /token behind a tmpfs
- Clears the environment of the wrapped command
Lacks:
- No hook into Renovate's own task spawner
- User namespaces fail under the pod's RuntimeDefault profile
- Binary absent from the renovate image; needs an allowedCommands wrapper
- Token still lives in the Renovate process memory
Proposed design
Problem statement
The Renovate CronJob runs postUpgradeTasks commands in the same container and as the same user as the Renovate process. The process holds a GitHub App installation token with contents: write and workflows: write on every repository of the installation. A bad command or a bad upstream release can read /token/github-token and send it out over public HTTPS. ADR 0027 says that a repository command that goes wrong reaches no key, and that claim is false for the token. The change removes the token file before Renovate processes a repository, adds a validator and a live check, and corrects ADR 0027.
Acceptance criteria
Requirement: The config removes the token file
The config.js in ConfigMap renovate-config SHALL read /token/github-token and SHALL remove that file before it exports the Renovate config.
Scenario: The k8s validator rejects a config that keeps the token
- WHEN
uv run devops ci --check --only k8sruns against aconfig.jsthat reads the token but does not remove/token/github-token - THEN the command exits non-zero and its error names the token path
Requirement: The token volume is writable in the renovate container
The CronJob SHALL mount the token volume writable in container renovate, so that config.js can remove the token file.
Scenario: The k8s validator rejects a read-only token mount
- WHEN
uv run devops ci --check --only k8sruns against a CronJob whoserenovatecontainer mounts thetokenvolume withreadOnly: true - THEN the command exits non-zero and its error names the
tokenvolumeMount
Requirement: A task command cannot open the token path
The change SHALL add a live check that proves a command in the renovate container cannot open /token/github-token after config.js runs.
Scenario: The live check finds no token file
- WHEN a person runs
uv run devops k8s renovate-check - THEN the command reports that
cat /token/github-tokenfails withNo such file or directory
Requirement: The live check command is tested
The new devops k8s renovate-check command SHALL have an offline test that asserts the pod spec and the failure message.
Scenario: The offline test checks the pod spec
- WHEN
uv run pytest tests/k8s/test_renovate_check.pyruns - THEN the test passes and asserts the pod mounts the
renovate-configConfigMap and a fake token file, and the command fails when the token remains
Requirement: ADR 0027 states the residual risk
ADR 0027 SHALL list the token in the memory of the Renovate process with its one hour of life as a bad consequence, and SHALL NOT claim that a repository command reaches no key.
Scenario: The ADR body states the risk
- WHEN
uv run pytest tests/invariants/test_k8s_renovate.pyruns - THEN the test passes and asserts the ADR body names the token in memory with its one hour of life, and the false sentence is absent
Existing Tool Considered
The alternatives check in the issue body records containers/bubblewrap (https://github.com/containers/bubblewrap) as rejected by ADR 0018. See the alternatives block in the issue body for what the tool covers and lacks. The block says it has no hook into Renovate's own task spawner. It needs user namespaces this pod refuses, and it leaves the token in the Renovate process memory. The proposal does not wrap tasks. It removes the token file in config.js before Renovate starts a task, so it needs no mount namespace and no wrapper. The written cost is about 4,000 tokens to build the config.js change, the k8s validator and the live check command. It is about 300 tokens to keep them at each later change and about 2,000 tokens to fix them, over about half a day.
Key questions
- How does the
renovatecontainer keep the installation token out of apostUpgradeTaskscommand's reach?:config.jsreads/token/github-tokeninto the Renovate config and then removes the file before it exports the config. Renovate loadsconfig.jsonce at start, before it processes a repository or runs a task. The CronJob mounts thetokenvolume writable in therenovatecontainer for that removal. (best practice) [sources: k8s/devops/renovate/cronjob.yaml, k8s/devops/renovate/configmap.yaml, openspec/specs/renovate-service/spec.md]- Chosen: Read the token in config.js and remove the file. config.js runs once at start, before any repository or task, and Renovate needs the token in its config.
- Rejected: Keep allowedCommands empty. The config already holds this, and it stops the upgrade work of the repositories. The issue asks for the token to be out of reach.
- Rejected: Pass the token through an environment variable. A child process inherits the environment of Renovate, so a task reads the token at once.
- Rejected: Run each task in a second container without /token. Renovate runs postUpgradeTasks in its own container, and the image is not patched.
- Rejected: Wrap each task with bubblewrap. The alternatives check records bubblewrap as rejected by ADR 0018, and it needs user namespaces this pod refuses.
- Where does the installation token live, and which process can read it?: The
tokeninit container writes the token to/token/github-tokenon a memoryemptyDir, with mode 0600 and uid 12021. Therenovatecontainer mounts that volume at/tokenand reads the file inconfig.js. The token grantscontents: writeandworkflows: writeon every repository of the App installation. [sources: k8s/devops/renovate/cronjob.yaml, src/devops_cli/config/constants.py:1654, src/devops_cli/github/app_token.py] - What stops a
postUpgradeTaskscommand today, and does this change wait on chore(k8s): measure the first Renovate runs in the cluster #4909?: The global config holds an emptyallowedCommands, so no command runs. The CronJob sets noRENOVATE_DRY_RUNat this commit. The spec says chore(k8s): measure the first Renovate runs in the cluster #4909 was a lookup dry run and Renovate now opens update pull requests. Nothing here waits on chore(k8s): measure the first Renovate runs in the cluster #4909. [sources: k8s/devops/renovate/configmap.yaml, k8s/devops/renovate/cronjob.yaml, openspec/specs/renovate-service/spec.md] - Can a child process of the same uid read the token in the memory of the Renovate process?: The pod drops all capabilities and uses the
RuntimeDefaultseccomp profile, so it holds noCAP_SYS_PTRACE. A node withkernel.yama.ptrace_scopeat 1 refuses a trace of a process that is not a descendant of the caller. The live checkkubectl debug node/<node> -- sysctl kernel.yama.ptrace_scopeconfirms the setting. ADR 0027 records the token in the memory of the Renovate process, with its one hour of life, as the residual risk. (best practice) [sources: k8s/devops/renovate/cronjob.yaml, docs/adr/0027-dependency-updates-come-from-self-hosted-renovate.md]- Chosen: Rely on the dropped capabilities and the node's ptrace_scope. The pod already drops all capabilities and uses the RuntimeDefault seccomp profile, and a node at kernel.yama.ptrace_scope 1 refuses a trace of a non-descendant.
- Rejected: Ship a Localhost seccomp profile that denies ptrace. The profile file must exist on every node, and this repository ships no node-level seccomp profile.
- Rejected: Run each task in its own container. Renovate runs the postUpgradeTasks commands in its own container.
- How does the change correct ADR 0027?: The change corrects the sentence in the body of ADR 0027 and lists the residual risk under the bad consequences. ADR 0027 has no
body-hashfield in its front matter, so the change does not update one. (best practice) [sources: docs/adr/0027-dependency-updates-come-from-self-hosted-renovate.md]- Chosen: Correct the body. The issue asks for the false sentence in the body to change, and the ADR has no body-hash to update.
- Rejected: Append a Status History entry only. It leaves the false sentence in the body of the ADR.
- Rejected: Write a new ADR that supersedes 0027. The decision of ADR 0027 stays in force, and a new ADR would supersede it for no reason.
- Which test or validator holds the new invariant?: The manifest invariant moves to the
k8svalidator:uv run devops ci --check --only k8schecks thatconfig.jsremoves the token and that thetokenmount is writable. The ADR body test stays intests/invariants/test_k8s_renovate.py. The live checkdevops k8s renovate-checkhas an offline test intests/k8s/test_renovate_check.py. (best practice) [sources: k8s/devops/renovate/configmap.yaml, k8s/devops/renovate/cronjob.yaml, tests/invariants/test_k8s_renovate.py]- Chosen: Use the k8s validator and a live check command. A test that reads a manifest or config value is being removed (test(k8s): Drop the tests that repeat third-party version pins #6060), and a validator command is the allowed proof for a manifest change.
- Rejected: Add a manifest invariant test in tests/invariants/test_k8s_renovate.py. The newer direction test(k8s): Drop the tests that repeat third-party version pins #6060 removes tests that compare a manifest or config value.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 16, 2026
A live security vulnerability (token with write scope readable by untrusted tasks) is mitigated only by dry-run mode and will become exploitable when #4909 removes it.#4905 created the Renovate CronJob; this candidate fixes a token-exposure defect in that design by isolating postUpgradeTasks from the installation token file.chore(k8s): Let Renovate open update PRs with no upgrade tasks (#6023)
devops-cli-service commentedon Nov 16, 2026
Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.
dan-petty commentedon Nov 16, 2026
Update, later on 2026-11-16: a newer direction (#6060) removes the tests that compare a manifest or config value. The qdrant
values.yamlcopy, the k8s-monitoring allow-lists and the SearXNG engine names file are test fixtures only; no project code and no cluster object reads them. If #6060 removes their tests, these tasks are not needed. Only theHELM_RELEASES_BY_STACKversion is runtime code (deploy-stackinstalls it).Upgrade tasks to turn on after this item. These are from the Renovate PRs of 2026-11-16 (#6046, #6029). An agent did each step by hand.
Helm chart updates (#6046, commit f375783). No repository command does these steps yet, so a task needs one first:
versionof the release inHELM_RELEASES_BY_STACK(src/devops_cli/commands/k8s/stack_lifecycle.py) to thetargetRevisionof its Application.helm pull --repo https://qdrant.github.io/qdrant-helm qdrant --version {{{newVersion}}} --untar. Then copyqdrant/values.yamltotests/fixtures/charts/qdrant/values.yaml, and write the version totests/fixtures/charts/qdrant/VERSION.charts/feature-cluster-metrics/default-allow-lists/{cadvisor,kube-state-metrics,kubelet}.yamlandcharts/feature-integrations/default-allow-lists/alloy.yamlundertests/fixtures/k8s_monitoring/. Set the header line# chart: grafana/k8s-monitoring <version>.tests/commands/k8s/test_k8s_logging_stack.py,tests/k8s/test_loki_pattern_ingester.pyandtests/invariants/test_k8s_manifests.py. A better fix: the tests read the version from the Application.A person must still review the claim table (
CHART_CLAIMS) and the token table (_CHART_TOKENS) at each chart bump. This is on purpose, so no task does it.SearXNG (#6029): the engine names refresh of
docs/CLUSTER.md(section SearXNG, step 3) readssettings.ymlfrom the image withdocker run. A task needs a tool that can read an image with no daemon. The livedevops k8s searxng-checkcannot be a task, so #6052 holds each tag for a Dashboard approval.Python patch (#6047): the ty rule renames need a code change, so no task applies.
devops-cli-service commentedon Nov 17, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (6)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 17, 2026
Status set to Ready at 2620fae (see proposed design in issue body).
1 remaining item
devops-cli-service commentedon Nov 18, 2026
Plan state: branch
fix/6020-keep-the-renovate-token-away-from, draft pull request #6251. The pull request plans the item and closes no issue. The stage job and the step fix-plan edit this comment, and a comment of each run tells what the run did.The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:
devops-cli-service commentedon Nov 18, 2026
The stage job staged the plan of draft pull request #6251. The plan state comment of #6251 holds the branch, the task groups and the findings.
The runs of the planner and the review made 86 model request(s), and used 7958042 input tokens and 212500 output tokens. The tool calls, in order:
list_files({"directory":"k8s/devops/renovate"})read_file({"path":"k8s/devops/renovate/configmap.yaml"})read_file({"path":"docs/adr/0027-dependency-updates-come-from-self-hosted-renovate.md"})read_file({"path":"k8s/devops/renovate/networkpolicy.yaml"})search_code({"text":"searxng-check"})list_files({"directory":"src/devops_cli/k8s"})search_code({"text":"\"k8s\":"})list_files({"directory":"src/devops_cli/ci"})search_code({"text":"kubectl kustomize"})list_files({"directory":"tests/gate"})read_file({"path":"tests/gate/k8s.py"})list_files({"directory":"tests/gate/k8s_checks"})read_file({"path":"tests/gate/k8s_checks/devops_runtime.py"})list_files({"directory":"src/devops_cli/commands/k8s"})read_file({"path":"tests/gate/runner.py"})read_file({"path":"src/devops_cli/commands/k8s/searxng_check.py"})file_symbols({"path":"src/devops_cli/k8s/searxng_check.py"})list_files({"directory":"src/devops_cli/lang"})search_code({"text":"k8s_checks"})search_code({"text":"docs/commands/"})search_code({"text":"uv run devops ci docs"})search_code({"text":"body-hash"})find_issues({"terms":"renovate token"})search_code({"text":"Status History"})read_file({"path":"docs/adr/README.md","start_line":20,"end_line":70})read_file({"path":"src/devops_cli/config/constants.py","start_line":1640,"end_line":1670})search_code({"text":"CONST_RENOVATE_GITHUB_APP_TOKEN_PERMISSIONS"})search_code({"text":"--check --only k8s"})read_file({"path":"tests/gate/k8s_render.py"})list_files({"directory":"src/devops_cli/lang/en"})search_code({"text":"install kubectl"})search_code({"text":"kubectl"})search_code({"text":"## Renovate"})read_file({"path":"docs/CLUSTER.md","start_line":253,"end_line":285})references({"name":"renovate_check"})references({"name":"renovate-check"})read_file({"path":"src/devops_cli/commands/k8s/__init__.py"})search_code({"text":"renovate_cronjob"})search_code({"text":"no post-upgrade task runs until #6020"})search_code({"text":"mountPath: /token"})list_files({"directory":"k8s/devops/renovate"})list_files({"directory":"tests/gate/k8s_checks"})read_file({"path":"k8s/devops/renovate/configmap.yaml"})read_file({"path":"tests/gate/k8s_checks/devops_runtime.py"})read_file({"path":"k8s/devops/renovate/cronjob.yaml","start_line":160,"end_line":200})read_file({"path":"tests/gate/k8s_checks/runner.py"})search_code({"text":"k8s_checks"})read_file({"path":"docs/adr/0027-dependency-updates-come-from-self-hosted-renovate.md","start_line":30,"end_line":90})search_code({"text":"[\"node\""})search_code({"text":"shutil.which(\"node\")"})read_file({"path":"tests/gate/k8s_render.py","start_line":1,"end_line":60})list_files({"directory":"tests/k8s"})search_code({"text":"applied_documents"})list_files({"directory":"src/devops_cli/k8s"})search_code({"text":"from devops_cli"})read_file({"end_line":20,"path":"docs/adr/0027-dependency-updates-come-from-self-hosted-renovate.md","start_line":1})search_code({"text":"postUpgradeTasks"})read_file({"path":"tests/invariants/test_k8s_renovate.py","start_line":1,"end_line":30})read_issue({"number":4909})read_issue({"number":6014})read_issue({"number":4905})find_issues({"terms":"renovate token"})read_file({"path":"docs/CLUSTER.md","start_line":252,"end_line":272})references({"name":"renovate_token"})search_code({"text":"renovate-config"})read_file({"end_line":45,"path":"tests/gate/k8s_checks/job_admission_policy.py","start_line":1})read_file({"end_line":25,"path":"src/devops_cli/k8s/configmap.py","start_line":1})search_code({"text":"TOKEN_FILE"})list_files({"directory":"tests/invariants"})read_file({"end_line":60,"path":"tests/invariants/test_suite_refuses_real_programs.py","start_line":1})read_file({"end_line":60,"path":"tests/support/refused_programs.py","start_line":1})read_file({"end_line":1672,"path":"src/devops_cli/config/constants.py","start_line":1648})list_files({"directory":"src/devops_cli/commands/k8s"})list_files({"directory":"docs/adr"})list_files({"directory":"tests/k8s"})list_files({"directory":"src/devops_cli/k8s"})list_files({"directory":"k8s/devops/renovate"})read_file({"path":"k8s/devops/renovate/configmap.yaml"})search_code({"text":"\"node\""})list_files({"directory":"tests/gate/k8s_checks"})read_file({"path":"k8s/devops/renovate/cronjob.yaml","start_line":170,"end_line":200})list_files({"directory":"tests/gate"})read_file({"path":"tests/gate/k8s_checks/devops_runtime.py","end_line":60})search_code({"text":"k8s_checks"})read_file({"path":"tests/gate/k8s.py","end_line":80})search_code({"text":"renovate-config"})read_file({"path":"tests/k8s/test_k8s_configmap.py","end_line":25})list_files({"directory":"tests/invariants"})read_file({"path":"docs/adr/0027-dependency-updates-come-from-self-hosted-renovate.md","end_line":70})search_code({"text":"token_file_problems"})read_file({"path":"docs/CLUSTER.md","start_line":250,"end_line":272})search_code({"text":"DEVOPS_CLI_TOKEN_FILE"})search_code({"text":"RENOVATE_TOKEN"})file_symbols({"path":"tests/gate/k8s_render.py"})read_file({"path":"src/devops_cli/config/constants.py","start_line":1646,"end_line":1672})list_files({"directory":"k8s/devops/renovate"})search_code({"text":"RENOVATE_DRY_RUN"})read_spec({"capability":"renovate-service"})read_file({"path":"k8s/devops/renovate/cronjob.yaml","start_line":170,"end_line":300})read_spec({"capability":"1"})read_spec({"capability":"renovate-service","requirement":"No upgrade task runs until the token is out of its reach"})read_spec({"capability":"renovate-service","requirement":"Only the token init container reads Secret renovate"})read_file({"path":"tests/gate/k8s.py"})read_file({"path":".github/renovate.json"})read_file({"path":"tests/gate/runner.py"})search_code({"text":"postUpgradeTasks"})search_code({"text":"NODE_MAJOR"})list_files({"directory":"src/devops_cli/k8s"})git_log({})list_files({"directory":"openspec/changes/archive"})references({"name":"6020"})read_file({"path":"docs/CLUSTER.md","start_line":245,"end_line":285})read_file({"path":"tests/invariants/test_k8s_renovate.py","start_line":1,"end_line":80})list_files({"directory":"tests/gate"})search_code({"text":"subprocess.run"})search_code({"text":"child process"})search_code({"text":"Popen"})references({"name":"6060"})read_file({"path":"tests/gate/tree_checks/config_reads.toml"})read_file({"path":"tests/gate/tree_checks/config_values.py","start_line":280,"end_line":340})read_file({"end_line":160,"path":"tests/gate/tree_checks/config_values.py","start_line":1})read_file({"path":"tests/gate/tree.py"})search_code({"text":"test-tree"})list_files({"directory":"tests/gate/k8s_checks"})list_files({"directory":"tests/gate/tree_checks"})read_file({"end_line":278,"path":"tests/gate/tree_checks/config_values.py","start_line":160})read_comment({})search_code({"text":"body-hash"})read_comment({"number":3})search_code({"text":"starts no program"})search_code({"text":"refused_programs"})list_files({"directory":"k8s/overlays/homelab/devops"})read_file({"path":"k8s/devops/renovate/configmap.yaml","start_line":25,"end_line":70})search_code({"text":"FROM node:"})read_file({"path":"k8s/overlays/homelab/devops/kustomization.yaml"})search_code({"text":"readOnly"})read_file({"end_line":62,"path":"docs/adr/0027-dependency-updates-come-from-self-hosted-renovate.md","start_line":50})read_file({"end_line":1670,"path":"src/devops_cli/config/constants.py","start_line":1645})read_file({"end_line":60,"path":"tests/gate/tree_checks/process_state.py","start_line":1})read_file({"end_line":40,"path":"tests/gate/tree_checks/assertions.py","start_line":1})find_issues({"terms":"renovate postUpgradeTasks allowedCommands"})search_code({"text":"renovate"})search_code({"text":"--from=node"})search_code({"text":"node -v"})read_file({"path":"tests/gate/k8s_checks/renovate.py"})read_file({"path":"src/devops_cli/k8s/renovate_token.py"})Tool calls: file_symbols=2 (empty=0), find_issues=3 (empty=0), git_log=1 (empty=0), list_files=28 (empty=0), read_comment=2 (empty=0), read_file=53 (empty=0), read_issue=3 (empty=0), read_spec=4 (empty=0), references=5 (empty=3), search_code=45 (empty=5)
The stage job read the open pull requests and their files in 1 GraphQL request(s).
The plan request held these comments of the item whole: #6020 (comment), #6020 (comment), #6020 (comment), #6020 (comment), #6020 (comment).
fix(k8s): Keep the Renovate token away from upgrade tasks
fix(k8s): Keep the Renovate token away from upgrade tasks
fix(k8s): Keep the Renovate token away from upgrade tasks
fix(k8s): Keep the Renovate token away from upgrade tasks
devops-cli-service commentedon Nov 18, 2026
Released in v0.176.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.176.0
devops-cli-service commentedon Nov 18, 2026
Live since 2026-11-18 13:25 UTC
fix(deps): update @fission-ai/openspec to v2.1.1 (#6909)
fix(deps): update @fission-ai/openspec to v2.2.0 (#7020)