[codex] Sanitize YAML schema diagnostics#3427
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Co-authored-by: codex <codex@users.noreply.github.com>
8f38b61 to
7b4c1ae
Compare
ApprovabilityVerdict: Approved Security hardening change that sanitizes YAML error messages to prevent sensitive data leakage. The changes are well-scoped, defensive in nature, and include tests verifying that input values don't appear in error output. You can customize Macroscope's approvability policy. Learn more. |
Summary
SchemaGetterfailures are constrained toSchemaIssue.Issue, which has no cause channel; this preserves the safe structural context that representation supports without leaking third-party messages.Validation
vp test packages/shared/src/schemaJson.test.ts packages/shared/src/schemaYaml.test.tsvp checkvp run typecheckNote
Medium Risk
Touches shared validation error surfaces where secrets could have leaked; behavior is intentionally narrower but may reduce debug detail for operators.
Overview
YAML schema helpers no longer surface raw parser messages, input snippets, or stringify exception text in
SchemaIssuediagnostics.Parse failures use a new
formatYamlParseErrorthat reports onlyYAMLParseErrorcodeplus optional line/column, andparseYamlattachesOption.none()instead of the offending string toInvalidValue. Encode failures always use the fixed messageFailed to stringify YAML.with no underlying error text.Tests assert malformed YAML and
toJSONthrow paths keep embedded secrets out oferror.message.Reviewed by Cursor Bugbot for commit 7b4c1ae. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Sanitize YAML schema diagnostics to prevent leaking raw input or error details
parseYamlnow emits a sanitized messageInvalid YAML (code=..., line=..., column=...)and excludes the original input from theSchemaIssuewhen parsing fails.stringifyYamlnow emits a fixed messageFailed to stringify YAML.and excludes the input value when stringification fails.formatYamlParseErrorhelper returnsInvalid YAML.for non-YAMLParseErrorinputs and a structured sanitized message forYAMLParseError.Macroscope summarized 7b4c1ae.