dbrecon

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package dbrecon runs read-only data-plane recon against a database connection string. Enforcement is structural: each engine runs ONLY a fixed allowlist of catalog/metadata queries (no user input is ever interpolated), and the session is put into read-only mode where the engine supports it.

This path is separate from the HTTP recon client because it speaks native DB protocols; the consent gate (--intrusive) and dry-run check live in the calling module, which only invokes Recon when both Live and Intrusive hold.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAuthError

func IsAuthError(err error) bool

IsAuthError reports whether a recon error is an authentication rejection (the server reached us and refused the credential) as opposed to a network/reach failure (which says nothing about the credential's validity). It is used to classify a credential as DEAD only when it was actually rejected.

We deliberately do NOT treat "unauthorized"/"not authorized" as an auth failure: those mean the credential authenticated but lacks privilege — i.e. it is valid. Matching is on stable SQLSTATE/driver codes plus engine-specific rejection phrases.

func Recon

func Recon(ctx context.Context, dsn string) ([]module.Finding, error)

Recon connects read-only and returns live catalog findings. The caller must have already confirmed Live && Intrusive.

func ReconSQLiteFile

func ReconSQLiteFile(ctx context.Context, path string) ([]module.Finding, error)

ReconSQLiteFile opens a SQLite database file read-only and reports what's in it: the table count, and a row count for any sensitively-named table. The path must already be absolute (the caller resolves it against the source file's directory). Read-only by construction: opened mode=ro with query_only, and only SELECT/metadata queries run.

func Supported

func Supported(dsn string) bool

Supported reports whether dbrecon can exercise the given DSN scheme live.

Types

type KVSecret

type KVSecret struct{ Key, Value string }

KVSecret is one plaintext key/value row pulled from an IDE token store.

func ReconVSCDBFile

func ReconVSCDBFile(ctx context.Context, path string) ([]module.Finding, []KVSecret, error)

ReconVSCDBFile reads a VS Code / Cursor "state.vscdb" — a plaintext SQLite key/value store (ItemTable) that AI IDEs use to hold OAuth/access tokens with no isolation — and reports which credential keys it holds, returning the plaintext token values for re-triage. Read-only by construction (mode=ro, query_only) against a fixed key allowlist (no user input interpolated). Encrypted/binary values are skipped: plaintext stores only, never OS-keychain decryption.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL