@carllee1983/dbcli 1.47.1 → 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/dist/core.d.ts CHANGED
@@ -607,6 +607,16 @@ export declare class BlacklistManager {
607
607
  * @returns Array of blacklisted column names, or empty array if none
608
608
  */
609
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[];
610
620
  /**
611
621
  * Check if the blacklist override is enabled via environment variable.
612
622
  * When true, all blacklist checks are bypassed.
@@ -636,10 +646,50 @@ export declare class BlacklistValidator {
636
646
  *
637
647
  * @param operation SQL operation type: SELECT, INSERT, UPDATE, DELETE
638
648
  * @param tableName Table name to check
639
- * @param _tableList Unused (reserved for future multi-table validation)
640
- * @throws BlacklistError if table is blacklisted
649
+ * @param tableList Further tables the same statement references
650
+ * @throws BlacklistError if any table is blacklisted
641
651
  */
642
- checkTableBlacklist(operation: string, tableName: string, _tableList?: string[]): void;
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
677
+ */
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;
643
693
  /**
644
694
  * Reject a write that touches blacklisted columns.
645
695
  * Computes the intersection of `fields` with the table's column blacklist
@@ -662,6 +712,22 @@ export declare class BlacklistValidator {
662
712
  * @returns Filtered rows and list of omitted column names
663
713
  */
664
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;
665
731
  /**
666
732
  * Build a security notification message for omitted columns.
667
733
  *