@getforma/core 1.0.8 → 1.0.10
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/README.md +1 -1
- package/dist/chunk-263HW3KN.cjs +35 -0
- package/dist/chunk-263HW3KN.cjs.map +1 -0
- package/dist/chunk-2QQBKQIF.js +30 -0
- package/dist/chunk-2QQBKQIF.js.map +1 -0
- package/dist/{chunk-TBWZZ3SI.js → chunk-3G7ET4O5.js} +32 -8
- package/dist/chunk-3G7ET4O5.js.map +1 -0
- package/dist/{chunk-BARF67I6.cjs → chunk-6FW5E54W.cjs} +32 -6
- package/dist/chunk-6FW5E54W.cjs.map +1 -0
- package/dist/{chunk-7Q7LIV23.js → chunk-AFRFF7XL.js} +64 -20
- package/dist/chunk-AFRFF7XL.js.map +1 -0
- package/dist/{chunk-7L3KHGEA.cjs → chunk-T33QUD2Y.cjs} +95 -51
- package/dist/chunk-T33QUD2Y.cjs.map +1 -0
- package/dist/forma-runtime-csp.js +40 -2
- package/dist/forma-runtime.js +40 -2
- package/dist/formajs-runtime-hardened.global.js +40 -2
- package/dist/formajs-runtime-hardened.global.js.map +1 -1
- package/dist/formajs-runtime.global.js +40 -2
- package/dist/formajs-runtime.global.js.map +1 -1
- package/dist/formajs.global.js +100 -24
- package/dist/formajs.global.js.map +1 -1
- package/dist/http.cjs +2 -2
- package/dist/http.js +1 -1
- package/dist/index.cjs +63 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/dist/runtime-hardened.cjs +40 -2
- package/dist/runtime-hardened.cjs.map +1 -1
- package/dist/runtime-hardened.js +40 -2
- package/dist/runtime-hardened.js.map +1 -1
- package/dist/runtime.cjs +41 -25
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +20 -4
- package/dist/runtime.js.map +1 -1
- package/dist/server.cjs +4 -4
- package/dist/server.js +1 -1
- package/dist/ssr/index.cjs +23 -42
- package/dist/ssr/index.cjs.map +1 -1
- package/dist/ssr/index.js +23 -42
- package/dist/ssr/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-7L3KHGEA.cjs.map +0 -1
- package/dist/chunk-7Q7LIV23.js.map +0 -1
- package/dist/chunk-BARF67I6.cjs.map +0 -1
- package/dist/chunk-TBWZZ3SI.js.map +0 -1
|
@@ -1116,7 +1116,35 @@ var FormaRuntime = (() => {
|
|
|
1116
1116
|
};
|
|
1117
1117
|
}
|
|
1118
1118
|
|
|
1119
|
+
// src/security/url-safety.ts
|
|
1120
|
+
var URL_IGNORED_CHARS_RE = /[\u0000-\u0020\u007F-\u009F]/g;
|
|
1121
|
+
var DANGEROUS_SCHEME_RE = /^(?:javascript|vbscript|data:text\/html)/i;
|
|
1122
|
+
var URL_ATTRS = /* @__PURE__ */ new Set([
|
|
1123
|
+
"href",
|
|
1124
|
+
"src",
|
|
1125
|
+
"action",
|
|
1126
|
+
"formaction",
|
|
1127
|
+
"xlink:href",
|
|
1128
|
+
"poster",
|
|
1129
|
+
"background"
|
|
1130
|
+
]);
|
|
1131
|
+
function isUrlAttr(name) {
|
|
1132
|
+
return URL_ATTRS.has(name.toLowerCase());
|
|
1133
|
+
}
|
|
1134
|
+
function isDangerousUrl(value2) {
|
|
1135
|
+
const normalized = value2.replace(URL_IGNORED_CHARS_RE, "");
|
|
1136
|
+
return DANGEROUS_SCHEME_RE.test(normalized);
|
|
1137
|
+
}
|
|
1138
|
+
function isEventHandlerAttr(name) {
|
|
1139
|
+
return /^on/i.test(name);
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1119
1142
|
// src/runtime.ts
|
|
1143
|
+
function isUnsafeAttrBinding(name, value2) {
|
|
1144
|
+
if (isEventHandlerAttr(name)) return true;
|
|
1145
|
+
if (isUrlAttr(name) && isDangerousUrl(value2)) return true;
|
|
1146
|
+
return false;
|
|
1147
|
+
}
|
|
1120
1148
|
var _refetchRegistry = /* @__PURE__ */ new Map();
|
|
1121
1149
|
function $refetch(id) {
|
|
1122
1150
|
const fn = _refetchRegistry.get(id);
|
|
@@ -2120,7 +2148,12 @@ var FormaRuntime = (() => {
|
|
|
2120
2148
|
if (attr.value.includes("{item")) {
|
|
2121
2149
|
const compiled = compileTemplate(attr.value);
|
|
2122
2150
|
entries.push({ attr: attr.name, compiled });
|
|
2123
|
-
|
|
2151
|
+
const value2 = evaluateCompiledTemplate(compiled, item);
|
|
2152
|
+
if (isUnsafeAttrBinding(attr.name, value2)) {
|
|
2153
|
+
node.removeAttribute(attr.name);
|
|
2154
|
+
} else {
|
|
2155
|
+
node.setAttribute(attr.name, value2);
|
|
2156
|
+
}
|
|
2124
2157
|
}
|
|
2125
2158
|
}
|
|
2126
2159
|
if (entries.length > 0) {
|
|
@@ -2962,7 +2995,12 @@ var FormaRuntime = (() => {
|
|
|
2962
2995
|
if (val == null || val === false) {
|
|
2963
2996
|
el.removeAttribute(attrName);
|
|
2964
2997
|
} else {
|
|
2965
|
-
|
|
2998
|
+
const str = String(val);
|
|
2999
|
+
if (isUnsafeAttrBinding(attrName, str)) {
|
|
3000
|
+
el.removeAttribute(attrName);
|
|
3001
|
+
} else {
|
|
3002
|
+
el.setAttribute(attrName, str);
|
|
3003
|
+
}
|
|
2966
3004
|
}
|
|
2967
3005
|
});
|
|
2968
3006
|
disposers.push(dispose);
|