|
2795 | 2795 | "match": [ |
2796 | 2796 | { |
2797 | 2797 | "field": "command", |
2798 | | - "pattern": "(\\bmysql[[:space:]][^|<]*(-e|--execute)([[:space:]]+|=)['\"]?[[:space:]]*(UPDATE|DELETE|INSERT|REPLACE|CREATE|ALTER|DROP|GRANT|REVOKE|TRUNCATE|RENAME)\\b)|(\\bmysql[[:space:]][^|]*<[[:space:]]*[^[:space:]]+\\.sql\\b)|(\\bmysqldump\\b[^|]*\\|[[:space:]]*mysql\\b)", |
| 2798 | + "pattern": "(\\bmysql[[:space:]][^|<]*(-e|--execute)([[:space:]]*|=)['\"]?[[:space:]]*(UPDATE|DELETE|INSERT|REPLACE|CREATE|ALTER|DROP|GRANT|REVOKE|TRUNCATE|RENAME)\\b)|(\\bmysql[[:space:]][^|]*<[[:space:]]*[^[:space:]]+\\.sql\\b)|(\\bmysqldump\\b[^|]*\\|[[:space:]]*mysql\\b)", |
2799 | 2799 | "flags": "i" |
2800 | 2800 | }, |
2801 | 2801 | { |
|
2836 | 2836 | }, |
2837 | 2837 | "expected_exit": 2 |
2838 | 2838 | }, |
| 2839 | + { |
| 2840 | + "name": "blocks-mysql-long-execute-space", |
| 2841 | + "input": { |
| 2842 | + "tool_input": { |
| 2843 | + "command": "mysql --execute \"UPDATE users SET active=1\"" |
| 2844 | + } |
| 2845 | + }, |
| 2846 | + "expected_exit": 2 |
| 2847 | + }, |
| 2848 | + { |
| 2849 | + "name": "blocks-mysql-long-execute-equals", |
| 2850 | + "input": { |
| 2851 | + "tool_input": { |
| 2852 | + "command": "mysql --execute=\"DROP TABLE legacy\"" |
| 2853 | + } |
| 2854 | + }, |
| 2855 | + "expected_exit": 2 |
| 2856 | + }, |
| 2857 | + { |
| 2858 | + "name": "blocks-mysql-short-e-no-space-quoted", |
| 2859 | + "input": { |
| 2860 | + "tool_input": { |
| 2861 | + "command": "mysql -uroot -e\"DROP TABLE legacy\"" |
| 2862 | + } |
| 2863 | + }, |
| 2864 | + "expected_exit": 2 |
| 2865 | + }, |
2839 | 2866 | { |
2840 | 2867 | "name": "blocks-mysql-stdin-redirect", |
2841 | 2868 | "input": { |
|
2910 | 2937 | "match": [ |
2911 | 2938 | { |
2912 | 2939 | "field": "command", |
2913 | | - "pattern": "(\\bpsql\\b[^|]*(-c|--command)([[:space:]]+|=)['\"]?[[:space:]]*(UPDATE|INSERT|REPLACE|CREATE|ALTER|GRANT|REVOKE|RENAME)\\b)|(\\bpg_restore\\b)", |
| 2940 | + "pattern": "(\\bpsql\\b[^|]*(-c|--command)([[:space:]]*|=)['\"]?[[:space:]]*(UPDATE|INSERT|REPLACE|CREATE|ALTER|GRANT|REVOKE|RENAME)\\b)|(\\bpg_restore\\b)", |
2914 | 2941 | "flags": "i" |
2915 | 2942 | }, |
2916 | 2943 | { |
|
2960 | 2987 | }, |
2961 | 2988 | "expected_exit": 2 |
2962 | 2989 | }, |
| 2990 | + { |
| 2991 | + "name": "blocks-psql-c-no-space-quoted", |
| 2992 | + "input": { |
| 2993 | + "tool_input": { |
| 2994 | + "command": "psql -d mydb -c\"UPDATE users SET active=true\"" |
| 2995 | + } |
| 2996 | + }, |
| 2997 | + "expected_exit": 2 |
| 2998 | + }, |
| 2999 | + { |
| 3000 | + "name": "blocks-psql-long-command-equals", |
| 3001 | + "input": { |
| 3002 | + "tool_input": { |
| 3003 | + "command": "psql -d mydb --command=\"UPDATE sessions SET expired=true\"" |
| 3004 | + } |
| 3005 | + }, |
| 3006 | + "expected_exit": 2 |
| 3007 | + }, |
2963 | 3008 | { |
2964 | 3009 | "name": "blocks-pg-restore", |
2965 | 3010 | "input": { |
|
3104 | 3149 | "match": [ |
3105 | 3150 | { |
3106 | 3151 | "field": "command", |
3107 | | - "pattern": "(\\b(mongo|mongosh)\\b[^|]*--eval[[:space:]]+[^[:space:]]*\\.(update|insert|delete|drop|createCollection|dropDatabase|replaceOne|save|findAndModify|deleteOne|deleteMany|updateOne|updateMany|insertOne|insertMany)\\b)|(\\bmongorestore\\b)" |
| 3152 | + "pattern": "(\\b(mongo|mongosh)\\b[^|]*--eval[[:space:]=][^|]*\\.(update|insert|delete|drop|createCollection|dropDatabase|replaceOne|save|findAndModify|deleteOne|deleteMany|updateOne|updateMany|insertOne|insertMany)\\b)|(\\bmongorestore\\b)" |
3108 | 3153 | }, |
3109 | 3154 | { |
3110 | 3155 | "field": "command", |
|
3126 | 3171 | }, |
3127 | 3172 | "expected_exit": 2 |
3128 | 3173 | }, |
| 3174 | + { |
| 3175 | + "name": "blocks-mongo-eval-update-with-spaces-inside-arg", |
| 3176 | + "input": { |
| 3177 | + "tool_input": { |
| 3178 | + "command": "mongo --eval \"db.users.update({_id: 42}, {$set: {active: true}})\"" |
| 3179 | + } |
| 3180 | + }, |
| 3181 | + "expected_exit": 2 |
| 3182 | + }, |
| 3183 | + { |
| 3184 | + "name": "blocks-mongosh-eval-insertOne-spaces", |
| 3185 | + "input": { |
| 3186 | + "tool_input": { |
| 3187 | + "command": "mongosh --eval \"db.audit.insertOne({ event: \\\"oneshot\\\" })\"" |
| 3188 | + } |
| 3189 | + }, |
| 3190 | + "expected_exit": 2 |
| 3191 | + }, |
| 3192 | + { |
| 3193 | + "name": "blocks-mongo-eval-equals", |
| 3194 | + "input": { |
| 3195 | + "tool_input": { |
| 3196 | + "command": "mongo --eval=\"db.users.deleteMany({active:false})\"" |
| 3197 | + } |
| 3198 | + }, |
| 3199 | + "expected_exit": 2 |
| 3200 | + }, |
3129 | 3201 | { |
3130 | 3202 | "name": "blocks-mongo-eval-deleteMany", |
3131 | 3203 | "input": { |
|
3324 | 3396 | "match": [ |
3325 | 3397 | { |
3326 | 3398 | "field": "command", |
3327 | | - "pattern": "\\bgcloud[[:space:]]+sql[[:space:]]+(import|export)[[:space:]]+(sql|csv|bak)\\b", |
| 3399 | + "pattern": "\\bgcloud[[:space:]]+(--?[a-zA-Z0-9_-]+(=[^[:space:]]*)?[[:space:]]+)*sql[[:space:]]+(import|export)[[:space:]]+(sql|csv|bak)\\b", |
3328 | 3400 | "flags": "i" |
3329 | 3401 | }, |
3330 | 3402 | { |
|
3377 | 3449 | }, |
3378 | 3450 | "expected_exit": 2 |
3379 | 3451 | }, |
| 3452 | + { |
| 3453 | + "name": "blocks-gcloud-global-project-sql-export", |
| 3454 | + "input": { |
| 3455 | + "tool_input": { |
| 3456 | + "command": "gcloud --project=my-prod sql export sql my-instance gs://backups/dump.sql --database=mydb" |
| 3457 | + } |
| 3458 | + }, |
| 3459 | + "expected_exit": 2 |
| 3460 | + }, |
| 3461 | + { |
| 3462 | + "name": "blocks-gcloud-global-quiet-sql-import", |
| 3463 | + "input": { |
| 3464 | + "tool_input": { |
| 3465 | + "command": "gcloud --quiet sql import sql my-instance gs://backups/dump.sql --database=mydb" |
| 3466 | + } |
| 3467 | + }, |
| 3468 | + "expected_exit": 2 |
| 3469 | + }, |
| 3470 | + { |
| 3471 | + "name": "blocks-gcloud-global-account-sql-export-csv", |
| 3472 | + "input": { |
| 3473 | + "tool_input": { |
| 3474 | + "command": "gcloud --account=svc@example.iam.gserviceaccount.com sql export csv my-instance gs://backups/users.csv --database=mydb --query=\"SELECT * FROM users\"" |
| 3475 | + } |
| 3476 | + }, |
| 3477 | + "expected_exit": 2 |
| 3478 | + }, |
| 3479 | + { |
| 3480 | + "name": "blocks-gcloud-multiple-global-flags-sql-export", |
| 3481 | + "input": { |
| 3482 | + "tool_input": { |
| 3483 | + "command": "gcloud --project=my-prod --quiet sql export sql my-instance gs://backups/dump.sql --database=mydb" |
| 3484 | + } |
| 3485 | + }, |
| 3486 | + "expected_exit": 2 |
| 3487 | + }, |
3380 | 3488 | { |
3381 | 3489 | "name": "allows-gcloud-sql-instances-list", |
3382 | 3490 | "input": { |
|
0 commit comments