@growth-labs/conformance 0.1.0 → 0.2.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/CHANGELOG.md +23 -0
- package/README.md +51 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/policy.d.ts +21 -2
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +48 -10
- package/dist/policy.js.map +1 -1
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +512 -15
- package/dist/runner.js.map +1 -1
- package/dist/schema.d.ts +503 -12
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +42 -1
- package/dist/schema.js.map +1 -1
- package/fixtures/negative/required-negative-fixtures.json +131 -0
- package/fixtures/valid/public-article.json +56 -2
- package/package.json +1 -1
- package/src/index.ts +13 -0
- package/src/policy.ts +70 -11
- package/src/runner.ts +584 -14
- package/src/schema.ts +49 -1
package/src/schema.ts
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
2
|
|
|
3
|
-
export const EVIDENCE_SCHEMA_VERSION = 'growth-labs.conformance.
|
|
3
|
+
export const EVIDENCE_SCHEMA_VERSION = 'growth-labs.conformance.v2'
|
|
4
|
+
export const REQUIRED_FUNCTIONAL_PROBE_NAMES = [
|
|
5
|
+
'oauth',
|
|
6
|
+
'media',
|
|
7
|
+
'images',
|
|
8
|
+
'analytics',
|
|
9
|
+
'embeds',
|
|
10
|
+
'error-pages',
|
|
11
|
+
] as const
|
|
4
12
|
|
|
5
13
|
export const REQUIRED_NEGATIVE_FIXTURE_CODES = {
|
|
6
14
|
'csp-unsafe-inline': 'security.csp.unsafe_inline',
|
|
15
|
+
'missing-coop': 'security.header.missing',
|
|
16
|
+
'missing-corp': 'security.header.missing',
|
|
17
|
+
'hsts-below-one-year': 'security.hsts.max_age_too_low',
|
|
18
|
+
'csp-wildcard-default-src': 'security.csp.default_src_wildcard',
|
|
19
|
+
'csp-unsafe-eval': 'security.csp.unsafe_eval',
|
|
20
|
+
'csp-inline-executable-without-nonce-or-hash':
|
|
21
|
+
'security.csp.inline_executable_without_nonce_or_hash',
|
|
22
|
+
'conflicting-duplicate-security-header': 'security.header.conflicting_values',
|
|
23
|
+
'missing-functional-probe-receipt': 'security.functional_probe.missing',
|
|
24
|
+
'missing-csp-report-receipt': 'security.csp_report.missing',
|
|
25
|
+
'failed-csp-report-receipt': 'security.csp_report.failed',
|
|
7
26
|
'headers-static-only-while-ssr-missing': 'security.headers.static_only_for_ssr',
|
|
8
27
|
'undeclared-na': 'publication.na.undeclared',
|
|
9
28
|
'stringified-is-accessible-for-free': 'structured_data.is_accessible_for_free.stringified',
|
|
@@ -62,6 +81,30 @@ export const cacheVariantSchema = z.object({
|
|
|
62
81
|
headers: headerMapSchema.default({}),
|
|
63
82
|
})
|
|
64
83
|
|
|
84
|
+
export const securityFunctionalProbeReceiptSchema = z.object({
|
|
85
|
+
name: z.string().min(1),
|
|
86
|
+
status: checkStatusSchema,
|
|
87
|
+
checkedAt: z.string().min(1).optional(),
|
|
88
|
+
evidence: z.string().min(1).optional(),
|
|
89
|
+
capabilityBoundary: z.string().min(1).optional(),
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
export const cspReportReceiptSchema = z.object({
|
|
93
|
+
name: z.string().min(1),
|
|
94
|
+
status: checkStatusSchema,
|
|
95
|
+
checkedAt: z.string().min(1).optional(),
|
|
96
|
+
evidence: z.string().min(1).optional(),
|
|
97
|
+
endpoint: z.string().min(1).optional(),
|
|
98
|
+
capabilityBoundary: z.string().min(1).optional(),
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
export const securityReceiptsSchema = z
|
|
102
|
+
.object({
|
|
103
|
+
functionalProbes: z.array(securityFunctionalProbeReceiptSchema).default([]),
|
|
104
|
+
cspReports: z.array(cspReportReceiptSchema).default([]),
|
|
105
|
+
})
|
|
106
|
+
.default({ functionalProbes: [], cspReports: [] })
|
|
107
|
+
|
|
65
108
|
export const buildEvidenceSchema = z.object({
|
|
66
109
|
commitSha: z.string().min(7).optional(),
|
|
67
110
|
artifactId: z.string().min(1).optional(),
|
|
@@ -88,6 +131,7 @@ export const conformanceFixtureSchema = z.object({
|
|
|
88
131
|
expected: conformanceExpectedSchema.default({}),
|
|
89
132
|
publicationSurfaces: z.array(publicationSurfaceSchema).default([]),
|
|
90
133
|
cacheVariants: z.array(cacheVariantSchema).default([]),
|
|
134
|
+
securityReceipts: securityReceiptsSchema,
|
|
91
135
|
buildEvidence: buildEvidenceSchema.optional(),
|
|
92
136
|
expectedFailingCode: z.string().min(1).optional(),
|
|
93
137
|
})
|
|
@@ -125,6 +169,7 @@ export const siteEvidenceBundleSchema = z.object({
|
|
|
125
169
|
summary: evidenceSummarySchema,
|
|
126
170
|
checks: z.array(conformanceCheckReceiptSchema),
|
|
127
171
|
findings: z.array(conformanceFindingSchema),
|
|
172
|
+
securityReceipts: securityReceiptsSchema,
|
|
128
173
|
})
|
|
129
174
|
|
|
130
175
|
export const fleetEvidenceBundleSchema = z.object({
|
|
@@ -143,6 +188,9 @@ export type HeaderMap = z.infer<typeof headerMapSchema>
|
|
|
143
188
|
export type SurfaceResponse = z.infer<typeof surfaceResponseSchema>
|
|
144
189
|
export type PublicationSurfaceEvidence = z.infer<typeof publicationSurfaceSchema>
|
|
145
190
|
export type CacheVariant = z.infer<typeof cacheVariantSchema>
|
|
191
|
+
export type SecurityFunctionalProbeReceipt = z.infer<typeof securityFunctionalProbeReceiptSchema>
|
|
192
|
+
export type CspReportReceipt = z.infer<typeof cspReportReceiptSchema>
|
|
193
|
+
export type SecurityReceipts = z.infer<typeof securityReceiptsSchema>
|
|
146
194
|
export type BuildEvidence = z.infer<typeof buildEvidenceSchema>
|
|
147
195
|
export type ConformanceFixtureInput = z.input<typeof conformanceFixtureSchema>
|
|
148
196
|
export type ConformanceFixture = z.infer<typeof conformanceFixtureSchema>
|