create-qa-architect 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +12 -0
- package/.github/CLAUDE_MD_AUTOMATION.md +248 -0
- package/.github/PROGRESSIVE_QUALITY_IMPLEMENTATION.md +408 -0
- package/.github/PROGRESSIVE_QUALITY_PROPOSAL.md +443 -0
- package/.github/RELEASE_CHECKLIST.md +100 -0
- package/.github/dependabot.yml +50 -0
- package/.github/git-sync.sh +48 -0
- package/.github/workflows/claude-md-validation.yml +82 -0
- package/.github/workflows/nightly-gitleaks-verification.yml +176 -0
- package/.github/workflows/pnpm-ci.yml.example +53 -0
- package/.github/workflows/python-ci.yml.example +69 -0
- package/.github/workflows/quality-legacy.yml.backup +165 -0
- package/.github/workflows/quality-progressive.yml.example +291 -0
- package/.github/workflows/quality.yml +436 -0
- package/.github/workflows/release.yml +53 -0
- package/.nvmrc +1 -0
- package/.prettierignore +14 -0
- package/.prettierrc +9 -0
- package/.stylelintrc.json +5 -0
- package/README.md +212 -0
- package/config/.lighthouserc.js +45 -0
- package/config/.pre-commit-config.yaml +66 -0
- package/config/constants.js +128 -0
- package/config/defaults.js +124 -0
- package/config/pyproject.toml +124 -0
- package/config/quality-config.schema.json +97 -0
- package/config/quality-python.yml +89 -0
- package/config/requirements-dev.txt +15 -0
- package/create-saas-monetization.js +1465 -0
- package/eslint.config.cjs +117 -0
- package/eslint.config.ts.cjs +99 -0
- package/legal/README.md +106 -0
- package/legal/copyright.md +76 -0
- package/legal/disclaimer.md +146 -0
- package/legal/privacy-policy.html +324 -0
- package/legal/privacy-policy.md +196 -0
- package/legal/terms-of-service.md +224 -0
- package/lib/billing-dashboard.html +645 -0
- package/lib/config-validator.js +163 -0
- package/lib/dependency-monitoring-basic.js +185 -0
- package/lib/dependency-monitoring-premium.js +1490 -0
- package/lib/error-reporter.js +444 -0
- package/lib/interactive/prompt.js +128 -0
- package/lib/interactive/questions.js +146 -0
- package/lib/license-validator.js +403 -0
- package/lib/licensing.js +989 -0
- package/lib/package-utils.js +187 -0
- package/lib/project-maturity.js +516 -0
- package/lib/security-enhancements.js +340 -0
- package/lib/setup-enhancements.js +317 -0
- package/lib/smart-strategy-generator.js +344 -0
- package/lib/telemetry.js +323 -0
- package/lib/template-loader.js +252 -0
- package/lib/typescript-config-generator.js +210 -0
- package/lib/ui-helpers.js +74 -0
- package/lib/validation/base-validator.js +174 -0
- package/lib/validation/cache-manager.js +158 -0
- package/lib/validation/config-security.js +741 -0
- package/lib/validation/documentation.js +326 -0
- package/lib/validation/index.js +186 -0
- package/lib/validation/validation-factory.js +153 -0
- package/lib/validation/workflow-validation.js +172 -0
- package/lib/yaml-utils.js +120 -0
- package/marketing/beta-user-email-campaign.md +372 -0
- package/marketing/landing-page.html +721 -0
- package/package.json +165 -0
- package/setup.js +2076 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
name: CLAUDE.md Validation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master, develop]
|
|
6
|
+
paths:
|
|
7
|
+
- 'CLAUDE.md'
|
|
8
|
+
- 'package.json'
|
|
9
|
+
- 'scripts/validate-claude-md.js'
|
|
10
|
+
- '.github/workflows/claude-md-validation.yml'
|
|
11
|
+
pull_request:
|
|
12
|
+
branches: [main, master, develop]
|
|
13
|
+
paths:
|
|
14
|
+
- 'CLAUDE.md'
|
|
15
|
+
- 'package.json'
|
|
16
|
+
- 'scripts/validate-claude-md.js'
|
|
17
|
+
- '.github/workflows/claude-md-validation.yml'
|
|
18
|
+
workflow_dispatch: # Allow manual trigger
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
validate-claude-md:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
name: Validate CLAUDE.md Consistency
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- name: Checkout code
|
|
27
|
+
uses: actions/checkout@v5
|
|
28
|
+
|
|
29
|
+
- name: Setup Node.js
|
|
30
|
+
uses: actions/setup-node@v6
|
|
31
|
+
with:
|
|
32
|
+
node-version: '20'
|
|
33
|
+
|
|
34
|
+
- name: Validate CLAUDE.md
|
|
35
|
+
run: |
|
|
36
|
+
echo "🔍 Running CLAUDE.md validation..."
|
|
37
|
+
node scripts/validate-claude-md.js
|
|
38
|
+
|
|
39
|
+
- name: Check CLAUDE.md formatting
|
|
40
|
+
run: |
|
|
41
|
+
echo "📝 Checking CLAUDE.md formatting with Prettier..."
|
|
42
|
+
npx prettier --check CLAUDE.md
|
|
43
|
+
|
|
44
|
+
- name: Validate against package.json
|
|
45
|
+
run: |
|
|
46
|
+
echo "🔗 Cross-checking CLAUDE.md with package.json..."
|
|
47
|
+
|
|
48
|
+
# Extract package name from package.json
|
|
49
|
+
PACKAGE_NAME=$(node -e "console.log(require('./package.json').name)")
|
|
50
|
+
|
|
51
|
+
# Check if package name is mentioned in CLAUDE.md
|
|
52
|
+
if ! grep -q "$PACKAGE_NAME" CLAUDE.md; then
|
|
53
|
+
echo "❌ Package name '$PACKAGE_NAME' not found in CLAUDE.md"
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
echo "✅ Package name reference validated"
|
|
58
|
+
|
|
59
|
+
- name: Check for TODO markers
|
|
60
|
+
run: |
|
|
61
|
+
echo "🔍 Checking for unresolved TODO markers..."
|
|
62
|
+
|
|
63
|
+
if grep -i "TODO\|FIXME\|XXX" CLAUDE.md; then
|
|
64
|
+
echo "⚠️ Found TODO markers in CLAUDE.md - consider resolving them"
|
|
65
|
+
exit 1
|
|
66
|
+
else
|
|
67
|
+
echo "✅ No TODO markers found"
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
- name: Validation summary
|
|
71
|
+
if: success()
|
|
72
|
+
run: |
|
|
73
|
+
echo ""
|
|
74
|
+
echo "✅ CLAUDE.md validation successful!"
|
|
75
|
+
echo ""
|
|
76
|
+
echo "All checks passed:"
|
|
77
|
+
echo " ✓ Structure and required sections"
|
|
78
|
+
echo " ✓ Package references"
|
|
79
|
+
echo " ✓ Script documentation"
|
|
80
|
+
echo " ✓ Formatting"
|
|
81
|
+
echo " ✓ No TODO markers"
|
|
82
|
+
echo ""
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
name: Nightly Gitleaks Real Download Verification
|
|
2
|
+
|
|
3
|
+
# Run nightly to verify real gitleaks download and checksum verification
|
|
4
|
+
# This catches upstream asset changes, checksum drift, and download issues
|
|
5
|
+
on:
|
|
6
|
+
schedule:
|
|
7
|
+
# Run at 2 AM UTC daily
|
|
8
|
+
- cron: '0 2 * * *'
|
|
9
|
+
workflow_dispatch: # Allow manual trigger
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
real-download-verification:
|
|
13
|
+
name: Real Gitleaks Download Test (Linux x64)
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout code
|
|
18
|
+
uses: actions/checkout@v5
|
|
19
|
+
|
|
20
|
+
- name: Setup Node.js
|
|
21
|
+
uses: actions/setup-node@v6
|
|
22
|
+
with:
|
|
23
|
+
node-version: '20'
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: npm ci
|
|
27
|
+
|
|
28
|
+
- name: Cache gitleaks binary
|
|
29
|
+
uses: actions/cache@v5
|
|
30
|
+
with:
|
|
31
|
+
path: ~/.cache/create-qa-architect/gitleaks
|
|
32
|
+
key: gitleaks-8.28.0-linux-x64-${{ hashFiles('lib/validation/config-security.js') }}
|
|
33
|
+
restore-keys: |
|
|
34
|
+
gitleaks-8.28.0-linux-x64-
|
|
35
|
+
|
|
36
|
+
- name: Clear any existing cache for fresh download test
|
|
37
|
+
run: |
|
|
38
|
+
echo "🧹 Clearing gitleaks cache for fresh download test..."
|
|
39
|
+
rm -rf ~/.cache/create-qa-architect/gitleaks || true
|
|
40
|
+
|
|
41
|
+
- name: Run real download verification test
|
|
42
|
+
run: |
|
|
43
|
+
echo "🔐 Running REAL gitleaks download and verification test..."
|
|
44
|
+
echo "Platform: $(uname -s)-$(uname -m)"
|
|
45
|
+
echo "Expected checksum: a65b5253807a68ac0cafa4414031fd740aeb55f54fb7e55f386acb52e6a840eb"
|
|
46
|
+
|
|
47
|
+
# Create a test script that downloads and verifies gitleaks
|
|
48
|
+
cat > test-real-download.js << 'EOF'
|
|
49
|
+
const { ConfigSecurityScanner } = require('./lib/validation/config-security');
|
|
50
|
+
const { execSync } = require('child_process');
|
|
51
|
+
const path = require('path');
|
|
52
|
+
const os = require('os');
|
|
53
|
+
|
|
54
|
+
async function testRealDownload() {
|
|
55
|
+
console.log('🧪 Testing real gitleaks download and verification...');
|
|
56
|
+
|
|
57
|
+
const scanner = new ConfigSecurityScanner();
|
|
58
|
+
const cacheDir = path.join(os.homedir(), '.cache', 'create-qa-architect');
|
|
59
|
+
const gitleaksBinary = path.join(cacheDir, 'gitleaks', '8.28.0', 'gitleaks');
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
// This should download, extract, and verify the real gitleaks binary
|
|
63
|
+
const binaryPath = await scanner.resolveGitleaksBinary();
|
|
64
|
+
console.log('✅ Binary resolved to:', binaryPath);
|
|
65
|
+
|
|
66
|
+
// Verify the binary is executable and works
|
|
67
|
+
const output = execSync(`${binaryPath} version`, { encoding: 'utf8' });
|
|
68
|
+
console.log('✅ Gitleaks version output:', output.trim());
|
|
69
|
+
|
|
70
|
+
if (!output.includes('8.28.0')) {
|
|
71
|
+
throw new Error(`Expected version 8.28.0, got: ${output}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Verify checksum again
|
|
75
|
+
const isValid = await scanner.verifyBinaryChecksum(binaryPath);
|
|
76
|
+
if (!isValid) {
|
|
77
|
+
throw new Error('Checksum verification failed');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
console.log('✅ Real download verification test passed!');
|
|
81
|
+
console.log('🔒 Binary downloaded, verified, and functional');
|
|
82
|
+
|
|
83
|
+
} catch (error) {
|
|
84
|
+
console.error('❌ Real download verification failed:', error.message);
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
testRealDownload();
|
|
90
|
+
EOF
|
|
91
|
+
|
|
92
|
+
# Run the real download test
|
|
93
|
+
node test-real-download.js
|
|
94
|
+
|
|
95
|
+
- name: Verify production checksums match expected values
|
|
96
|
+
run: |
|
|
97
|
+
echo "🧪 Running production checksum validation..."
|
|
98
|
+
node tests/gitleaks-production-checksums.test.js
|
|
99
|
+
|
|
100
|
+
- name: Test real binary with security config
|
|
101
|
+
run: |
|
|
102
|
+
echo "🔐 Testing downloaded binary with security configuration..."
|
|
103
|
+
|
|
104
|
+
# Create a minimal test to verify the real binary works with our security config
|
|
105
|
+
echo "console.log('test file')" > test-file.js
|
|
106
|
+
echo "API_KEY=secret123" > .env.test
|
|
107
|
+
|
|
108
|
+
# Run security config with the real binary (should detect the secret)
|
|
109
|
+
if node setup.js --security-config --no-markdownlint 2>&1 | grep -q "secret"; then
|
|
110
|
+
echo "✅ Real gitleaks binary correctly detected secrets"
|
|
111
|
+
else
|
|
112
|
+
echo "❌ Real gitleaks binary failed to detect secrets"
|
|
113
|
+
exit 1
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
# Cleanup test files
|
|
117
|
+
rm -f test-file.js .env.test
|
|
118
|
+
|
|
119
|
+
- name: Report success
|
|
120
|
+
run: |
|
|
121
|
+
echo "✅ Nightly gitleaks verification completed successfully!"
|
|
122
|
+
echo "📊 Verification report:"
|
|
123
|
+
echo " - Real download: ✅ Successful"
|
|
124
|
+
echo " - Checksum verification: ✅ Passed"
|
|
125
|
+
echo " - Version check: ✅ 8.28.0"
|
|
126
|
+
echo " - Functionality test: ✅ Working"
|
|
127
|
+
echo " - Production checksums: ✅ Valid"
|
|
128
|
+
|
|
129
|
+
- name: Cache verification result
|
|
130
|
+
if: success()
|
|
131
|
+
run: |
|
|
132
|
+
# Cache remains in place for faster regular CI runs
|
|
133
|
+
echo "🎯 Real binary cached for regular CI performance"
|
|
134
|
+
ls -la ~/.cache/create-qa-architect/gitleaks/8.28.0/ || true
|
|
135
|
+
|
|
136
|
+
alert-on-failure:
|
|
137
|
+
name: Alert on Verification Failure
|
|
138
|
+
runs-on: ubuntu-latest
|
|
139
|
+
needs: real-download-verification
|
|
140
|
+
if: failure()
|
|
141
|
+
|
|
142
|
+
steps:
|
|
143
|
+
- name: Create Issue on Failure
|
|
144
|
+
uses: actions/github-script@v7
|
|
145
|
+
with:
|
|
146
|
+
script: |
|
|
147
|
+
const title = '🚨 Nightly Gitleaks Verification Failed';
|
|
148
|
+
const body = `
|
|
149
|
+
## Nightly Gitleaks Real Download Verification Failed
|
|
150
|
+
|
|
151
|
+
**Date**: ${new Date().toISOString()}
|
|
152
|
+
**Workflow**: ${context.workflow}
|
|
153
|
+
**Run**: ${context.runNumber}
|
|
154
|
+
|
|
155
|
+
### Possible Issues
|
|
156
|
+
- Gitleaks release assets changed unexpectedly
|
|
157
|
+
- Network/download issues
|
|
158
|
+
- Checksum mismatch (potential security concern)
|
|
159
|
+
- Binary execution problems
|
|
160
|
+
|
|
161
|
+
### Next Steps
|
|
162
|
+
1. Check the [workflow run](${context.payload.repository.html_url}/actions/runs/${context.runId}) for details
|
|
163
|
+
2. Verify gitleaks v8.28.0 release hasn't been modified
|
|
164
|
+
3. Update checksums if legitimate release change
|
|
165
|
+
4. Investigate if potential supply chain attack
|
|
166
|
+
|
|
167
|
+
**Priority**: High - affects security scanning functionality
|
|
168
|
+
`;
|
|
169
|
+
|
|
170
|
+
github.rest.issues.create({
|
|
171
|
+
owner: context.repo.owner,
|
|
172
|
+
repo: context.repo.repo,
|
|
173
|
+
title,
|
|
174
|
+
body,
|
|
175
|
+
labels: ['security', 'bug', 'high-priority']
|
|
176
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master, develop]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
quality:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
# CRITICAL: Install pnpm BEFORE Node.js setup
|
|
18
|
+
# pnpm/action-setup must come before actions/setup-node
|
|
19
|
+
# Otherwise setup-node won't detect pnpm and caching will fail
|
|
20
|
+
- name: Install pnpm
|
|
21
|
+
uses: pnpm/action-setup@v4
|
|
22
|
+
with:
|
|
23
|
+
version: 9
|
|
24
|
+
|
|
25
|
+
- name: Setup Node.js
|
|
26
|
+
uses: actions/setup-node@v4
|
|
27
|
+
with:
|
|
28
|
+
node-version: '20'
|
|
29
|
+
cache: 'pnpm' # Now works because pnpm was installed first
|
|
30
|
+
|
|
31
|
+
- name: Install dependencies
|
|
32
|
+
run: pnpm install --frozen-lockfile
|
|
33
|
+
|
|
34
|
+
# For monorepos: Build packages before running tests
|
|
35
|
+
# This ensures dependent packages are built before tests run
|
|
36
|
+
- name: Build packages
|
|
37
|
+
run: pnpm run build --if-present
|
|
38
|
+
|
|
39
|
+
- name: Lint
|
|
40
|
+
run: pnpm run lint
|
|
41
|
+
|
|
42
|
+
- name: Format check
|
|
43
|
+
run: pnpm run format:check
|
|
44
|
+
|
|
45
|
+
- name: Type check
|
|
46
|
+
run: pnpm run type-check --if-present
|
|
47
|
+
|
|
48
|
+
- name: Run tests
|
|
49
|
+
run: pnpm test --if-present
|
|
50
|
+
|
|
51
|
+
- name: Security audit
|
|
52
|
+
run: pnpm audit --audit-level high
|
|
53
|
+
continue-on-error: true # Don't fail CI on dev dependency vulnerabilities
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
name: Python CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master, develop]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
quality:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ['3.9', '3.10', '3.11', '3.12']
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout code
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Setup Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
cache: 'pip' # Cache pip dependencies
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: |
|
|
29
|
+
python -m pip install --upgrade pip
|
|
30
|
+
pip install -r requirements.txt
|
|
31
|
+
pip install -r requirements-dev.txt
|
|
32
|
+
|
|
33
|
+
- name: Lint with Ruff
|
|
34
|
+
run: |
|
|
35
|
+
pip install ruff
|
|
36
|
+
ruff check .
|
|
37
|
+
|
|
38
|
+
- name: Format check with Black
|
|
39
|
+
run: |
|
|
40
|
+
pip install black
|
|
41
|
+
black --check --diff .
|
|
42
|
+
|
|
43
|
+
- name: Import sorting check with isort
|
|
44
|
+
run: |
|
|
45
|
+
pip install isort
|
|
46
|
+
isort --check-only --diff .
|
|
47
|
+
|
|
48
|
+
- name: Type check with mypy
|
|
49
|
+
run: |
|
|
50
|
+
pip install mypy
|
|
51
|
+
mypy .
|
|
52
|
+
continue-on-error: true # mypy can be strict, don't fail CI initially
|
|
53
|
+
|
|
54
|
+
- name: Security check with Bandit
|
|
55
|
+
run: |
|
|
56
|
+
pip install bandit
|
|
57
|
+
bandit -r . -ll
|
|
58
|
+
continue-on-error: true
|
|
59
|
+
|
|
60
|
+
- name: Run tests with pytest
|
|
61
|
+
run: |
|
|
62
|
+
pip install pytest pytest-cov
|
|
63
|
+
pytest --cov=. --cov-report=xml --cov-report=term
|
|
64
|
+
|
|
65
|
+
- name: Upload coverage to Codecov
|
|
66
|
+
uses: codecov/codecov-action@v4
|
|
67
|
+
with:
|
|
68
|
+
file: ./coverage.xml
|
|
69
|
+
fail_ci_if_error: false
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
name: Quality Checks
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master, develop]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
quality:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v5
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@v6
|
|
19
|
+
with:
|
|
20
|
+
node-version: '20'
|
|
21
|
+
cache: 'npm'
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: |
|
|
25
|
+
if [ -f package-lock.json ]; then
|
|
26
|
+
npm ci
|
|
27
|
+
else
|
|
28
|
+
echo "No package-lock.json found; running npm install"
|
|
29
|
+
npm install
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
- name: Verify dependency integrity
|
|
33
|
+
run: |
|
|
34
|
+
echo "🔐 Verifying dependency integrity..."
|
|
35
|
+
# Verify package-lock.json integrity hashes
|
|
36
|
+
if [ -f package-lock.json ]; then
|
|
37
|
+
npm ci --dry-run --prefer-offline
|
|
38
|
+
echo "✅ Dependency integrity verified"
|
|
39
|
+
else
|
|
40
|
+
echo "⚠️ No package-lock.json found - skipping integrity verification"
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Check for known vulnerabilities in dependencies
|
|
44
|
+
echo "🔍 Checking for vulnerable dependencies..."
|
|
45
|
+
npm audit --audit-level=moderate || true
|
|
46
|
+
|
|
47
|
+
# Verify npm package signatures (Node.js 16+)
|
|
48
|
+
if command -v npm &> /dev/null; then
|
|
49
|
+
echo "✍️ Verifying npm package signatures..."
|
|
50
|
+
npm audit signatures || echo "⚠️ Signature verification not available or failed"
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
- name: Prettier check
|
|
54
|
+
run: npm run format:check
|
|
55
|
+
|
|
56
|
+
- name: ESLint
|
|
57
|
+
run: npx eslint . --max-warnings=0
|
|
58
|
+
|
|
59
|
+
- name: Stylelint
|
|
60
|
+
run: npx stylelint "**/*.{css,scss,sass,less,pcss}" --allow-empty-input
|
|
61
|
+
|
|
62
|
+
- name: Security audit
|
|
63
|
+
run: npm audit --audit-level high
|
|
64
|
+
|
|
65
|
+
- name: Check for hardcoded secrets
|
|
66
|
+
run: |
|
|
67
|
+
# Check for common secret patterns (excluding docs, tests, and workflow files)
|
|
68
|
+
if grep -r -E "(password|secret|key|token).*[=:].*['\"][^'\"]{8,}" . \
|
|
69
|
+
--exclude-dir=node_modules \
|
|
70
|
+
--exclude-dir=.git \
|
|
71
|
+
--exclude-dir=.github \
|
|
72
|
+
--exclude-dir=tests \
|
|
73
|
+
--exclude="*.md" \
|
|
74
|
+
--exclude="package.json" || \
|
|
75
|
+
grep -r -E "-----BEGIN.*KEY-----" . \
|
|
76
|
+
--exclude-dir=node_modules \
|
|
77
|
+
--exclude-dir=.git \
|
|
78
|
+
--exclude-dir=.github \
|
|
79
|
+
--exclude-dir=tests; then
|
|
80
|
+
echo "❌ Potential hardcoded secrets found"
|
|
81
|
+
exit 1
|
|
82
|
+
else
|
|
83
|
+
echo "✅ No hardcoded secrets detected"
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
- name: Security pattern detection
|
|
87
|
+
run: |
|
|
88
|
+
# Check for XSS vulnerability patterns from WFHroulette
|
|
89
|
+
echo "🔍 Scanning for XSS vulnerability patterns..."
|
|
90
|
+
|
|
91
|
+
# Check for innerHTML with interpolation (dangerous pattern)
|
|
92
|
+
if grep -r -E "innerHTML.*\\\$\{" . --include="*.js" --include="*.jsx" --include="*.ts" --include="*.tsx" --exclude-dir=node_modules; then
|
|
93
|
+
echo "❌ Potential XSS: innerHTML with template literal interpolation found"
|
|
94
|
+
exit 1
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
# Check for eval with interpolation
|
|
98
|
+
if grep -r -E "eval\\\(.*\\\$\{" . --include="*.js" --include="*.jsx" --include="*.ts" --include="*.tsx" --exclude-dir=node_modules; then
|
|
99
|
+
echo "❌ Potential code injection: eval with interpolation found"
|
|
100
|
+
exit 1
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
# Check for document.write with interpolation
|
|
104
|
+
if grep -r -E "document\\\\.write.*\\\$\{" . --include="*.js" --include="*.jsx" --include="*.ts" --include="*.tsx" --exclude-dir=node_modules; then
|
|
105
|
+
echo "❌ Potential XSS: document.write with interpolation found"
|
|
106
|
+
exit 1
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
# Check for onclick handlers with interpolation
|
|
110
|
+
if grep -r -E "onclick.*=.*['\"].*\\\$\{" . --include="*.js" --include="*.jsx" --include="*.ts" --include="*.tsx" --include="*.html" --exclude-dir=node_modules; then
|
|
111
|
+
echo "❌ Potential XSS: onclick handler with interpolation found"
|
|
112
|
+
exit 1
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
echo "✅ No XSS vulnerability patterns detected"
|
|
116
|
+
|
|
117
|
+
- name: Input validation check
|
|
118
|
+
run: |
|
|
119
|
+
# Check for proper input validation patterns
|
|
120
|
+
echo "🔍 Checking for input validation patterns..."
|
|
121
|
+
|
|
122
|
+
# Set pipefail to catch grep failures properly
|
|
123
|
+
set -o pipefail
|
|
124
|
+
|
|
125
|
+
# Look for unvalidated user inputs in common patterns
|
|
126
|
+
if grep -r -E "(req\\.query|req\\.params|req\\.body)\\.[a-zA-Z_][a-zA-Z0-9_]*[^\\.]" . --include="*.js" --include="*.ts" --exclude-dir=node_modules | grep -v -E "(trim|toLowerCase|toUpperCase|parseInt|parseFloat|Number\\.isNaN|String|Boolean)" > /tmp/unvalidated_inputs.txt 2>/dev/null && [ -s /tmp/unvalidated_inputs.txt ]; then
|
|
127
|
+
echo "⚠️ Found potential unvalidated user inputs (review manually):"
|
|
128
|
+
head -5 /tmp/unvalidated_inputs.txt
|
|
129
|
+
echo "This is a warning, not a failure. Review these patterns manually."
|
|
130
|
+
else
|
|
131
|
+
echo "✅ No unvalidated user inputs detected"
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
# Clean up temp file
|
|
135
|
+
rm -f /tmp/unvalidated_inputs.txt
|
|
136
|
+
|
|
137
|
+
- name: Configuration security check
|
|
138
|
+
run: |
|
|
139
|
+
# Run comprehensive configuration security validation
|
|
140
|
+
echo "🔍 Running configuration security validation..."
|
|
141
|
+
npx create-quality-automation@latest --security-config
|
|
142
|
+
|
|
143
|
+
- name: Documentation validation
|
|
144
|
+
run: |
|
|
145
|
+
# Run comprehensive documentation validation
|
|
146
|
+
echo "📖 Running documentation validation..."
|
|
147
|
+
npx create-quality-automation@latest --validate-docs
|
|
148
|
+
|
|
149
|
+
- name: Lighthouse CI
|
|
150
|
+
run: |
|
|
151
|
+
# Only run Lighthouse CI if configuration exists
|
|
152
|
+
if [ -f ".lighthouserc.js" ] || [ -f ".lighthouserc.json" ] || [ -f "lighthouserc.js" ]; then
|
|
153
|
+
echo "🚢 Running Lighthouse CI..."
|
|
154
|
+
npx lhci autorun
|
|
155
|
+
else
|
|
156
|
+
echo "⏭️ No Lighthouse CI configuration found, skipping"
|
|
157
|
+
fi
|
|
158
|
+
continue-on-error: true
|
|
159
|
+
|
|
160
|
+
# NOTE: The "Test README Quick Start Instructions" step has been removed
|
|
161
|
+
# because it relies on setup.js which only exists in the create-quality-automation
|
|
162
|
+
# package itself, not in consumer repositories that copy this workflow.
|
|
163
|
+
#
|
|
164
|
+
# Consumer projects get the quality checks above (prettier, eslint, stylelint, etc.)
|
|
165
|
+
# but don't need to test the installation process.
|