Skip to content
$ shellfirm

Other clients

sqlite3, mongosh, sqlcmd, clickhouse-client and cqlsh under shellfirm wrap.

sqlite3

shellfirm wrap sqlite3 app.db
Output
shellfirm: protecting sqlite3 (79 checks from database; checking statements ending with ';' on Enter)
DROP TABLE t;
============ RISKY STATEMENT DETECTED (shellfirm wrap:sqlite3) ============
Statement: DROP TABLE t
Check: database:drop_table
Severity: CRITICAL
Description: Dropping a table permanently deletes all of its data.
Escalated to Yes (from Math): severity CRITICAL

[CRITICAL] Type `yes` to continue (Esc or Ctrl-C to discard the statement)
  • Dot-commands that run files or programs are followed: .read FILE, .shell …, and .once / .output / .import with '|cmd'.
  • SQL on the command line (sqlite3 app.db "DROP TABLE t") is checked before sqlite3 starts.

mongosh

shellfirm wrap mongosh "mongodb://db.internal/app"
Output
shellfirm: protecting mongosh (16 checks from mongodb; checking statements ending with ';' or a complete line on Enter)
db.dropDatabase()
============ RISKY STATEMENT DETECTED (shellfirm wrap:mongosh) ============
Statement: db.dropDatabase()
Check: mongodb:interactive_drop_database
Severity: CRITICAL
Description: Dropping a MongoDB database will permanently delete all its data.
Escalated to Yes (from Math): severity CRITICAL

[CRITICAL] Type `yes` to continue (Esc or Ctrl-C to discard the statement)
  • A statement is checked at ; or when the line is complete.
  • load(FILE) is followed, and mongosh --eval and script files on the command line are checked before mongosh starts.
  • mongosh -p PASSWORD is stored as -p *** in the audit log.

sqlcmd (SQL Server)

shellfirm wrap sqlcmd -S db.internal -U sa

sqlcmd runs a batch at GO, so shellfirm checks the batch on a ; or a GO line. A real session (TRUNCATE TABLE orders, then GO):

Output
shellfirm: protecting sqlcmd (79 checks from database; checking statements ending with ';' or a GO line on Enter)
TRUNCATE TABLE orders
GO
============ RISKY STATEMENT DETECTED (shellfirm wrap:sqlcmd) ============
Statement: TRUNCATE TABLE orders
Check: database:truncate_table
Severity: CRITICAL
Description: Truncating a table permanently deletes all of its rows.
Escalated to Yes (from Math): severity CRITICAL

[CRITICAL] Type `yes` to continue (Esc or Ctrl-C to discard the statement)

Declining keeps the session:

Output
shellfirm: statement discarded; your sqlcmd session is still open.
  • !!cmd and :!! cmd lines are checked as shell commands.
  • :r FILE includes are followed.
  • sqlcmd -Q / -q / -i FILE on the command line are checked before sqlcmd starts. The shell hook and shellfirm check read sqlcmd -i files the same way.

clickhouse-client and cqlsh

shellfirm wrap clickhouse-client --host ch.internal
shellfirm wrap cqlsh cassandra.internal

Statements end at ; and are checked against the database checks. clickhouse-client -q "…" and cqlsh -e "…" / -f FILE are checked before the client starts.

Not listed?

Any program can be wrapped with an explicit tool type and delimiter. See Custom tools.