Skip to content

feat: enhance Argus integration with proxy support and error handling…#2

Merged
robosushie merged 10 commits into
mainfrom
feat/argus-proxy-1
Jun 3, 2026
Merged

feat: enhance Argus integration with proxy support and error handling…#2
robosushie merged 10 commits into
mainfrom
feat/argus-proxy-1

Conversation

@robosushie
Copy link
Copy Markdown
Contributor

… improvements

What

  • Split secrets (loadEnv in src/load-env.ts) from proxy/TLS (configure in src/configure.ts)
  • In-memory proxy config cache (src/proxy-state.ts) set by loadEnv, consumed by configure
  • configure() sets HTTP(S)_PROXY, Argus CA bundle (NODE_EXTRA_CA_CERTS), http/https global agents, undici global ProxyAgent; optional per-client setup (axios, undici Client/Pool, fetch options)
  • Typed IPC errors (src/ipc-errors.ts, src/errors.ts) with stable code values and user-facing messages from Argus
  • loadProxies / applyUndiciGlobalProxy retained as compatibility helpers; README documents loadEnvconfigure flow

Why

Callers should be able to load env vars without forcing global proxy side effects (e.g. scripts that only need secrets). Proxy setup should be explicit, repeatable, and work with Node fetch/undici as well as axios/https. Typed IPC errors improve DX when Argus returns approval, bucket, or token errors.

Security impact

  • Threat considered: Accidental secret exfiltration via global proxy; silent misconfiguration on denied approvals
  • Mitigation: Secrets-only loadEnv; proxy placeholders injected from bucket IPC; real keys rewritten only by Argus proxy when traffic uses the configured proxy; typed errors surface misconfiguration clearly
  • Accepted risk / out of scope: Not all HTTP clients use global fetch/agents (e.g. some SDK default agents) — callers must call configure(client) where needed. Host allowlisting is enforced in Argus Rust, not in this package.

How to test

  1. Run Argus desktop with an active bucket + proxy (see argus commit)
  2. cd node-argus && pnpm install && pnpm test && pnpm run build
  3. cd test-node-argus && pnpm install && pnpm run env — verify placeholders after loadEnv, proxy URLs after configure
  4. pnpm run test:fetch (uses undici/fetch + proxy); pnpm run test:langchain — confirm Argus proxy logs show rewrite + upstream api.anthropic.com
  5. Temporarily remove anthropic.com from all proxy mappings; test:fetch should fail at proxy; SDK-only paths may differ

Checklist

  • I ran pnpm exec tsc --noEmit and pnpm lint locally (or CI is green)
  • I did not commit secrets, tokens, or ~/.argus database files
  • I read CONTRIBUTING.md and docs/security.md if touching security-related code

robosushie added 10 commits June 1, 2026 07:59
… improvements

- Added support for HTTP and HTTPS proxy agents in the package.
- Introduced new `configure()` function to set up proxy settings after loading environment variables.
- Expanded error handling with additional Argus error classes for better diagnostics.
- Updated README with new usage instructions for proxy configuration.
- Modified `loadEnv` to manage proxy state and handle bucket credentials more effectively.
- Updated dependencies in package.json and package-lock.json to include new proxy-related packages.
- Moved internal modules to a new directory structure for better organization.
- Implemented a new IPC client for fetching environment variables from Argus.
- Added error handling and response parsing for IPC communication.
- Updated README to reflect changes in package layout and usage instructions.
- Introduced new proxy configuration and state management modules.
- Revised README to clarify the usage of factory methods for HTTP client configuration after loading environment variables.
- Deprecated the `configure()` and `loadProxies()` functions in favor of explicit factory helpers.
- Enhanced proxy configuration logic to improve clarity and usability.
- Updated type exports in `index.ts` to reflect new proxy factory methods.
- Removed deprecated code and improved documentation for proxy usage.
- Enhanced the README to improve the formatting of tables related to factory methods and error handling.
- Clarified usage instructions for HTTP library factories and Argus error classes.
- Ensured consistency in documentation style for better readability.
- Updated package version to 0.2.0 to reflect new functionality.
- Enhanced README to include support for Argus Proxy factories, detailing usage modes for both enabled and disabled proxy scenarios.
- Clarified instructions for integrating with HTTP clients using the new fetchOptions method.
…e patterns

- Removed deprecated `configure()` and proxy factory methods in favor of explicit wiring with new helpers.
- Updated README to reflect changes in proxy usage, emphasizing the use of `createArgusUndiciDispatcher` and related methods.
- Streamlined package.json dependencies by removing unused proxy-related packages.
- Clarified instructions for integrating HTTP clients with the new proxy helpers.
- Improved table formatting for better readability in the error handling section.
- Clarified descriptions of error types and their corresponding Argus IPC codes.
- Ensured consistent styling throughout the documentation to enhance user experience.
@robosushie robosushie merged commit 695c377 into main Jun 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant