@taggor/contract 0.4.0 → 0.5.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/dist/.tsbuildinfo +1 -1
- package/dist/artifact-keys.d.ts +11 -11
- package/dist/artifact-keys.d.ts.map +1 -1
- package/dist/artifact-keys.js +11 -11
- package/dist/artifact-keys.js.map +1 -1
- package/dist/assets.d.ts +5 -5
- package/dist/assets.js +5 -5
- package/dist/bounded-path.d.ts +2 -2
- package/dist/bounded-path.js +2 -2
- package/dist/bounded.d.ts +2 -2
- package/dist/bounded.js +2 -2
- package/dist/build-diagnostic.d.ts +5 -5
- package/dist/build-diagnostic.js +5 -5
- package/dist/component-types.d.ts +7 -7
- package/dist/component-types.js +4 -4
- package/dist/component-types.js.map +1 -1
- package/dist/consent-text.d.ts +1 -1
- package/dist/consent-text.js +1 -1
- package/dist/contract-version.d.ts +13 -12
- package/dist/contract-version.d.ts.map +1 -1
- package/dist/contract-version.js +13 -12
- package/dist/contract-version.js.map +1 -1
- package/dist/credential-fields.d.ts +1 -1
- package/dist/credential-fields.js +1 -1
- package/dist/css-tokens.d.ts +1 -1
- package/dist/css-tokens.js +1 -1
- package/dist/css-value.d.ts +4 -4
- package/dist/css-value.js +4 -4
- package/dist/data-api.d.ts +11 -11
- package/dist/data-api.js +14 -14
- package/dist/data-api.js.map +1 -1
- package/dist/denylist-keys.d.ts +1 -1
- package/dist/denylist-keys.js +4 -4
- package/dist/diagnostic-catalog.d.ts +44 -36
- package/dist/diagnostic-catalog.d.ts.map +1 -1
- package/dist/diagnostic-catalog.js +44 -40
- package/dist/diagnostic-catalog.js.map +1 -1
- package/dist/dom-members.snapshot.d.ts +4 -4
- package/dist/dom-members.snapshot.js +8 -8
- package/dist/early-loading.d.ts +1 -1
- package/dist/early-loading.js +1 -1
- package/dist/error-catalog.d.ts +67 -7
- package/dist/error-catalog.d.ts.map +1 -1
- package/dist/error-catalog.js +105 -49
- package/dist/error-catalog.js.map +1 -1
- package/dist/executable-config.d.ts +1 -1
- package/dist/freeze.d.ts +2 -2
- package/dist/freeze.js +2 -2
- package/dist/gunzip.d.ts +3 -3
- package/dist/gunzip.js +4 -4
- package/dist/gunzip.js.map +1 -1
- package/dist/hostname.d.ts +5 -6
- package/dist/hostname.d.ts.map +1 -1
- package/dist/hostname.js +7 -8
- package/dist/hostname.js.map +1 -1
- package/dist/human-actions.d.ts +3 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/json-schema.d.ts +15 -15
- package/dist/json-schema.d.ts.map +1 -1
- package/dist/json-schema.js +22 -22
- package/dist/json-schema.js.map +1 -1
- package/dist/key-checksum.d.ts +1 -1
- package/dist/key-checksum.js +1 -1
- package/dist/libraries.d.ts +4 -4
- package/dist/libraries.d.ts.map +1 -1
- package/dist/libraries.js +4 -4
- package/dist/libraries.js.map +1 -1
- package/dist/limit-catalog.d.ts +17 -17
- package/dist/limit-catalog.d.ts.map +1 -1
- package/dist/limit-catalog.js +30 -30
- package/dist/limit-catalog.js.map +1 -1
- package/dist/limits.d.ts +15 -15
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +16 -16
- package/dist/limits.js.map +1 -1
- package/dist/locale-tag.d.ts +2 -2
- package/dist/locale-tag.js +2 -2
- package/dist/make-diagnostic.d.ts +2 -3
- package/dist/make-diagnostic.d.ts.map +1 -1
- package/dist/make-diagnostic.js.map +1 -1
- package/dist/manifest-compat-diagnostics.d.ts +1 -1
- package/dist/manifest-compat.js +1 -1
- package/dist/manifest.d.ts +21 -22
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +31 -32
- package/dist/manifest.js.map +1 -1
- package/dist/metering.d.ts +17 -18
- package/dist/metering.d.ts.map +1 -1
- package/dist/metering.js +17 -18
- package/dist/metering.js.map +1 -1
- package/dist/migrate.d.ts +1 -1
- package/dist/migrate.js +5 -5
- package/dist/migrate.js.map +1 -1
- package/dist/money.d.ts +2 -2
- package/dist/money.js +2 -2
- package/dist/names.d.ts +4 -4
- package/dist/names.js +4 -4
- package/dist/overage-pricing.d.ts +1 -1
- package/dist/overage-pricing.js +1 -1
- package/dist/plan-ids.d.ts +1 -1
- package/dist/plan-ids.js +1 -1
- package/dist/plan-limits.d.ts +13 -13
- package/dist/plan-limits.d.ts.map +1 -1
- package/dist/plan-limits.js +8 -8
- package/dist/plan-limits.js.map +1 -1
- package/dist/plan-pricing.d.ts +10 -12
- package/dist/plan-pricing.d.ts.map +1 -1
- package/dist/plan-pricing.js +12 -14
- package/dist/plan-pricing.js.map +1 -1
- package/dist/plan-usage.d.ts +18 -18
- package/dist/plan-usage.d.ts.map +1 -1
- package/dist/plan-usage.js +19 -20
- package/dist/plan-usage.js.map +1 -1
- package/dist/preview-token.js +2 -2
- package/dist/prop-names.d.ts +5 -5
- package/dist/prop-names.d.ts.map +1 -1
- package/dist/prop-names.js +10 -10
- package/dist/prop-names.js.map +1 -1
- package/dist/prop-type-docs.js +1 -1
- package/dist/prop-types.d.ts +6 -6
- package/dist/prop-types.js +16 -16
- package/dist/prop-types.js.map +1 -1
- package/dist/props.d.ts +5 -5
- package/dist/props.js +6 -6
- package/dist/props.js.map +1 -1
- package/dist/proto-guard.js +3 -3
- package/dist/proto-guard.js.map +1 -1
- package/dist/runtime-errors.d.ts +2 -2
- package/dist/runtime-errors.js +2 -2
- package/dist/runtime-pointers.d.ts +2 -2
- package/dist/runtime-pointers.js +2 -2
- package/{schema → dist/schema}/component-manifest.v1.json +5 -5
- package/dist/secret-scan.d.ts +10 -10
- package/dist/secret-scan.d.ts.map +1 -1
- package/dist/secret-scan.js +15 -16
- package/dist/secret-scan.js.map +1 -1
- package/dist/semver.d.ts +2 -2
- package/dist/semver.js +2 -2
- package/dist/server-key.js +1 -1
- package/dist/site-manifest-keys.d.ts +11 -11
- package/dist/site-manifest-keys.d.ts.map +1 -1
- package/dist/site-manifest-keys.js +18 -18
- package/dist/site-manifest-keys.js.map +1 -1
- package/dist/site-manifest.d.ts +2 -2
- package/dist/site-manifest.js +9 -9
- package/dist/site-manifest.js.map +1 -1
- package/dist/source-archive.d.ts +13 -13
- package/dist/source-archive.js +25 -25
- package/dist/source-archive.js.map +1 -1
- package/dist/source-package-corpus.d.ts +3 -4
- package/dist/source-package-corpus.d.ts.map +1 -1
- package/dist/source-package-corpus.js +4 -6
- package/dist/source-package-corpus.js.map +1 -1
- package/dist/source-package.d.ts +17 -17
- package/dist/source-package.d.ts.map +1 -1
- package/dist/source-package.js +15 -15
- package/dist/source-package.js.map +1 -1
- package/dist/source-secrets.js +1 -1
- package/dist/ssr-cap.d.ts +1 -1
- package/dist/ssr-cap.js +4 -4
- package/dist/ssr-kv.d.ts +1 -1
- package/dist/ssr-kv.js +1 -1
- package/dist/ssr-render.d.ts +2 -2
- package/dist/ssr-render.d.ts.map +1 -1
- package/dist/ssr-render.js +3 -3
- package/dist/ssr-render.js.map +1 -1
- package/dist/ssr-version-ledger.js +3 -3
- package/dist/style-references.d.ts +2 -3
- package/dist/style-references.d.ts.map +1 -1
- package/dist/style-references.js +10 -11
- package/dist/style-references.js.map +1 -1
- package/dist/support-contact.d.ts +11 -0
- package/dist/support-contact.d.ts.map +1 -0
- package/dist/support-contact.js +11 -0
- package/dist/support-contact.js.map +1 -0
- package/dist/tag-name.d.ts +6 -6
- package/dist/tag-name.d.ts.map +1 -1
- package/dist/tag-name.js +7 -7
- package/dist/tag-name.js.map +1 -1
- package/dist/tar-writer.js +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/text-codec.d.ts +2 -2
- package/dist/text-codec.js +2 -2
- package/dist/url-value.d.ts +1 -1
- package/dist/url-value.js +6 -6
- package/dist/usage-guard.d.ts +16 -16
- package/dist/usage-guard.js +15 -15
- package/dist/usage-mirror.d.ts +5 -5
- package/dist/value-check.d.ts +6 -6
- package/dist/value-check.js +20 -20
- package/dist/value-check.js.map +1 -1
- package/dist/value-patterns.js +2 -2
- package/dist/value-schema.d.ts +3 -3
- package/dist/value-schema.d.ts.map +1 -1
- package/dist/value-schema.js +4 -4
- package/dist/value-schema.js.map +1 -1
- package/dist/zod-free.d.ts +24 -23
- package/dist/zod-free.d.ts.map +1 -1
- package/dist/zod-free.js +25 -24
- package/dist/zod-free.js.map +1 -1
- package/package.json +9 -10
- package/schema/DEPLOYED +0 -12
- package/schema/published/SHA256SUMS +0 -41
- package/schema/published/build-diagnostic/v1.10.json +0 -83
- package/schema/published/build-diagnostic/v1.11.json +0 -83
- package/schema/published/build-diagnostic/v1.3.json +0 -83
- package/schema/published/build-diagnostic/v1.4.json +0 -83
- package/schema/published/build-diagnostic/v1.5.json +0 -83
- package/schema/published/build-diagnostic/v1.6.json +0 -83
- package/schema/published/build-diagnostic/v1.7.json +0 -83
- package/schema/published/build-diagnostic/v1.8.json +0 -83
- package/schema/published/build-diagnostic/v1.9.json +0 -83
- package/schema/published/component-manifest/v1.10.json +0 -1443
- package/schema/published/component-manifest/v1.11.json +0 -1443
- package/schema/published/component-manifest/v1.3.json +0 -1411
- package/schema/published/component-manifest/v1.4.json +0 -1419
- package/schema/published/component-manifest/v1.5.json +0 -1437
- package/schema/published/component-manifest/v1.6.json +0 -1437
- package/schema/published/component-manifest/v1.7.json +0 -1437
- package/schema/published/component-manifest/v1.8.json +0 -1437
- package/schema/published/component-manifest/v1.9.json +0 -1437
- package/schema/published/data-api/v1.10.json +0 -282
- package/schema/published/data-api/v1.11.json +0 -282
- package/schema/published/data-api/v1.3.json +0 -281
- package/schema/published/data-api/v1.4.json +0 -281
- package/schema/published/data-api/v1.5.json +0 -281
- package/schema/published/data-api/v1.6.json +0 -281
- package/schema/published/data-api/v1.7.json +0 -281
- package/schema/published/data-api/v1.8.json +0 -282
- package/schema/published/data-api/v1.9.json +0 -282
- package/schema/published/library-manifest/v1.10.json +0 -68
- package/schema/published/library-manifest/v1.11.json +0 -68
- package/schema/published/library-manifest/v1.5.json +0 -68
- package/schema/published/library-manifest/v1.6.json +0 -68
- package/schema/published/library-manifest/v1.7.json +0 -68
- package/schema/published/library-manifest/v1.8.json +0 -68
- package/schema/published/library-manifest/v1.9.json +0 -68
- package/schema/published/taggor-config/v1.10.json +0 -56
- package/schema/published/taggor-config/v1.11.json +0 -56
- package/schema/published/taggor-config/v1.5.json +0 -56
- package/schema/published/taggor-config/v1.6.json +0 -56
- package/schema/published/taggor-config/v1.7.json +0 -56
- package/schema/published/taggor-config/v1.8.json +0 -56
- package/schema/published/taggor-config/v1.9.json +0 -56
- /package/{schema → dist/schema}/build-diagnostic.v1.json +0 -0
- /package/{schema → dist/schema}/data-api.v1.json +0 -0
- /package/{schema → dist/schema}/library-manifest.v1.json +0 -0
- /package/{schema → dist/schema}/taggor-config.v1.json +0 -0
package/dist/prop-types.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The prop type catalog of component contract v1
|
|
2
|
+
* The prop type catalog of component contract v1: for each of the nine prop types, how an
|
|
3
3
|
* attribute becomes a value, which JS values a property accepts, how a value becomes attribute
|
|
4
|
-
* text again, and whether the runtime reflects it. Zod-free and pure: the runtime
|
|
5
|
-
*
|
|
4
|
+
* text again, and whether the runtime reflects it. Zod-free and pure: the runtime
|
|
5
|
+
* imports it through `@taggor/contract/zod-free`, the SDK types props from
|
|
6
6
|
* `PropValue`, and SPEC.md's "tipo → atributo aceito → valor resultante" table is generated from it.
|
|
7
7
|
*
|
|
8
8
|
* Every rule is fixed by the declared `type` and its plain options (golden rule 5): no `eval`, no
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
* before it is parsed (`MANIFEST_LIMITS`), invalid text never throws, and the coercion helpers fall
|
|
11
11
|
* back to the declared `default`. `parse(serialize(v))` returns `v` for every accepted value
|
|
12
12
|
* (prop-types.test.ts checks it on thousands of generated values), with two documented
|
|
13
|
-
* exceptions: `-0` becomes `0` at any depth, by attribute and by property alike
|
|
14
|
-
* the delivered `default
|
|
13
|
+
* exceptions: `-0` becomes `0` at any depth, by attribute and by property alike and in
|
|
14
|
+
* the delivered `default`, and an `array`/`object` value whose JSON is longer than
|
|
15
15
|
* `propJsonMaxLength` serializes to `null` (set it by property instead). String value limits count
|
|
16
|
-
* code points, like Zod and JSON Schema
|
|
16
|
+
* code points, like Zod and JSON Schema; raw text bounds count UTF-16 units.
|
|
17
17
|
*
|
|
18
|
-
* Why there is no `json` nor `slot` type
|
|
18
|
+
* Why there is no `json` nor `slot` type: a top-level JSON value is
|
|
19
19
|
* either a scalar (covered by the scalar types) or a container, and `array`/`object` are the JSON
|
|
20
20
|
* types with a declared item or field schema; a free `json` would be the same thing without a
|
|
21
21
|
* schema. Slot content is DOM, not a value: it stays in the light DOM and is projected by a native
|
|
@@ -60,7 +60,7 @@ const jsonDepth = MANIFEST_LIMITS.valueSchemaDepth;
|
|
|
60
60
|
/**
|
|
61
61
|
* Turns every `-0` into `0`, in place, at any depth: `String(-0)` and `JSON.stringify(-0)` both
|
|
62
62
|
* give `"0"`, so only `0` survives the attribute, and a property must give the component the same
|
|
63
|
-
* value
|
|
63
|
+
* value. Only ever called on a value `checkValue` has just built (fresh containers with
|
|
64
64
|
* declared fields only, at most `valueSchemaDepth` levels), so mutating it touches nobody's data.
|
|
65
65
|
*/
|
|
66
66
|
function positiveZero(value) {
|
|
@@ -83,16 +83,16 @@ function serializeJson(value) {
|
|
|
83
83
|
return text.length > MANIFEST_LIMITS.propJsonMaxLength ? null : text;
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
|
-
* The catalog. Data plus pure functions, frozen in depth (
|
|
86
|
+
* The catalog. Data plus pure functions, frozen in depth (a page script cannot swap an
|
|
87
87
|
* entry's `accept`); iterate it (`Object.values`) to cover every type, so a new type is picked up
|
|
88
|
-
* by every consumer's tests
|
|
88
|
+
* by every consumer's tests.
|
|
89
89
|
*/
|
|
90
90
|
export const propTypeCatalog = deepFreeze({
|
|
91
91
|
string: {
|
|
92
92
|
type: "string",
|
|
93
93
|
attribute: "text",
|
|
94
94
|
reflect: true,
|
|
95
|
-
// In UTF-16 units of the raw text; the limit itself is in code points
|
|
95
|
+
// In UTF-16 units of the raw text; the limit itself is in code points, at most two
|
|
96
96
|
// units each, and `checkValue` applies it exactly.
|
|
97
97
|
maxAttributeLength: (prop) => 2 * (prop.maxLength ?? MANIFEST_LIMITS.stringMaxLength),
|
|
98
98
|
parse: (text, prop) => checkValue(prop, text),
|
|
@@ -125,7 +125,7 @@ export const propTypeCatalog = deepFreeze({
|
|
|
125
125
|
type: "enum",
|
|
126
126
|
attribute: "text",
|
|
127
127
|
reflect: true,
|
|
128
|
-
// Every declared value has at most `enumValueMaxLength` code points
|
|
128
|
+
// Every declared value has at most `enumValueMaxLength` code points, so at most
|
|
129
129
|
// twice as many UTF-16 units: a cheap bound before the exact membership check.
|
|
130
130
|
maxAttributeLength: () => ENUM_ATTRIBUTE_MAX_LENGTH,
|
|
131
131
|
parse: (text, prop) => within(textLength(text, ENUM_ATTRIBUTE_MAX_LENGTH), (bounded) => checkValue(prop, bounded)),
|
|
@@ -211,8 +211,8 @@ function entryOf(prop) {
|
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
213
|
* The value of a prop when nothing valid was given: the declared `default` as the entry's `accept`
|
|
214
|
-
* returns it (a fresh copy, every `-0` as `0
|
|
215
|
-
* (the same as an absent attribute, by property too
|
|
214
|
+
* returns it (a fresh copy, every `-0` as `0`), and `false` for a `boolean` without one
|
|
215
|
+
* (the same as an absent attribute, by property too). Going through `accept` gives the
|
|
216
216
|
* component the same value whether `0` came from the attribute, a property or the default, and never
|
|
217
217
|
* hands out (or mutates) the manifest's own object. A default `accept` refuses or throws on (only
|
|
218
218
|
* possible in a definition the manifest schema never saw) is returned as declared, as before.
|
|
@@ -236,7 +236,7 @@ function fallback(prop, entry, problem) {
|
|
|
236
236
|
/** An undeclared type counts as absent: no value, not even its `default`. */
|
|
237
237
|
const UNKNOWN_TYPE = Object.freeze({ value: undefined, problem: "not-allowed" });
|
|
238
238
|
/**
|
|
239
|
-
* Attribute → prop value, as the runtime's `attributeChangedCallback` needs it
|
|
239
|
+
* Attribute → prop value, as the runtime's `attributeChangedCallback` needs it.
|
|
240
240
|
*
|
|
241
241
|
* Inputs: a declaration accepted by `propDeclarationSchema`, and the attribute text or `null` when
|
|
242
242
|
* the attribute is absent. Output: `{ value }` (absent: `false` for `boolean`, otherwise the
|
|
@@ -262,7 +262,7 @@ export function attributeToValue(prop, text) {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
/**
|
|
265
|
-
* Property (or `<script type="application/json" data-props>` entry) → prop value
|
|
265
|
+
* Property (or `<script type="application/json" data-props>` entry) → prop value.
|
|
266
266
|
*
|
|
267
267
|
* Inputs: a declaration and any JS value. Output: `{ value }` with a fresh accepted value,
|
|
268
268
|
* `{ value: default }` for `undefined` or `null` (the property was cleared), or
|
package/dist/prop-types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.js","sourceRoot":"","sources":["../src/prop-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EACL,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,OAAO,GAGR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAqDvD;;;GAGG;AACH,MAAM,mBAAmB,GAAG,8CAA8C,CAAC;AAE3E,kGAAkG;AAClG,MAAM,yBAAyB,GAAG,CAAC,GAAG,eAAe,CAAC,kBAAkB,CAAC;AAEzE;;;GAGG;AACH,MAAM,U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;IACxF,CAAC;IAAC,MAAM,CAAC;QACP,+FAA+F;QAC/F,OAAO,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,IAAqB,EAAE,KAAc;IACnE,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,YAAY,CAAC;IAC7C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;IACpF,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC1C,OAAO,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACxF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAqB,EAAE,KAAc;IACpE,OAAO,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC;AACvD,CAAC"}
|
package/dist/props.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Prop declarations of component contract v1
|
|
2
|
+
* Prop declarations of component contract v1.
|
|
3
3
|
*
|
|
4
4
|
* A prop is declared by its `type` and plain options; how an HTML attribute becomes a prop value is
|
|
5
|
-
* fully determined by that type (golden rule 5): the runtime
|
|
6
|
-
* attribute. The per-type parse table is `propTypeCatalog` (prop-types.ts
|
|
5
|
+
* fully determined by that type (golden rule 5): the runtime never evaluates the
|
|
6
|
+
* attribute. The per-type parse table is `propTypeCatalog` (prop-types.ts); this module
|
|
7
7
|
* fixes the shape of each declaration and checks that a declared `default` fits it.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* The defaults of `array` and `object` props have a structural shape (JSON scalars,
|
|
10
10
|
* arrays and records keyed by field names, as deep as a value schema), so the JSON Schema refuses
|
|
11
11
|
* an own `__proto__` key in a default as `parseManifest` does, instead of accepting any JSON.
|
|
12
12
|
*/
|
|
@@ -500,7 +500,7 @@ export type PropType = PropDeclaration["type"];
|
|
|
500
500
|
* or an already parsed attribute must satisfy.
|
|
501
501
|
*
|
|
502
502
|
* Inputs: a prop declaration. Output: a Zod schema with the same rules as the Zod-free
|
|
503
|
-
* `propTypeCatalog[type].accept` (
|
|
503
|
+
* `propTypeCatalog[type].accept` (a test keeps them in agreement): `color` gets the CSS
|
|
504
504
|
* value allowlist (the runtime may narrow it further with `CSS.supports`), `url` the scheme
|
|
505
505
|
* allowlist, the printable-ASCII rule and the WHATWG URL parser (`isAllowedUrl`). Errors: none at
|
|
506
506
|
* build time. Side effects: none.
|
package/dist/props.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Prop declarations of component contract v1
|
|
2
|
+
* Prop declarations of component contract v1.
|
|
3
3
|
*
|
|
4
4
|
* A prop is declared by its `type` and plain options; how an HTML attribute becomes a prop value is
|
|
5
|
-
* fully determined by that type (golden rule 5): the runtime
|
|
6
|
-
* attribute. The per-type parse table is `propTypeCatalog` (prop-types.ts
|
|
5
|
+
* fully determined by that type (golden rule 5): the runtime never evaluates the
|
|
6
|
+
* attribute. The per-type parse table is `propTypeCatalog` (prop-types.ts); this module
|
|
7
7
|
* fixes the shape of each declaration and checks that a declared `default` fits it.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* The defaults of `array` and `object` props have a structural shape (JSON scalars,
|
|
10
10
|
* arrays and records keyed by field names, as deep as a value schema), so the JSON Schema refuses
|
|
11
11
|
* an own `__proto__` key in a default as `parseManifest` does, instead of accepting any JSON.
|
|
12
12
|
*/
|
|
@@ -51,7 +51,7 @@ const urlPropSchema = z.strictObject({
|
|
|
51
51
|
.optional()
|
|
52
52
|
.meta({ description: 'Accepted URL schemes; defaults to ["https"].' }),
|
|
53
53
|
// Structural rule, also in the JSON Schema: whatever `protocols` says, a default starts with
|
|
54
|
-
// https://, http:// or mailto
|
|
54
|
+
// https://, http:// or mailto:. The declared schemes are checked by
|
|
55
55
|
// the default check below (Zod only, `SEMANTIC_RULES`).
|
|
56
56
|
default: z
|
|
57
57
|
.string()
|
|
@@ -113,7 +113,7 @@ const propVariantsSchema = z.discriminatedUnion("type", [
|
|
|
113
113
|
* or an already parsed attribute must satisfy.
|
|
114
114
|
*
|
|
115
115
|
* Inputs: a prop declaration. Output: a Zod schema with the same rules as the Zod-free
|
|
116
|
-
* `propTypeCatalog[type].accept` (
|
|
116
|
+
* `propTypeCatalog[type].accept` (a test keeps them in agreement): `color` gets the CSS
|
|
117
117
|
* value allowlist (the runtime may narrow it further with `CSS.supports`), `url` the scheme
|
|
118
118
|
* allowlist, the printable-ASCII rule and the WHATWG URL parser (`isAllowedUrl`). Errors: none at
|
|
119
119
|
* build time. Side effects: none.
|
package/dist/props.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.js","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,eAAe,EAA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C;QACD,OAAO,CAAC,QAAQ,CAAC;YACf,gCAAgC;YAChC,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,KAAK,CAAC;YACb,OAAO,EAAE,2BAA2B;SACrC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS;QAAE,OAAO;IACvC,MAAM,MAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,eAAe,CAAC;QAClE,OAAO,CAAC,QAAQ,CAAC;YACf,yEAAyE;YACzE,gGAAgG;YAChG,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,SAAS,CAAC;YACjB,OAAO,EAAE,gDAAgD,MAAM,EAAE;SAClE,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC;KACD,IAAI,CAAC,EAAE,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAC"}
|
package/dist/proto-guard.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Refusal of own `__proto__` keys in decoded JSON (
|
|
2
|
+
* Refusal of own `__proto__` keys in decoded JSON (moved here and hardened).
|
|
3
3
|
*
|
|
4
4
|
* `JSON.parse` turns `"__proto__"` into a plain own key. Zod's records skip such a key in silence
|
|
5
5
|
* while the JSON Schema refuses it, so the two validators would disagree; worse, code that copies
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* `findOwnProtoKey` before parsing and refuse the whole input, so every validator agrees.
|
|
8
8
|
*
|
|
9
9
|
* The path of a finding names keys of untrusted input and ends up in logs and in the portal, so
|
|
10
|
-
* it is bounded by `boundedPath` (
|
|
10
|
+
* it is bounded by `boundedPath` (`bounded-path.ts`).
|
|
11
11
|
*
|
|
12
12
|
* Zod-free (the runtime and `migrateManifest` use it too). Pure.
|
|
13
13
|
*/
|
|
@@ -51,7 +51,7 @@ export function findOwnProtoKey(input) {
|
|
|
51
51
|
}
|
|
52
52
|
const budget = PROTO_SCAN_MAX_NODES - visited - 1 - pending.length;
|
|
53
53
|
// Checked before listing the entries: a sparse array of length 2**32 - 1 has none, yet
|
|
54
|
-
// JSON.stringify would walk every index
|
|
54
|
+
// JSON.stringify would walk every index.
|
|
55
55
|
if (Array.isArray(value) && value.length > budget)
|
|
56
56
|
return tooLarge();
|
|
57
57
|
const entries = Object.entries(value);
|
package/dist/proto-guard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proto-guard.js","sourceRoot":"","sources":["../src/proto-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAE3F;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC,aAAa,CAAC;AAalE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,6FAA6F;IAC7F,0DAA0D;IAC1D,MAAM,OAAO,GAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAC/E,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;QACvD,sFAAsF;QACtF,IAAI,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,oBAAoB;YAAE,OAAO,QAAQ,EAAE,CAAC;QACvE,MAAM,KAAK,GAAG,OAAO,C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,CAAC;AASD,SAAS,MAAM,CAAC,KAAY;IAC1B,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,KAAK,IAAI,EAAE,GAAsB,KAAK,EAAE,EAAE,EAAE,GAAG,KAAK,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM;QAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACjG,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;AACxB,CAAC"}
|
package/dist/runtime-errors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The runtime error telemetry layout (
|
|
2
|
+
* The runtime error telemetry layout (the kinds of failure the
|
|
3
3
|
* browser reports, the bounds on what it reports, and the extra columns of an `error` point of the
|
|
4
4
|
* `component_events` dataset (the first eight columns are the ones of `metering.ts`).
|
|
5
5
|
*
|
|
@@ -21,7 +21,7 @@ export declare const RUNTIME_ERROR_MESSAGE_MAX = 200;
|
|
|
21
21
|
export declare const RUNTIME_ERROR_MAX_FRAMES = 5;
|
|
22
22
|
/**
|
|
23
23
|
* Most reports one component sends per page load: a technical protection against an error loop,
|
|
24
|
-
* not a plan limit
|
|
24
|
+
* not a plan limit.
|
|
25
25
|
*/
|
|
26
26
|
export declare const RUNTIME_ERRORS_PER_COMPONENT_PER_PAGE = 5;
|
|
27
27
|
/**
|
package/dist/runtime-errors.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The runtime error telemetry layout (
|
|
2
|
+
* The runtime error telemetry layout (the kinds of failure the
|
|
3
3
|
* browser reports, the bounds on what it reports, and the extra columns of an `error` point of the
|
|
4
4
|
* `component_events` dataset (the first eight columns are the ones of `metering.ts`).
|
|
5
5
|
*
|
|
@@ -25,7 +25,7 @@ export const RUNTIME_ERROR_MESSAGE_MAX = 200;
|
|
|
25
25
|
export const RUNTIME_ERROR_MAX_FRAMES = 5;
|
|
26
26
|
/**
|
|
27
27
|
* Most reports one component sends per page load: a technical protection against an error loop,
|
|
28
|
-
* not a plan limit
|
|
28
|
+
* not a plan limit.
|
|
29
29
|
*/
|
|
30
30
|
export const RUNTIME_ERRORS_PER_COMPONENT_PER_PAGE = 5;
|
|
31
31
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Runtime versions and the two global release pointers
|
|
2
|
+
* Runtime versions and the two global release pointers. The shared runtime lives in R2
|
|
3
3
|
* under immutable `rt/<version>/<file>` keys; two KV keys in the edge's `MANIFESTS` namespace,
|
|
4
4
|
* `runtime:canary` and `runtime:stable`, say which version the loader of each ring links to. The
|
|
5
|
-
* operator tooling writes them (`scripts/runtime-release`), the edge only reads them
|
|
5
|
+
* operator tooling writes them (`scripts/runtime-release`), the edge only reads them,
|
|
6
6
|
* and a site chooses its ring with `runtimeRing` in its manifest. Pure and import-free on purpose:
|
|
7
7
|
* the edge, the API and the release scripts all use these very rules, and the version goes into an
|
|
8
8
|
* R2 key and a URL path, so it is validated here once.
|
package/dist/runtime-pointers.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Runtime versions and the two global release pointers
|
|
2
|
+
* Runtime versions and the two global release pointers. The shared runtime lives in R2
|
|
3
3
|
* under immutable `rt/<version>/<file>` keys; two KV keys in the edge's `MANIFESTS` namespace,
|
|
4
4
|
* `runtime:canary` and `runtime:stable`, say which version the loader of each ring links to. The
|
|
5
|
-
* operator tooling writes them (`scripts/runtime-release`), the edge only reads them
|
|
5
|
+
* operator tooling writes them (`scripts/runtime-release`), the edge only reads them,
|
|
6
6
|
* and a site chooses its ring with `runtimeRing` in its manifest. Pure and import-free on purpose:
|
|
7
7
|
* the edge, the API and the release scripts all use these very rules, and the version goes into an
|
|
8
8
|
* R2 key and a URL path, so it is validated here once.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"properties": {
|
|
6
6
|
"contractVersion": {
|
|
7
7
|
"type": "string",
|
|
8
|
-
"pattern": "^1\\.(?:0|1|2|3|4|5|6|7|8|9|10|11)\\.(?:0|[1-9]\\d{0,5})$"
|
|
8
|
+
"pattern": "^1\\.(?:0|1|2|3|4|5|6|7|8|9|10|11|12)\\.(?:0|[1-9]\\d{0,5})$"
|
|
9
9
|
},
|
|
10
10
|
"name": { "$ref": "#/$defs/ComponentName" },
|
|
11
11
|
"tag": { "$ref": "#/$defs/TagName" },
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"maxProperties": 50
|
|
74
74
|
},
|
|
75
75
|
"formAssociated": {
|
|
76
|
-
"description": "True for a form field component
|
|
76
|
+
"description": "True for a form field component: the element is form-associated, submits the value the component sets under its name attribute, takes part in the form's validation, reset and disabled state, and delegates focus unless delegatesFocus is false. Defaults to false.",
|
|
77
77
|
"type": "boolean"
|
|
78
78
|
},
|
|
79
79
|
"eventSampleRate": {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"description": "Share of interaction and custom events the browser sends, from 0.001 to 1 (default 1: all). Render and error events are never sampled. Each stored event is weighted by 1 divided by this rate, so totals stay estimates of the real count."
|
|
84
84
|
},
|
|
85
85
|
"delegatesFocus": {
|
|
86
|
-
"description": "Whether the shadow root delegates focus
|
|
86
|
+
"description": "Whether the shadow root delegates focus: focusing the element, clicking one of its labels or a non-focusable part of it focuses the component's first focusable element. Defaults to the value of formAssociated.",
|
|
87
87
|
"type": "boolean"
|
|
88
88
|
}
|
|
89
89
|
},
|
|
@@ -783,11 +783,11 @@
|
|
|
783
783
|
"maxProperties": 30
|
|
784
784
|
},
|
|
785
785
|
"personal": {
|
|
786
|
-
"description": "True when the collections hold personal data
|
|
786
|
+
"description": "True when the collections hold personal data: every submit then carries the visitor's consent. Defaults to false.",
|
|
787
787
|
"type": "boolean"
|
|
788
788
|
},
|
|
789
789
|
"privacyPolicyUrl": {
|
|
790
|
-
"description": "Name of the prop of type \"url\" that links the privacy policy, set per site
|
|
790
|
+
"description": "Name of the prop of type \"url\" that links the privacy policy, set per site. Required when personal is true.",
|
|
791
791
|
"$ref": "#/$defs/PropName"
|
|
792
792
|
}
|
|
793
793
|
},
|
package/dist/secret-scan.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Secret detector
|
|
2
|
+
* Secret detector: finds credentials in the text of a component's source package or of
|
|
3
3
|
* its built bundle, so the build can refuse them with `SECRET_IN_SOURCE` (a component's code is
|
|
4
4
|
* public: anyone who loads the page can read it).
|
|
5
5
|
*
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* providers' documented prefixes. Keys that are public by design (Stripe publishable keys
|
|
10
10
|
* `pk_…`, Google API keys `AIza…` that browser SDKs embed) have no rule and never block.
|
|
11
11
|
*
|
|
12
|
-
* Obvious placeholders never block (
|
|
12
|
+
* Obvious placeholders never block (gitleaks' allowlist kept strict): a value ending in
|
|
13
13
|
* `EXAMPLE`, a body of one repeated character, or a sample the provider itself publishes
|
|
14
14
|
* (`isPlaceholderSecret`). Every source file counts, documentation (`README.md`) included: the
|
|
15
15
|
* package is kept by Taggor and a key in it is leaked all the same.
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
* `mentionsSecretKeyword` tells whether such a text may quote a key; both read the text as
|
|
23
23
|
* written and with its JavaScript and CSS escapes decoded (`escapeReadings`), and count a keyword
|
|
24
24
|
* that is also an ordinary word (`cloudflare`, `Asia`) only before a token mixing letters and
|
|
25
|
-
* digits
|
|
25
|
+
* digits.
|
|
26
26
|
*
|
|
27
27
|
* Cost is bounded (golden rule 5, the text is untrusted): at most `SECRET_SCAN_LIMITS.maxFiles`
|
|
28
28
|
* files and `maxChars` UTF-16 units per scan (the builder's own ceilings), a rule's regex runs
|
|
29
29
|
* only on texts that contain one of its keywords, every quantifier of every rule is bounded and
|
|
30
30
|
* starts after a literal, and the scan stops at `SECRET_SCAN_MAX_FINDINGS`. Zod-free and
|
|
31
|
-
* dependency-free, so the CLI (`taggor check`, `taggor publish
|
|
31
|
+
* dependency-free, so the CLI (`taggor check`, `taggor publish`) and the API
|
|
32
32
|
* can run the same scan before a package leaves the agent's machine or is stored.
|
|
33
33
|
*/
|
|
34
34
|
/** One detection rule, in the shape of a gitleaks rule. */
|
|
@@ -60,13 +60,13 @@ export interface SecretRule {
|
|
|
60
60
|
* The rules. A new provider adds an entry here with a test in both directions in
|
|
61
61
|
* `secret-scan.test.ts` (a fake value that blocks, a near miss or public key that does not).
|
|
62
62
|
* The Taggor API key format (`tgr_live_` or `tgr_test_`, then base62 with a CRC32 at the end) is
|
|
63
|
-
* the one
|
|
64
|
-
*
|
|
63
|
+
* the one the API implements; the body length here is a range so the rule holds whatever length
|
|
64
|
+
* the API settles on within it. The SSR server key (`tgs_live_`/`tgs_test_`, server-key.ts) has the
|
|
65
65
|
* same shape and its own rule.
|
|
66
66
|
*/
|
|
67
67
|
export declare const SECRET_RULES: readonly SecretRule[];
|
|
68
68
|
/**
|
|
69
|
-
* Whether a value a rule matched is an obvious placeholder, never a real key (
|
|
69
|
+
* Whether a value a rule matched is an obvious placeholder, never a real key (the
|
|
70
70
|
* gitleaks allowlist idea, kept strict): the secret ends with `SECRET_EXAMPLE_SUFFIX`
|
|
71
71
|
* (`AKIAIOSFODNN7EXAMPLE`; a random body ends so with odds of 1 in 32^7, about 3·10^10, or less), its body is one
|
|
72
72
|
* character repeated (`sk_test_xxxxxxxxxxxxxxxx`, `tgr_test_0000…`), or it is a value the
|
|
@@ -143,12 +143,12 @@ export declare function scanSecrets(inputs: readonly SecretScanInput[], limits?:
|
|
|
143
143
|
/**
|
|
144
144
|
* The most characters `escapeReadings`, `mentionsSecretKeyword` and `redactSecrets` read: they
|
|
145
145
|
* are for short diagnostic texts (a message is at most 2,000 characters, a snippet 300). Linear
|
|
146
|
-
* as they are, they take seconds of CPU on 20 MiB
|
|
146
|
+
* as they are, they take seconds of CPU on 20 MiB, so a longer
|
|
147
147
|
* text is cut and its rest treated as one that may quote a secret.
|
|
148
148
|
*/
|
|
149
149
|
export declare const SECRET_TEXT_MAX_CHARS = 4000;
|
|
150
150
|
/**
|
|
151
|
-
* A text as it reads with its escapes decoded
|
|
151
|
+
* A text as it reads with its escapes decoded: as written, as JavaScript decodes it
|
|
152
152
|
* (`\xNN`, `\uNNNN`, `\u{…}`, legacy octal, `\n` and the like, and any other `\c` as `c`) and as
|
|
153
153
|
* CSS does (`\73 `). A key written with escapes (`"\x73k_live_…"`) only shows its keyword in a
|
|
154
154
|
* decoded reading. Linear: one pass per reading. Only for short diagnostic texts: past
|
|
@@ -176,7 +176,7 @@ export declare function mentionsSecretKeyword(text: string): boolean;
|
|
|
176
176
|
* characters of `MIN_MASKED_RUN` characters or more (a key a rule misses, such as one with an
|
|
177
177
|
* odd boundary), replaced by its mask; a keyword that is also an ordinary word (`WORD_KEYWORDS`)
|
|
178
178
|
* only starts a run when the token after it mixes letters and digits, so
|
|
179
|
-
* `cloudflare-turnstile-loader.js` and `Asia/Ho_Chi_Minh` stay whole
|
|
179
|
+
* `cloudflare-turnstile-loader.js` and `Asia/Ho_Chi_Minh` stay whole. When a decoded
|
|
180
180
|
* reading (`escapeReadings`) has something to mask, that reading is returned masked (the
|
|
181
181
|
* JavaScript one before the CSS one): `"\x73k_live_…"` becomes `"sk_l…"`. For texts that are not a
|
|
182
182
|
* source file but may quote one: a bundler's message, a thrown error. Only for short diagnostic
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret-scan.d.ts","sourceRoot":"","sources":["../src/secret-scan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,2DAA2D;AAC3D,MAAM,WAAW,UAAU;IACzB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,uFAAuF;IACvF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,QAAQ,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CAAC,QAAQ,EAAE,MAAM,CAAA;CAAuB,GACpF,gBAAgB,CAwBlB;AAwGD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,OAAQ,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAmB9D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQ3D;AA4CD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAclD"}
|
package/dist/secret-scan.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Secret detector
|
|
2
|
+
* Secret detector: finds credentials in the text of a component's source package or of
|
|
3
3
|
* its built bundle, so the build can refuse them with `SECRET_IN_SOURCE` (a component's code is
|
|
4
4
|
* public: anyone who loads the page can read it).
|
|
5
5
|
*
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* providers' documented prefixes. Keys that are public by design (Stripe publishable keys
|
|
10
10
|
* `pk_…`, Google API keys `AIza…` that browser SDKs embed) have no rule and never block.
|
|
11
11
|
*
|
|
12
|
-
* Obvious placeholders never block (
|
|
12
|
+
* Obvious placeholders never block (gitleaks' allowlist kept strict): a value ending in
|
|
13
13
|
* `EXAMPLE`, a body of one repeated character, or a sample the provider itself publishes
|
|
14
14
|
* (`isPlaceholderSecret`). Every source file counts, documentation (`README.md`) included: the
|
|
15
15
|
* package is kept by Taggor and a key in it is leaked all the same.
|
|
@@ -22,19 +22,18 @@
|
|
|
22
22
|
* `mentionsSecretKeyword` tells whether such a text may quote a key; both read the text as
|
|
23
23
|
* written and with its JavaScript and CSS escapes decoded (`escapeReadings`), and count a keyword
|
|
24
24
|
* that is also an ordinary word (`cloudflare`, `Asia`) only before a token mixing letters and
|
|
25
|
-
* digits
|
|
25
|
+
* digits.
|
|
26
26
|
*
|
|
27
27
|
* Cost is bounded (golden rule 5, the text is untrusted): at most `SECRET_SCAN_LIMITS.maxFiles`
|
|
28
28
|
* files and `maxChars` UTF-16 units per scan (the builder's own ceilings), a rule's regex runs
|
|
29
29
|
* only on texts that contain one of its keywords, every quantifier of every rule is bounded and
|
|
30
30
|
* starts after a literal, and the scan stops at `SECRET_SCAN_MAX_FINDINGS`. Zod-free and
|
|
31
|
-
* dependency-free, so the CLI (`taggor check`, `taggor publish
|
|
31
|
+
* dependency-free, so the CLI (`taggor check`, `taggor publish`) and the API
|
|
32
32
|
* can run the same scan before a package leaves the agent's machine or is stored.
|
|
33
33
|
*/
|
|
34
34
|
/**
|
|
35
35
|
* The start of a prefixed token: a word boundary, or right after an escaped line break or tab in
|
|
36
|
-
* a string (`"Stripe:\nsk_live_…"`), where `\b` sees no boundary between the `n` and the `s
|
|
37
|
-
* (TAG-1707 security review, M2).
|
|
36
|
+
* a string (`"Stripe:\nsk_live_…"`), where `\b` sees no boundary between the `n` and the `s`.
|
|
38
37
|
*/
|
|
39
38
|
const START = "(?:\\b|(?<=\\\\[nrt]))";
|
|
40
39
|
/** The end of a token: no further character of the token's alphabet. */
|
|
@@ -44,8 +43,8 @@ const END_TOKEN = "(?![A-Za-z0-9_-])";
|
|
|
44
43
|
* The rules. A new provider adds an entry here with a test in both directions in
|
|
45
44
|
* `secret-scan.test.ts` (a fake value that blocks, a near miss or public key that does not).
|
|
46
45
|
* The Taggor API key format (`tgr_live_` or `tgr_test_`, then base62 with a CRC32 at the end) is
|
|
47
|
-
* the one
|
|
48
|
-
*
|
|
46
|
+
* the one the API implements; the body length here is a range so the rule holds whatever length
|
|
47
|
+
* the API settles on within it. The SSR server key (`tgs_live_`/`tgs_test_`, server-key.ts) has the
|
|
49
48
|
* same shape and its own rule.
|
|
50
49
|
*/
|
|
51
50
|
export const SECRET_RULES = Object.freeze([
|
|
@@ -134,7 +133,7 @@ export const SECRET_RULES = Object.freeze([
|
|
|
134
133
|
// placeholder ("-----BEGIN PRIVATE KEY-----\n...") does not block. Line breaks may be real
|
|
135
134
|
// or escaped in a string (`\n`), as in a service account JSON. A header line ends only at
|
|
136
135
|
// a line break: if it could end at a space, `a: a: a: …` would split into header lines in
|
|
137
|
-
// exponentially many ways (
|
|
136
|
+
// exponentially many ways (136 s for 1.5 KB gzipped).
|
|
138
137
|
id: "private-key",
|
|
139
138
|
description: "a PEM private key",
|
|
140
139
|
regex: "-----BEGIN[ A-Z0-9_-]{0,40}PRIVATE KEY(?: BLOCK)?-----[ \\t]{0,8}(?:\\r?\\n|(?:\\\\r)?\\\\n)(?:[A-Za-z-]{1,30}: [^\\r\\n\\\\]{1,100}(?:\\r?\\n|(?:\\\\r)?\\\\n)){0,4}(?:[ \\t\\r\\n]|\\\\[nr]){0,8}([A-Za-z0-9+/]{32})",
|
|
@@ -151,7 +150,7 @@ export const SECRET_RULES = Object.freeze([
|
|
|
151
150
|
keywords: ["tgr_live_", "tgr_test_"],
|
|
152
151
|
},
|
|
153
152
|
{
|
|
154
|
-
// The SSR server key (server-key.ts
|
|
153
|
+
// The SSR server key (server-key.ts): a server secret that must never reach a page.
|
|
155
154
|
id: "taggor-server-key",
|
|
156
155
|
description: "a Taggor server key",
|
|
157
156
|
regex: `${START}(tgs_(?:live|test)_([A-Za-z0-9]{24,128}))${END_ALNUM}`,
|
|
@@ -165,7 +164,7 @@ const SECRET_EXAMPLE_SUFFIX = "EXAMPLE";
|
|
|
165
164
|
/**
|
|
166
165
|
* Exact values that providers publish in their own documentation, so they are public and tied
|
|
167
166
|
* to a demo account: Stripe's sample test secret keys (docs.stripe.com/api/authentication and
|
|
168
|
-
* the code samples on stripe.com, checked 2026
|
|
167
|
+
* the code samples on stripe.com, checked in 2026). Assembled from parts so no repository
|
|
169
168
|
* scanner reads a whole key here.
|
|
170
169
|
*/
|
|
171
170
|
const PUBLISHED_EXAMPLE_VALUES = new Set([
|
|
@@ -184,7 +183,7 @@ function isOneCharacterRepeated(text) {
|
|
|
184
183
|
return true;
|
|
185
184
|
}
|
|
186
185
|
/**
|
|
187
|
-
* Whether a value a rule matched is an obvious placeholder, never a real key (
|
|
186
|
+
* Whether a value a rule matched is an obvious placeholder, never a real key (the
|
|
188
187
|
* gitleaks allowlist idea, kept strict): the secret ends with `SECRET_EXAMPLE_SUFFIX`
|
|
189
188
|
* (`AKIAIOSFODNN7EXAMPLE`; a random body ends so with odds of 1 in 32^7, about 3·10^10, or less), its body is one
|
|
190
189
|
* character repeated (`sk_test_xxxxxxxxxxxxxxxx`, `tgr_test_0000…`), or it is a value the
|
|
@@ -332,7 +331,7 @@ export function scanSecrets(inputs, limits = SECRET_SCAN_LIMITS) {
|
|
|
332
331
|
/** Any keyword of any rule, in any case. */
|
|
333
332
|
const ANY_KEYWORD = new RegExp(SECRET_RULES.flatMap((rule) => rule.keywords.map(escapeRegExp)).join("|"), "i");
|
|
334
333
|
/**
|
|
335
|
-
* Keywords that are also ordinary words in legitimate text
|
|
334
|
+
* Keywords that are also ordinary words in legitimate text: those of a rule that
|
|
336
335
|
* recognizes the value by its variable name (`cloudflare`, as in `cloudflare-turnstile-loader.js`)
|
|
337
336
|
* and AWS prefixes that are common words or parts of them (`Asia/Ho_Chi_Minh`, `Arabia`,
|
|
338
337
|
* `accademia`). Such a keyword only counts when the token characters right after it mix letters
|
|
@@ -412,12 +411,12 @@ function codePoint(hex, fallback) {
|
|
|
412
411
|
/**
|
|
413
412
|
* The most characters `escapeReadings`, `mentionsSecretKeyword` and `redactSecrets` read: they
|
|
414
413
|
* are for short diagnostic texts (a message is at most 2,000 characters, a snippet 300). Linear
|
|
415
|
-
* as they are, they take seconds of CPU on 20 MiB
|
|
414
|
+
* as they are, they take seconds of CPU on 20 MiB, so a longer
|
|
416
415
|
* text is cut and its rest treated as one that may quote a secret.
|
|
417
416
|
*/
|
|
418
417
|
export const SECRET_TEXT_MAX_CHARS = 4_000;
|
|
419
418
|
/**
|
|
420
|
-
* A text as it reads with its escapes decoded
|
|
419
|
+
* A text as it reads with its escapes decoded: as written, as JavaScript decodes it
|
|
421
420
|
* (`\xNN`, `\uNNNN`, `\u{…}`, legacy octal, `\n` and the like, and any other `\c` as `c`) and as
|
|
422
421
|
* CSS does (`\73 `). A key written with escapes (`"\x73k_live_…"`) only shows its keyword in a
|
|
423
422
|
* decoded reading. Linear: one pass per reading. Only for short diagnostic texts: past
|
|
@@ -511,7 +510,7 @@ function redactReading(text) {
|
|
|
511
510
|
* characters of `MIN_MASKED_RUN` characters or more (a key a rule misses, such as one with an
|
|
512
511
|
* odd boundary), replaced by its mask; a keyword that is also an ordinary word (`WORD_KEYWORDS`)
|
|
513
512
|
* only starts a run when the token after it mixes letters and digits, so
|
|
514
|
-
* `cloudflare-turnstile-loader.js` and `Asia/Ho_Chi_Minh` stay whole
|
|
513
|
+
* `cloudflare-turnstile-loader.js` and `Asia/Ho_Chi_Minh` stay whole. When a decoded
|
|
515
514
|
* reading (`escapeReadings`) has something to mask, that reading is returned masked (the
|
|
516
515
|
* JavaScript one before the CSS one): `"\x73k_live_…"` becomes `"sk_l…"`. For texts that are not a
|
|
517
516
|
* source file but may quote one: a bundler's message, a thrown error. Only for short diagnostic
|