fix(config): validate storage and unknown fields in Parse, wire max_message_bytes (audit #12) - #258
Merged
Merged
Conversation
|
|
sbalabanov
marked this pull request as ready for review
August 3, 2026 21:18
sbalabanov
force-pushed
the
audit/fix-12-config-hardening
branch
from
August 5, 2026 00:01
2d301d4 to
10c17ad
Compare
…essage_bytes (audit #12) Move storage type/root_path validation from example/main.go into config.Parse so all embedders get it. Switch to strict YAML decoding (DisallowUnknownField) to reject typos. Set query_timeout default (900s) in Parse instead of letting zero leak to core/bazel. Wire MaxMessageBytes into controller construction in example/main.go. Document field defaults and constraints. Add config_test.go covering all defaults and rejection branches. Update example/README.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sbalabanov
force-pushed
the
audit/fix-12-config-hardening
branch
from
August 5, 2026 00:25
addb13d to
345579b
Compare
yushan8
approved these changes
Aug 5, 2026
xytan0056
approved these changes
Aug 5, 2026
|
|
||
| // ParseBytes parses the full configuration from raw YAML bytes. | ||
| // Unknown YAML fields are rejected. | ||
| func ParseBytes(yamlBytes []byte) (*Config, error) { |
Contributor
There was a problem hiding this comment.
no need to export, only used in this config package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Config validation had several gaps: storage type/root_path checks lived only in the example binary, unknown YAML fields were silently accepted,
query_timeouthad no default inParse,MaxMessageByteswas parsed but not wired to the controller, field defaults were undocumented, and the config package had zero tests.config.Parseso all embedders get itDisallowUnknownField) to reject unknown fieldsquery_timeoutdefault (900s / 15 min) inParse, matching core/bazel's_queryTimeoutMaxMessageBytesinto controller construction inexample/main.goRepoManagerClonePath,WorkerRootPath, andQueryTimeoutfieldsconfig/config_test.gowith table-driven tests covering all defaults and rejection branchesexample/README.md: remove nonexistent "default branch" reference, documentfull_hash_repos,bazel_command,bazel_extra_args,stream_bazel_logs,max_message_bytesTest plan
go build ./...passesgo test ./...passes (all existing tests including orchestrator testdata)make gazelleproduces no further changesconfig/config_test.gocovers defaults, storage validation, unknown field rejection, and all error paths🤖 Generated with Claude Code