@@ -256,6 +256,16 @@ Feature: Import a WordPress database
256256 CREATE TABLE wp_cli_sqlite_meta (id int NOT NULL);
257257 .shell touch side_effect_sqlite.txt
258258 """
259+ And a malicious_sqlite_space.sql file:
260+ """
261+ CREATE TABLE wp_cli_sqlite_meta (id int NOT NULL);
262+ . shell touch side_effect_sqlite_space.txt
263+ """
264+ And a malicious_sqlite_quotes.sql file:
265+ """
266+ CREATE TABLE wp_cli_sqlite_meta (id int NOT NULL);
267+ ."shell" touch side_effect_sqlite_quotes.txt
268+ """
259269
260270 When I try `wp db import malicious_sqlite.sql`
261271 Then STDERR should contain:
@@ -264,6 +274,43 @@ Feature: Import a WordPress database
264274 """
265275 And the side_effect_sqlite.txt file should not exist
266276
277+ When I try `wp db import malicious_sqlite_space.sql`
278+ Then STDERR should contain:
279+ """
280+ SQLite dot-commands are not allowed in import files.
281+ """
282+ And the side_effect_sqlite_space.txt file should not exist
283+
284+ When I try `wp db import malicious_sqlite_quotes.sql`
285+ Then STDERR should contain:
286+ """
287+ SQLite dot-commands are not allowed in import files.
288+ """
289+ And the side_effect_sqlite_quotes.txt file should not exist
290+
291+ @require-sqlite
292+ Scenario : `wp db import` allows multiline SQL containing numeric literals starting with a dot
293+ Given a WP install
294+ And a numeric_literal.sql file:
295+ """
296+ CREATE TABLE wp_cli_prices (value REAL);
297+ INSERT INTO wp_cli_prices (value) VALUES (
298+ .5
299+ );
300+ """
301+
302+ When I run `wp db import numeric_literal.sql`
303+ Then STDOUT should contain:
304+ """
305+ Success: Imported from 'numeric_literal.sql'.
306+ """
307+
308+ When I run `wp db query 'SELECT value FROM wp_cli_prices;' --skip-column-names`
309+ Then STDOUT should be:
310+ """
311+ 0.5
312+ """
313+
267314 # SQLite does not use the MySQL client and has no concept of SQL modes.
268315 @require-mysql-or-mariadb
269316 Scenario : `wp db import` adapts the SQL mode via --init-command by default
0 commit comments