lsec — Laravel Security Audit
ActionsAbout
Tags
(2)A GitHub Action that runs lsec — the Laravel
security audit CLI — against your repository, uploads results to GitHub Code
Scanning as SARIF, and posts a summary comment on pull requests.
lsec ships 61 rules across 8 categories: env, auth, injection, http,
storage, deps, secrets, logging. See the
lsec README for the full rule list.
# .github/workflows/lsec.yml
name: lsec
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
security-events: write # required for SARIF upload
pull-requests: write # required for the PR summary comment
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: AfaanBilal/lsec-action@v1That defaults to scanning the repository root, failing on high or above,
uploading SARIF, and commenting on pull requests.
| Name | Default | Description |
|---|---|---|
path |
. |
Path to the Laravel project root. |
version |
latest |
lsec release version (e.g. 0.1.4) or latest. |
fail-on |
high |
Minimum severity that fails the job: critical | high | medium | low | info. |
min-confidence |
0.7 |
Minimum confidence score for reported findings (0.0 – 1.0). |
baseline |
"" |
Path to a baseline file used to suppress known findings. |
only |
"" |
Comma-separated rule categories to include (e.g. env,secrets,injection). |
skip |
"" |
Comma-separated rule categories to skip. |
upload-sarif |
true |
Upload SARIF to GitHub Code Scanning. |
post-comment |
true |
Post (or update) a summary comment on pull requests. |
sarif-output |
lsec.sarif |
Path to write the SARIF report. |
json-output |
lsec-report.json |
Path to write the JSON report. |
| Name | Description |
|---|---|
result |
pass or fail (against the fail-on threshold). |
exit-code |
Raw lsec exit code (0 clean, 1 threshold breached, 2 runtime error). |
findings-count |
Total findings reported. |
critical-count |
Number of CRITICAL findings. |
high-count |
Number of HIGH findings. |
medium-count |
Number of MEDIUM findings. |
low-count |
Number of LOW findings. |
info-count |
Number of INFO findings. |
sarif-path |
Path to the generated SARIF file. |
json-path |
Path to the generated JSON report. |
| Permission | Why |
|---|---|
contents: read |
Checkout the repository. |
security-events: write |
Upload SARIF to Code Scanning. Omit if upload-sarif: false. |
pull-requests: write |
Post the PR summary comment. Omit if post-comment: false. |
Code Scanning is free on public repositories. Private repositories require GitHub Advanced Security.
- uses: AfaanBilal/lsec-action@v1
with:
path: ./api- uses: AfaanBilal/lsec-action@v1
with:
fail-on: critical- uses: AfaanBilal/lsec-action@v1
with:
version: 0.1.4- uses: AfaanBilal/lsec-action@v1
with:
baseline: ci/lsec-baseline.jsonGenerate the baseline locally with lsec baseline write . and commit it.
- uses: AfaanBilal/lsec-action@v1
with:
only: env,secrets,deps- uses: AfaanBilal/lsec-action@v1
with:
skip: logging- uses: AfaanBilal/lsec-action@v1
with:
upload-sarif: false- uses: AfaanBilal/lsec-action@v1
id: lsec
continue-on-error: true
with:
fail-on: info
- run: echo "lsec found ${{ steps.lsec.outputs.findings-count }} issue(s)"- uses: AfaanBilal/lsec-action@v1
id: lsec
- name: Notify on critical findings
if: steps.lsec.outputs.critical-count != '0'
run: ./notify-security.sh "${{ steps.lsec.outputs.critical-count }} critical findings"- Install — downloads the matching
lsecrelease binary into$RUNNER_TEMP/lsec-bin/and adds it toPATH. - Scan (JSON) — runs
lsec scan ... --ci --format json. Thelsecexit code is the source of truth forpass/fail. - Scan (SARIF) — runs
lsec scan ... --format sarif(only whenupload-sarif: true). - Upload SARIF — hands the report to
github/codeql-action/upload-sarif@v3so findings appear inline on PRs and in the Security tab. - PR comment — posts (or updates) a single sticky comment with the severity table and top findings.
- Enforce — exits non-zero when
result == fail, failing the job.
| OS / arch | Supported |
|---|---|
ubuntu-latest (x86_64) |
✅ |
| Linux ARM64 | ✅ |
macos-latest (Apple Silicon) |
✅ |
macos-13 (Intel) |
✅ |
windows-latest |
✅ (x86_64 only) |
This action follows semantic versioning. Pin to:
@v1— latest 1.x release (recommended).@v1.2.3— exact release.@main— bleeding edge (not recommended for production).
The version input controls which lsec CLI release is downloaded; it is
independent of the action version.
MIT — see lsec for the upstream tool.
Action authored by Afaan Bilal.
lsec — Laravel Security Audit is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.