xynginc 1.0.92 → 1.0.93

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/index.js CHANGED
@@ -17,6 +17,19 @@ import { startXNCPlugin } from "./startPlugin";
17
17
  export default function XNCP(options) {
18
18
  const { domains, autoReload = true, autoFixFirewall = false, binaryPath, autoDownload = true, version = "latest", installRequirements = true, sudoPassword, } = options;
19
19
  const pkg = Plugin.manifest(__sys__);
20
+ const hostRoot = (typeof __sys__ !== "undefined" && __sys__.__env__?.get("__root__")) ||
21
+ process.cwd();
22
+ const effectiveSudoPassword = sudoPassword ||
23
+ (typeof __sys__ !== "undefined" &&
24
+ typeof __sys__.__env__?.getForRoot === "function" &&
25
+ hostRoot
26
+ ? __sys__.__env__.getForRoot("SUDO_PASSWORD", hostRoot)
27
+ : undefined) ||
28
+ (typeof __sys__ !== "undefined"
29
+ ? __sys__.__env__?.get("SUDO_PASSWORD")
30
+ : undefined) ||
31
+ "";
32
+ console.log("effectiveSudoPassword: ", effectiveSudoPassword);
20
33
  return Plugin.create({
21
34
  name: pkg.name,
22
35
  version: pkg.version,
@@ -35,7 +48,7 @@ export default function XNCP(options) {
35
48
  version,
36
49
  domains,
37
50
  installRequirements,
38
- sudoPassword: sudoPassword || "",
51
+ sudoPassword: effectiveSudoPassword,
39
52
  });
40
53
  },
41
54
  onServerStop: async () => {
@@ -2,34 +2,27 @@ import { ensureBinary } from "./mods/ensureBinary";
2
2
  import { Logger } from "./mods/logger";
3
3
  import { addDomain, applyConfig, checkRequirements, getStatus, installRequirementsHandler, listDomains, reloadNginx, removeDomain, testNginx, } from "./mods/requirements";
4
4
  const getSudo = (sudoPassword) => {
5
- let pwd = sudoPassword;
6
- // Attempt multiple ways to get the password from the host project's environment
7
- if (!pwd && typeof __sys__ !== "undefined" && __sys__.__env__) {
8
- const projectRoot = globalThis.__sys__?._primaryRoot ||
9
- globalThis.__sys__?._internalRoot ||
10
- process.cwd();
11
- if (typeof __sys__.__env__.getForRoot === "function") {
12
- pwd = __sys__.__env__.getForRoot("SUDO_PASSWORD", projectRoot);
13
- }
14
- if (!pwd) {
15
- pwd = __sys__.__env__.get("SUDO_PASSWORD");
16
- }
17
- }
18
- // Strip wrapping quotes if present in .env (e.g., SUDO_PASSWORD="Test")
19
- if (pwd) {
20
- if ((pwd.startsWith('"') && pwd.endsWith('"')) ||
21
- (pwd.startsWith("'") && pwd.endsWith("'"))) {
22
- pwd = pwd.slice(1, -1);
23
- }
5
+ // 1. Direct option passed by the user
6
+ if (sudoPassword) {
7
+ Logger.info(`[XyNginC] Using sudo password provided via plugin options(${sudoPassword.slice(0, 2)}***).`);
8
+ return `echo '${sudoPassword}' | sudo -S`;
24
9
  }
25
- if (pwd) {
26
- if (sudoPassword) {
27
- Logger.info(`[XyNginC] Using sudo password provided via plugin options(${pwd.slice(0, 2)}***).`);
28
- }
29
- else {
30
- Logger.info("[XyNginC] Using sudo password injected from environment variables.");
31
- }
32
- return `echo '${pwd}' | sudo -S`;
10
+ // 2. Read from host project .env via XyPriss getForRoot
11
+ // In XyPriss Zero-Trust sandboxing, __sys__.__env__.get() scopes to the caller module root.
12
+ // We use the host application root (__root__ or process.cwd()) to retrieve project-level secrets.
13
+ const hostRoot = (typeof __sys__ !== "undefined" && __sys__.__env__?.get("__root__")) ||
14
+ process.cwd();
15
+ const envPwd = (typeof __sys__ !== "undefined" &&
16
+ typeof __sys__.__env__?.getForRoot === "function" &&
17
+ hostRoot
18
+ ? __sys__.__env__.getForRoot("SUDO_PASSWORD", hostRoot)
19
+ : undefined) ||
20
+ (typeof __sys__ !== "undefined"
21
+ ? __sys__.__env__?.get("SUDO_PASSWORD")
22
+ : undefined);
23
+ if (envPwd) {
24
+ Logger.info("[XyNginC] Using sudo password injected from environment variables.");
25
+ return `echo '${envPwd}' | sudo -S`;
33
26
  }
34
27
  Logger.warn("[XyNginC] ⚠️ No sudo password provided. Falling back to non-interactive mode (sudo -n).");
35
28
  Logger.warn("[XyNginC] ⚠️ If the command requires a password, it will fail immediately instead of hanging.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xynginc",
3
- "version": "1.0.92",
3
+ "version": "1.0.93",
4
4
  "description": "XyPriss Nginx Controller - Automatic Nginx & SSL management for XyPriss servers",
5
5
  "author": "Seth Eleazar - iDevo",
6
6
  "license": "NOSL",
@@ -1,11 +1,11 @@
1
1
  --- XYPRISS SIGNATURE (G3) ---
2
- Manifest: xynginc@1.0.92
2
+ Manifest: xynginc@1.0.93
3
3
  Min-Engine: 1.0.81
4
- Fingerprint: sha256:528683a10d34bbd3202d63026467c67783d03a68242cdca43cd0c3e775a07dd1
4
+ Fingerprint: sha256:03604e0d879653568e2b805ed55cce558bd4de72f7787e784ebdd0bc3c85e128
5
5
  Identity: ed25519:0e2e1accdbba45480979305256d50d368ae6cc2c0d7ee378c5f1999ae834cf58
6
6
  Privileges: XHS.HOOK.LIFECYCLE.REGISTER,XHS.HOOK.LIFECYCLE.SERVER_START,XHS.HOOK.LIFECYCLE.SERVER_STOP,XHS.HOOK.LIFECYCLE.SERVER_READY
7
- Expires: 2027-09-12T17:06:51Z
7
+ Expires: 2027-09-12T18:00:07Z
8
8
  Revision: sha256:none
9
9
  --- BEGIN CRYPTOGRAPHIC PROOF ---
10
- base64:XT/1zHk9NXaE6pBH4Qm3jkE0wWNTIVoMCBty3LJrm6+dln8Dq+yqnMY2kssQcBJUPDYGOZGdxh3n/g7kvIwHAA==
10
+ base64:pPdQIlTA2rrp+vWXh9st+1bemSKN28DAMl3MtxyDwnVipcGP/k6ftC2+m/Xzt68WrAsaum2aM3Uwpqs7vw3+CQ==
11
11
  --- END XYPRISS SIGNATURE ---