@xenos1996/usat 1.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.
Files changed (129) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +335 -0
  3. package/USAT.md +596 -0
  4. package/dist/cli.d.ts +3 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +438 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/config.d.ts +7 -0
  9. package/dist/config.d.ts.map +1 -0
  10. package/dist/config.js +72 -0
  11. package/dist/config.js.map +1 -0
  12. package/dist/detect/index.d.ts +58 -0
  13. package/dist/detect/index.d.ts.map +1 -0
  14. package/dist/detect/index.js +329 -0
  15. package/dist/detect/index.js.map +1 -0
  16. package/dist/engine/audit.d.ts +21 -0
  17. package/dist/engine/audit.d.ts.map +1 -0
  18. package/dist/engine/audit.js +295 -0
  19. package/dist/engine/audit.js.map +1 -0
  20. package/dist/engine/diff.d.ts +24 -0
  21. package/dist/engine/diff.d.ts.map +1 -0
  22. package/dist/engine/diff.js +136 -0
  23. package/dist/engine/diff.js.map +1 -0
  24. package/dist/engine/evaluate.d.ts +19 -0
  25. package/dist/engine/evaluate.d.ts.map +1 -0
  26. package/dist/engine/evaluate.js +377 -0
  27. package/dist/engine/evaluate.js.map +1 -0
  28. package/dist/engine/gate.d.ts +19 -0
  29. package/dist/engine/gate.d.ts.map +1 -0
  30. package/dist/engine/gate.js +47 -0
  31. package/dist/engine/gate.js.map +1 -0
  32. package/dist/engine/loader.d.ts +22 -0
  33. package/dist/engine/loader.d.ts.map +1 -0
  34. package/dist/engine/loader.js +360 -0
  35. package/dist/engine/loader.js.map +1 -0
  36. package/dist/engine/maturity.d.ts +20 -0
  37. package/dist/engine/maturity.d.ts.map +1 -0
  38. package/dist/engine/maturity.js +157 -0
  39. package/dist/engine/maturity.js.map +1 -0
  40. package/dist/engine/score.d.ts +19 -0
  41. package/dist/engine/score.d.ts.map +1 -0
  42. package/dist/engine/score.js +141 -0
  43. package/dist/engine/score.js.map +1 -0
  44. package/dist/engine/sections.d.ts +14 -0
  45. package/dist/engine/sections.d.ts.map +1 -0
  46. package/dist/engine/sections.js +50 -0
  47. package/dist/engine/sections.js.map +1 -0
  48. package/dist/index.d.ts +23 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.js +17 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/report/markdown.d.ts +16 -0
  53. package/dist/report/markdown.d.ts.map +1 -0
  54. package/dist/report/markdown.js +488 -0
  55. package/dist/report/markdown.js.map +1 -0
  56. package/dist/types.d.ts +282 -0
  57. package/dist/types.d.ts.map +1 -0
  58. package/dist/types.js +16 -0
  59. package/dist/types.js.map +1 -0
  60. package/dist/util/glob.d.ts +11 -0
  61. package/dist/util/glob.d.ts.map +1 -0
  62. package/dist/util/glob.js +86 -0
  63. package/dist/util/glob.js.map +1 -0
  64. package/dist/util/project.d.ts +72 -0
  65. package/dist/util/project.d.ts.map +1 -0
  66. package/dist/util/project.js +586 -0
  67. package/dist/util/project.js.map +1 -0
  68. package/dist/util/yaml.d.ts +28 -0
  69. package/dist/util/yaml.d.ts.map +1 -0
  70. package/dist/util/yaml.js +48 -0
  71. package/dist/util/yaml.js.map +1 -0
  72. package/docs/ARCHITECTURE.md +119 -0
  73. package/docs/README.md +27 -0
  74. package/docs/adr/0001-record-architecture-decisions.md +35 -0
  75. package/docs/adr/0002-typescript-engine-over-python.md +49 -0
  76. package/docs/adr/0003-rules-are-data-not-code.md +50 -0
  77. package/docs/adr/0004-markdown-only-output.md +41 -0
  78. package/docs/adr/0005-maturity-dampens-severity.md +56 -0
  79. package/docs/adr/0006-severity-status-two-axes.md +48 -0
  80. package/docs/adr/0007-suppressions-are-visible-and-expiring.md +46 -0
  81. package/docs/adr/0008-report-trailer-and-diff.md +48 -0
  82. package/docs/adr/0009-fail-closed-on-malformed-input.md +56 -0
  83. package/docs/adr/0010-detector-design.md +54 -0
  84. package/docs/adr/0011-coexist-with-deep-scanners.md +52 -0
  85. package/docs/adr/README.md +32 -0
  86. package/docs/agent-integration.md +129 -0
  87. package/docs/ci-integration.md +163 -0
  88. package/docs/concepts.md +196 -0
  89. package/docs/configuration.md +105 -0
  90. package/docs/detectors.md +186 -0
  91. package/docs/getting-started.md +99 -0
  92. package/docs/maturity-profiles.md +156 -0
  93. package/docs/reference/api.md +193 -0
  94. package/docs/reference/cli.md +412 -0
  95. package/docs/rule-packs.md +278 -0
  96. package/docs/standards-mapping.md +171 -0
  97. package/package.json +96 -0
  98. package/rules/core/architecture.yaml +190 -0
  99. package/rules/core/cicd.yaml +212 -0
  100. package/rules/core/code-quality.yaml +261 -0
  101. package/rules/core/dependencies.yaml +132 -0
  102. package/rules/core/documentation.yaml +119 -0
  103. package/rules/core/future-readiness.yaml +91 -0
  104. package/rules/core/release.yaml +131 -0
  105. package/rules/core/repo.yaml +303 -0
  106. package/rules/core/security.yaml +494 -0
  107. package/rules/core/supply-chain.yaml +357 -0
  108. package/rules/core/testing.yaml +260 -0
  109. package/rules/detectors.yaml +2255 -0
  110. package/rules/index.yaml +41 -0
  111. package/rules/profiles/maturity.yaml +135 -0
  112. package/rules/stacks/ai-era.yaml +193 -0
  113. package/rules/stacks/api-backend.yaml +121 -0
  114. package/rules/stacks/cli.yaml +105 -0
  115. package/rules/stacks/compliance.yaml +157 -0
  116. package/rules/stacks/containers.yaml +124 -0
  117. package/rules/stacks/data.yaml +165 -0
  118. package/rules/stacks/go.yaml +134 -0
  119. package/rules/stacks/iac.yaml +128 -0
  120. package/rules/stacks/jvm.yaml +150 -0
  121. package/rules/stacks/ml-ai.yaml +140 -0
  122. package/rules/stacks/mobile.yaml +121 -0
  123. package/rules/stacks/node-typescript.yaml +166 -0
  124. package/rules/stacks/python.yaml +175 -0
  125. package/rules/stacks/rust.yaml +129 -0
  126. package/rules/stacks/solidity.yaml +139 -0
  127. package/rules/stacks/web-frontend.yaml +159 -0
  128. package/templates/AGENTS.audit.md +135 -0
  129. package/templates/AUDIT_REPORT.md +155 -0
