Repository navigation
test(chart): template tests reach every document of a multi-document template, and a failing test never prints Secret data (#1371, #1382) - #1410
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Some valid failure paths can still expose unmasked Secret data.
2 open findings
What changed in this PR
Improves Helm chart testing by supporting multi-document templates and masking Secret data in failure logs.
Changes:
- Adds document-scoped matching and bounded, masked diagnostics.
- Expands Aether and udsecho chart coverage.
- Adds regression fixtures, documentation, guards, and chart version bumps.
| File | Description |
|---|---|
charts/udsecho/Chart.yaml |
Bumps chart version. |
charts/udsecho/BUILD.bazel |
Adds document and Secret guards. |
charts/README.md |
Documents test-rule selection. |
charts/aether/Chart.yaml |
Bumps chart version. |
charts/aether/BUILD.bazel |
Adds multi-document tests and safer options. |
bazel/helm/upstream_template_test_opts_test.sh |
Enforces Secret-free upstream tests. |
bazel/helm/testdata/secretchart/values.yaml |
Defines masking fixtures. |
bazel/helm/testdata/secretchart/templates/multi.yaml |
Exercises multi-document Secrets. |
bazel/helm/testdata/secretchart/templates/list.yaml |
Exercises nested Secrets. |
bazel/helm/testdata/secretchart/templates/broken.yaml |
Exercises failed rendering. |
bazel/helm/testdata/secretchart/Chart.yaml |
Defines the test chart. |
bazel/helm/testdata/secretchart/BUILD.bazel |
Defines rule regression runners. |
bazel/helm/template_rules_test.sh |
Validates bounded, masked diagnostics. |
bazel/helm/render_lib.sh |
Adds rendering, splitting, and masking helpers. |
bazel/helm/defs.bzl |
Extends Helm test rules. |
bazel/helm/BUILD.bazel |
Wires shell helpers and regression tests. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
b43a147 to
b0095d6
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Valid flow-style YAML Secrets bypass the masker and can expose their data in test logs.
1 open finding
2 resolved since last review
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
b0095d6 to
4919113
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Valid Secret syntax and one assertion path can still expose Secret values, while flow-style documents cannot use the new per-document API.
3 open findings
1 resolved since last review
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
4919113 to
436b60d
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Secret masking and its upstream-test guard still have bypasses that can expose rendered Secret data.
2 open findings
3 resolved since last review
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
436b60d to
b158875
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Explicit YAML mapping keys can bypass Secret masking, and two new RBAC tests omit rendered grants.
3 open findings
2 resolved since last review
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
…template, and a failing test never prints Secret data (#1371, #1382) rules_helm's helm_template_test keeps one document per template file, the one helm prints last (helm sorts by kind), and its runner prints the whole render into the test log whether the test passes or fails. With default values the aether chart generates the webhook's private key at render time. bazel/helm: - helm_template_match_test gains document_patterns ({"<Kind>/<name>": [...]}): patterns matched inside one named document, wherever it is in its template. - On a mismatch it prints the pattern, the document searched and at most 16 lines from where the pattern stopped matching, from a copy of the render in which the data/stringData of every Secret document is masked. It never prints the render. helm_template_fail_test, _absent_test and _value_changes_test mask and bound what helm printed in the same way. - render_lib.sh holds the shared shell (POSIX awk and bash [[ =~ ]] only). - //bazel/helm:template_rules_test runs deliberately failing runners over a chart of Secrets in every shape and requires that no Secret byte is printed, with every awk the host has. charts/aether (2.4.17), charts/udsecho (2.0.2): tests only. - 25 new tests for the documents that were out of reach: agent, controller, registrar and edge RBAC, the two ServiceAccounts, the webhook Secret and both webhook configurations, the edge HTTPRoutes, udsecho's ServiceAccounts and the uds-cr-echo Deployment. - Every rules_helm helm_template_test in charts/aether passes controller.webhook.spire=true (no Secret rendered; a guard test enforces it); the two that need the default webhook path moved to the masked rule. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
b158875 to
ff7e42b
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The masker exposes data from valid SecretList manifests.
1 open finding
3 resolved since last review
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
There was a problem hiding this comment.
🟡 Changes recommended
The masker can expose nested Secret data when the nested kind uses YAML anchors or similar properties.
2 open findings
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
…s possibly Secret Review on #1410. A SecretList printed its items' data (the kind is a plain word, the items carry no kind line), and a plainly-kinded object carrying a Secret whose nested kind had a YAML anchor was printed verbatim. A document is now readable only if its top-level kind does not end in List and no kind key anywhere inside it is Secret, a typed list, or written with an anchor, a tag or an alias. Both shapes are fixtures; the rule's test printed their values on 2 lines before the change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
There was a problem hiding this comment.
🟡 Changes recommended
The masker can still expose an embedded Secret whose kind uses an indented explicit YAML key.
1 open finding
2 resolved since last review
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
…nreadable to the mask Review on #1410. A plainly-kinded object could embed a Secret through an indented explicit key (`? kind` / `: Secret`); only column 0 was checked. Fixture added; the rule's test printed its value on 1 line before the change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
There was a problem hiding this comment.
🟡 Changes recommended
A flow-style or JSON Secret in the first Helm stderr chunk bypasses masking and exposes its data.
1 open finding
1 resolved since last review
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
There was a problem hiding this comment.
🔵 Needs a closer look
The security-sensitive redaction boundary and broad Helm test-runner changes warrant final human review.
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
…as a flow document Review on #1410. The stream mode printed its first chunk unmasked unless it had a block-style manifest marker, so a JSON Secret on stderr printed its data. An error message does neither; a bracketed tag such as [ERROR] still prints. Regression check added, red against the previous library. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
There was a problem hiding this comment.
🔵 Needs a closer look
Security-sensitive redaction and extensive generated-runner changes warrant final human review despite strong regression coverage.
0 open findings
1 resolved since last review
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.


Closes #1371
Closes #1382
Tests and test rules only. No template and no
values.yamlchanges (git diff origin/main -- charts/*/templates charts/*/values.yamlis empty), so the charts render what they rendered, apart from thehelm.sh/chartversion label.The two facts behind the issues
Read from rules_helm's runner (
helm/private/runner/runner.go):parseHelmOutputkeeps one document per# Source:path, so for a template with several documents only the one helm prints last is searched. Helm prints a release's objects sorted by kind, so that is not the last one in the file either: forcontroller-webhook.yamlit is the ValidatingWebhookConfiguration, forcontroller-rbac.yamlthe RoleBinding.fmt.Print(test_stream.String())) before it checks any pattern, so the render is in the test log of a passing test too, not only on a mismatch as chart tests: a failing helm_template_test prints the whole render, including the generated webhook private key #1382 says. Measured on this branch: thetest.logof a passingaether_agent_restart_fast_path_testis 2,348 lines (the render); with the option described below it holds nokind: Secretand notls.key.aether_template_test, moved to the masked rule, logs 4 lines.#1371: which documents no test could reach
Measured by rendering each chart with the toolchain's helm (4.2.0) with every relevant switch on.
[last]is the document atemplate_patternsentry searches.agent-rbac.yaml[last]ClusterRoleBindingagent-serviceaccount.yaml[last]ServiceAccount (proxy)controller-rbac.yaml[last]RoleBindingcontroller-webhook.yaml[last]ValidatingWebhookConfigurationregistrar-rbac.yaml[last]RoleBindingedge-rbac.yaml[last]ClusterRoleBindingedge-httproute.yamledge.gateway.httpRoutesentry,[last]by nameuds-cr-echo.yaml[last]EndpointPolicyuds-echo.yaml,client.yaml[last]Deploymentauthz-canary.yaml[last]HTTPFilterhelm_template_match_test(#1365, #1397)No existing test was silently testing the wrong document: none of the 81 upstream tests in
charts/aetheris keyed on a multi-document template (the ten template files they name each render one document).The new tests (25)
charts/aether:aether_agent_rbac_test,_namespace_test,_gamma_and_uds_off_test;aether_agent_service_accounts_test,aether_proxy_service_account_off_test;aether_controller_rbac_test,_webhook_spire_test;aether_registrar_rbac_test,_mcs_test;aether_edge_rbac_test,_tls_test;aether_edge_httproutes_test,_default_test;aether_webhook_documents_test,aether_webhook_ndots_only_test,aether_webhook_namespace_injection_only_test,aether_webhook_mutating_off_test;aether_webhook_spire_no_secret_test,_all_enabled_test; and the two moved tests below.charts/udsecho:udsecho_documents_test,udsecho_socket_override_test,udsecho_policy_path_off_test,udsecho_no_secret_test.What they pin, in short: each RBAC rule as rendered (the agent's eviction grant in the core group, the node
patchgrants, whatagent.gamma,udsCsi.enabled,registrar.enableMCS,edge.tls.enabledandcontroller.webhook.spireadd or remove); every binding's role and its one subject in the right namespace; every webhook entry'sfailurePolicy: Ignore, selector, path and a non-emptycaBundle, and that the mutating configuration holds exactly the entries its two switches ask for; the Secret's shape (never its content).Left out on purpose: label blocks on RBAC and ServiceAccount objects (the #1363 tests already cover what matters about labels); the SPIRE-served webhook's positive shape (the existing
aether_webhook_cert_rotation_spire_testalready asserts no Secret and nocaBundle); the controller's RBAC withwebhook.spire=trueandinjectPodNdots=false, which looks wrong and is reported below rather than pinned.#1382: what a failing test prints
helm_template_match_testnow prints the pattern, the document it searched, and at most 16 lines from where the pattern stopped matching, taken from a masked copy of the render (the rule is below). It never prints the render. Example (a temporaryfailurePolicy: Fail):The other five rules in
defs.bzlprinted helm's output when helm failed; with--debugthat includes the render. Every runner now captures helm's stdout (the render) and stderr apart and shows only stderr, masked and cut to 30 lines; the rejection test no longer prints a render that should have been rejected. One consequence:helm_template_match_testandhelm_template_absent_testnow search helm's stdout only, not stdout and stderr together.The mask fails closed. It does not try to recognise a Secret, which YAML can spell in more ways than a line pattern can follow. A document is printed as it is only when it is plainly something else: exactly one top-level
kind: <Word>line (optionally quoted, optional trailing comment) whose word is notSecretorList, not flow style or JSON, no top-level explicit (?) or merge (<<) key, and nokind: Secretanywhere else in it. In a document that might be a Secret, only these lines are ever printed, and only as simplekey: scalarlines: the# Source:comment,apiVersion:,kind:,type:,metadata:and thename:/namespace:directly under it. Everything else is<masked>. So a ConfigMap written the usual way stays readable in an excerpt, and a failure in a Secret shows which Secret and where, never what is in it.The shell is in
bazel/helm/render_lib.sh: bash[[ =~ ]]and POSIX awk, nogrep -P, no\sin an ERE or an awk pattern. The rule also translates\Snow ([^[:space:]]), next to\nand\s: the prober tests merged in #1397 use\S+, which glibc's regcomp takes as it is and BSD's does not.The test of the rule itself
//bazel/helm:template_rules_testruns fifteen runners that fail by design overbazel/helm/testdata/secretchart, a chart of Secrets in every shape (plain keys,stringData, a block scalar, a flow mapping, a Secret inside aList,databeforekind, akindline with a comment, whole documents in flow style and in JSON, whitespace before a key's colon, a kind that is anchored, tagged, aliased or missing, explicit and block-scalar keys, values behind a merge key), in which every Secret value starts withFORBIDDEN. It requires each to fail, to say what a reader needs, to stay within a line bound, and to print noFORBIDDENbyte. The control is:documents_test, which matches those same values in the same render. It repeats with every awk the host has (here: gawk, mawk, busybox awk).The failing runners are not tests:
scripts/ci-impacted-targets.shhands CI every test targetbazel query 'tests(//...)'finds,manualones included, so a target that fails by design cannot be one. Each of the five rules that can print helm output has a_runnertwin (same implementation, plain executable) for this.The tests that stay on the upstream rule
79 of the 81 upstream tests in
charts/aethernow pass--set controller.webhook.spire=true(77 added, 2 already had it). Why that does not change what they check, measured: with and without the switch, at default values and with edge, the authz sidecar and telemetry on, exactly three template files differ (controller-deployment.yaml,controller-rbac.yaml,controller-webhook.yaml). For the tests keyed oncontroller-deployment.yaml, the diff of that file is the same 20 lines (the webhook-serving flags, one volume, one mount) under each of those tests' own options, and none of their patterns is about those lines.Moved to the masked rule (2):
aether_template_test: it is the "default values render" test, so it cannot take the switch. It now also names the eleven objects the default render must hold.aether_identity_gate_no_spire_test: it renders a mesh without SPIRE; adding the SPIRE-served webhook to that would be a contradiction.Two guards keep this from regressing:
aether_upstream_template_tests_render_no_secret_testfails anyhelm_template_testin that BUILD file whoseoptslist does not hold the option right after a"--set"(it has a self-test over calls that hold the text in a comment or another attribute), andaether_webhook_spire_no_secret_test(+_all_enabled_test) prove the option renders no Secret.udsecho_no_secret_testdoes the second job for udsecho, whose one upstream test renders at default values.Red, then green
policy, a hard-coded binding namespace, a dropped verb,failurePolicy: Fail, a switch replaced byif true, a stray HTTPRoute, ...), all applied at once. All 25 failed, each on the line it is about; 118 other tests kept passing and 4 existing tests failed with them, as they should (aether_identity_gate_disabled_test,aether_reproducible_webhook_spire_test,aether_uds_csi_off_test,aether_webhook_cert_rotation_spire_test). Templates restored from git; 177 of 177 pass. Run twice, before and after the patterns were tidied.secret = 0),template_rules_testfails withprints Secret datafor five runners, under each awk.aetherrender, aimed at the Secret, printed no base64 run of 40 or more characters (since the final version of the mask, a Secret shows only its identity lines).Also run:
bazel test //charts/... //bazel/helm/..., the lint build (--config=lintwithfail_on_violation),make format-check,scripts/check-shell-lint.sh,scripts/check-chart-version-bump.sh.Chart versions
scripts/check-chart-version-bump.shdiffs the wholecharts/<name>/directory, so aBUILD.bazel-only change needs a bump:aether2.4.16 -> 2.4.17,udsecho2.0.1 -> 2.0.2.crdsandproberare not touched. No other open pull request touches eitherChart.yaml.On upgrade
Nothing to do. No pod rolls: the pod templates do not carry the chart version (#1363,
aether_pod_template_version_test).Not verified
[[ =~ ]]under glibc only.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr