fix(types): validate script JSON boundaries - #1679
Open
open-inspect[bot] wants to merge 1 commit into
Open
Conversation
Terraform Validation Results
Pushed by: @open-inspect[bot], Action: |
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.
This is an automated nightly unsafe-cast remediation sweep. It replaces selected unsafe TypeScript casts at external/opaque JSON boundaries with local parse-and-validate guards, following the TypeScript Coding Standards guidance for unsafe casts / parse-don't-assert and the Zod boundary-validation pattern established in PR #807. These two script-local boundaries do not justify a new dependency, so the fixes use narrow inline structural guards instead of adding a schema library at the root.
scripts/cf-logs.ts:394await response.json()asserted as a response objectparseTelemetryQueryResponseto parse asunknown, require the consumedsuccessboolean, and safely extract optional errors/events fields.scripts/merge-split-users.ts:144JSON.parse(child.stdout)asserted asWranglerQueryResult[]parseWranglerQueryResultsto parse asunknown, require array entries with a booleansuccess, and safely extractresults/meta.changes.Verification:
npm run build -w @open-inspect/sharednpm run typechecknpm run lintnpm run formatgit diff --checkUnit tests: not applicable for this sweep because only root scripts were touched and no workspace package test seam exists for these side-effecting CLI scripts.
Created with Open-Inspect