Repository navigation
sec: Support Laminar API key injection to prevent credential leaks - #2813
Closed
simonrosenberg wants to merge 7 commits into
Closed
simonrosenberg wants to merge 7 commits into
simonrosenberg wants to merge 7 commits into
Conversation
SWE-bench base images often ship with NVM-managed old Node.js versions
(v8–v14) that already have `npm` in PATH. The previous conditional
install (`if ! command -v npm`) would skip Node 22, causing ACP packages
(claude-agent-acp, codex-acp, gemini-cli) to be installed into the old
Node.js where they crash with SyntaxError on modern ES module syntax.
Remove the conditional and always install Node 22 from nodesource so ACP
subprocess servers can start reliably regardless of the base image.
Fixes: OpenHands/runtime-api#458
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instead of replacing the system Node.js with nodesource, download a Node 22 binary tarball to /opt/acp-node/ and install ACP packages there. Wrapper scripts in /usr/local/bin/ prepend the ACP Node to PATH only for the ACP subprocess, so the repo's own Node.js (needed for test suites) stays untouched. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…al leaks
Adds 'laminar_api_key' field to workspace implementations to enable secure
credential transport without exposing LMNR_PROJECT_API_KEY via environment
variables. This prevents credential leaks in logged payloads.
**Changes:**
- **openhands-workspace/**: Add laminar_api_key field to:
- APIRemoteWorkspace (remote runtime)
- DockerWorkspace (Docker containers)
- ApptainerWorkspace (Apptainer/Singularity)
Environment variable handling skips LMNR_PROJECT_API_KEY when in forward_env
list and injects it from the laminar_api_key field instead.
- **openhands-sdk/observability/laminar.py**: Update to:
- Accept optional api_key parameter in maybe_init_laminar()
- Update should_enable_observability() and _is_otel_backend_laminar()
to accept and handle optional api_key parameter
- Allows programmatic credential injection without environment variables
**Benefits:**
- Credentials not logged in workspace payloads
- Not exposed in Datadog logs
- Leverages Laminar's native Bearer token authentication
- Backward compatible (env var still works if provided)
- Prevents logging warnings if LMNR_PROJECT_API_KEY in forward_env
**Issue:** OpenHands/evaluation#388
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Member
Author
|
Closing in favor of #2814, which is a clean implementation created from main without unrelated changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for secure Laminar credential injection, eliminating the need to forward
LMNR_PROJECT_API_KEYas an environment variable. This prevents credentials from leaking into logged payloads.Problem
Currently,
LMNR_PROJECT_API_KEYis forwarded to remote workspaces via theforward_envmechanism, causing it to:/startendpoint)The root cause: Laminar SDK reads credentials from
os.environ[], which gets serialized into logged data structures.Solution
Added
laminar_api_keyfield to all workspace implementations (APIRemoteWorkspace, DockerWorkspace, ApptainerWorkspace) to inject credentials directly without using environment variables.Key design:
api_keyparameter for programmatic injectionChanges
openhands-workspace/openhands/workspace/
laminar_api_keyfield, inject at/startpayload buildlaminar_api_keyfield, inject via-eflags in docker runlaminar_api_keyfield, inject via--envflagsopenhands-sdk/openhands/sdk/observability/
maybe_init_laminar(api_key=None): Accept optional API key parametershould_enable_observability(api_key=None): Enable when api_key provided_is_otel_backend_laminar(api_key=None): Recognize backend from api_keyBenefits
✅ Security: Credentials never in environment dict (not logged)
✅ Backward Compatible: Env vars still work, just not recommended
✅ Clean: Leverages Laminar's native Bearer token auth
✅ Observable: Warning logs if old pattern detected
✅ Minimal: ~50 lines of code, focused change
Test Plan
LMNR_PROJECT_API_KEYRelated
🤖 Generated with Claude Code