@xenos1996/usa 2.26.0 → 2.27.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.
Files changed (40) hide show
  1. package/dist/engine/audit-config.d.ts +66 -0
  2. package/dist/engine/audit-config.d.ts.map +1 -0
  3. package/dist/engine/audit-config.js +148 -0
  4. package/dist/engine/audit-config.js.map +1 -0
  5. package/dist/engine/audit-types.d.ts +44 -0
  6. package/dist/engine/audit-types.d.ts.map +1 -0
  7. package/dist/engine/audit-types.js +2 -0
  8. package/dist/engine/audit-types.js.map +1 -0
  9. package/dist/engine/audit-warnings.d.ts +56 -0
  10. package/dist/engine/audit-warnings.d.ts.map +1 -0
  11. package/dist/engine/audit-warnings.js +116 -0
  12. package/dist/engine/audit-warnings.js.map +1 -0
  13. package/dist/engine/audit.d.ts +14 -38
  14. package/dist/engine/audit.d.ts.map +1 -1
  15. package/dist/engine/audit.js +9 -500
  16. package/dist/engine/audit.js.map +1 -1
  17. package/dist/engine/evaluate-packs.d.ts +37 -0
  18. package/dist/engine/evaluate-packs.d.ts.map +1 -0
  19. package/dist/engine/evaluate-packs.js +144 -0
  20. package/dist/engine/evaluate-packs.js.map +1 -0
  21. package/dist/engine/invariants.d.ts +8 -0
  22. package/dist/engine/invariants.d.ts.map +1 -1
  23. package/dist/engine/invariants.js +11 -0
  24. package/dist/engine/invariants.js.map +1 -1
  25. package/dist/engine/pack-selection.d.ts +21 -0
  26. package/dist/engine/pack-selection.d.ts.map +1 -0
  27. package/dist/engine/pack-selection.js +63 -0
  28. package/dist/engine/pack-selection.js.map +1 -0
  29. package/dist/engine/report-build.d.ts +22 -0
  30. package/dist/engine/report-build.d.ts.map +1 -0
  31. package/dist/engine/report-build.js +67 -0
  32. package/dist/engine/report-build.js.map +1 -0
  33. package/dist/foundation/interview.d.ts.map +1 -1
  34. package/dist/foundation/interview.js +16 -5
  35. package/dist/foundation/interview.js.map +1 -1
  36. package/package.json +17 -12
  37. package/rules/core/code-quality.yaml +12 -2
  38. package/rules/core/provenance-attestation.yaml +5 -0
  39. package/rules/core/security.yaml +1 -1
  40. package/rules/core/testing-assurance.yaml +19 -4
@@ -100,7 +100,12 @@ rules:
100
100
  applies_when: { fact: 'lang:typescript' }
101
101
  check:
102
102
  kind: grep_absent
103
- pattern: '(@ts-ignore|@ts-expect-error|:\s*any\b|\bas any\b|as unknown as)'
103
+ # `:\s*any\b` alone matched prose — "Degraded-never-empty: any fetch
104
+ # failure" in a doc comment — so the type-escape branch now requires a
105
+ # type position after the keyword (`: any,` `: any)` `: any[]` `: any =`).
106
+ # Masking comments instead is not an option here: `@ts-ignore` lives in a
107
+ # comment, and the rule exists to catch it.
108
+ pattern: '(@ts-ignore|@ts-expect-error|:\s*any\b(?=\s*[,;)\]}>=]|$)|\bas any\b|as unknown as)'
104
109
  include: ['**/*.{ts,tsx}']
105
110
  exclude: ['**/*.test.*', '**/*.spec.*', '**/*.d.ts']
106
111
  why: 'Every `any` is a place the type system was told to stop helping. A few are fine; a pattern is a problem.'
@@ -204,7 +209,12 @@ rules:
204
209
  kind: grep_wrong
205
210
  pattern: '(TODO|FIXME|XXX|HACK|WORKAROUND)\b'
206
211
  include: ['**/*.{ts,tsx,js,jsx,py,go,rs,java,kt,rb,php,cs,yml,yaml}']
207
- exclude: ['**/*.md', '**/docs/**', '**/node_modules/**']
212
+ # A fixture is a *sample of bad code*, not debt: CQ-010.yaml contains a
213
+ # TODO precisely so this rule has something to flag. Excluding them here
214
+ # (rather than from the audit index) keeps the fixtures visible to the
215
+ # rules that need to see them, e.g. TAS-011.
216
+ exclude:
217
+ ['**/*.md', '**/docs/**', '**/node_modules/**', '**/fixtures/**', '**/__fixtures__/**']
208
218
  why: 'A TODO with no owner and no ticket is a lie the codebase tells itself.'
