troxy-cli 1.29.12 → 1.29.14
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/package.json +1 -1
- package/src/proxy.js +17 -0
- package/src/tests/proxy-wiring.test.js +22 -0
- package/src/uninstall.js +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "troxy-cli",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.14",
|
|
4
4
|
"description": "A secure control layer for AI agents: policies across payments, messages, logins, destructive actions, model usage, and secrets, all enforceable from the CLI",
|
|
5
5
|
"homepage": "https://troxy.io",
|
|
6
6
|
"bugs": {
|
package/src/proxy.js
CHANGED
|
@@ -172,6 +172,13 @@ export async function runProxyEnable(flags = {}) {
|
|
|
172
172
|
|
|
173
173
|
export function runProxyDisable() {
|
|
174
174
|
const settingsPath = claudeCodeSettingsPath();
|
|
175
|
+
|
|
176
|
+
// Same restart hazard as uninstall.js's own fix: a Claude Code process
|
|
177
|
+
// already running has these two env vars loaded in memory, independent of
|
|
178
|
+
// what settings.json says from this point on. Check BEFORE unpatching so
|
|
179
|
+
// this reflects the state the running process actually launched with.
|
|
180
|
+
const wasIntercepting = interceptionIsConfigured(settingsPath);
|
|
181
|
+
|
|
175
182
|
process.stdout.write('\n Removing HTTPS_PROXY / NODE_EXTRA_CA_CERTS from settings.json... ');
|
|
176
183
|
try {
|
|
177
184
|
unpatchClaudeCodeInterception(settingsPath);
|
|
@@ -181,4 +188,14 @@ export function runProxyDisable() {
|
|
|
181
188
|
console.error(`\n ${err.message}\n`);
|
|
182
189
|
process.exit(1);
|
|
183
190
|
}
|
|
191
|
+
|
|
192
|
+
if (wasIntercepting) {
|
|
193
|
+
console.log(' ⚠ Restart Claude Code / Claude Desktop now for this to take effect -');
|
|
194
|
+
console.log(' the running process still has the old proxy settings loaded in');
|
|
195
|
+
console.log(' memory and will keep routing through Troxy until you do.\n');
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
console.log(' The CLI, background daemon, certificate, and your API key are all still');
|
|
199
|
+
console.log(' in place - this only stops routing calls through Troxy. Turn it back on');
|
|
200
|
+
console.log(' any time with: troxy proxy enable --experimental\n');
|
|
184
201
|
}
|
|
@@ -116,3 +116,25 @@ describe('uninstall.js: settings.json symmetry (fail-open layer 6)', () => {
|
|
|
116
116
|
assert.match(surrounding, /try\s*\{[\s\S]*unpatchClaudeCodeConfig[\s\S]*\}\s*catch/);
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
|
+
|
|
120
|
+
describe('proxy.js: runProxyDisable restart warning (same hazard as uninstall.js)', () => {
|
|
121
|
+
const proxySrc = readFileSync(join(__dirname, '..', 'proxy.js'), 'utf8');
|
|
122
|
+
|
|
123
|
+
it('checks interceptionIsConfigured BEFORE unpatching, not after', () => {
|
|
124
|
+
const checkIdx = proxySrc.indexOf('interceptionIsConfigured(settingsPath)');
|
|
125
|
+
const unpatchIdx = proxySrc.indexOf('unpatchClaudeCodeInterception(settingsPath)');
|
|
126
|
+
assert.ok(checkIdx !== -1 && unpatchIdx !== -1);
|
|
127
|
+
assert.ok(checkIdx < unpatchIdx, 'must read whether interception was configured before unpatching removes the evidence');
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('warns to restart Claude Code only when it was actually intercepting', () => {
|
|
131
|
+
const warnIdx = proxySrc.indexOf('now for this to take effect');
|
|
132
|
+
assert.ok(warnIdx !== -1, 'restart warning text not found');
|
|
133
|
+
const guardIdx = proxySrc.lastIndexOf('if (wasIntercepting)', warnIdx);
|
|
134
|
+
assert.ok(guardIdx !== -1 && guardIdx < warnIdx, 'restart warning must be gated behind an if (wasIntercepting) check');
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('reassures the user that disable leaves the CLI, daemon, cert and API key untouched', () => {
|
|
138
|
+
assert.match(proxySrc, /CLI, background daemon, certificate, and your API key are all still/);
|
|
139
|
+
});
|
|
140
|
+
});
|
package/src/uninstall.js
CHANGED
|
@@ -134,7 +134,10 @@ export async function runUninstall() {
|
|
|
134
134
|
const settingsPath = claudeCodeSettingsPath();
|
|
135
135
|
if (fs.existsSync(settingsPath)) {
|
|
136
136
|
const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
|
|
137
|
-
wasIntercepting = !!(
|
|
137
|
+
wasIntercepting = !!(
|
|
138
|
+
settings.env?.HTTPS_PROXY || settings.env?.NODE_EXTRA_CA_CERTS ||
|
|
139
|
+
settings.env?.ANTHROPIC_BASE_URL || settings.env?.ANTHROPIC_AUTH_TOKEN
|
|
140
|
+
);
|
|
138
141
|
}
|
|
139
142
|
} catch {}
|
|
140
143
|
|