@gcunharodrigues/wrxn 0.18.1 → 0.18.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gcunharodrigues/wrxn",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.2",
|
|
4
4
|
"description": "WRXN Kernel — installable AI operating system. Two profiles (project | workspace), pull-based updates, managed/seeded/state file classes.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"wrxn": "bin/wrxn.cjs"
|
|
@@ -43,7 +43,7 @@ const SIDECAR_EXTRA = [
|
|
|
43
43
|
// OR bare (password=) — never a lone trailing quote, so a path ending in "passwd" used as a JSON key
|
|
44
44
|
// (e.g. "../../etc/passwd": …) is NOT misread as an assignment (it would falsely refuse a sidecar write).
|
|
45
45
|
/(?:["'](?:password|passwd|pwd)["']|(?:password|passwd|pwd))\s*[:=]\s*["']?[^\s"',;)&}{]+/i,
|
|
46
|
-
/[a-z][a-z0-9+.\-]
|
|
46
|
+
/[a-z][a-z0-9+.\-]{1,19}:\/\/[^\s:/@]+:[^\s/@]+@\S+/i, // URI connection string with inline creds (scheme://user:pass@host); scheme bounded {1,19} so a long letter-run fails fast — no O(n²) backtrack (#66)
|
|
47
47
|
/eyJ[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}/, // JWT (eyJ header; shorter min than the canonical JWT)
|
|
48
48
|
];
|
|
49
49
|
const SECRET_PATTERNS = [...SECRET_PATTERNS_CANON, ...SIDECAR_EXTRA];
|
|
@@ -65,6 +65,27 @@ function pageBody(text) {
|
|
|
65
65
|
return end < 0 ? '' : src.slice(end + 4);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
// Fenced code blocks (``` or ~~~) hold ILLUSTRATIVE text — a [[slug]] written there as example syntax is
|
|
69
|
+
// not a navigable wikilink, so it must not be checked for a dead target (#28). Strip whole fenced regions
|
|
70
|
+
// before the scan. Line-based + anchored (`^\s{0,3}` … `{3,}`) so it stays linear — no backtracking,
|
|
71
|
+
// mirroring wikilinkTargets' own ReDoS discipline. A fence closes only on the SAME marker char with no
|
|
72
|
+
// trailing info; an unclosed fence runs to end-of-body (CommonMark), so its content stays stripped.
|
|
73
|
+
function stripFencedCode(body) {
|
|
74
|
+
const kept = [];
|
|
75
|
+
let fence = ''; // '`' or '~' while inside a fenced block; '' when outside
|
|
76
|
+
for (const line of String(body || '').split('\n')) {
|
|
77
|
+
const m = /^\s{0,3}(`{3,}|~{3,})/.exec(line);
|
|
78
|
+
if (!fence) {
|
|
79
|
+
if (m) fence = m[1][0]; // open: drop the fence line, enter the block
|
|
80
|
+
else kept.push(line);
|
|
81
|
+
} else if (m && m[1][0] === fence && line.slice(m[0].length).trim() === '') {
|
|
82
|
+
fence = ''; // close: drop the fence line, leave the block
|
|
83
|
+
}
|
|
84
|
+
// a line inside a block (including the fences) is dropped
|
|
85
|
+
}
|
|
86
|
+
return kept.join('\n');
|
|
87
|
+
}
|
|
88
|
+
|
|
68
89
|
// Wikilinks are written `[[slug]]` (Obsidian style), where slug equals a target page's `name:`. An
|
|
69
90
|
// optional `|alias` or `#anchor` is stripped to the bare target slug. Returns the distinct slugs.
|
|
70
91
|
// The inner class excludes BOTH `]` and `[`: a real `[[slug]]` target never contains `[`, and the
|
|
@@ -74,7 +95,8 @@ function wikilinkTargets(body) {
|
|
|
74
95
|
const out = new Set();
|
|
75
96
|
const re = /\[\[([^\]\[]+)\]\]/g;
|
|
76
97
|
let m;
|
|
77
|
-
|
|
98
|
+
const scannable = stripFencedCode(body); // code-block [[slug]] is illustrative, not navigable (#28)
|
|
99
|
+
while ((m = re.exec(scannable))) {
|
|
78
100
|
const slug = m[1].split('|')[0].split('#')[0].trim();
|
|
79
101
|
if (slug) out.add(slug);
|
|
80
102
|
}
|