209
219
  remediation: 'Convert each one to a tracked issue with a link in the comment, or delete it if it no longer applies.'
210
220
 
@@ -58,6 +58,11 @@ rules:
58
58
  # An empty signature file signs nothing — presence alone is not evidence.
59
59
  non_empty: true
60
60
  files:
61
+ # cosign's own default bundle name is `<artifact>.sigstore.json`
62
+ # (`cosign sign-blob --bundle x.sigstore.json`), which `*.sigstore`
63
+ # does not match — that gap made every cosign-signed repo fail this
64
+ # rule. `*.sigstore` stays for legacy bundles written with that suffix.
65
+ - '**/*.sigstore.json'
61
66
  - '**/*.sigstore'
62
67
  - '**/*.bundle'
63
68
  - '**/*.sig'
@@ -534,7 +534,7 @@ rules:
534
534
  assert: { rule: SEC-014, status: [PASS] }
535
535
  why: 'Sound tokens with expiry but no rate limiting leave a credential-stuffing window: each token check passes, the login endpoint still takes unlimited guesses.'
536
536
  remediation: 'Rate-limit failed authentication (see SEC-014) on every endpoint that accepts these tokens.'
537
- references: ['CWE-307', 'ASVS-6.3.3']
537
+ references: ['CWE-307']
538
538
 
539
539
  - id: INV-SEC-003
540
540
  title: Validated input is also encoded on output
@@ -137,11 +137,22 @@ rules:
137
137
  patterns:
138
138
  - 'reports/**/*mut*'
139
139
  - 'reports/mutation/**'
140
+ # Stryker's default config file has been `stryker.config.*` since v6;
141
+ # `stryker.conf.*` is the pre-6 name and is kept for older projects.
142
+ - 'stryker.config.*'
140
143
  - 'stryker.conf.*'
141
144
  - '.stryker.conf.*'
142
145
  - '.mutmut*'
143
146
  - 'mutants/**'
144
- why: 'Coverage tells you which lines ran, not whether the test would have failed if the line were wrong; a mutation config or report proves the question was asked.'
147
+ # A committed harness that mutates and asserts is evidence too — and
148
+ # stronger evidence than a config file, which proves only that someone
149
+ # installed a tool. USA mutates every rule check and asserts its own
150
+ # fixture flips (tests/integration/auditor-mutation.test.ts, ~100
151
+ # probes in every CI run); no third-party tool name appears anywhere in
152
+ # the repo, so the tool-only globs scored that work as absent.
153
+ - 'tests/**/*mutation*'
154
+ - 'tests/**/mutation/**'
155
+ why: 'Coverage tells you which lines ran, not whether the test would have failed if the line were wrong; a mutation config, report, or committed mutation harness proves the question was asked.'
145
156
  remediation: 'Run mutation testing on the highest-risk module first and keep the config or report in the repo.'
146
157
  references: ['Mutation-Testing']
147
158
 
@@ -178,7 +189,11 @@ rules:
178
189
  class: operations
179
190
  check:
180
191
  kind: grep_present
181
- pattern: '(retries\s*:\s*[1-9]|"retries"\s*:\s*[1-9]|retries=[1-9]|--retries[ =][1-9]|rerun-failed|flaky-test-retry|retry-on-failure)'
192
+ # A declared budget of zero is a budget, and a stricter one than 2:
193
+ # the project has decided a flaky test is a failure, not a rerun. The
194
+ # earlier `[1-9]` required paying for retries, so the most honest
195
+ # answer a deterministic suite can give was scored as absent.
196
+ pattern: '(retr(?:y|ies)\s*:\s*\d|retries=\d|--retries[ =]\d|rerun-failed|flaky-test-retry|retry-on-failure)'
182
197
  include:
183
198
  [
184
199
  'playwright.config.*',
@@ -190,8 +205,8 @@ rules:
190
205
  '.github/workflows/*.yaml',
191
206
  '.gitlab-ci.yml',
192
207
  ]
193
- why: 'A retries setting proves the project pays for reruns; it proves nothing about whether the tests are flaky or stable — only that the budget exists.'
194
- remediation: 'Declare an explicit retry budget (e.g. retries: 2 on CI) and track which tests consume it; quarantine chronic consumers.'
208
+ why: 'A declared retry budget says what the project does when a test fails twice: rerun it, or treat it as a defect. Either answer is a policy; silence means nobody decided.'
209
+ remediation: 'Declare the budget explicitly. Prefer retries: 0 and fix flakes; if reruns are unavoidable, set retries: 2 on CI only, track which tests consume it, and quarantine chronic consumers.'
195
210
  references: ['Google-Testing-Blog:Flaky']
196
211
 
197
212
  - id: TAS-010