Skip to content

Add CockroachDB error-based fingerprints (PostgreSQL fork)#6067

Open
potato-20 wants to merge 1 commit into
sqlmapproject:masterfrom
potato-20:add-cockroachdb-error-fingerprints
Open

Add CockroachDB error-based fingerprints (PostgreSQL fork)#6067
potato-20 wants to merge 1 commit into
sqlmapproject:masterfrom
potato-20:add-cockroachdb-error-fingerprints

Conversation

@potato-20
Copy link
Copy Markdown
Contributor

CockroachDB is already handled as a PostgreSQL fork by the active fingerprint (VERSION() LIKE '%CockroachDB%'), but data/xml/errors.xml had no passive (error-message) signatures for it — so error-based detection couldnʼt flag a CockroachDB backend the way it already does for the MySQL forks (MariaDB / TiDB / MemSQL).

This adds two CockroachDB-specific signatures under the existing <dbms value="PostgreSQL"> block:

<error regexp="at or near &quot;[^&quot;]*&quot;: syntax error" fork="CockroachDB"/>
<error regexp="See: https?://(go\.crdb\.dev|github\.com/cockroachdb)" fork="CockroachDB"/>
  • The first matches CockroachDBʼs location-first syntax error (at or near "x": syntax error), which is distinct from PostgreSQLʼs verb-first syntax error at or near "x".
  • The second matches the go.crdb.dev / github.com/cockroachdb link CockroachDB emits in error hints.

Validation (CockroachDB v26.2, Docker)

Ran the real DB and fed its errors through htmlParser():

Input resolved DBMS forkNote
CockroachDB syntax error PostgreSQL CockroachDB
CockroachDB "not yet implemented" hint PostgreSQL CockroachDB
genuine PostgreSQL error PostgreSQL (none)
genuine MySQL error MySQL (none)
unrelated page containing similar prose (none) (none)

So CockroachDB now resolves to the PostgreSQL family annotated as the CockroachDB fork, with no false attribution for real PostgreSQL/MySQL or unrelated pages. Each signature carries a CockroachDB-specific token to keep false positives near zero. data/txt/sha256sums.txt regenerated for the modified file; --smoke passes.

(Follows the existing fork-signature pattern and the precedent of recent DBMS-detection additions like Snowflake #5980.)

CockroachDB is already recognized as a PostgreSQL fork by the active
fingerprint, but data/xml/errors.xml had no passive (error-message)
signatures for it, so error-based detection couldn't flag a CockroachDB
backend the way it does for the existing MySQL forks (MariaDB/TiDB/MemSQL).

Add two CockroachDB-specific error signatures under the PostgreSQL block:
  - the location-first syntax error ('at or near "...": syntax error',
    distinct from PostgreSQL's 'syntax error at or near ...')
  - the go.crdb.dev / github.com/cockroachdb reference link emitted in
    CockroachDB error hints

Validated against CockroachDB v26.2 (Docker): htmlParser() resolves these
to PostgreSQL with forkNote='CockroachDB', while genuine PostgreSQL/MySQL
errors and unrelated pages are unaffected (no false attribution). Each
signature carries a CockroachDB-specific token to avoid false positives.
sha256sums.txt regenerated; smoke test passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant