|
56 | 56 | - CREATE INDEX email_idx ON commits USING pilosa (commit_author_email) WITH (async = false)
|
57 | 57 | - SELECT COUNT(*) FROM commits WHERE NOT(commit_author_email = 'non existing email address')
|
58 | 58 | - DROP INDEX email_idx ON commits
|
| 59 | +- |
| 60 | + ID: 'query11' |
| 61 | + Name: 'Leak detection on all refs' |
| 62 | + Statements: |
| 63 | + - > |
| 64 | + SELECT f.repository_id, f.blob_hash, f.commit_hash, f.file_path |
| 65 | + FROM ( |
| 66 | + SELECT blob_hash, repository_id |
| 67 | + FROM blobs |
| 68 | + WHERE NOT IS_BINARY(blob_content) AND ( |
| 69 | + blob_content REGEXP '(?i)facebook.*[\'\\"][0-9a-f]{32}[\'\\"]' |
| 70 | + OR blob_content REGEXP '(?i)twitter.*[\'\\"][0-9a-zA-Z]{35,44}[\'\\"]' |
| 71 | + OR blob_content REGEXP '(?i)github.*[\'\\"][0-9a-zA-Z]{35,40}[\'\\"]' |
| 72 | + OR blob_content REGEXP 'AKIA[0-9A-Z]{16}' |
| 73 | + OR blob_content REGEXP '(?i)heroku.*[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}' |
| 74 | + OR blob_content REGEXP '.*-----BEGIN ((RSA|DSA|OPENSSH|SSH2|EC) )?PRIVATE KEY-----.*' |
| 75 | + ) |
| 76 | + ) h |
| 77 | + INNER JOIN commit_files f |
| 78 | + ON h.blob_hash = f.blob_hash |
| 79 | + AND h.repository_id = f.repository_id |
| 80 | + AND f.file_path NOT REGEXP '^vendor.*' |
| 81 | +- |
| 82 | + ID: 'query12' |
| 83 | + Name: 'Leaks detection on HEAD' |
| 84 | + Statements: |
| 85 | + - > |
| 86 | + SELECT repository_id, blob_hash, commit_hash, file_path |
| 87 | + FROM refs r |
| 88 | + NATURAL JOIN commit_files cf |
| 89 | + NATURAL JOIN files f |
| 90 | + WHERE r.ref_name = 'HEAD' AND NOT IS_BINARY(blob_content) AND ( |
| 91 | + blob_content REGEXP '(?i)facebook.*[\'\\"][0-9a-f]{32}[\'\\"]' |
| 92 | + OR blob_content REGEXP '(?i)twitter.*[\'\\"][0-9a-zA-Z]{35,44}[\'\\"]' |
| 93 | + OR blob_content REGEXP '(?i)github.*[\'\\"][0-9a-zA-Z]{35,40}[\'\\"]' |
| 94 | + OR blob_content REGEXP 'AKIA[0-9A-Z]{16}' |
| 95 | + OR blob_content REGEXP '(?i)heroku.*[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}' |
| 96 | + OR blob_content REGEXP '.*-----BEGIN ((RSA|DSA|OPENSSH|SSH2|EC) )?PRIVATE KEY-----.*' |
| 97 | + ) AND cf.file_path NOT REGEXP '^vendor.*' |
| 98 | +- |
| 99 | + ID: 'query13' |
| 100 | + Name: 'Has README' |
| 101 | + Statements: |
| 102 | + - > |
| 103 | + SELECT DISTINCT repository_id |
| 104 | + FROM refs r |
| 105 | + NATURAL JOIN commits |
| 106 | + NATURAL JOIN tree_entries te |
| 107 | + WHERE r.ref_name = 'HEAD' |
| 108 | + AND te.tree_entry_name REGEXP '^(?i)readme(\.[a-z]+)?$' |
0 commit comments