fix(types): validate unsafe boundary casts#830
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. It replaces three high-risk TypeScript assertions at request/internal-session/API trust boundaries with Zod
safeParsevalidation, following the TypeScript Coding Standards unsafe-cast / parse-don't-assert guidance and the Zod boundary-validation pattern established in PR #807.packages/control-plane/src/routes/session-child-spawn.ts:36(await request.json()) as SpawnChildSessionRequestfor child session creation inputspawnChildSessionRequestSchemawithz.inferas the type source and validate the request body withsafeParse, preserving the existing 400title and prompt are requiredpathpackages/control-plane/src/routes/session-child-spawn.ts:82(await spawnContextRes.json()) as SpawnContextfor parent session state used to initialize child sessionsspawnContextSchemawith nullable fields modeled explicitly and validate the internal response withsafeParse, preserving the existing 500Failed to get parent session contextpathpackages/github-bot/src/github-auth.ts:132(await response.json()) as { permission: string }for GitHub collaborator permission authorization responsesafeParse, preserving{ hasPermission: false, error: true }on malformed API responsesVerification:
npm test -w @open-inspect/shared -- src/types/boundary-schemas.test.tsnpm test -w @open-inspect/github-bot -- test/github-auth.test.tsnpm test -w @open-inspect/control-plane -- src/router.spawn-child.test.ts@open-inspect/sharedrebuild refreshed the new exportsnpm run build -w @open-inspect/sharednpm run build -w @open-inspect/control-planenpm run build -w @open-inspect/github-botnpm test -w @open-inspect/sharednpm test -w @open-inspect/control-planenpm test -w @open-inspect/github-botnpm run typechecknpm run lint.opencode/tooling directory out of the workspace so the root lint command evaluated tracked repository filesnpm run formatgit diff --checkReferences: TypeScript Coding Standards unsafe-cast / parse-don't-assert guidance; Zod boundary-validation pattern established in PR #807.
Created with Open-Inspect