Repository navigation
feat(lint): recognize arrowbricks SQL calls - #82
Merged
Merged
Conversation
aersam
marked this pull request as ready for review
October 12, 2026 07:36
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…agent, stream_query_json) Injection rules apply with Databricks-dialect parsing and arrowbricks-specific fix hints; the postgres house style is not applied to them. unsafe_sql(x) is checked like cast(LiteralString, x). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- scope the *_sql complexity suppression: a name also handed to a psycopg sink keeps the check - recognise execute(sql=...) in arrowbricks files, import aliases and attribute chains of the free stream_query_json, a starred first argument with the sql= keyword - fix hints name params=/parameters= correctly and stay neutral for a plain .execute() - tests prove recognition (13 fail without the feature), plus find-injection coverage Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
bdt lintandbdt find-injectionnow recognize arrowbricks (the Databricks SQL client), which gained t-strings andLiteralStringtyping in 6.1.0.What
Cursor.execute/execute_streamed,DatabricksClient.query_agent/stream_query_json, and the freearrowbricks.stream_query_json(client, sql)(SQL is its second argument; also underfrom arrowbricks import stream_query_json as xandarrowbricks[._streaming].…).sql=keyword works. The three new names match by name anywhere, like pgdevkit'sfetch_all(a client injected from another module is the common case).%/.format()) apply to them, with a fix hint pointing at an arrowbricks t-string ({value}binds,{name:i}identifier) orparameters=[...]/params=[...]. The postgres house style (sql-inline-too-complex,sql-positional-param,sql-forbidden-join) is not applied: Databricks SQL isn't postgres.QUALIFY, …), so such f-strings are no longer missed. A plain.execute()gets the extra dialect only in a file that importsarrowbricks(and keeps the postgres rules there, since it may be a psycopg cursor); everything else is unchanged.unsafe_sql(x)(arrowbricks' typing-only escape hatch) is treated likecast(LiteralString, x): only as safe asx;bdt find-injectionraisessql-unverified-castforunsafe_sql(request_sql). t-strings were already trusted.*_sqlliteral passed only to an arrowbricks call skips the complexity check at its assignment (not when the same name also reaches a psycopg sink).Verification
bdt lintis clean,bdt find-injectionlists eachunsafe_sql(sql)for review, as intended.Known trade-offs
agent.query_agent(f"select …")whose text parses as SQL is flagged (same by-name approach as pgdevkit).unsafe_sqlis recognized in any file, not only arrowbricks ones.🤖 Generated with Claude Code
Claude Session: 5d82abe3-e5c6-5795-9028-095258572af3