Skip to content

Take js-yaml 5, with guards for the two behaviour changes it brings - #17

Merged
repsecure merged 1 commit into
mainfrom
agent/3.1-js-yaml
Aug 5, 2026
Merged

Take js-yaml 5, with guards for the two behaviour changes it brings#17
repsecure merged 1 commit into
mainfrom
agent/3.1-js-yaml

Conversation

@repsecure

Copy link
Copy Markdown
Owner

Takes js-yaml 5.2.3, pinned exactly, and supersedes Dependabot #7 which bumps the range without the guards this change needs.

Policy files are YAML and are attacker-adjacent input, so this was reviewed against the API surface we actually call (5 files, load and dump only, no custom schemas or tags) with a 38-case differential probe run side by side on 4.3.1 and 5.2.3. The security-relevant behaviour is unchanged: duplicate mapping keys are still rejected, unknown tags still throw so !!js/function and !!python/object gadget payloads remain refused, and there is no prototype pollution via __proto__ or constructor.prototype. Starter config and policy dumps are byte-identical, including quoting of yes, 0777, 1:30 and 2026-01-02.

Two operator-visible changes did surface, and both are now guarded and tested rather than discovered in production:

  • an unparseable policy file must still leave the previous ruleset in force
  • an unparseable agent-harness config must degrade one dashboard panel, not the dashboard

@types/js-yaml is removed because 5.x ships its own types.

Falsifiers: removing the dashboard guard fails 3 of 4 new cases; making reload() clear its rules on error fails all 4 policy cases. Both restore clean.

js-yaml 5 loads with the YAML 1.2 core schema. Two of the resulting
differences reach code that reads attacker-adjacent files.

load() now throws on a stream that contains no document. The dashboard
reads the agent harness's own config.yaml, a file Agentwall does not own,
so a comment-only or half-written one would take the whole dashboard
state build down rather than one panel. summarizeYamlSource returns the
unknown summary on any parse failure, which covers malformed input too.

Merge keys are no longer expanded, so a policy file that relies on << now
fails schema validation and is rejected whole. FileBackedPolicyRuntime
keeps the last good ruleset on any reload failure; the new cases pin that
for parser-level rejection, not just schema-level rejection.

@types/js-yaml is dropped because js-yaml 5 ships its own declarations.
js-yaml is exact-pinned per the runtime dependency policy.

Verified: require('js-yaml') resolves the CommonJS build and round-trips
load and dump on node 24.14.1; dump output for the config and policy
shapes is byte-identical to 4.3.1; the shipped examples carry no merge
keys, YAML 1.1 booleans, leading-zero octals, or sexagesimal scalars.

Signed-off-by: reesebuilt <126643625+reesepj@users.noreply.github.com>
@repsecure
repsecure merged commit f90407e into main Aug 5, 2026
4 checks passed
@repsecure
repsecure deleted the agent/3.1-js-yaml branch August 5, 2026 02:57
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