@netcatty/dsh-guard 0.2.0 → 0.2.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.
Files changed (2) hide show
  1. package/lib/index.js +4 -0
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -175,6 +175,10 @@ function matchParam(pattern, value, permission) {
175
175
  export function expand(p, cwd) {
176
176
  if (typeof p !== 'string' || p === '') return undefined;
177
177
  if (p === '~') return homedir();
178
+ // `~\x` is how Windows users write the home prefix. Normalising the tail
179
+ // matters on POSIX too: `resolve` keeps a backslash as part of the file name,
180
+ // so `/home/u/\secret` would never match a `~/secret*` rule.
181
+ if (p.startsWith('~\\')) return resolve(homedir(), toPosix(p.slice(2)));
178
182
  if (p.startsWith('~/')) return resolve(homedir(), p.slice(2));
179
183
  return isAbsolute(p) ? resolve(p) : resolve(cwd, p);
180
184
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netcatty/dsh-guard",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "allow/ask/deny permission gates for DeepSeek Harness tools: path/params/agents surfaces, argv decomposition, network rules, redaction, grants, dry-run, fail-closed config",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",