@belvador/core 0.4.0 → 0.4.1
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/privacy.js +21 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/privacy.js
CHANGED
|
@@ -83,7 +83,25 @@ const PROVIDER_KEY = /\b[sr]k_(?:live|test)_[A-Za-z0-9]{8,}\b/g;
|
|
|
83
83
|
const JWT = /\beyJ[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{4,}/g;
|
|
84
84
|
const CARD = /\b(?:\d[ -]?){12,18}\d\b/g;
|
|
85
85
|
const EMAIL = /\b[A-Za-z0-9._%+-]{1,64}@([A-Za-z0-9-]{1,63}(?:\.[A-Za-z0-9-]{1,63})*\.[A-Za-z]{2,24})\b/g;
|
|
86
|
+
/** The same address percent-encoded in a URL (`linh%40example.com`). */
|
|
87
|
+
const EMAIL_ENCODED = /\b(?:[A-Za-z0-9._+-]|%[0-9A-Fa-f]{2}){1,64}%40([A-Za-z0-9-]{1,63}(?:\.[A-Za-z0-9-]{1,63})*\.[A-Za-z]{2,24})\b/gi;
|
|
86
88
|
const USERINFO = /\b([a-z][a-z0-9+.-]{1,15}:\/\/)[^\s/?#@]+@/gi;
|
|
89
|
+
/** A dotted IPv4 in free text, not inside a longer dotted number or a word (`v1.2.3.4`). */
|
|
90
|
+
const IPV4_TEXT = /(^|[^0-9A-Za-z.])(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?![0-9A-Za-z]|\.\d)/g;
|
|
91
|
+
/**
|
|
92
|
+
* Private, CGNAT, loopback, link-local, unspecified and multicast/reserved addresses name
|
|
93
|
+
* infrastructure (`ECONNREFUSED 10.0.3.17:5432`) and stay readable; any other IPv4 may be a client.
|
|
94
|
+
*/
|
|
95
|
+
function isInfrastructureV4(a, b) {
|
|
96
|
+
return (a === 0 ||
|
|
97
|
+
a === 10 ||
|
|
98
|
+
a === 127 ||
|
|
99
|
+
a >= 224 ||
|
|
100
|
+
(a === 100 && b >= 64 && b <= 127) ||
|
|
101
|
+
(a === 169 && b === 254) ||
|
|
102
|
+
(a === 172 && b >= 16 && b <= 31) ||
|
|
103
|
+
(a === 192 && b === 168));
|
|
104
|
+
}
|
|
87
105
|
/** name=value inside URLs, query strings and log lines. */
|
|
88
106
|
const PARAM = /([A-Za-z0-9_.~%[\]-]{1,128})=([^&#\s"'<>,;]*)/g;
|
|
89
107
|
/** `Basic <base64>` credentials in headers and log lines. */
|
|
@@ -154,7 +172,9 @@ export function scrubText(text) {
|
|
|
154
172
|
.replace(PROVIDER_KEY, FILTERED)
|
|
155
173
|
.replace(JWT, FILTERED)
|
|
156
174
|
.replace(CARD, (m) => (luhn(m.replace(/[ -]/g, "")) ? FILTERED : m))
|
|
157
|
-
.replace(EMAIL, (_m, domain) => `${FILTERED}@${domain}`)
|
|
175
|
+
.replace(EMAIL, (_m, domain) => `${FILTERED}@${domain}`)
|
|
176
|
+
.replace(EMAIL_ENCODED, (_m, domain) => `${FILTERED}%40${domain}`)
|
|
177
|
+
.replace(IPV4_TEXT, (all, lead, a, b, c) => isInfrastructureV4(Number(a), Number(b)) ? all : `${lead}${a}.${b}.${c}.0`);
|
|
158
178
|
}
|
|
159
179
|
function readKey(obj, key) {
|
|
160
180
|
try {
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// One version for every @belvador/* package (lockstep). Changed only by
|
|
2
2
|
// `bun scripts/set-version.ts`; tests compare it with every package.json and
|
|
3
3
|
// with src/content/sdk-matrix.ts in the web app.
|
|
4
|
-
export const SDK_VERSION = "0.4.
|
|
4
|
+
export const SDK_VERSION = "0.4.1";
|
|
5
5
|
/** The audited engine version every package pins exactly (research/05-decisions.md D3). */
|
|
6
6
|
export const ENGINE_VERSION = "10.76.2";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@belvador/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Internal building blocks of the Belvador SDK (privacy, sending policy). Install @belvador/browser, @belvador/react, @belvador/cloudflare or @belvador/tanstack-start instead.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Belvador (https://belvador.dev)",
|