|
1 | 1 | rules:
|
2 |
| - - id: detect-os-system-calls |
3 |
| - pattern: os.system(...) |
4 |
| - message: "Unsafe use of os.system(). Consider using subprocess.run() instead." |
5 |
| - languages: [python] |
| 2 | + - id: third-party-action-not-pinned-to-commit-sha |
| 3 | + pattern-either: |
| 4 | + - pattern: uses: $ACTION@$REF |
| 5 | + metavariable-regex: |
| 6 | + $ACTION: ^(?!.*?/\.)(?!actions/).*?/.*?$ |
| 7 | + $REF: ^(v?\d+(\.\d+){0,2}|[^@]+)$ |
| 8 | + - pattern: uses: $ACTION |
| 9 | + metavariable-regex: |
| 10 | + $ACTION: ^(?!.*?/\.)(?!actions/).*?/.*?$ |
| 11 | + message: > |
| 12 | + Third-party GitHub Action is not pinned to a specific commit SHA. |
| 13 | + This can be a security risk as the action may be modified unexpectedly. |
| 14 | + Consider using a full length commit SHA instead of a tag or branch name. |
6 | 15 | severity: WARNING
|
| 16 | + languages: [yaml] |
| 17 | + paths: |
| 18 | + include: |
| 19 | + - '**/workflows/*.yml' |
| 20 | + - '**/workflows/*.yaml' |
| 21 | + metadata: |
| 22 | + category: security |
| 23 | + technology: |
| 24 | + - github-actions |
| 25 | + references: |
| 26 | + - https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-third-party-actions |
7 | 27 |
|
8 |
| - - id: detect-sql-injection |
9 |
| - pattern: 'execute("SELECT * FROM " + $TABLE)' |
10 |
| - message: "Potential SQL injection detected. Use parameterized queries." |
| 28 | + - id: insecure-file-permissions |
| 29 | + pattern: os.chmod(..., $PERMS) |
| 30 | + message: > |
| 31 | + Detected a call to os.chmod() with potentially insecure permissions. |
| 32 | + Ensure that file permissions are set correctly to prevent unauthorized access. |
| 33 | + severity: WARNING |
11 | 34 | languages: [python]
|
12 |
| - severity: ERROR |
| 35 | + metadata: |
| 36 | + category: security |
| 37 | + technology: |
| 38 | + - python |
| 39 | + references: |
| 40 | + - https://docs.python.org/3/library/os.html#os.chmod |
| 41 | + - https://owasp.org/www-community/vulnerabilities/Insecure_Temporary_File |
| 42 | + fix-regex: |
| 43 | + regex: os\.chmod\((.*?),\s*(.*?)\) |
| 44 | + replacement: os.chmod($1, 0o600) |
13 | 45 |
|
14 |
| - - id: detect-eval-usage |
15 |
| - pattern: eval(...) |
16 |
| - message: "Use of eval() detected. This can be dangerous if used with untrusted input." |
17 |
| - languages: [python] |
18 |
| - severity: ERROR |
|
0 commit comments