Skip to content

Commit 448be8b

Browse files
authored
Merge pull request #146 from aicodingstack/agent/security-accessibility
feat(quality): add security and accessibility gates
2 parents a6927f8 + c029a69 commit 448be8b

16 files changed

Lines changed: 5127 additions & 12867 deletions

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,25 @@ jobs:
9797
- name: Run CSpell
9898
run: npm run spell
9999

100+
security:
101+
name: Dependency Audit
102+
runs-on: ubuntu-latest
103+
steps:
104+
- name: Checkout code
105+
uses: actions/checkout@v6
106+
107+
- name: Setup Node.js
108+
uses: actions/setup-node@v6
109+
with:
110+
node-version: '22'
111+
cache: 'npm'
112+
113+
- name: Install dependencies
114+
run: npm ci
115+
116+
- name: Block high and critical advisories
117+
run: npm run security:audit
118+
100119
build:
101120
name: Build
102121
runs-on: ubuntu-latest
@@ -156,7 +175,7 @@ jobs:
156175
ci-success:
157176
name: CI Success
158177
runs-on: ubuntu-latest
159-
needs: [lint, type-check, test, spell-check, build, e2e]
178+
needs: [lint, type-check, test, spell-check, security, build, e2e]
160179
if: always()
161180
steps:
162181
- name: Check all jobs

SECURITY.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ If you're contributing to this project, please follow these security guidelines:
8181

8282
### Current Architecture
8383

84-
AI Coding Stack is a static Next.js website deployed on Cloudflare Pages:
84+
AI Coding Stack is a mostly static Next.js website deployed on Cloudflare Workers:
8585

8686
- **No user authentication**: The site doesn't handle user credentials
8787
- **No user data collection**: We don't store personal information
@@ -97,7 +97,8 @@ AI Coding Stack is a static Next.js website deployed on Cloudflare Pages:
9797

9898
2. **Dependency vulnerabilities**: npm packages may have vulnerabilities
9999
- Mitigation: Dependabot automatic updates
100-
- Regular security audits with `npm audit`
100+
- CI blocks high and critical advisories across production and development dependencies
101+
- Run the same audit locally with `npm run security:audit`
101102

102103
3. **XSS risks**: User-contributed content could introduce XSS
103104
- Mitigation: All content is sanitized and validated
@@ -147,6 +148,16 @@ If you're deploying AI Coding Stack, ensure:
147148
- Configure CSP (Content Security Policy)
148149
- Enable DDoS protection
149150

151+
## Dependency Audit Policy
152+
153+
- Dependabot checks npm and GitHub Actions dependencies every Monday.
154+
- Pull requests and `main` pushes run `npm run security:audit` against the official npm advisory
155+
service.
156+
- High and critical advisories block CI. Moderate and low advisories require documented triage and
157+
should be resolved in the next compatible dependency update.
158+
- Security upgrades should stay within supported framework and adapter ranges; do not accept an
159+
automated downgrade solely to reduce the audit count.
160+
150161
## Contact
151162

152163
For security concerns or questions not covered here:

docs/PROJECT-REVIEW-2026-07-18.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ Baseline captured on 2026-07-18:
9595
- [x] Add route-contract tests for every manifest category.
9696
- [x] Add browser-level smoke tests for search, navigation, detail pages, locale switching, and
9797
comparison selection.
98-
- [ ] Add automated accessibility checks for dialogs, menus, comparison tables, and mobile nav.
98+
- [x] Add automated accessibility checks for dialogs, menus, comparison tables, and mobile nav.
9999
- [x] Run generation in CI and fail when tracked generated output differs.
100100
- [x] Make the aggregate CI job fail on cancelled or skipped required jobs as well as failures.
101-
- [ ] Add a small security workflow/policy for dependency and application review.
101+
- [x] Add a small security workflow/policy for dependency and application review.
102102

103103
## P2 — Architecture and Scale
104104

@@ -177,3 +177,10 @@ evidence; completed items are reflected in the checklists and implementation log
177177
guard requiring future manifest changes to be represented in `data/changelogs.json`.
178178
- Fixed the search result category badge to use the shared translated category names after browser
179179
testing exposed a missing runtime message lookup.
180+
- Upgraded Next.js, OpenNext Cloudflare, next-intl, React, Vitest, Wrangler, and AJV to compatible
181+
patched releases; refreshed vulnerable transitives and reduced `npm audit` from 42 advisories to
182+
zero without accepting automated framework downgrades.
183+
- Added a required high/critical dependency-audit CI job and documented the security triage policy.
184+
- Added Axe browser checks for the search dialog, language menu, model comparison tables, and
185+
expanded mobile navigation, fixing the accessible names, ARIA relationships, decorative content,
186+
and contrast issues those checks exposed.

next.config.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ const securityHeaders = [
3636
const nextConfig: NextConfig = {
3737
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'],
3838

39+
allowedDevOrigins: ['localhost'],
40+
3941
// Required for OpenNext Cloudflare adapter
4042
output: 'standalone',
4143

@@ -140,16 +142,20 @@ const nextConfig: NextConfig = {
140142
},
141143
],
142144
},
143-
// Aggressive caching for Next.js static assets
144-
{
145-
source: '/_next/static/:path*',
146-
headers: [
147-
{
148-
key: 'Cache-Control',
149-
value: 'public, max-age=31536000, immutable',
150-
},
151-
],
152-
},
145+
...(process.env.NODE_ENV === 'production'
146+
? [
147+
// Development assets must remain revalidatable for hydration and HMR.
148+
{
149+
source: '/_next/static/:path*',
150+
headers: [
151+
{
152+
key: 'Cache-Control',
153+
value: 'public, max-age=31536000, immutable',
154+
},
155+
],
156+
},
157+
]
158+
: []),
153159
// Cache images and media files
154160
{
155161
source: '/images/:path*',

0 commit comments

Comments
 (0)