Skip to content

Commit fdde591

Browse files
committed
chore: harden repository security
1 parent ae2c267 commit fdde591

7 files changed

Lines changed: 204 additions & 38 deletions

File tree

.github/dependabot.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 5
8+
labels:
9+
- dependencies
10+
- security
11+
groups:
12+
next-stack:
13+
patterns:
14+
- next
15+
- react
16+
- react-dom
17+
tooling:
18+
patterns:
19+
- eslint*
20+
- typescript
21+
- @types/*
22+
- tailwindcss
23+
- postcss
24+
- autoprefixer
25+
- wrangler
26+
- @opennextjs/*
27+
28+
- package-ecosystem: github-actions
29+
directory: /
30+
schedule:
31+
interval: weekly
32+
open-pull-requests-limit: 5
33+
labels:
34+
- dependencies
35+
- security

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
steps:
3030
- name: Checkout
3131
uses: actions/checkout@v4
32+
with:
33+
persist-credentials: false
3234

3335
- name: Setup Node.js
3436
uses: actions/setup-node@v4

.github/workflows/security.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Security
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- main
8+
push:
9+
branches:
10+
- main
11+
schedule:
12+
- cron: '23 4 * * 1'
13+
14+
permissions:
15+
contents: read
16+
17+
env:
18+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
19+
20+
concurrency:
21+
group: security-${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
dependency-review:
26+
name: Dependency review
27+
if: github.event_name == 'pull_request'
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: read
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
with:
35+
persist-credentials: false
36+
37+
- name: Dependency review
38+
uses: actions/dependency-review-action@v4
39+
with:
40+
fail-on-severity: high
41+
42+
audit:
43+
name: npm audit
44+
runs-on: ubuntu-latest
45+
permissions:
46+
contents: read
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v4
50+
with:
51+
persist-credentials: false
52+
53+
- name: Setup Node.js
54+
uses: actions/setup-node@v4
55+
with:
56+
node-version: 22
57+
cache: npm
58+
59+
- name: Install dependencies
60+
run: npm ci
61+
62+
- name: Audit production dependencies
63+
run: npm audit --omit=dev --audit-level=high
64+
65+
secret-scan:
66+
name: Secret scan
67+
runs-on: ubuntu-latest
68+
permissions:
69+
contents: read
70+
steps:
71+
- name: Checkout
72+
uses: actions/checkout@v4
73+
with:
74+
fetch-depth: 0
75+
persist-credentials: false
76+
77+
- name: Scan for secrets
78+
uses: gitleaks/gitleaks-action@v2
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
GITLEAKS_ENABLE_COMMENTS: false
82+
83+
codeql:
84+
name: CodeQL
85+
runs-on: ubuntu-latest
86+
permissions:
87+
actions: read
88+
contents: read
89+
security-events: write
90+
strategy:
91+
fail-fast: false
92+
matrix:
93+
language:
94+
- javascript-typescript
95+
steps:
96+
- name: Checkout
97+
uses: actions/checkout@v4
98+
with:
99+
fetch-depth: 0
100+
persist-credentials: false
101+
102+
- name: Initialize CodeQL
103+
uses: github/codeql-action/init@v3
104+
with:
105+
languages: ${{ matrix.language }}
106+
build-mode: none
107+
108+
- name: Perform CodeQL analysis
109+
uses: github/codeql-action/analyze@v3

.gitignore

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
/.open-next/
2020
/.wrangler/
2121
/.mf/
22-
.dev.vars
2322

2423
# misc
2524
.DS_Store
@@ -32,9 +31,18 @@ yarn-debug.log*
3231
yarn-error.log*
3332
pnpm-debug.log*
3433

35-
# local env files
36-
.env*.local
34+
# local env files and secrets
3735
.env
36+
.env.*
37+
!.env.example
38+
!.env*.example
39+
.dev.vars
40+
.dev.vars.*
41+
!.dev.vars.example
42+
.envrc
43+
.direnv/
44+
secrets.json
45+
*.secrets.json
3846

3947
# vercel
4048
.vercel

SECURITY.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
This project currently supports security fixes on the latest state of the `main` branch.
6+
7+
## Reporting a Vulnerability
8+
9+
Please do not open a public issue for security reports, leaked secrets, or deployment credentials.
10+
11+
Instead, use one of these channels:
12+
13+
1. GitHub security advisory reporting for this repository, if available.
14+
2. A private direct contact channel with the maintainer.
15+
16+
When reporting, include:
17+
18+
- a short summary of the issue
19+
- affected files, routes, or workflows
20+
- reproduction steps or proof of concept
21+
- impact assessment
22+
- any suggested remediation
23+
24+
## Secret Handling
25+
26+
- Never commit `.env*`, `.dev.vars*`, `secrets.json`, private keys, or cloud credentials.
27+
- Use GitHub Actions secrets, Cloudflare dashboard secrets, or `wrangler secret put` for production secrets.
28+
- Rotate exposed secrets immediately, then remove them from the repository history if they were ever committed.
29+
30+
## Project Security Baseline
31+
32+
- Branch protection on `main`
33+
- Build validation in CI
34+
- Dependency review on pull requests
35+
- Production dependency audit in CI
36+
- Secret scanning in CI
37+
- CodeQL static analysis
38+
- Dependabot updates for npm and GitHub Actions

package-lock.json

Lines changed: 5 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"preview": "npm run build && opennextjs-cloudflare preview",
1515
"cf-typegen": "wrangler types"
1616
},
17+
"overrides": {
18+
"postcss": "8.5.14"
19+
},
1720
"dependencies": {
1821
"clsx": "2.1.1",
1922
"next": "^15.5.18",
@@ -29,7 +32,7 @@
2932
"autoprefixer": "10.4.20",
3033
"eslint": "9.17.0",
3134
"eslint-config-next": "^15.5.18",
32-
"postcss": "8.4.49",
35+
"postcss": "8.5.14",
3336
"tailwindcss": "3.4.17",
3437
"typescript": "5.7.2",
3538
"wrangler": "^4.86.0"

0 commit comments

Comments
 (0)