pi-landstrip 0.16.18 → 0.16.20

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/index.ts +71 -2
  2. package/package.json +2 -2
package/index.ts CHANGED
@@ -782,11 +782,78 @@ function landstripAvailable(): boolean {
782
782
  }
783
783
  }
784
784
 
785
+ // Essential environment variables to forward to the sandboxed process.
786
+ // Only these names (plus their lowercase variants) are passed through.
787
+ // Filtering prevents E2BIG (Argument list too long) when pi's own
788
+ // process environment grows large over a long-running session.
789
+ const FORWARD_ENV_NAMES = new Set([
790
+ 'PATH',
791
+ 'HOME',
792
+ 'USER',
793
+ 'LOGNAME',
794
+ 'SHELL',
795
+ 'LANG',
796
+ 'LC_ALL',
797
+ 'LC_CTYPE',
798
+ 'TERM',
799
+ 'COLORTERM',
800
+ 'TMPDIR',
801
+ 'TMP',
802
+ 'TEMP',
803
+ 'DISPLAY',
804
+ 'WAYLAND_DISPLAY',
805
+ 'SSH_AUTH_SOCK',
806
+ 'SSH_AGENT_PID',
807
+ 'XDG_CACHE_HOME',
808
+ 'XDG_CONFIG_HOME',
809
+ 'XDG_DATA_HOME',
810
+ 'XDG_STATE_HOME',
811
+ 'XDG_RUNTIME_DIR',
812
+ 'DBUS_SESSION_BUS_ADDRESS',
813
+ 'NVM_DIR',
814
+ 'NVM_INC',
815
+ 'NVM_CD_FLAGS',
816
+ 'GIT_ASKPASS',
817
+ 'GIT_TERMINAL_PROMPT',
818
+ 'EDITOR',
819
+ 'VISUAL',
820
+ 'PAGER',
821
+ 'BROWSER',
822
+ 'MANPATH',
823
+ 'INFOPATH',
824
+ 'PKG_CONFIG_PATH',
825
+ 'LD_LIBRARY_PATH',
826
+ 'JAVA_HOME',
827
+ 'GOPATH',
828
+ 'GOROOT',
829
+ 'CARGO_HOME',
830
+ 'RUSTUP_HOME',
831
+ 'PYTHONPATH',
832
+ 'VIRTUAL_ENV',
833
+ 'CONDA_PREFIX',
834
+ 'NODE_PATH',
835
+ 'npm_config_cache',
836
+ 'npm_config_userconfig',
837
+ 'DENO_DIR',
838
+ 'BUN_INSTALL',
839
+ ]);
840
+
841
+ function forwardEnv(baseEnv: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
842
+ const filtered: NodeJS.ProcessEnv = {};
843
+ for (const name of Object.keys(baseEnv)) {
844
+ if (FORWARD_ENV_NAMES.has(name) || FORWARD_ENV_NAMES.has(name.toUpperCase())) {
845
+ const value = baseEnv[name];
846
+ if (value !== undefined) filtered[name] = value;
847
+ }
848
+ }
849
+ return filtered;
850
+ }
851
+
785
852
  function proxyEnv(env: NodeJS.ProcessEnv | undefined, port: number): NodeJS.ProcessEnv {
786
853
  const url = `http://127.0.0.1:${port}`;
787
854
 
788
855
  return {
789
- ...process.env,
856
+ ...forwardEnv(process.env),
790
857
  ...env,
791
858
  HTTP_PROXY: url,
792
859
  HTTPS_PROXY: url,
@@ -1189,7 +1256,9 @@ export function createLandstripIntegration(
1189
1256
 
1190
1257
  const child = spawn(binaryPath(), landstripArgs, {
1191
1258
  cwd,
1192
- env: allowNetwork ? { ...process.env, ...env } : proxyEnv(env, proxy!.port),
1259
+ env: allowNetwork
1260
+ ? { ...forwardEnv(process.env), ...env }
1261
+ : proxyEnv(env, proxy!.port),
1193
1262
  detached: true,
1194
1263
  stdio: ['ignore', 'pipe', 'pipe', childEnd],
1195
1264
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-landstrip",
3
- "version": "0.16.18",
3
+ "version": "0.16.20",
4
4
  "description": "Landlock-based sandboxing for pi with interactive permission prompts",
5
5
  "keywords": [
6
6
  "landstrip",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@earendil-works/pi-tui": "^0.78.0",
36
- "@landstrip/landstrip": "^0.16.18"
36
+ "@landstrip/landstrip": "^0.16.19"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@earendil-works/pi-coding-agent": "^0.74.2",