Skip to content

Commit 64c9dc8

Browse files
committed
chore: add scan workflow with leaks/vulns/scan scripts; rename setversion to vers
1 parent f289bbd commit 64c9dc8

3 files changed

Lines changed: 68 additions & 2 deletions

File tree

.github/workflows/scan.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: scan
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
schedule:
11+
- cron: "0 6 * * 1"
12+
13+
jobs:
14+
vulns:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout Repo
19+
uses: actions/checkout@v5
20+
- name: Setup Pnpm
21+
uses: pnpm/action-setup@v4
22+
- name: Setup Node
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version-file: package.json
26+
- name: Setup Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.12"
30+
- name: Install Semgrep
31+
run: pip install semgrep
32+
- name: Run Vulnerability Scan
33+
run: pnpm vulns
34+
35+
leaks:
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: Checkout Repo
40+
uses: actions/checkout@v5
41+
with:
42+
fetch-depth: 0
43+
- name: Setup Pnpm
44+
uses: pnpm/action-setup@v4
45+
- name: Setup Node
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version-file: package.json
49+
- name: Install Gitleaks
50+
run: |
51+
curl -sSfL https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz | tar -xz -C /usr/local/bin gitleaks
52+
- name: Run Secrets Scan
53+
run: pnpm leaks

.gitleaks.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[extend]
2+
useDefault = true
3+
4+
[[allowlists]]
5+
description = "Test fixtures may contain placeholder credentials"
6+
paths = ['''(^|\/)fixtures\/.*''']
7+
8+
[[allowlists]]
9+
description = "Tests may contain placeholder credentials"
10+
paths = ['''\.unit\.ts$''', '''\.spec\.ts$''']

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@
2727
"lint": "vp fmt --check && vp lint",
2828
"prepare": "lefthook install",
2929
"release": "pnpm publish --access public --ignore-scripts --no-git-checks",
30-
"setversion": "pnpm version --no-git-tag-version",
3130
"test": "pnpm lint && pnpm type && pnpm unit",
3231
"type": "tsgo --noEmit",
33-
"unit": "vp test"
32+
"unit": "vp test",
33+
"leaks": "gitleaks git --config=.gitleaks.toml --verbose --redact",
34+
"vulns": "semgrep --config=p/typescript --config=p/nodejs --config=p/owasp-top-ten --config=p/secrets --exclude=\"**/fixtures/**\" --metrics=off",
35+
"scan": "pnpm leaks && pnpm vulns",
36+
"vers": "pnpm version --no-git-tag-version"
3437
},
3538
"dependencies": {
3639
"mdast-util-to-string": "^4.0.0",

0 commit comments

Comments
 (0)