13
0
Fork 0
mirror of https://github.com/yannh/kubeconform.git synced 2026-07-03 18:09:30 +00:00
Commit graph

15 commits

Author SHA1 Message Date
Nikolai Emil Damm
d3ae574bf2
fix: copy scanner bytes in FromStream to prevent aliasing data race
FromStream set each Resource's Bytes to scanner.Bytes(), which aliases
the bufio.Scanner's internal buffer. Resources are emitted on a channel
and retained/parsed by the consumer concurrently with the producer
goroutine; when the scanner refills its buffer for later documents it
overwrites the slices earlier Resources still point at. Consumers that
parse resources as they arrive (e.g. ValidateWithContext) then read
corrupted bytes — a later document spliced into the one being parsed —
surfacing as non-deterministic YAML parse errors on large multi-document
streams (a different resource fails on each run).

Clone the scanner bytes so each Resource owns its slice. Adds a
regression test that streams >4MB (forcing the scanner to refill) and
asserts every resource's bytes are intact after draining.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 02:50:27 +02:00
Yann Hamon
ab4745ddf0 Small clean-up 2021-09-26 22:55:01 +02:00
Yann Hamon
b5c823d6b5 Also read up to 256MB from stdin 2021-09-26 17:45:27 +02:00
Yann Hamon
4eb75860d9 support for lists 2021-07-03 15:49:37 +02:00
Christoph Mertz
65968cf540 remove gosimple offences 2021-02-19 17:01:54 +01:00
Yann Hamon
031f83cbde linting 2020-12-15 22:20:02 +01:00
Yann Hamon
7d9bb98a35 increase max size of k8s resource 2020-11-15 17:05:11 +01:00
Yann Hamon
4ae74305d1 Updated names for schema-location vars, added documentation, updated openapi2jsonschema 2020-11-15 16:19:49 +01:00
Yann Hamon
94f8e9e631 fix race condition when shutting down 2020-11-11 22:50:59 +01:00
Yann Hamon
3a2d4705f5 better yaml splitting - not perfect but similar to k8s - fix path logging 2020-11-08 23:48:02 +01:00
Yann Hamon
d64a376779 do not buffer all of stdin before starting to process resources 2020-11-08 22:54:41 +01:00
Yann Hamon
4b16128b75 Add comments to most exported functions/types 2020-11-08 22:35:17 +01:00
Yann Hamon
358f145023 Add support for -exit-on-error 2020-11-08 10:08:14 +01:00
Yann Hamon
0a7f885768 Refactor resource discovery 2020-11-01 20:09:48 +01:00
Yann Hamon
1bc9283240 refactor 2020-11-01 16:28:32 +01:00