|
| 1 | +name: 'LLM AuthZ Audit' |
| 2 | +description: 'Static security analyzer for LLM applications — finds OWASP LLM Top 10 issues before they reach production' |
| 3 | + |
| 4 | +branding: |
| 5 | + icon: 'shield' |
| 6 | + color: 'green' |
| 7 | + |
| 8 | +inputs: |
| 9 | + path: |
| 10 | + description: 'Path to scan' |
| 11 | + required: false |
| 12 | + default: '.' |
| 13 | + format: |
| 14 | + description: 'Output format: console, json, sarif' |
| 15 | + required: false |
| 16 | + default: 'sarif' |
| 17 | + fail-on: |
| 18 | + description: 'Minimum severity for non-zero exit: critical, high, medium, low' |
| 19 | + required: false |
| 20 | + default: 'high' |
| 21 | + min-confidence: |
| 22 | + description: 'Minimum confidence to include: low, medium, high' |
| 23 | + required: false |
| 24 | + default: '' |
| 25 | + exclude: |
| 26 | + description: 'Comma-separated glob patterns to exclude' |
| 27 | + required: false |
| 28 | + default: '' |
| 29 | + extra-rules: |
| 30 | + description: 'Comma-separated paths to custom rule directories' |
| 31 | + required: false |
| 32 | + default: '' |
| 33 | + suppress: |
| 34 | + description: 'Path to suppression YAML file' |
| 35 | + required: false |
| 36 | + default: '' |
| 37 | + diff: |
| 38 | + description: 'Only scan files changed since this git ref (e.g. HEAD~1, main)' |
| 39 | + required: false |
| 40 | + default: '' |
| 41 | + python-version: |
| 42 | + description: 'Python version to use' |
| 43 | + required: false |
| 44 | + default: '3.12' |
| 45 | + version: |
| 46 | + description: 'llm-authz-audit version to install (default: latest)' |
| 47 | + required: false |
| 48 | + default: '' |
| 49 | + |
| 50 | +outputs: |
| 51 | + sarif-file: |
| 52 | + description: 'Path to SARIF output file (when format=sarif)' |
| 53 | + value: ${{ steps.scan.outputs.sarif-file }} |
| 54 | + exit-code: |
| 55 | + description: 'Exit code from the scan (0=pass, 1=findings, 2=error)' |
| 56 | + value: ${{ steps.scan.outputs.exit-code }} |
| 57 | + |
| 58 | +runs: |
| 59 | + using: 'composite' |
| 60 | + steps: |
| 61 | + - name: Set up Python |
| 62 | + uses: actions/setup-python@v5 |
| 63 | + with: |
| 64 | + python-version: ${{ inputs.python-version }} |
| 65 | + |
| 66 | + - name: Install llm-authz-audit |
| 67 | + shell: bash |
| 68 | + run: | |
| 69 | + if [ -n "${{ inputs.version }}" ]; then |
| 70 | + pip install llm-authz-audit==${{ inputs.version }} |
| 71 | + else |
| 72 | + pip install llm-authz-audit |
| 73 | + fi |
| 74 | +
|
| 75 | + - name: Run scan |
| 76 | + id: scan |
| 77 | + shell: bash |
| 78 | + run: | |
| 79 | + CMD="llm-authz-audit scan ${{ inputs.path }}" |
| 80 | + CMD="$CMD --format ${{ inputs.format }}" |
| 81 | + CMD="$CMD --fail-on ${{ inputs.fail-on }}" |
| 82 | +
|
| 83 | + if [ -n "${{ inputs.min-confidence }}" ]; then |
| 84 | + CMD="$CMD --min-confidence ${{ inputs.min-confidence }}" |
| 85 | + fi |
| 86 | + if [ -n "${{ inputs.exclude }}" ]; then |
| 87 | + CMD="$CMD --exclude ${{ inputs.exclude }}" |
| 88 | + fi |
| 89 | + if [ -n "${{ inputs.extra-rules }}" ]; then |
| 90 | + CMD="$CMD --extra-rules ${{ inputs.extra-rules }}" |
| 91 | + fi |
| 92 | + if [ -n "${{ inputs.suppress }}" ]; then |
| 93 | + CMD="$CMD --suppress ${{ inputs.suppress }}" |
| 94 | + fi |
| 95 | + if [ -n "${{ inputs.diff }}" ]; then |
| 96 | + CMD="$CMD --diff ${{ inputs.diff }}" |
| 97 | + fi |
| 98 | +
|
| 99 | + SARIF_FILE="" |
| 100 | + if [ "${{ inputs.format }}" = "sarif" ]; then |
| 101 | + SARIF_FILE="llm-authz-audit-results.sarif" |
| 102 | + CMD="$CMD > $SARIF_FILE" |
| 103 | + fi |
| 104 | +
|
| 105 | + echo "Running: $CMD" |
| 106 | + set +e |
| 107 | + eval "$CMD" |
| 108 | + EXIT_CODE=$? |
| 109 | + set -e |
| 110 | +
|
| 111 | + echo "exit-code=$EXIT_CODE" >> "$GITHUB_OUTPUT" |
| 112 | + if [ -n "$SARIF_FILE" ]; then |
| 113 | + echo "sarif-file=$SARIF_FILE" >> "$GITHUB_OUTPUT" |
| 114 | + fi |
| 115 | +
|
| 116 | + exit $EXIT_CODE |
0 commit comments