Skip to main content

Context-Isolated Secret Management for Autonomous AI Software Engineering Agents

Project description

๐Ÿ”’ nv-protocol (nvenv)

License: MIT Platform Security

nvenv is a local-first cryptographic proxy designed to decouple raw credentials from the viewable workspace of autonomous AI software engineering agents such as Cursor, Claude Code, Windsurf, and Devin.

Instead of exposing secrets through traditional .env files or shell environment variables, nvenv replaces them with secure cryptographic URI placeholders (nv://KEY_NAME). During outbound network communication, the proxy transparently substitutes placeholders with the real credentials only in volatile memory, immediately before the TLS request leaves the machine.

Applications continue to work normally while autonomous AI agents remain unable to access plaintext credentials.


โšก Quick Start

Install Globally (Recommended)

Node.js

npm install -g nv-protocol

Python

pip install nv-protocol

Windows Package Manager (Coming Soon)

winget install SarveshSonkusre.nv-protocol

Verify installation:

nvenv --help

๐Ÿ“ฆ Installation Options

Global Installation

Recommended if you want the nvenv command available everywhere.

npm

npm install -g nv-protocol

PyPI

pip install nv-protocol

Local Project Installation (Node.js)

Install only inside the current project.

npm install nv-protocol

Run using:

npx nvenv --help

or from your package scripts.


Install From Source

git clone https://github.com/SarveshSonkusre02/nv-protocol.git

cd nv-protocol

pip install -e .

โœ… Verify Installation

Display the CLI help.

nvenv --help

Expected output:

nvenv (No-View Env) - Context-Isolated Secret Management CLI

Verify installed package.

npm

npm list -g nv-protocol

PyPI

pip show nv-protocol

โ“ Why nvenv?

Traditional secret management exposes credentials directly inside:

  • .env
  • process.env
  • os.environ
  • shell exports

This means secrets become visible to:

  • AI coding agents
  • Third-party dependencies
  • Build systems
  • Prompt injection attacks
  • Memory scraping tools

nvenv shifts credential injection from the application layer to the network layer, ensuring applications authenticate normally while secrets never become part of the AI-visible execution context.


๐Ÿ”’ Security Comparison

Security Vector Legacy .env / Shell Export nvenv
Process Environment โŒ Plaintext credentials โœ… Placeholder only
Prompt Injection โŒ Secrets can be printed โœ… AI never receives secrets
Dependency Scraping โŒ Packages can read env vars โœ… No credentials available
Authentication Scope โŒ Shared with every process โœ… Injected only into authorized outbound requests
Secret Lifetime โŒ Entire process lifetime โœ… Exists only during request execution

๐Ÿ— Architecture

Developer

        โ”‚

        โ–ผ

Application
Reads

OPENAI_API_KEY=nv://OPENAI_API_KEY

        โ”‚

        โ–ผ

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

           nvenv Proxy

โ€ข Validate destination
โ€ข Retrieve encrypted secret
โ€ข Decrypt in volatile memory
โ€ข Replace placeholder
โ€ข Forward TLS request

        โ”‚

        โ–ผ

External API

Authorization:
Bearer sk-xxxxxxxxxxxxxxxx

๐Ÿš€ Quick Start

Initialize the Vault

nvenv init

Store a Secret

nvenv set OPENAI_API_KEY

Replace Your .env

Instead of:

OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx

Use:

OPENAI_API_KEY=nv://OPENAI_API_KEY

Run Your Application

Node.js

nvenv run -- npm run dev

Python

nvenv run -- python app.py

List Stored Secrets

nvenv list

โš™๏ธ How It Works

Application

Authorization:
Bearer nv://OPENAI_API_KEY

           โ”‚

           โ–ผ

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         nvenv Proxy           โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โ€ข Intercepts request          โ”‚
โ”‚ โ€ข Reads encrypted vault       โ”‚
โ”‚ โ€ข Decrypts in RAM             โ”‚
โ”‚ โ€ข Replaces placeholder        โ”‚
โ”‚ โ€ข Sends HTTPS request         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

           โ”‚

           โ–ผ

api.openai.com

Authorization:
Bearer sk-xxxxxxxxxxxxxxxx

๐Ÿ›ก Core Security Features

Context Isolation

Your:

  • source code
  • .env
  • terminal
  • logs
  • shell variables

contain only placeholders.

OPENAI_API_KEY=nv://OPENAI_API_KEY

Secrets never become visible inside an AI context window.


Hardware-Backed Vault

Windows stores credentials inside:

~/.nv/vault.db

using:

  • SQLite
  • Windows DPAPI encryption

Secrets are cryptographically bound to the current Windows user account.


Memory-Only Secret Injection

Credentials are:

  • decrypted only when needed
  • never stored inside environment variables
  • never written to disk
  • wiped immediately after request completion

HTTPS Proxy Injection

The runtime launches a local HTTPS interception proxy which:

  • validates destinations
  • decrypts secrets
  • replaces placeholders
  • forwards encrypted traffic

Applications remain unaware that substitution occurred.


AI Agent Protection

Commands such as

nvenv get OPENAI_API_KEY

cannot be abused through:

  • redirected output
  • pipes
  • automated execution
  • non-interactive sessions

The CLI verifies that a real interactive user is present before revealing secrets.


Git Credential Helper

Store your GitHub Personal Access Token.

nvenv set GITHUB_TOKEN

Configure Git.

git config --local credential.helper "!nvenv git-helper"

Git retrieves credentials directly from the encrypted vault without exposing tokens through:

  • environment variables
  • shell history
  • repository files
  • .gitconfig

๐Ÿ’ป Platform Support

Platform Status
Windows โœ… Stable
Linux ๐Ÿšง In Progress
macOS ๐Ÿšง In Progress
npm โœ… Available
PyPI โœ… Available
WinGet โณ Pending

๐Ÿงช Verification

Run the built-in tests.

python test_nv.py

Coverage includes:

  • โœ… Vault CRUD
  • โœ… Windows DPAPI encryption
  • โœ… Placeholder substitution
  • โœ… HTTPS interception
  • โœ… Runtime injection
  • โœ… End-to-end verification

๐Ÿ“ˆ Example Workflow

Developer

     โ”‚

     โ–ผ

nvenv set OPENAI_API_KEY

     โ”‚

     โ–ผ

Encrypted Vault

     โ”‚

     โ–ผ

.env

OPENAI_API_KEY=nv://OPENAI_API_KEY

     โ”‚

     โ–ผ

nvenv run -- npm run dev

     โ”‚

     โ–ผ

Application

     โ”‚

     โ–ผ

nvenv Proxy

     โ”‚

     โ–ผ

Placeholder Replacement

     โ”‚

     โ–ผ

OpenAI API

๐ŸŽฏ Philosophy

Traditional secret managers primarily protect credentials at rest.

nvenv focuses on protecting credentials during execution, preventing autonomous AI systems, third-party packages, and prompt injection attacks from ever accessing plaintext secrets while preserving the existing application workflow.


๐Ÿ—บ Roadmap

  • โœ… npm Distribution
  • โœ… PyPI Distribution
  • โณ WinGet Distribution
  • โณ Homebrew Formula
  • โณ Native Linux Secret Backend
  • โณ Native macOS Keychain Backend
  • โณ Docker Integration
  • โณ VS Code Extension

๐Ÿ“ Notes

Global npm installation

npm install -g nv-protocol

Installs the nvenv command globally.


Local npm installation

npm install nv-protocol

Installs the package only inside the current project.

Use:

npx nvenv

or reference it from your project's scripts.


Python installation

pip install nv-protocol

Installs the nvenv command globally into the active Python environment.


๐Ÿ“„ License

Released under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nv_protocol-2.0.4.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nv_protocol-2.0.4-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

Details for the file nv_protocol-2.0.4.tar.gz.

File metadata

  • Download URL: nv_protocol-2.0.4.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for nv_protocol-2.0.4.tar.gz
Algorithm Hash digest
SHA256 6cfeefb057591120c2741a89993d1401a8fb430080fae835313152a1faf46374
MD5 1b7e4944cc07615fc1d1e4dd8227b6ea
BLAKE2b-256 3adc2924ce4bcc6ac6a715b384e56b357769ef6a041bb79dc0493a3462b18303

See more details on using hashes here.

File details

Details for the file nv_protocol-2.0.4-py3-none-any.whl.

File metadata

  • Download URL: nv_protocol-2.0.4-py3-none-any.whl
  • Upload date:
  • Size: 28.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for nv_protocol-2.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dce5beadc6417c07dfbf89dc031b09504f9c5b91d4955afc33b9a5f9640463cf
MD5 171221979c5e83b0d86bdd97d6706310
BLAKE2b-256 9e9cf07a4b9577d8079426c68ce6f020ec5df89fc1a5baac5c0af8535fd72816

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page