diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml new file mode 100644 index 000000000..1506b56ec --- /dev/null +++ b/.github/workflows/gitleaks.yml @@ -0,0 +1,28 @@ +name: Gitleaks + +on: + pull_request: + branches: [main] + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +jobs: + gitleaks: + # Forked pull_request runs do not receive repository/org secrets except GITHUB_TOKEN. + if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + with: + fetch-depth: 0 + + - uses: gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2.3.9 + env: + # GITHUB_TOKEN is provided automatically by GitHub Actions. + # GITLEAKS_KEY must be configured as a repository secret. + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_KEY }} diff --git a/.gitleaks.toml b/.gitleaks.toml new file mode 100644 index 000000000..597b33952 --- /dev/null +++ b/.gitleaks.toml @@ -0,0 +1,16 @@ +title = "lark-cli gitleaks config" + +[extend] +useDefault = true + +[[rules]] +id = "lark-bot-app-id" +description = "Detect Lark bot app ids" +regex = '''\bcli_[a-z0-9]{16}\b''' +keywords = ["cli_"] + +[[rules]] +id = "lark-session-token" +description = "Detect Lark session tokens" +regex = '''\bXN0YXJ0-[A-Za-z0-9_-]+-WVuZA\b''' +keywords = ["XN0YXJ0-", "-WVuZA"]