Skip to content

[codex] Sanitize YAML schema diagnostics#3427

Merged
juliusmarminge merged 1 commit into
mainfrom
codex/safe-yaml-schema-diagnostics
Jun 20, 2026
Merged

[codex] Sanitize YAML schema diagnostics#3427
juliusmarminge merged 1 commit into
mainfrom
codex/safe-yaml-schema-diagnostics

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • replace raw YAML source excerpts with parser code and line/column diagnostics
  • prevent arbitrary stringify exceptions from becoming schema error messages
  • cover parse and encode failures with behavior tests that verify sensitive values stay out of rendered diagnostics

SchemaGetter failures are constrained to SchemaIssue.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.ts
  • vp check
  • vp run typecheck

Note

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 SchemaIssue diagnostics.

Parse failures use a new formatYamlParseError that reports only YAMLParseError code plus optional line/column, and parseYaml attaches Option.none() instead of the offending string to InvalidValue. Encode failures always use the fixed message Failed to stringify YAML. with no underlying error text.

Tests assert malformed YAML and toJSON throw paths keep embedded secrets out of error.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

  • parseYaml now emits a sanitized message Invalid YAML (code=..., line=..., column=...) and excludes the original input from the SchemaIssue when parsing fails.
  • stringifyYaml now emits a fixed message Failed to stringify YAML. and excludes the input value when stringification fails.
  • A new formatYamlParseError helper returns Invalid YAML. for non-YAMLParseError inputs and a structured sanitized message for YAMLParseError.
  • Tests in schemaYaml.test.ts verify that secret values are not present in error output for both parse and stringify failures.

Macroscope summarized 7b4c1ae.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2e0d186c-6f8e-47bb-95db-181a400a3cb5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/safe-yaml-schema-diagnostics

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge
juliusmarminge force-pushed the codex/safe-yaml-schema-diagnostics branch from 8f38b61 to 7b4c1ae Compare June 20, 2026 18:52
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

@juliusmarminge
juliusmarminge merged commit 6888276 into main Jun 20, 2026
16 checks passed
@juliusmarminge
juliusmarminge deleted the codex/safe-yaml-schema-diagnostics branch June 20, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant