@lhi/tdd-audit 1.12.0 → 1.15.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.
@@ -400,6 +400,115 @@ After all vulnerabilities are addressed, output a final **Remediation Summary**:
400
400
 
401
401
  ---
402
402
 
403
+ ## Phase 4: Coverage Gate (≥ 95%)
404
+
405
+ After all vulnerabilities are patched and the hardening checklist is complete, measure test coverage and drive it to **≥ 95% line and branch coverage**.
406
+
407
+ ```bash
408
+ # Node.js / Jest
409
+ npx jest --coverage --coverageReporters=text
410
+
411
+ # Python
412
+ pytest --cov=. --cov-report=term-missing
413
+
414
+ # Go
415
+ go test ./... -coverprofile=coverage.out && go tool cover -func=coverage.out
416
+ ```
417
+
418
+ 1. Run the coverage report.
419
+ 2. Identify every uncovered line or branch.
420
+ 3. For each gap: write a test (Red — must fail without the code path), confirm it passes (Green), re-run coverage.
421
+ 4. Repeat until the overall line **and** branch coverage both reach ≥ 95%.
422
+ 5. If a file is intentionally excluded (e.g., generated code, migration stubs), add it to the coverage exclusion config and note the reason.
423
+
424
+ Do **not** write empty or trivially-true tests to inflate numbers. Every test must assert real behavior.
425
+
426
+ ---
427
+
428
+ ## Phase 5: Badge README
429
+
430
+ Once coverage is ≥ 95%, add a coverage badge to `README.md`.
431
+
432
+ - If `README.md` does not exist, create a minimal one with the project name and badge.
433
+ - The badge must appear at the **top of the file**, before any other content.
434
+ - Use a static Shields.io badge that reflects the actual measured value:
435
+
436
+ ```markdown
437
+ ![Coverage](https://img.shields.io/badge/coverage-95%25-brightgreen)
438
+ ```
439
+
440
+ **Colour tiers:**
441
+
442
+ | Coverage | Colour |
443
+ |---|---|
444
+ | ≥ 90% | `brightgreen` |
445
+ | 75–89% | `yellow` |
446
+ | < 75% | `red` |
447
+
448
+ Adjust the percentage in the badge URL to match the real number (e.g., `97%25` for 97%).
449
+
450
+ ---
451
+
452
+ ## Phase 6: SECURITY.md
453
+
454
+ Check whether a `SECURITY.md` exists at the repo root.
455
+
456
+ - **If it exists** — do not overwrite it. Read it and confirm it has a vulnerability reporting contact. If missing, append one.
457
+ - **If it does not exist** — create it following the GitHub Security Advisory format:
458
+
459
+ ```markdown
460
+ # Security Policy
461
+
462
+ ## Supported Versions
463
+
464
+ | Version | Supported |
465
+ |---|---|
466
+ | latest | ✅ |
467
+ | < latest | ❌ |
468
+
469
+ ## Reporting a Vulnerability
470
+
471
+ Please **do not** open a public GitHub issue for security vulnerabilities.
472
+
473
+ Report vulnerabilities privately via:
474
+ - **GitHub**: Use [GitHub's private vulnerability reporting](../../security/advisories/new)
475
+ - **Email**: security@example.com *(replace with project contact)*
476
+
477
+ Expect acknowledgement within **48 hours** and a patch or mitigation plan within **14 days** for verified HIGH/CRITICAL issues. Reporters are credited in release notes unless anonymity is requested.
478
+
479
+ ## Security Hardening
480
+
481
+ This repository is maintained with the following controls:
482
+
483
+ - HTTP security headers (CSP, HSTS, X-Frame-Options, X-Content-Type-Options)
484
+ - Rate limiting on all state-mutating and authentication routes
485
+ - Dependencies audited on every CI run (`npm audit --audit-level=high`)
486
+ - No secrets committed to git history (verified with gitleaks / trufflehog)
487
+ - ≥ 95% test coverage enforced via CI coverage gate
488
+ - Vulnerabilities remediated using a Red-Green-Refactor exploit-test protocol
489
+ ```
490
+
491
+ Replace placeholder email and version table with the project's real information.
492
+
493
+ ---
494
+
495
+ ## Final Report
496
+
497
+ After Phases 4–6 complete, append to the Remediation Summary:
498
+
499
+ ```
500
+ ## Coverage & Documentation
501
+
502
+ | Item | Status | Detail |
503
+ |---|---|---|
504
+ | Line coverage | ✅ | 96.4% |
505
+ | Branch coverage | ✅ | 95.1% |
506
+ | README badge | ✅ | Updated to 96% (brightgreen) |
507
+ | SECURITY.md | ✅ | Created at repo root |
508
+ ```
509
+
510
+ ---
511
+
403
512
  ## Agentic AI Security (ASI01–ASI10)
404
513
 
