@open-mercato/shared 0.9.1-develop.7566.1.b9de0a5eb7 → 0.9.1-develop.7572.1.e9bdaac5f1

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.
@@ -1,3 +1,3 @@
1
1
  [generate-countries] up to date (259 countries)
2
- [build:shared] found 319 entry points
2
+ [build:shared] found 320 entry points
3
3
  [build:shared] built successfully
@@ -1,4 +1,4 @@
1
- const APP_VERSION = "0.9.1-develop.7566.1.b9de0a5eb7";
1
+ const APP_VERSION = "0.9.1-develop.7572.1.e9bdaac5f1";
2
2
  const appVersion = APP_VERSION;
3
3
  export {
4
4
  APP_VERSION,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/lib/version.ts"],
4
- "sourcesContent": ["// Build-time generated version\nexport const APP_VERSION = '0.9.1-develop.7566.1.b9de0a5eb7';\nexport const appVersion = APP_VERSION;\n"],
4
+ "sourcesContent": ["// Build-time generated version\nexport const APP_VERSION = '0.9.1-develop.7572.1.e9bdaac5f1';\nexport const appVersion = APP_VERSION;\n"],
5
5
  "mappings": "AACO,MAAM,cAAc;AACpB,MAAM,aAAa;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,20 @@
1
+ const SENTINEL_ORIGIN = "https://notifications.open-mercato.local";
2
+ const CONTROL_OR_BACKSLASH = /[\u0000-\u001F\u007F\\]/;
3
+ function isSafeNotificationHref(href) {
4
+ if (!href.startsWith("/") || href.startsWith("//")) {
5
+ return false;
6
+ }
7
+ if (CONTROL_OR_BACKSLASH.test(href)) {
8
+ return false;
9
+ }
10
+ try {
11
+ const parsed = new URL(href, SENTINEL_ORIGIN);
12
+ return parsed.origin === SENTINEL_ORIGIN && !parsed.pathname.startsWith("//");
13
+ } catch {
14
+ return false;
15
+ }
16
+ }
17
+ export {
18
+ isSafeNotificationHref
19
+ };
20
+ //# sourceMappingURL=safeHref.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/modules/notifications/safeHref.ts"],
4
+ "sourcesContent": ["const SENTINEL_ORIGIN = 'https://notifications.open-mercato.local'\nconst CONTROL_OR_BACKSLASH = /[\\u0000-\\u001F\\u007F\\\\]/\n\nexport function isSafeNotificationHref(href: string): boolean {\n if (!href.startsWith('/') || href.startsWith('//')) {\n return false\n }\n\n if (CONTROL_OR_BACKSLASH.test(href)) {\n return false\n }\n\n try {\n const parsed = new URL(href, SENTINEL_ORIGIN)\n return parsed.origin === SENTINEL_ORIGIN && !parsed.pathname.startsWith('//')\n } catch {\n return false\n }\n}\n"],
5
+ "mappings": "AAAA,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAEtB,SAAS,uBAAuB,MAAuB;AAC5D,MAAI,CAAC,KAAK,WAAW,GAAG,KAAK,KAAK,WAAW,IAAI,GAAG;AAClD,WAAO;AAAA,EACT;AAEA,MAAI,qBAAqB,KAAK,IAAI,GAAG;AACnC,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,MAAM,eAAe;AAC5C,WAAO,OAAO,WAAW,mBAAmB,CAAC,OAAO,SAAS,WAAW,IAAI;AAAA,EAC9E,QAAQ;AACN,WAAO;AAAA,EACT;AACF;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/shared",
3
- "version": "0.9.1-develop.7566.1.b9de0a5eb7",
3
+ "version": "0.9.1-develop.7572.1.e9bdaac5f1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -121,7 +121,7 @@
121
121
  "@mikro-orm/core": "^7.1.14",
122
122
  "@mikro-orm/decorators": "^7.1.14",
123
123
  "@mikro-orm/postgresql": "^7.1.14",
124
- "@open-mercato/cache": "0.9.1-develop.7566.1.b9de0a5eb7",
124
+ "@open-mercato/cache": "0.9.1-develop.7572.1.e9bdaac5f1",
125
125
  "@types/html-to-text": "^9.0.4",
126
126
  "@types/sanitize-html": "^2.16.1",
127
127
  "dotenv": "^17.4.2",
@@ -0,0 +1,19 @@
1
+ const SENTINEL_ORIGIN = 'https://notifications.open-mercato.local'
2
+ const CONTROL_OR_BACKSLASH = /[\u0000-\u001F\u007F\\]/
3
+
4
+ export function isSafeNotificationHref(href: string): boolean {
5
+ if (!href.startsWith('/') || href.startsWith('//')) {
6
+ return false
7
+ }
8
+
9
+ if (CONTROL_OR_BACKSLASH.test(href)) {
10
+ return false
11
+ }
12
+
13
+ try {
14
+ const parsed = new URL(href, SENTINEL_ORIGIN)
15
+ return parsed.origin === SENTINEL_ORIGIN && !parsed.pathname.startsWith('//')
16
+ } catch {
17
+ return false
18
+ }
19
+ }