+1
-1
| { | ||
| "name": "moshcode", | ||
| "version": "0.62.0", | ||
| "version": "0.63.0", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "description": "moshcode — a metal wrapper for coding engines and native UGig/CoinPay workflow CLIs, with OpenPRD and moshscript", |
+18
-2
@@ -335,4 +335,20 @@ // Routing Moshpit TLDs to the local bridge, on whatever OS this is. | ||
| */ | ||
| export function pidfilePath() { | ||
| const base = process.env.XDG_RUNTIME_DIR || join(homedir(), ".moshcode") || tmpdir(); | ||
| export function pidfilePath(env = process.env, exists = existsSync) { | ||
| // `dns enable` escalates, so the run that *starts* the bridge is root and the | ||
| // runs that later ask about it are not. Under sudo both XDG_RUNTIME_DIR and | ||
| // HOME belong to root, so the pidfile went to /root/.moshcode — a path the | ||
| // unprivileged `dns status` and `dns disable` never look at and could not | ||
| // read if they did. The bridge was reported "not running" for the rest of its | ||
| // life, and the fix status advised started a second one on top of it. | ||
| // | ||
| // So an escalated run records against the invoking user's runtime dir, and | ||
| // only when that directory is really there: deriving /run/user/<uid> on a | ||
| // machine without one trades an unreadable path for a nonexistent one. macOS | ||
| // has no /run/user and falls through unchanged — the escalated paths this | ||
| // matters for are the systemd-resolved ones. | ||
| const invoker = env.SUDO_UID ? `/run/user/${env.SUDO_UID}` : null; | ||
| const base = (invoker && exists(invoker) ? invoker : null) | ||
| || env.XDG_RUNTIME_DIR | ||
| || join(homedir(), ".moshcode") | ||
| || tmpdir(); | ||
| return join(base, "moshpit-dns.pid"); | ||
@@ -339,0 +355,0 @@ } |
Sorry, the diff of this file is too big to display
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
1764449
0.34%31509
0.38%