405
514
  When the project contains AI agent code, MCP configurations, CLAUDE.md files, or tool-calling patterns, also scan for agentic-specific vulnerabilities. These can be harder to spot than traditional web vulns but carry severe consequences (data exfiltration via tool abuse, agent hijacking, supply chain via MCP).
@@ -321,6 +321,94 @@ If this project contains AI agent code, MCP configurations, or CLAUDE.md files,
321
321
 
322
322
  ---
323
323
 
324
+ ## 4l. Coverage Gate (≥ 95%)
325
+
326
+ After hardening is complete, measure test coverage and drive it to **≥ 95% line and branch coverage** before closing the audit.
327
+
328
+ ```bash
329
+ # Node.js / Jest
330
+ npx jest --coverage --coverageReporters=text
331
+
332
+ # Python
333
+ pytest --cov=. --cov-report=term-missing
334
+
335
+ # Go
336
+ go test ./... -coverprofile=coverage.out && go tool cover -func=coverage.out
337
+ ```
338
+
339
+ 1. Run the coverage report and note every uncovered line or branch.
340
+ 2. For each gap: write a failing test (Red), make it pass (Green), re-run coverage.
341
+ 3. Repeat until line **and** branch coverage both reach ≥ 95%.
342
+ 4. Files that are intentionally excluded (generated code, migration stubs) must be listed in the coverage config with a reason.
343
+
344
+ Do **not** write trivially-true tests to inflate numbers — every test must assert real behavior.
345
+
346
+ ---
347
+
348
+ ## 4m. Badge README
349
+
350
+ Once coverage is ≥ 95%, add (or update) a coverage badge in `README.md`. If no `README.md` exists, create a minimal one.
351
+
352
+ The badge must appear at the **top of the file**, before any other content:
353
+
354
+ ```markdown
355
+ ![Coverage](https://img.shields.io/badge/coverage-95%25-brightgreen)
356
+ ```
357
+
358
+ **Colour tiers:**
359
+
360
+ | Coverage | Colour |
361
+ |---|---|
362
+ | ≥ 90% | `brightgreen` |
363
+ | 75–89% | `yellow` |
364
+ | < 75% | `red` |
365
+
366
+ Adjust the percentage to match the actual measured value (e.g., `97%25` for 97%). Do not overwrite other existing badges — add the coverage badge as the first badge on the line.
367
+
368
+ ---
369
+
370
+ ## 4n. SECURITY.md
371
+
372
+ Check whether a `SECURITY.md` exists at the repo root. **Do not overwrite an existing file.**
373
+
374
+ If absent, create one following the GitHub Security Advisory format:
375
+
376
+ ```markdown
377
+ # Security Policy
378
+
379
+ ## Supported Versions
380
+
381
+ | Version | Supported |
382
+ |---|---|
383
+ | latest | ✅ |
384
+ | < latest | ❌ |
385
+
386
+ ## Reporting a Vulnerability
387
+
388
+ Please **do not** open a public GitHub issue for security vulnerabilities.
389
+
390
+ Report privately via:
391
+ - **GitHub**: Use [GitHub's private vulnerability reporting](../../security/advisories/new)
392
+ - **Email**: security@example.com *(replace with project contact)*
393
+
394
+ Expect acknowledgement within **48 hours** and a patch or mitigation plan within **14 days** for verified HIGH/CRITICAL issues. Reporters are credited in release notes unless anonymity is requested.
395
+
396
+ ## Security Hardening
397
+
398
+ This repository is maintained with the following controls:
399
+
400
+ - HTTP security headers (CSP, HSTS, X-Frame-Options, X-Content-Type-Options)
401
+ - Rate limiting on all state-mutating and authentication routes
402
+ - Dependencies audited on every CI run (`npm audit --audit-level=high`)
403
+ - No secrets committed to git history (verified with gitleaks / trufflehog)
404
+ - ≥ 95% test coverage enforced via CI coverage gate
405
+ - Vulnerabilities remediated using a Red-Green-Refactor exploit-test protocol
406
+ ```
407
+
408
+ Replace placeholder email and version table with the project's real information.
409
+
410
+ ---
411
+
324
412
  ## 4k. Hardening Verification Checklist
325
413
 
326
414
  After Phase 4, confirm all of the following:
@@ -341,3 +429,6 @@ After Phase 4, confirm all of the following:
341
429
  - [ ] `CLAUDE.md` in version control and reviewed; no user-supplied content
342
430
  - [ ] MCP servers pinned to exact versions or local installs
343
431
  - [ ] Agent tool permissions scoped to minimum required
432
+ - [ ] Test coverage ≥ 95% line and branch (4l)
433
+ - [ ] `README.md` has a coverage badge at the top reflecting the actual % (4m)
434
+ - [ ] `SECURITY.md` exists at repo root with a private vulnerability reporting contact (4n)