@caelo-cms/shared 0.12.1 → 0.12.3

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.
@@ -28,14 +28,17 @@ export declare const NOSNIFF = "nosniff";
28
28
  /** The MIME type the CSP is keyed on. */
29
29
  export declare const SVG_CONTENT_TYPE = "image/svg+xml";
30
30
  /**
31
- * Regex (source string, unanchored at the start) matching a URL path that
32
- * ends in `.svg`, any case. Only syntax shared by ECMAScript and RE2 (no
33
- * inline flags), so the same string serves Firebase Hosting's `regex`
34
- * header matcher and `RegExp` here. The static generator names every file
35
- * by extension (`contentTypeFor` in admin-core), so the extension is what
36
- * decides the served `image/svg+xml`.
31
+ * Regex (source string) matching a whole URL path that ends in `.svg`, any
32
+ * case. Anchored at both ends because Firebase Hosting matches a header
33
+ * `regex` against the WHOLE request path (`firebase-version-headers.ts` in
34
+ * admin-core): the unanchored `\.[sS][vV][gG]$` it replaced never matched
35
+ * there, so SVGs went out without the CSP. Self-anchored, it means the same
36
+ * under a full match and a `RegExp` search. Only syntax shared by
37
+ * ECMAScript and RE2 (no inline flags). The static generator names every
38
+ * file by extension (`contentTypeFor` in admin-core), so the extension is
39
+ * what decides the served `image/svg+xml`.
37
40
  */
38
- export declare const SVG_PATH_PATTERN = "\\.[sS][vV][gG]$";
41
+ export declare const SVG_PATH_PATTERN = "^/.*\\.[sS][vV][gG]$";
39
42
  /** True when `contentType` is SVG (case and parameters such as `; charset=` ignored). */
40
43
  export declare function isSvgContentType(contentType: string): boolean;
