@carllee1983/dbcli 1.47.0 → 1.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor/rules/dbcli.mdc +4 -1
- package/.cursor/skills/dbcli/reference.md +15 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/.github/skills/dbcli/SKILL.md +4 -1
- package/.github/skills/dbcli/reference.md +15 -1
- package/CHANGELOG.md +95 -0
- package/assets/SKILL.md +4 -1
- package/assets/reference.md +15 -1
- package/dist/cli.mjs +18839 -7091
- package/dist/core.d.ts +86 -3
- package/dist/core.mjs +617 -58
- package/gemini-extension.json +1 -1
- package/package.json +3 -2
- package/plugins/dbcli-agent/.codex-plugin/plugin.json +1 -1
- package/plugins/dbcli-agent/skills/dbcli/SKILL.md +4 -1
- package/plugins/dbcli-agent/skills/dbcli/reference.md +15 -1
- package/skills/dbcli/SKILL.md +4 -1
- package/skills/dbcli/reference.md +15 -1
package/dist/core.d.ts
CHANGED
|
@@ -560,6 +560,12 @@ export interface QueryResult<T> {
|
|
|
560
560
|
/** Internal row-limit proof, mapped into public JSON metadata by the formatter. */
|
|
561
561
|
appliedLimit?: AppliedLimitMetadata;
|
|
562
562
|
}
|
|
563
|
+
declare const SQL_DIALECTS: readonly [
|
|
564
|
+
"postgresql",
|
|
565
|
+
"mysql",
|
|
566
|
+
"mariadb"
|
|
567
|
+
];
|
|
568
|
+
type SqlDialect = (typeof SQL_DIALECTS)[number];
|
|
563
569
|
/**
|
|
564
570
|
* Manager class for loading and querying blacklist rules.
|
|
565
571
|
* Instantiate once per CLI invocation.
|
|
@@ -601,6 +607,16 @@ export declare class BlacklistManager {
|
|
|
601
607
|
* @returns Array of blacklisted column names, or empty array if none
|
|
602
608
|
*/
|
|
603
609
|
getBlacklistedColumns(tableName: string): string[];
|
|
610
|
+
/**
|
|
611
|
+
* Every blacklisted column name, across all tables.
|
|
612
|
+
*
|
|
613
|
+
* Used when a statement's tables could not be identified: applying every
|
|
614
|
+
* rule is the reading of "I do not know which table this came from" that
|
|
615
|
+
* does not disclose data.
|
|
616
|
+
*
|
|
617
|
+
* @returns Array of blacklisted column names, deduplicated
|
|
618
|
+
*/
|
|
619
|
+
getAllBlacklistedColumns(): string[];
|
|
604
620
|
/**
|
|
605
621
|
* Check if the blacklist override is enabled via environment variable.
|
|
606
622
|
* When true, all blacklist checks are bypassed.
|
|
@@ -630,10 +646,50 @@ export declare class BlacklistValidator {
|
|
|
630
646
|
*
|
|
631
647
|
* @param operation SQL operation type: SELECT, INSERT, UPDATE, DELETE
|
|
632
648
|
* @param tableName Table name to check
|
|
633
|
-
* @param
|
|
634
|
-
* @throws BlacklistError if table is blacklisted
|
|
649
|
+
* @param tableList Further tables the same statement references
|
|
650
|
+
* @throws BlacklistError if any table is blacklisted
|
|
651
|
+
*/
|
|
652
|
+
checkTableBlacklist(operation: string, tableName: string, tableList?: string[]): void;
|
|
653
|
+
/**
|
|
654
|
+
* Check every table a statement references.
|
|
655
|
+
*
|
|
656
|
+
* A statement is blocked when *any* referenced table is blacklisted — the
|
|
657
|
+
* table reached through a JOIN, a comma, or a UNION branch is as sensitive as
|
|
658
|
+
* the one named first (issue #23).
|
|
659
|
+
*
|
|
660
|
+
* @param operation SQL operation type: SELECT, INSERT, UPDATE, DELETE
|
|
661
|
+
* @param tableNames Every table the statement references
|
|
662
|
+
* @throws BlacklistError if any table is blacklisted
|
|
663
|
+
*/
|
|
664
|
+
checkTablesBlacklist(operation: string, tableNames: string[]): void;
|
|
665
|
+
/**
|
|
666
|
+
* Check an Elasticsearch index expression against the table blacklist.
|
|
667
|
+
*
|
|
668
|
+
* `--index` is not a name: Elasticsearch accepts a comma list and wildcards,
|
|
669
|
+
* so `secrets,orders`, `sec*`, `*` and `_all` all read a blacklisted index
|
|
670
|
+
* while matching no blacklist entry by equality. Concrete names are checked
|
|
671
|
+
* directly; a wildcard is refused when it *could* match a blacklisted index,
|
|
672
|
+
* since which indices exist is server-side knowledge.
|
|
673
|
+
*
|
|
674
|
+
* @param operation Operation label for the error message
|
|
675
|
+
* @param target Raw `--index` expression
|
|
676
|
+
* @throws BlacklistError if any named or matchable index is blacklisted
|
|
635
677
|
*/
|
|
636
|
-
|
|
678
|
+
checkIndexBlacklist(operation: string, target: string): void;
|
|
679
|
+
/**
|
|
680
|
+
* Mask result fields for an Elasticsearch index *expression*.
|
|
681
|
+
*
|
|
682
|
+
* `filterColumns` looks the name up by equality, so `--index 'us*'` or
|
|
683
|
+
* `--index 'users,orders'` matched no rule and returned every protected field
|
|
684
|
+
* — the table check passing is not enough when only columns are blacklisted.
|
|
685
|
+
* A wildcard is resolved server-side, so every rule it could reach is
|
|
686
|
+
* applied.
|
|
687
|
+
*
|
|
688
|
+
* @param target Raw `--index` expression
|
|
689
|
+
* @param rows Result documents
|
|
690
|
+
* @param columnList Field names in the result
|
|
691
|
+
*/
|
|
692
|
+
filterColumnsForIndexExpression(target: string, rows: Record<string, unknown>[], columnList: string[]): FilterColumnsResult;
|
|
637
693
|
/**
|
|
638
694
|
* Reject a write that touches blacklisted columns.
|
|
639
695
|
* Computes the intersection of `fields` with the table's column blacklist
|
|
@@ -656,6 +712,22 @@ export declare class BlacklistValidator {
|
|
|
656
712
|
* @returns Filtered rows and list of omitted column names
|
|
657
713
|
*/
|
|
658
714
|
filterColumns(tableName: string, rows: Record<string, unknown>[], columnList: string[]): FilterColumnsResult;
|
|
715
|
+
/**
|
|
716
|
+
* Filter blacklisted columns using the rules of every referenced table.
|
|
717
|
+
*
|
|
718
|
+
* A result set built from a JOIN carries columns from several tables, and the
|
|
719
|
+
* driver returns them unqualified — `u.password_hash` arrives as
|
|
720
|
+
* `password_hash`. Attribution is therefore not recoverable from the result,
|
|
721
|
+
* so a column blacklisted on *any* referenced table is omitted. That errs
|
|
722
|
+
* towards hiding a same-named column of an innocent table, which is the
|
|
723
|
+
* direction that does not disclose data.
|
|
724
|
+
*
|
|
725
|
+
* @param tableNames Every table the statement references
|
|
726
|
+
* @param rows Query result rows
|
|
727
|
+
* @param columnList Column names in result set
|
|
728
|
+
* @returns Filtered rows and list of omitted column names
|
|
729
|
+
*/
|
|
730
|
+
filterColumnsForTables(tableNames: string[], rows: Record<string, unknown>[], columnList: string[]): FilterColumnsResult;
|
|
659
731
|
/**
|
|
660
732
|
* Build a security notification message for omitted columns.
|
|
661
733
|
*
|
|
@@ -2833,7 +2905,18 @@ export declare class QueryExecutor {
|
|
|
2833
2905
|
connectionName?: string;
|
|
2834
2906
|
recovery?: boolean;
|
|
2835
2907
|
deferDiagnostics?: boolean;
|
|
2908
|
+
/**
|
|
2909
|
+
* Quoting rules that decide what counts as a statement separator differ
|
|
2910
|
+
* per dialect. Without this, the stacking check has to fail closed.
|
|
2911
|
+
*/
|
|
2912
|
+
dialect?: SqlDialect;
|
|
2836
2913
|
});
|
|
2914
|
+
/**
|
|
2915
|
+
* The dialect the statement will actually run under. Falls back to the
|
|
2916
|
+
* connection config, then to undefined — where the stacking check fails
|
|
2917
|
+
* closed rather than guessing.
|
|
2918
|
+
*/
|
|
2919
|
+
private resolveDialect;
|
|
2837
2920
|
takeDiagnostics(): string[];
|
|
2838
2921
|
/**
|
|
2839
2922
|
* Execute a SQL query with permission enforcement and error handling
|