Skip to content

Commit 5cdbe9b

Browse files
committed
fix(deploy): taint Helm changes of and/or, later conditions, sortAlpha, parse errors
Review round 4 of DeusData#2677 (user decisions: R4-1..R4-4, R4-6, R4-7, R4-9; R4-5 measured and left out). Every case ends in an UNKNOWN image, never a wrong one. Changes not run exactly (helm_template.c): - A deep merge into a values map is not exact when a change was made at or below its path (a set storing a map there): every values map a set or a merge changes keeps its path, and such a merge leaves the images after it UNKNOWN. - and / or at an operand whose truth is not known -- UNKNOWN, or a map a change made unknown -- leave the images after them UNKNOWN when an operand after it may change maps. - In an if / with an UNKNOWN condition skips, the else-if / else-with conditions after it are looked at too: a change there taints, an assignment there makes its variable UNKNOWN. - sortAlpha sorts a []string in place: it counts as a change (a list is never poisoned, so it taints). No other Sprig list function changes its argument in place. - A template, a define body or a scanned template file the grammar does not parse may hide a change: its images are UNKNOWN. Work (helm_template.c): - A capture's keys leave the key set one by one; the set is no longer cleared by walking its whole capacity after each capture. - Template files are found by a hash of their path, and an include of a name that is no define is answered once per render. Known limit, documented (README): each template file renders on its own, while Helm renders a chart's files with one shared .Values. Running them in Helm's order is the planned follow-up; the coarse rule across files cost 83 more correct images on the 20 infra corpora and was left out. On the 20 infra corpora: Image edges identical to round 4 (0 lost, 0 added), no budget trip. Tests: R4-1..R4-4 and R4-9 fail on 3401def by their assertions (each sub case too); R4-6 and R4-7 are correctness controls, their cost measured outside the suite. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 3401def commit 5cdbe9b

4 files changed