@@ -0,0 +1,303 @@
1
+ id: core/repo
2
+ title: Repository & Project Structure
3
+ section: S1
4
+ section_title: Repository & Project Structure
5
+ description: >
6
+ Root hygiene, the essential-files baseline, and version-control quality.
7
+ Cheap to fix, expensive to ignore — this is where most leaked credentials
8
+ and most onboarding pain originate.
9
+ version: '1.0'
10
+
11
+ rules:
12
+ - id: REPO-001
13
+ title: .gitignore is present
14
+ section: S1
15
+ section_title: Repository & Project Structure
16
+ severity: CRITICAL
17
+ class: security
18
+ check: { kind: file_exists, files: ['.gitignore'] }
19
+ why: >
20
+ Without a .gitignore the next `git add -A` commits node_modules, build
21
+ output, and — sooner or later — a .env file.
22
+ remediation: 'Add a .gitignore for your stack (github/gitignore has templates).'
23
+ references: ['CWE-540', 'OpenSSF-Scorecard:Binary-Artifacts']
24
+
25
+ - id: REPO-002
26
+ title: No environment/secret files committed
27
+ section: S1
28
+ section_title: Repository & Project Structure
29
+ severity: CRITICAL
30
+ class: security
31
+ check:
32
+ kind: tracked_absent
33
+ patterns:
34
+ [
35
+ '.env',
36
+ '.env.*',
37
+ '*.env',
38
+ '*.pem',
39
+ '*.key',
40
+ '*.p12',
41
+ '*.pfx',
42
+ 'id_rsa*',
43
+ 'credentials*',
44
+ 'secrets/**',
45
+ '.npmrc',
46
+ '.pypirc',
47
+ ]
48
+ why: 'A committed .env is a published credential. Rotating is the only fix.'
49
+ remediation: 'Remove from the index, rotate every value in the file, purge history (git filter-repo / BFG), add to .gitignore.'
50
+ references: ['CWE-798', 'ASVS-14.3.2', 'OpenSSF-Scorecard:Binary-Artifacts']
51
+
52
+ - id: REPO-003
53
+ title: No secrets in git history
54
+ section: S1
55
+ section_title: Repository & Project Structure
56
+ severity: CRITICAL
57
+ class: security
58
+ check:
59
+ kind: command
60
+ run: '! git log -p --all | grep -qiE "(api[_-]?key|secret|password|passwd|token|private[_-]?key)[[:space:]]*[:=][[:space:]]*[A-Za-z0-9/+_-]{16,}"'
61
+ expect_exit: 0
62
+ why: 'Deleting a secret from HEAD does not delete it from history. Anyone who cloned the repo still has it.'
63
+ evidence: 'Command output, or a manual `gitleaks detect --log-opts=--all` run.'
64
+ remediation: 'Rotate the exposed values and rewrite history with git-filter-repo. Rotation first: assume it is already public.'
65
+ references: ['CWE-798', 'ASVS-14.3.2']
66
+
67
+ - id: REPO-004
68
+ title: README present
69
+ section: S1
70
+ section_title: Repository & Project Structure
71
+ severity: HIGH
72
+ class: documentation
73
+ check:
74
+ kind: any_file
75
+ patterns: ['README.md', 'readme.md', 'README.rst', 'README.txt', 'README']
76
+ why: 'The README is the front door. Without it, every new contributor needs a human guided tour.'
77
+ remediation: 'Write: what this is, how to install, how to run it, how to contribute. Four headings, one page.'
78
+ references: ['CII-Best-Practices']
79
+
80
+ - id: REPO-005
81
+ title: LICENSE present
82
+ section: S1
83
+ section_title: Repository & Project Structure
84
+ severity: HIGH
85
+ class: compliance
86
+ check:
87
+ kind: any_file
88
+ patterns: ['LICENSE*', 'COPYING*']
89
+ why: 'No license means "all rights reserved" by default. Nobody can legally use it, including you, later.'
90
+ remediation: 'Add MIT / Apache-2.0 / GPL-3.0 as appropriate. Choose at choosealicense.com.'
91
+ references: ['OpenSSF-Scorecard:License', 'SPDX']
92
+
93
+ - id: REPO-006
94
+ title: .env.example documents required configuration
95
+ section: S1
96
+ section_title: Repository & Project Structure
97
+ severity: HIGH
98
+ class: maintainability
99
+ applies_when:
100
+ any:
101
+ - { fact: 'has:database' }
102
+ - { fact: 'platform:server' }
103
+ - { fact: 'auth:jwt' }
104
+ - { fact: 'auth:apikey' }
105
+ - { fact: 'auth:oauth' }
106
+ check:
107
+ kind: any_file
108
+ patterns: ['.env.example', '.env.sample', '.env.template', 'env.example', 'config.example.*']
109
+ why: 'Undocumented required env vars turn setup into archaeology.'
110
+ remediation: 'Add .env.example listing every variable the app reads, with safe placeholder values and a comment per var.'
111
+ references: ['ASVS-14.3.2']
112
+
113
+ - id: REPO-007
114
+ title: Build artifacts and dependencies are not committed
115
+ section: S1
116
+ section_title: Repository & Project Structure
117
+ severity: HIGH
118
+ class: maintainability
119
+ check:
120
+ kind: tracked_absent
121
+ patterns:
122
+ [
123
+ 'dist/**',
124
+ 'build/**',
125
+ 'out/**',
126
+ 'node_modules/**',
127
+ 'target/**',
128
+ '.venv/**',
129
+ 'venv/**',
130
+ '*.egg-info/**',
131
+ '__pycache__/**',
132
+ 'coverage/**',
133
+ '.next/**',
134
+ ]
135
+ why: 'Committed build output bloats the repo, guarantees merge conflicts, and hides the real source in review noise.'
136
+ remediation: 'Untrack (git rm -r --cached) and add the paths to .gitignore.'
137
+ references: ['OpenSSF-Scorecard:Binary-Artifacts']
138
+
139
+ - id: REPO-008
140
+ title: Large binaries are not committed directly
141
+ section: S1
142
+ section_title: Repository & Project Structure
143
+ severity: MEDIUM
144
+ class: maintainability
145
+ check:
146
+ kind: tracked_absent
147
+ patterns:
148
+ [
149
+ '*.mp4',
150
+ '*.mov',
151
+ '*.zip',
152
+ '*.tar.gz',
153
+ '*.tgz',
154
+ '*.exe',
155
+ '*.dll',
156
+ '*.so',
157
+ '*.dylib',
158
+ '*.jar',
159
+ '*.war',
160
+ '*.psd',
161
+ '*.sketch',
162
+ ]
163
+ why: 'Git stores every revision of every binary forever. Use Git LFS or object storage.'
164
+ remediation: 'Move binaries to LFS or object storage; rewrite history if the repo has already grown past ~200 MB.'
165
+ references: ['OpenSSF-Scorecard:Binary-Artifacts']
166
+
167
+ - id: REPO-009
168
+ title: SECURITY.md published
169
+ section: S1
170
+ section_title: Repository & Project Structure
171
+ severity: HIGH
172
+ class: security
173
+ applies_when:
174
+ not: { fact: 'maturity:prototype' }
175
+ check:
176
+ kind: any_file
177
+ patterns: ['SECURITY.md', '.github/SECURITY.md', 'docs/SECURITY.md']
178
+ why: 'Without a disclosure route, researchers either stay silent or post publicly. Neither helps you.'
179
+ remediation: 'Add SECURITY.md with supported versions and a report address. GitHub surfaces it in the Security tab.'
180
+ references: ['OpenSSF-Scorecard:Security-Policy', 'NIST-SSDF-RV.1.1']
181
+
182
+ - id: REPO-010
183
+ title: CHANGELOG maintained
184
+ section: S1
185
+ section_title: Repository & Project Structure
186
+ severity: MEDIUM
187
+ class: documentation
188
+ applies_when:
189
+ not: { fact: 'maturity:prototype' }
190
+ check:
191
+ kind: any_file
192
+ patterns: ['CHANGELOG*', 'CHANGES*', 'HISTORY.md']
193
+ why: 'Users and downstream maintainers need to know what changed and whether it will break them.'
194
+ remediation: 'Adopt Keep a Changelog, or generate it from Conventional Commits / Changesets.'
195
+ references: ['Keep-a-Changelog']
196
+
197
+ - id: REPO-011
198
+ title: CONTRIBUTING guide present
199
+ section: S1
200
+ section_title: Repository & Project Structure
201
+ severity: LOW
202
+ class: documentation
203
+ applies_when:
204
+ not: { fact: 'maturity:prototype' }
205
+ check: { kind: any_file, patterns: ['CONTRIBUTING*', 'docs/CONTRIBUTING*'] }
206
+ why: 'Turns "how do I run the tests?" from an interruption into a link.'
207
+ remediation: 'Setup, test/lint commands, branch naming, commit convention, review expectations.'
208
+ references: ['CII-Best-Practices']
209
+
210
+ - id: REPO-012
211
+ title: Code of conduct present
212
+ section: S1
213
+ section_title: Repository & Project Structure
214
+ severity: LOW
215
+ class: compliance
216
+ applies_when:
217
+ not: { fact: 'maturity:prototype' }
218
+ check: { kind: any_file, patterns: ['CODE_OF_CONDUCT*', 'docs/CODE_OF_CONDUCT*'] }
219
+ why: 'Sets the floor for interaction and gives maintainers something to point at.'
220
+ remediation: 'Adopt the Contributor Covenant.'
221
+ references: ['CII-Best-Practices']
222
+
223
+ - id: REPO-013
224
+ title: .editorconfig present
225
+ section: S1
226
+ section_title: Repository & Project Structure
227
+ severity: LOW
228
+ class: style
229
+ check: { kind: file_exists, files: ['.editorconfig'] }
230
+ why: 'Kills tabs-vs-spaces diffs before they start, across every editor.'
231
+ remediation: 'Add a 6-line .editorconfig (charset, EOL, indent style/size, trailing whitespace, final newline).'
232
+
233
+ - id: REPO-014
234
+ title: CODEOWNERS assigns review responsibility
235
+ section: S1
236
+ section_title: Repository & Project Structure
237
+ severity: MEDIUM
238
+ class: operations
239
+ applies_when: { fact: 'metric:contributors', op: 'gt', value: 2 }
240
+ check: { kind: any_file, patterns: ['.github/CODEOWNERS', 'CODEOWNERS', 'docs/CODEOWNERS'] }
241
+ why: 'With more than two contributors, unreviewed-by-default becomes the default.'
242
+ remediation: 'Add .github/CODEOWNERS mapping paths to teams; require review from code owners on the default branch.'
243
+ references: ['OpenSSF-Scorecard:Code-Review']
244
+
245
+ - id: REPO-015
246
+ title: Commit history is meaningful
247
+ section: S1
248
+ section_title: Repository & Project Structure
249
+ severity: LOW
250
+ class: maintainability
251
+ check: { kind: manual }
252
+ why: >-
253
+ Commit messages are the only history most projects ever write down. "fix stuff" costs the next person an afternoon.
254
+ evidence: 'Last 20 commit messages. Are they descriptive and consistently formatted?'
255
+ remediation: 'Adopt Conventional Commits; enforce with commitlint in CI.'
256
+
257
+ - id: REPO-016
258
+ title: Branch strategy is defined and stale branches pruned
259
+ section: S1
260
+ section_title: Repository & Project Structure
261
+ severity: LOW
262
+ class: maintainability
263
+ applies_when: { fact: 'metric:branches', op: 'gt', value: 3 }
264
+ check: { kind: manual }
265
+ why: >-
266
+ A branching strategy nobody wrote down is a branching strategy nobody follows, and stale branches hide work.
267
+ evidence: 'Branch list and age of the oldest non-default branch.'
268
+ remediation: 'Document trunk-based or Git Flow in CONTRIBUTING; delete merged branches; protect the default branch.'
269
+
270
+ - id: REPO-017
271
+ title: Concern separation at the root
272
+ section: S1
273
+ section_title: Repository & Project Structure
274
+ severity: MEDIUM
275
+ class: maintainability
276
+ check:
277
+ kind: any_file
278
+ patterns: ['src/**', 'app/**', 'lib/**', 'pkg/**', 'internal/**', 'packages/**']
279
+ why: 'A flat root of 40 files makes ownership and navigation guesswork.'
280
+ remediation: 'Group by concern (src/, tests/, docs/, scripts/, config/). Monorepos: packages/ or apps/.'
281
+
282
+ - id: REPO-018
283
+ title: Agent instruction file present (AGENTS.md / CLAUDE.md)
284
+ section: S1
285
+ section_title: Repository & Project Structure
286
+ severity: LOW
287
+ class: documentation
288
+ check:
289
+ kind: any_file
290
+ patterns:
291
+ [
292
+ 'AGENTS.md',
293
+ 'CLAUDE.md',
294
+ '.cursorrules',
295
+ '.github/copilot-instructions.md',
296
+ 'codex.md',
297
+ '.windsurfrules',
298
+ ]
299
+ why: >
300
+ Coding agents perform measurably better when the repo tells them how to
301
+ build, test, and what not to touch. It also stops them inventing commands.
302
+ remediation: 'Add AGENTS.md: setup, build/test/lint commands, conventions, and explicit no-go areas.'
303
+ references: ['Agent-Skills']