Skip to content

Commit 1a9c499

Browse files
Merge pull request #2 from CodeMonkeyCybersecurity/claude/hera-testing-analysis-011CUqe9ycrVMyd2u5m2oiTC
Claude/hera testing analysis 011 c uqe9ycr v myd2u5m2oi tc
2 parents 2aa2b62 + 84711da commit 1a9c499

23 files changed

+11766
-1649
lines changed

.eslintrc.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
"extends": [
88
"eslint:recommended"
99
],
10-
"plugins": [
11-
"webextensions"
12-
],
10+
"plugins": [],
1311
"parserOptions": {
1412
"ecmaVersion": 2022,
1513
"sourceType": "module"
@@ -28,10 +26,6 @@
2826
"no-debugger": "warn",
2927
"no-constant-condition": ["error", { "checkLoops": false }],
3028

31-
// Chrome Extension Best Practices
32-
"webextensions/no-browser-action-set-icon-without-path": "error",
33-
"webextensions/no-browser-action-set-popup-without-popup": "error",
34-
3529
// Async/Await Best Practices
3630
"require-await": "warn",
3731
"no-async-promise-executor": "error",

.github/workflows/security.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Security Scan
2+
3+
on:
4+
schedule:
5+
# Run security scan daily at 00:00 UTC
6+
- cron: '0 0 * * *'
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
branches: [ main ]
11+
12+
jobs:
13+
security-scan:
14+
name: Security Vulnerability Scan
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
23+
with:
24+
node-version: '20.x'
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Run npm audit
31+
run: npm audit --audit-level=moderate
32+
33+
- name: Run npm audit fix
34+
run: npm audit fix --dry-run
35+
36+
- name: Check for outdated dependencies
37+
run: npm outdated
38+
continue-on-error: true
39+
40+
codeql-analysis:
41+
name: CodeQL Analysis
42+
runs-on: ubuntu-latest
43+
permissions:
44+
actions: read
45+
contents: read
46+
security-events: write
47+
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
51+
52+
- name: Initialize CodeQL
53+
uses: github/codeql-action/init@5d5cd550d3e189c569da8f16ea8de2d821c9bf7a # v3.31.2
54+
with:
55+
languages: javascript
56+
57+
- name: Perform CodeQL Analysis
58+
uses: github/codeql-action/analyze@5d5cd550d3e189c569da8f16ea8de2d821c9bf7a # v3.31.2

.github/workflows/test.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Test Suite
2+
3+
on:
4+
push:
5+
branches: [ main, develop, 'claude/**' ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
name: Run Tests
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [18.x, 20.x]
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
21+
22+
- name: Setup Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
cache: 'npm'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Run linter
32+
run: npm run lint
33+
34+
- name: Validate extension
35+
run: npm run validate
36+
37+
- name: Run unit tests
38+
run: npm run test:unit
39+
40+
- name: Run integration tests
41+
run: npm run test:integration
42+
43+
- name: Generate coverage report
44+
run: npm run test:coverage
45+
46+
- name: Upload coverage to Codecov
47+
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
48+
with:
49+
files: ./coverage/lcov.info
50+
flags: unittests
51+
name: codecov-umbrella
52+
fail_ci_if_error: true
53+
env:
54+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
55+
56+
- name: Archive test results
57+
if: always()
58+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
59+
with:
60+
name: test-results-${{ matrix.node-version }}
61+
path: |
62+
coverage/
63+
html/
64+
retention-days: 30
65+
66+
code-quality:
67+
name: Code Quality Checks
68+
runs-on: ubuntu-latest
69+
70+
steps:
71+
- name: Checkout code
72+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
73+
74+
- name: Setup Node.js
75+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
76+
with:
77+
node-version: '20.x'
78+
cache: 'npm'
79+
80+
- name: Install dependencies
81+
run: npm ci
82+
83+
- name: Run ESLint
84+
run: npm run lint
85+
86+
- name: Check for security vulnerabilities
87+
run: npm audit --audit-level=moderate
88+
89+
build:
90+
name: Build Extension
91+
runs-on: ubuntu-latest
92+
needs: [test, code-quality]
93+
94+
steps:
95+
- name: Checkout code
96+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
97+
98+
- name: Setup Node.js
99+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
100+
with:
101+
node-version: '20.x'
102+
cache: 'npm'
103+
104+
- name: Install dependencies
105+
run: npm ci
106+
107+
- name: Validate manifest
108+
run: node scripts/validate-extension.js
109+
110+
- name: Archive extension
111+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
112+
with:
113+
name: hera-extension
114+
path: |
115+
manifest.json
116+
background.js
117+
content-script.js
118+
popup.js
119+
evidence-collector.js
120+
modules/
121+
lib/
122+
icons/
123+
devtools/
124+
popup.html
125+
devtools.html
126+
retention-days: 30

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
/.DS_Store
22
/DATA-PERSISTENCE-GUIDE.md
3-
/ICON_INSTRUCTIONS.md
3+
/ICON_INSTRUCTIONS.md
4+
node_modules/
5+
coverage/
6+
html/
7+
.vitest/

.husky/pre-commit

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
echo "🔍 Running pre-commit checks..."
5+
6+
# Run lint-staged to check only staged files
7+
npx lint-staged
8+
9+
# Check coverage delta (ensure coverage doesn't decrease)
10+
echo "📊 Checking test coverage..."
11+
npm run test:coverage -- --changed
12+
13+
echo "✅ Pre-commit checks passed!"

0 commit comments

Comments
 (0)