41
44
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"static-security-headers.d.ts","sourceRoot":"","sources":["../src/static-security-headers.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,0FAC4D,CAAC;AAE1F,4EAA4E;AAC5E,eAAO,MAAM,OAAO,YAAY,CAAC;AAEjC,yCAAyC;AACzC,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIhF"}
1
+ {"version":3,"file":"static-security-headers.d.ts","sourceRoot":"","sources":["../src/static-security-headers.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,0FAC4D,CAAC;AAE1F,4EAA4E;AAC5E,eAAO,MAAM,OAAO,YAAY,CAAC;AAEjC,yCAAyC;AACzC,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AAEvD,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIhF"}
@@ -29,14 +29,17 @@ export const NOSNIFF = "nosniff";
29
29
  /** The MIME type the CSP is keyed on. */
30
30
  export const SVG_CONTENT_TYPE = "image/svg+xml";
31
31
  /**
32
- * Regex (source string, unanchored at the start) matching a URL path that
33
- * ends in `.svg`, any case. Only syntax shared by ECMAScript and RE2 (no
34
- * inline flags), so the same string serves Firebase Hosting's `regex`
35
- * header matcher and `RegExp` here. The static generator names every file
36
- * by extension (`contentTypeFor` in admin-core), so the extension is what
37
- * decides the served `image/svg+xml`.
32
+ * Regex (source string) matching a whole URL path that ends in `.svg`, any
33
+ * case. Anchored at both ends because Firebase Hosting matches a header
34
+ * `regex` against the WHOLE request path (`firebase-version-headers.ts` in
35
+ * admin-core): the unanchored `\.[sS][vV][gG]$` it replaced never matched
36
+ * there, so SVGs went out without the CSP. Self-anchored, it means the same
37
+ * under a full match and a `RegExp` search. Only syntax shared by
38
+ * ECMAScript and RE2 (no inline flags). The static generator names every
39
+ * file by extension (`contentTypeFor` in admin-core), so the extension is
40
+ * what decides the served `image/svg+xml`.
38
41
  */
39
- export const SVG_PATH_PATTERN = "\\.[sS][vV][gG]$";
42
+ export const SVG_PATH_PATTERN = "^/.*\\.[sS][vV][gG]$";
40
43
  /** True when `contentType` is SVG (case and parameters such as `; charset=` ignored). */
41
44
  export function isSvgContentType(contentType) {
42
45
  return (contentType.split(";")[0] ?? "").trim().toLowerCase() === SVG_CONTENT_TYPE;
@@ -1 +1 @@
1
- {"version":3,"file":"static-security-headers.js","sourceRoot":"","sources":["../src/static-security-headers.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,qEAAqE;AACrE,MAAM,CAAC,MAAM,gBAAgB,GAC3B,uFAAuF,CAAC;AAE1F,4EAA4E;AAC5E,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AAEjC,yCAAyC;AACzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAEnD,yFAAyF;AACzF,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,gBAAgB,CAAC;AACrF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,WAAmB;IACtD,MAAM,OAAO,GAA2B,EAAE,wBAAwB,EAAE,OAAO,EAAE,CAAC;IAC9E,IAAI,gBAAgB,CAAC,WAAW,CAAC;QAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,gBAAgB,CAAC;IACzF,OAAO,OAAO,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"static-security-headers.js","sourceRoot":"","sources":["../src/static-security-headers.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,qEAAqE;AACrE,MAAM,CAAC,MAAM,gBAAgB,GAC3B,uFAAuF,CAAC;AAE1F,4EAA4E;AAC5E,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AAEjC,yCAAyC;AACzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAEvD,yFAAyF;AACzF,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,gBAAgB,CAAC;AACrF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,WAAmB;IACtD,MAAM,OAAO,GAA2B,EAAE,wBAAwB,EAAE,OAAO,EAAE,CAAC;IAC9E,IAAI,gBAAgB,CAAC,WAAW,CAAC;QAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,gBAAgB,CAAC;IACzF,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/dist/version.d.ts CHANGED
@@ -19,7 +19,7 @@
19
19
  * Format: SemVer 2.0.0. Pre-1.0 minor bumps are breaking; post-1.0
20
20
  * follow standard SemVer.
21
21
  */
22
- export declare const CAELO_VERSION = "0.12.1";
22
+ export declare const CAELO_VERSION = "0.12.3";
23
23
  /**
24
24
  * Deprecated alias for back-compat — early P17 work spelled this
25
25
  * `CALEO_VERSION` (typo of "Caelo"). New code should import
@@ -31,7 +31,7 @@ export declare const CAELO_VERSION = "0.12.1";
31
31
  *
32
32
  * @deprecated use CAELO_VERSION
33
33
  */
34
- export declare const CALEO_VERSION = "0.12.1";
34
+ export declare const CALEO_VERSION = "0.12.3";
35
35
  /**
36
36
  * Parsed shape — major/minor/patch + optional pre-release tag.
37
37
  * Stable interface for callers that need to feature-gate (rare —
package/dist/version.js CHANGED
@@ -20,7 +20,7 @@
20
20
  * Format: SemVer 2.0.0. Pre-1.0 minor bumps are breaking; post-1.0
21
21
  * follow standard SemVer.
22
22
  */
23
- export const CAELO_VERSION = "0.12.1";
23
+ export const CAELO_VERSION = "0.12.3";
24
24
  /**
25
25
  * Deprecated alias for back-compat — early P17 work spelled this
26
26
  * `CALEO_VERSION` (typo of "Caelo"). New code should import
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caelo-cms/shared",
3
- "version": "0.12.1",
3
+ "version": "0.12.3",
4
4
  "private": false,
5
5
  "license": "MPL-2.0",
6
6
  "description": "Shared Zod schemas + types + the two-pass HTML composer used by every Caelo CMS workspace package. Stable enough for plugin authors and embedders to depend on directly.",
@@ -46,7 +46,7 @@ describe("mediaSecurityHeaders", () => {
46
46
 
47
47
  describe("SVG_PATH_PATTERN", () => {
48
48
  it("matches .svg paths in any case and nothing else", () => {
49
- for (const p of ["/_assets/logo.0123456789abcdef.svg", "/_assets/LOGO.SVG", "icon.Svg"]) {
49
+ for (const p of ["/_assets/logo.0123456789abcdef.svg", "/_assets/LOGO.SVG", "/icon.Svg"]) {
50
50
  expect(new RegExp(SVG_PATH_PATTERN).test(p)).toBe(true);
51
51
  }
52
52
  for (const p of ["/_assets/logo.svgz", "/_assets/svg/logo.png", "/about/", "/x.svg/"]) {
@@ -57,4 +57,15 @@ describe("SVG_PATH_PATTERN", () => {
57
57
  it("uses no inline flags or lookaround, so RE2 (Firebase Hosting) accepts it", () => {
58
58
  expect(SVG_PATH_PATTERN).not.toMatch(/\(\?/);
59
59
  });
60
+
61
+ it("is anchored at both ends: Firebase Hosting matches a header regex against the whole path", () => {
62
+ expect(SVG_PATH_PATTERN.startsWith("^/")).toBe(true);
63
+ expect(SVG_PATH_PATTERN.endsWith("$")).toBe(true);
64
+ // Anchored, a search and a whole-path match agree.
65
+ for (const p of ["/a.svg", "/x/a.SVG", "/a.svg/", "/a.svgz", "a.svg"]) {
66
+ expect(new RegExp(SVG_PATH_PATTERN).test(p)).toBe(
67
+ new RegExp(`^(?:${SVG_PATH_PATTERN})$`).test(p),
68
+ );
69
+ }
70
+ });
60
71
  });
@@ -35,14 +35,17 @@ export const NOSNIFF = "nosniff";
35
35
  export const SVG_CONTENT_TYPE = "image/svg+xml";
36
36
 
37
37
  /**
38
- * Regex (source string, unanchored at the start) matching a URL path that
39
- * ends in `.svg`, any case. Only syntax shared by ECMAScript and RE2 (no
40
- * inline flags), so the same string serves Firebase Hosting's `regex`
41
- * header matcher and `RegExp` here. The static generator names every file
42
- * by extension (`contentTypeFor` in admin-core), so the extension is what
43
- * decides the served `image/svg+xml`.
38
+ * Regex (source string) matching a whole URL path that ends in `.svg`, any
39
+ * case. Anchored at both ends because Firebase Hosting matches a header
40
+ * `regex` against the WHOLE request path (`firebase-version-headers.ts` in
41
+ * admin-core): the unanchored `\.[sS][vV][gG]$` it replaced never matched
42
+ * there, so SVGs went out without the CSP. Self-anchored, it means the same
43
+ * under a full match and a `RegExp` search. Only syntax shared by
44
+ * ECMAScript and RE2 (no inline flags). The static generator names every
45
+ * file by extension (`contentTypeFor` in admin-core), so the extension is
46
+ * what decides the served `image/svg+xml`.
44
47
  */
45
- export const SVG_PATH_PATTERN = "\\.[sS][vV][gG]$";
48
+ export const SVG_PATH_PATTERN = "^/.*\\.[sS][vV][gG]$";
46
49
 
47
50
  /** True when `contentType` is SVG (case and parameters such as `; charset=` ignored). */
48
51
  export function isSvgContentType(contentType: string): boolean {
package/src/version.ts CHANGED
@@ -22,7 +22,7 @@
22
22
  * follow standard SemVer.
23
23
  */
24
24
 
25
- export const CAELO_VERSION = "0.12.1";
25
+ export const CAELO_VERSION = "0.12.3";
26
26
 
27
27
  /**
28
28
  * Deprecated alias for back-compat — early P17 work spelled this