Lines changed: 312 additions & 47 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ The install script placed beside the binary is **reported, not deleted**: uninst
333333
- `INFRA_MAPS`: a Kubernetes Service to each workload whose pod labels carry every `key: value` of the Service's selector, within one namespace
334334
- `CONNECTS_TO`: a Kubernetes workload or compose service to the Service its containers' environment addresses (`PRODUCT_CATALOG_SERVICE_ADDR: productcatalogservice:3550`, a URL's host, `<svc>.<ns>.svc...`, a bare name on an `*_ADDR` / `*_HOST` / `*_URL` / ... key; compose: the project's `.env` interpolated): a Kubernetes Service of the same bundle and namespace, or a compose service of the same file. The edge keeps `via: env`, `key` and `container`, never the value
335335
- `USAGE` with `ref: image`: a Kubernetes workload (any pod template: containers, initContainers, CronJobs, custom resources) or a docker compose service to the `Image` it runs
336+
- Helm templates are rendered for their images: with the chart's values (the `Chart` `DEPLOYS` them, `default_of`: the values keys read) and with each release's (a Flux HelmRelease, a kustomize `helmCharts` entry, a Terraform `helm_release`: `override_of`). An image the render cannot know is left out, never guessed: after a change of values it does not run exactly, a `tpl` or include it cannot look into, a release value it cannot read, or a work budget it runs past. Known limit: each template file renders on its own, while Helm renders a chart's files with one shared `.Values` (a subchart's is its parent's `.Values.<alias>`), so a chart that changes `.Values` in one file and reads it in another can still show a wrong image
336337
- `DEPLOYS`: what puts manifests, kustomizations or charts on a cluster, to what it puts there: a Flux Kustomization or Argo Application to the kustomizations / manifests / chart of its path, a Flux HelmRelease to its chart (`spec.chart` or `chartRef` → OCIRepository), a shell command or Make recipe (`kubectl apply -f/-k`, `kustomize build | kubectl apply`, `helm install/upgrade/template`), a Go installer loading a chart with the Helm SDK, a Terraform `helm_release`, a Terraform `kubernetes_*` resource the object it declares (a `Resource` like a manifest's, `ecosystem: terraform`, when its name is a literal), a kustomization inflating a chart (`helmCharts`; its values file an `IMPORTS`). A chart outside the repository is an external `Chart`, keyed by its publisher when its repository URL is stated (`__chart__<repository>/<name>`, the same node in every project, the URL in `repository`), else one per project and name; the edge says `via` (`flux`, `argo`, `helmrelease`, `kubectl`, `kustomize`, `helm`, `helm-sdk`, `terraform`, `helmcharts`, ...)
337338
- `DEPENDS_ON`: a Helm chart to the charts it declares (the local chart for a resolvable `file://` repository, otherwise an external `Chart`; the edge keeps `repository`), and a `go.mod` / `requirements.txt` file to an external `Package`; a Dockerfile to the `Image`s it builds on (`via: from`, `copy-from`); an `Image` to the Dockerfile it is built from (`via: build`; `tool`: `skaffold`, `compose`, `docker-build` for `docker` / `podman` / `nerdctl` / `buildah` build commands in scripts, Make and CI); a compose service to the services its `depends_on` / `links` name
338339
- `CONFIGURES`: code reading an environment variable to the shared `EnvVar` of that name (`strategy: env_access`); a Kubernetes container, compose service or Dockerfile (`ENV` of the image) setting one to that container's own `EnvVar` (`strategy: env_set`, with `source`: `value`, `configMapKeyRef`, `secretKeyRef`, `fieldRef`, ..., `compose`, `dockerfile`; values are never stored); and that container's `EnvVar` to the code reading the name inside the files its image is built from (`strategy: env_read`, with `dockerfile`): the image's files are the sources its Dockerfile's `COPY` / `ADD` put into it, less the context's `.dockerignore`

‎src/pipeline/helm_template.c‎

Lines changed: 126 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -916,15 +916,17 @@ struct cbm_helm_defines {
916916
hd_file_t **files; /* each allocated once: defines point into them */
917917
int nfiles;
918918
int cap;
919-
CBMHashTable *names; /* name -> hd_def_t* */
919+
CBMHashTable *names; /* name -> hd_def_t* */
920+
CBMHashTable *by_rel; /* path -> hd_file_t* */
920921
};
921922

922923
cbm_helm_defines_t *cbm_helm_defines_new(void) {
923924
cbm_helm_defines_t *d = cbm_calloc(CBM_MEM_CLASS_OTHER, sizeof(*d));
924925
if (d) {
925926
d->names = cbm_ht_create(0);
926-
if (!d->names) {
927-
cbm_free(CBM_MEM_CLASS_OTHER, d);
927+
d->by_rel = cbm_ht_create(0);
928+
if (!d->names || !d->by_rel) {
929+
cbm_helm_defines_free(d);
928930
return NULL;
929931
}
930932
}
@@ -1018,6 +1020,7 @@ void cbm_helm_defines_add(cbm_helm_defines_t *d, const char *rel, const char *sr
10181020
ts_parser_delete(parser);
10191021
}
10201022
d->files[d->nfiles++] = f;
1023+
cbm_ht_set(d->by_rel, f->rel, f);
10211024
if (f->tree) {
10221025
hd_scan(d, f, ts_tree_root_node(f->tree), hd_depth(rel));
10231026
}
@@ -1037,6 +1040,9 @@ void cbm_helm_defines_free(cbm_helm_defines_t *d) {
10371040
cbm_ht_foreach(d->names, hd_free_def, NULL);
10381041
cbm_ht_free(d->names);
10391042
}
1043+
if (d->by_rel) {
1044+
cbm_ht_free(d->by_rel); /* its keys are the files' own */
1045+
}
10401046
for (int i = 0; i < d->nfiles; i++) {
10411047
if (d->files[i]->tree) {
10421048
ts_tree_delete(d->files[i]->tree);
@@ -1051,12 +1057,7 @@ void cbm_helm_defines_free(cbm_helm_defines_t *d) {
10511057

10521058
/* Template file `rel` of the set; NULL: none. */
10531059
static const hd_file_t *hd_file_find(const cbm_helm_defines_t *d, const char *rel) {
1054-
for (int i = 0; d && i < d->nfiles; i++) {
1055-
if (strcmp(d->files[i]->rel, rel) == 0) {
1056-
return d->files[i];
1057-
}
1058-
}
1059-
return NULL;
1060+
return d && d->by_rel ? cbm_ht_get(d->by_rel, rel) : NULL;
10601061
}
10611062

10621063
static const hd_def_t *hd_find(const cbm_helm_defines_t *d, const char *name) {
@@ -1394,6 +1395,11 @@ typedef struct {
13941395
* and for a merge of values also by values path (everything below it) */
13951396
CBMHashTable *poison_maps;
13961397
CBMHashTable *poison_paths;
1398+
/* the values path of each values map changed (a set or a merge): a merge
1399+
* above one of them reaches what it put there */
1400+
const char **changes;
1401+
int nchanges;
1402+
int chcap;
13971403
/* a change of maps not run exactly: every capture ending later is UNKNOWN */
13981404
bool tainted;
13991405
CBMHashTable *mutates; /* define name -> it may change a map (he_define_may_mutate) */
@@ -1655,6 +1661,37 @@ static bool hst_poison(hst_t *st, const hv_t *v, bool deep) {
16551661
return hst_poison_at(st, v, deep, 0);
16561662
}
16571663

1664+
/* Has a values map at path p or below it been changed? */
1665+
static bool hst_changed_below(hst_t *st, const char *p) {
1666+
size_t lp = strlen(p);
1667+
for (int i = 0; i < st->nchanges; i++) {
1668+
const char *c = st->changes[i];
1669+
if (!hst_step(st) ||
1670+
(strncmp(c, p, lp) == 0 && (c[lp] == '\0' || c[lp] == '.' || c[lp] == '['))) {
1671+
return true;
1672+
}
1673+
}
1674+
return false;
1675+
}
1676+
1677+
/* Values map at path p changed in place; false with no room to say so. */
1678+
static bool hst_record_change(hst_t *st, const char *p) {
1679+
if (st->nchanges == st->chcap) {
1680+
int cap = st->chcap ? st->chcap * PAIR_LEN : CBM_SZ_16;
1681+
const char **g = cbm_arena_alloc(st->a, (size_t)cap * sizeof(*g));
1682+
if (!g) {
1683+
return false;
1684+
}
1685+
if (st->nchanges) {
1686+
memcpy(g, st->changes, (size_t)st->nchanges * sizeof(*g));
1687+
}
1688+
st->changes = g;
1689+
st->chcap = cap;
1690+
}
1691+
st->changes[st->nchanges++] = p;
1692+
return true;
1693+
}
1694+
16581695
static bool hst_poison_at(hst_t *st, const hv_t *v, bool deep, int depth) {
16591696
if (depth > HELM_MAX_NESTING || !hst_step(st)) {
16601697
return false;
@@ -1666,9 +1703,12 @@ static bool hst_poison_at(hst_t *st, const hv_t *v, bool deep, int depth) {
16661703
return false;
16671704
}
16681705
/* a deep change reaches every map within: one not known, one a change
1669-
* already made unknown, the values root (every path below it), or a map
1670-
* not of the values (whose maps no path covers) cannot be poisoned whole */
1671-
if (deep && (hv_poisoned(st, v) || (v->path && !v->path[0]) || (v->k == HV_JSON && !v->path))) {
1706+
* already made unknown, the values root (every path below it), a map not
1707+
* of the values (whose maps no path covers), or a values map below which
1708+
* a change was made (it may hold another's map now) cannot be poisoned
1709+
* whole */
1710+
if (deep && (hv_poisoned(st, v) || (v->path && !v->path[0]) || (v->k == HV_JSON && !v->path) ||
1711+
(v->path && hst_changed_below(st, v->path)))) {
16721712
return false;
16731713
}
16741714
if (deep && v->k == HV_MAP) {
@@ -1681,7 +1721,7 @@ static bool hst_poison_at(hst_t *st, const hv_t *v, bool deep, int depth) {
16811721
}
16821722
char key[CBM_SZ_32];
16831723
snprintf(key, sizeof(key), "%p", map);
1684-
if (!hst_set_add(st, &st->poison_maps, key)) {
1724+
if (!hst_set_add(st, &st->poison_maps, key) || (v->path && !hst_record_change(st, v->path))) {
16851725
return false;
16861726
}
16871727
return !(deep && v->path) || hst_set_add(st, &st->poison_paths, v->path);
@@ -1935,12 +1975,15 @@ static void hst_capture_end(hst_t *st) {
19351975
p->keys[p->n] = whole ? keys : NULL;
19361976
p->n++;
19371977
}
1978+
/* the keys this capture recorded, one by one: a clear walks the set's
1979+
* whole capacity, which one huge capture leaves behind for every later
1980+
* one */
1981+
for (int i = 0; st->ckset && i < st->nck; i++) {
1982+
(void)cbm_ht_delete(st->ckset, st->ckeys[i]);
1983+
}
19381984
st->capture = -SKIP_ONE;
19391985
st->cap = (hsink_t){0};
19401986
st->nck = 0;
1941-
if (st->ckset) {
1942-
cbm_ht_clear(st->ckset);
1943-
}
19441987
}
19451988

19461989
/* Output of the top-level template: into the capture until its newline. */
@@ -2415,10 +2458,16 @@ static hv_t he_strfn(hst_t *st, const char *fn, const hv_t *a, int n) {
24152458
return HV_UNKNOWN;
24162459
}
24172460

2418-
/* Sprig functions that change a map in place. */
2461+
/* Sprig functions that change their argument in place: set / unset / merge
2462+
* a map, sortAlpha a []string (splitList, keys, regexSplit give one; a list
2463+
* is never poisoned, so it always counts as a change not run). Every other
2464+
* list function copies its argument (push, append, prepend, reverse, uniq,
2465+
* without, compact, rest, initial, concat, chunk) or reads it (first, last,
2466+
* has, slice -- which shares it but changes nothing). */
24192467
static bool he_mutator(const char *s, size_t n) {
24202468
static const char *const MUTATORS[] = {
2421-
"set", "unset", "merge", "mergeOverwrite", "mustMerge", "mustMergeOverwrite", NULL};
2469+
"set", "unset", "merge", "mergeOverwrite", "mustMerge", "mustMergeOverwrite",
2470+
"sortAlpha", NULL};
24222471
return hy_in(s, n, MUTATORS);
24232472
}
24242473

@@ -2478,8 +2527,8 @@ static bool he_is_fn(const char *s, size_t n, const char *name) {
24782527
* looked into), or an include / template of a name not known or of one that
24792528
* may (he_define_may_mutate). A variable's name ($set) is no call. */
24802529
static bool he_may_mutate(hst_t *st, const char *src, TSNode n, int depth) {
2481-
if (depth > HELM_MAX_NESTING) {
2482-
return true;
2530+
if (depth > HELM_MAX_NESTING || ts_node_has_error(n)) {
2531+
return true; /* a form the grammar rejects (Go may not) may hide a change */
24832532
}
24842533
TSTreeCursor cur = ts_tree_cursor_new(n);
24852534
bool found = false;
@@ -2514,6 +2563,9 @@ static bool he_may_mutate(hst_t *st, const char *src, TSNode n, int depth) {
25142563
return found || st->stop;
25152564
}
25162565

2566+
/* Memo states of he_define_may_mutate / he_file_may_mutate. */
2567+
enum { HM_NO = 1, HM_YES = 2, HM_BUSY = 3, HM_STALE = 4 };
2568+
25172569
/* The chart's template file an include names -- Helm names each one
25182570
* `<.Template.BasePath>/<file>` -- or NULL: none of this chart's. */
25192571
static const hd_file_t *he_template_file(hst_t *st, const char *name) {
@@ -2534,7 +2586,6 @@ static const hd_file_t *he_template_file(hst_t *st, const char *name) {
25342586
* while it is being scanned -- one including itself -- may. A no that leaned
25352587
* on a define still being scanned is not kept. */
25362588
static bool he_file_may_mutate(hst_t *st, const hd_file_t *f, int depth) {
2537-
enum { HM_NO = 1, HM_YES = 2, HM_BUSY = 3 };
25382589
if (!f->tree) {
25392590
return true;
25402591
}
@@ -2564,21 +2615,28 @@ static bool he_file_may_mutate(hst_t *st, const hd_file_t *f, int depth) {
25642615
* scanned again when next asked), so defines including each other never fix
25652616
* a wrong no -- a yes is final. */
25662617
static bool he_define_may_mutate(hst_t *st, const char *name, int depth) {
2567-
enum { HM_NO = 1, HM_YES = 2, HM_BUSY = 3, HM_STALE = 4 };
2568-
const hd_def_t *d = hd_find(st->defs, name);
2569-
if (!d) {
2570-
/* a template file of the chart by its name (the checksum idiom) is
2571-
* looked into; a name not the chart's (a library's) may */
2572-
const hd_file_t *f = he_template_file(st, name);
2573-
return f ? he_file_may_mutate(st, f, depth) : true;
2574-
}
25752618
if (!st->mutates) {
25762619
st->mutates = cbm_ht_create(0);
25772620
}
25782621
uintptr_t memo = st->mutates ? (uintptr_t)cbm_ht_get(st->mutates, name) : 0;
25792622
if (memo == HM_YES || memo == HM_NO) {
25802623
return memo == HM_YES;
25812624
}
2625+
const hd_def_t *d = hd_find(st->defs, name);
2626+
if (!d) {
2627+
/* a template file of the chart by its name (the checksum idiom) is
2628+
* looked into; a name not the chart's (a library's) may. Kept by
2629+
* name once final, so an include in a loop asks once */
2630+
const hd_file_t *f = he_template_file(st, name);
2631+
bool m = f ? he_file_may_mutate(st, f, depth) : true;
2632+
bool final =
2633+
m || (st->file_mutates && (uintptr_t)cbm_ht_get(st->file_mutates, f->rel) == HM_NO);
2634+
const char *key = final && st->mutates ? cbm_arena_strdup(st->a, name) : NULL;
2635+
if (key) {
2636+
cbm_ht_set(st->mutates, key, (void *)(uintptr_t)(m ? HM_YES : HM_NO));
2637+
}
2638+
return m;
2639+
}
25822640
if (memo == HM_BUSY) {
25832641
st->busy_hits++;
25842642
return false;
@@ -2988,7 +3046,15 @@ static hv_t he_call(hst_t *st, hframe_t *fr, TSNode call, const hv_t *piped) {
29883046
uint32_t total = na + (piped ? SKIP_ONE : 0);
29893047
for (uint32_t i = 0; i < total; i++) {
29903048
v = i < na ? he_eval(st, fr, ts_node_named_child(args, i)) : *piped;
2991-
if (v.k == HV_UNK) {
3049+
if (v.k == HV_UNK || hv_poisoned(st, &v)) {
3050+
/* its truth is not known (a poisoned map's either): whether
3051+
* the operands after it run is not, nor a change they make */
3052+
for (uint32_t j = i + SKIP_ONE; j < na; j++) {
3053+
if (he_may_mutate(st, fr->src, ts_node_named_child(args, j), st->nesting)) {
3054+
hst_taint(st, fn);
3055+
break;
3056+
}
3057+
}
29923058
return HV_UNKNOWN;
29933059
}
29943060
bool t = hv_truth(&v);
@@ -3212,20 +3278,25 @@ static int he_scan_skipped(hst_t *st, hframe_t *fr, TSNode n, bool in_range) {
32123278
return leave;
32133279
}
32143280

3215-
/* The children of n but its condition / collection (what was run), each:
3281+
/* The children of n but what was run -- its collection, its conditions up
3282+
* to `ran` (the one run; an else if / else with after it would be) -- each:
32163283
* the variables it would assign UNKNOWN, and a change of maps it may make
32173284
* (he_may_mutate) leaves every image after it UNKNOWN; returns how it would
32183285
* leave the loop. */
3219-
static int he_spoil_parts(hst_t *st, hframe_t *fr, TSNode n, const char *only, bool in_range) {
3286+
static int he_spoil_parts(hst_t *st, hframe_t *fr, TSNode n, TSNode ran, const char *only,
3287+
bool in_range) {
32203288
int leave = HL_NONE;
32213289
bool mutates = false;
3290+
bool after = false; /* past `ran` */
32223291
uint32_t cc = ts_node_child_count(n);
32233292
for (uint32_t i = 0; i < cc; i++) {
32243293
TSNode c = ts_node_child(n, i);
32253294
const char *f = ts_node_field_name_for_child(n, i);
3226-
if (!ts_node_is_named(c) || hn_is(c, "range_variable_definition") ||
3227-
(f && (strcmp(f, "condition") == 0 || strcmp(f, "range") == 0)) ||
3228-
(only && !(f && strcmp(f, only) == 0))) {
3295+
bool cond = f && strcmp(f, "condition") == 0;
3296+
bool was_run = cond && !after;
3297+
after = after || (cond && ts_node_eq(c, ran));
3298+
if (!ts_node_is_named(c) || hn_is(c, "range_variable_definition") || was_run ||
3299+
(f && strcmp(f, "range") == 0) || (only && !(f && strcmp(f, only) == 0))) {
32293300
continue;
32303301
}
32313302
leave |= he_scan_skipped(st, fr, c, in_range);
@@ -3237,16 +3308,17 @@ static int he_spoil_parts(hst_t *st, hframe_t *fr, TSNode n, const char *only, b
32373308
return leave;
32383309
}
32393310

3240-
/* The bodies of if / with / range n, not run because its condition or
3241-
* collection is UNKNOWN (that one was run): their output, the variables they
3242-
* would assign and a change they would make are UNKNOWN. A break / continue
3243-
* in them may or may not leave the loop around: what the rest of that loop's
3244-
* body would assign or change is UNKNOWN too, and a break leaves it now (its
3245-
* later iterations are not known), a continue this iteration. */
3246-
static void he_skipped(hst_t *st, hframe_t *fr, TSNode n) {
3311+
/* The bodies of if / with / range n, not run because its condition `ran` or
3312+
* its collection (a null `ran`) is UNKNOWN (that one was run): their output,
3313+
* the variables they -- and the conditions after `ran` -- would assign and a
3314+
* change they would make are UNKNOWN. A break / continue in them may or may
3315+
* not leave the loop around: what the rest of that loop's body would assign
3316+
* or change is UNKNOWN too, and a break leaves it now (its later iterations
3317+
* are not known), a continue this iteration. */
3318+
static void he_skipped(hst_t *st, hframe_t *fr, TSNode n, TSNode ran) {
32473319
hst_out_unknown(st, fr);
32483320
bool range = hn_is(n, "range_action");
3249-
int leave = he_spoil_parts(st, fr, n, NULL, range);
3321+
int leave = he_spoil_parts(st, fr, n, ran, NULL, range);
32503322
if (leave == HL_NONE) {
32513323
return;
32523324
}
@@ -3257,7 +3329,7 @@ static void he_skipped(hst_t *st, hframe_t *fr, TSNode n) {
32573329
loop = ts_node_parent(loop);
32583330
}
32593331
if (hn_is(loop, "range_action")) {
3260-
(void)he_spoil_parts(st, fr, loop, "body", true);
3332+
(void)he_spoil_parts(st, fr, loop, (TSNode){0}, "body", true);
32613333
}
32623334
if (leave & HL_BREAK) {
32633335
st->brk = true;
@@ -3293,7 +3365,7 @@ static void he_branches(hst_t *st, hframe_t *fr, TSNode n, bool with) {
32933365
if (v.k == HV_UNK || hv_poisoned(st, &v)) {
32943366
stop = true;
32953367
active = false;
3296-
he_skipped(st, fr, n); /* which branch renders is unknown */
3368+
he_skipped(st, fr, n, c); /* which branch renders is unknown */
32973369
continue;
32983370
}
32993371
active = hv_truth(&v);
@@ -3331,7 +3403,7 @@ static void he_range(hst_t *st, hframe_t *fr, TSNode n) {
33313403
}
33323404
hv_t coll = he_eval(st, fr, expr);
33333405
if (coll.k == HV_UNK || hv_poisoned(st, &coll)) {
3334-
he_skipped(st, fr, n);
3406+
he_skipped(st, fr, n, (TSNode){0});
33353407
return;
33363408
}
33373409
hv_t *items = NULL;
@@ -3472,6 +3544,9 @@ static hv_t he_render_define(hst_t *st, const char *name, hv_t arg, hsink_t *int
34723544
hst_taint(st, "include"); /* nested too deep: not run */
34733545
return HV_UNKNOWN;
34743546
}
3547+
if (ts_node_has_error(d->node)) {
3548+
hst_taint(st, "parse"); /* a form the grammar rejects may hide a change */
3549+
}
34753550
int mark = st->nvars;
34763551
hframe_t sub = {.src = d->file->src, .dot = arg, .var_base = st->nvars, .out = into};
34773552
hst_var_push(st, "", 0, arg);
@@ -3584,6 +3659,11 @@ bool cbm_helm_render(CBMArena *a, const char *rel, const char *src, size_t len,
35843659
uint32_t *lines = cbm_arena_alloc(&work, (size_t)nl * sizeof(*lines));
35853660
TSTree *tree = lines ? ts_parser_parse_string(st.parser, NULL, src, (uint32_t)len) : NULL;
35863661
if (tree) {
3662+
/* a template that does not parse may hide a change (Go may take a
3663+
* form the grammar rejects): no image of it is known */
3664+
if (ts_node_has_error(ts_tree_root_node(tree))) {
3665+
hst_taint(&st, "parse");
3666+
}
35873667
int k = 0;
35883668
lines[k++] = 0;
35893669
for (size_t i = 0; i < len; i++) {

0 commit comments

Comments
 (0)