Repository navigation
fix(security,cbinding): scan raw-text statements, recover from panics in C exports - #871
Open
ajitpratap0 wants to merge 1 commit into
Open
ajitpratap0 wants to merge 1 commit into
ajitpratap0 wants to merge 1 commit into
Conversation
… in C exports - Scanner.Scan(tree) scans standalone VALUES and statements the parser keeps as text (utility, SET, transaction, USE, unsupported, T-SQL blocks, PREPARE/EXECUTE, CREATE POLICY/TRIGGER) with the ScanSQL rules, so payloads such as VALUES (SLEEP(5)) and IF 1=1 WAITFOR DELAY are reported; no finding is reported twice. - Every C-binding export recovers from a panic and returns its normal error result with a fixed message instead of crashing the host. - DialectExtras()/DialectModifiers() read accessors return values, so the shared zero-value stand-ins can no longer be mutated through them; EnsureExtras() stays the mutable path. No new allocations. - tokscratch panics with a clear message when the tokenizer is not linked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @ajitpratap0's task in 20s —— View job Review of PR #871I read the diff for the scanner, C binding recovery, Scanner (
C binding (
AST accessors (
Tests
Verdict: Approve-worthy once you decide on the "shallow copy" doc wording. The other points are optional. |
This branch was successfully deployed
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
Follow-ups from the pre-merge security and AST reviews of #866–#868:
Scanner.Scan(tree)now sees newly parseable statements. StandaloneVALUESand every statement the parser keeps as raw text go through theScanSQLrules: utility,SET, transaction,USE, unsupported, T-SQLIF/WHILE/BEGINbodies,PREPARE/EXECUTE,CREATE POLICY/TRIGGER.VALUES (SLEEP(5))andIF 1=1 WAITFOR DELAY '0:0:5'are now reported as TIME_BASED. Each statement takes exactly one path, so nothing is reported twice.//exportrecovers from a panic and returns its normal error result with a fixed message. A panic can no longer crash the host process, and panic values (which may contain SQL or paths) are not exposed.DialectExtras()/DialectModifiers()return values instead of pointers to shared zero values, so a caller can no longer mutate every node through them.EnsureExtras()remains the mutable path. These accessors are unreleased, so the signature change is safe.internal/tokscratchpanics with a clear message if the tokenizer isn't linked.Test Plan
gofmt,go vet,golangci-lint run(0 issues),task test:race,task test:cbindingScanSQLproduced is preserved, andScan(tree)now matchesScanSQLon the newly parseable statementsBenchmarkRealWorldParseFormatvs main, 4 interleaved runs: median 9.68 vs 9.63 ms/op, same B/op and allocs/opBreaking Changes
DialectExtras()/DialectModifiers()now return values (SelectExtras,FunctionExtras,BinaryExtras,InsertDialectFields,DMLTargetFields,TableModifiers) instead of pointers. These were added after v1.16.0 and are unreleased.🤖 Generated with Claude Code
https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2