atris 3.72.2 → 3.72.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.
Files changed (2) hide show
  1. package/lib/site.js +8 -2
  2. package/package.json +1 -1
package/lib/site.js CHANGED
@@ -18,13 +18,19 @@ function collectMd(input) {
18
18
  const stat = fs.statSync(input);
19
19
  if (stat.isFile()) return MD_EXTS.has(path.extname(input)) ? [input] : [];
20
20
  const out = [];
21
+ let realRoot; try { realRoot = fs.realpathSync(input); } catch { return out; }
22
+ const inside = (p) => p === realRoot || p.startsWith(realRoot + path.sep);
21
23
  (function walk(dir) {
22
24
  for (const name of fs.readdirSync(dir).sort()) {
23
25
  if (name.startsWith('.')) continue;
24
26
  const full = path.join(dir, name);
25
- let st; try { st = fs.statSync(full); } catch { continue; }
27
+ // lstat, not stat: symlinks are skipped so a site only ever contains files that live in its folder.
28
+ let st; try { st = fs.lstatSync(full); } catch { continue; }
29
+ if (st.isSymbolicLink()) continue;
30
+ let real; try { real = fs.realpathSync(full); } catch { continue; }
31
+ if (!inside(real)) continue;
26
32
  if (st.isDirectory()) { if (!SKIP_DIRS.has(name)) walk(full); }
27
- else if (MD_EXTS.has(path.extname(name))) out.push(full);
33
+ else if (st.isFile() && MD_EXTS.has(path.extname(name))) out.push(full);
28
34
  }
29
35
  })(input);
30
36
  return out;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atris",
3
- "version": "3.72.2",
3
+ "version": "3.72.3",
4
4
  "description": "you say what you want in plain words. atris builds it, checks it, and shows you proof.",
5
5
  "main": "bin/atris.js",
6
6
  "bin": {