feat(policy): add Heygen OAuth endpoints and onboard hints#1843
feat(policy): add Heygen OAuth endpoints and onboard hints#1843DemianHeyGen wants to merge 4 commits intoNVIDIA:mainfrom
Conversation
📝 WalkthroughWalkthroughAdded a HeyGen policy preset and documentation, updated onboarding to detect/block HeyGen credentials, adjusted a sudo-lsof retry condition in preflight, and expanded tests to cover HeyGen vars, preset endpoints, and more portable git init behavior. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@nemoclaw-blueprint/policies/presets/heygen.yaml`:
- Around line 50-51: The binaries allowlist currently only includes the entry {
path: /usr/local/bin/node } under the binaries key, which causes HeyGen to be
blocked when Node is executed from /usr/bin/node; update the preset by adding an
additional allowlist entry for { path: /usr/bin/node } alongside the existing
/usr/local/bin/node entry so both locations are permitted.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 4d3e3ec0-0a92-4991-a0fa-05d79cc5a0a2
📒 Files selected for processing (8)
.agents/skills/nemoclaw-user-manage-policy/SKILL.mddocs/network-policy/customize-network-policy.mdnemoclaw-blueprint/policies/presets/heygen.yamlsrc/lib/onboard.tssrc/lib/preflight.tstest/credential-exposure.test.tstest/legacy-path-guard.test.tstest/policies.test.ts
| binaries: | ||
| - { path: /usr/local/bin/node } |
There was a problem hiding this comment.
Add /usr/bin/node to the binaries allowlist to avoid runtime mismatches.
Line 50 currently allows only /usr/local/bin/node. On images where Node is invoked from /usr/bin/node, this preset won’t match and HeyGen traffic will be blocked.
Proposed fix
binaries:
- { path: /usr/local/bin/node }
+ - { path: /usr/bin/node }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| binaries: | |
| - { path: /usr/local/bin/node } | |
| binaries: | |
| - { path: /usr/local/bin/node } | |
| - { path: /usr/bin/node } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@nemoclaw-blueprint/policies/presets/heygen.yaml` around lines 50 - 51, The
binaries allowlist currently only includes the entry { path: /usr/local/bin/node
} under the binaries key, which causes HeyGen to be blocked when Node is
executed from /usr/bin/node; update the preset by adding an additional allowlist
entry for { path: /usr/bin/node } alongside the existing /usr/local/bin/node
entry so both locations are permitted.
|
✨ Thanks for submitting this PR, which proposes a way to improve integration with Heygen by adding OAuth endpoints and onboard hints. Possibly related open issues: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/onboard.ts`:
- Around line 3930-3942: The conditional that auto-suggests the "heygen" preset
is using raw process.env checks which can be whitespace-only and cause false
positives; update the if() to rely solely on getCredential("HEYGEN_API_KEY"),
getCredential("HEYGEN_ACCESS_TOKEN"), and getCredential("HEYGEN_REFRESH_TOKEN")
(which already normalize/validate values) instead of including
process.env.HEYGEN_API_KEY / HEYGEN_ACCESS_TOKEN / HEYGEN_REFRESH_TOKEN, leaving
the suggestions.push("heygen") and the TTY/CI logging logic
(process.stdout.isTTY, isNonInteractive(), process.env.CI) unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 79ea0229-d706-4b28-8e84-2c0ffca557df
📒 Files selected for processing (5)
.agents/skills/nemoclaw-user-manage-policy/SKILL.mddocs/network-policy/customize-network-policy.mdsrc/lib/onboard.tssrc/lib/preflight.tstest/credential-exposure.test.ts
✅ Files skipped from review due to trivial changes (2)
- docs/network-policy/customize-network-policy.md
- .agents/skills/nemoclaw-user-manage-policy/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (2)
- test/credential-exposure.test.ts
- src/lib/preflight.ts
| if ( | ||
| getCredential("HEYGEN_API_KEY") || | ||
| process.env.HEYGEN_API_KEY || | ||
| getCredential("HEYGEN_ACCESS_TOKEN") || | ||
| process.env.HEYGEN_ACCESS_TOKEN || | ||
| getCredential("HEYGEN_REFRESH_TOKEN") || | ||
| process.env.HEYGEN_REFRESH_TOKEN | ||
| ) { | ||
| suggestions.push("heygen"); | ||
| if (process.stdout.isTTY && !isNonInteractive() && process.env.CI !== "true") { | ||
| console.log(" Auto-detected: HeyGen credentials -> suggesting heygen preset"); | ||
| } | ||
| } |
There was a problem hiding this comment.
Avoid raw process.env checks to prevent false-positive HeyGen preset suggestions.
getCredential() already checks env + stored creds and normalizes whitespace. The extra process.env.* checks can incorrectly suggest heygen when a var is set to whitespace.
♻️ Proposed fix
- if (
- getCredential("HEYGEN_API_KEY") ||
- process.env.HEYGEN_API_KEY ||
- getCredential("HEYGEN_ACCESS_TOKEN") ||
- process.env.HEYGEN_ACCESS_TOKEN ||
- getCredential("HEYGEN_REFRESH_TOKEN") ||
- process.env.HEYGEN_REFRESH_TOKEN
- ) {
+ const heygenCredentialKeys = [
+ "HEYGEN_API_KEY",
+ "HEYGEN_ACCESS_TOKEN",
+ "HEYGEN_REFRESH_TOKEN",
+ ];
+ if (heygenCredentialKeys.some((key) => getCredential(key))) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/lib/onboard.ts` around lines 3930 - 3942, The conditional that
auto-suggests the "heygen" preset is using raw process.env checks which can be
whitespace-only and cause false positives; update the if() to rely solely on
getCredential("HEYGEN_API_KEY"), getCredential("HEYGEN_ACCESS_TOKEN"), and
getCredential("HEYGEN_REFRESH_TOKEN") (which already normalize/validate values)
instead of including process.env.HEYGEN_API_KEY / HEYGEN_ACCESS_TOKEN /
HEYGEN_REFRESH_TOKEN, leaving the suggestions.push("heygen") and the TTY/CI
logging logic (process.stdout.isTTY, isNonInteractive(), process.env.CI)
unchanged.
Summary
Adds a
heygennetwork policy preset so sandboxed agents can reach HeyGen’s REST API, OAuth token endpoints (HeyGen OAuth 2.0), uploads, generated files, and WebSocket streaming onapi.heygen.com. Onboarding suggests this preset when HeyGen API or OAuth-related credentials are present, and those secret names are stripped from the sandbox create environment.Doc and autogenerated user skill copy are updated for the new preset.
Related Issue
Changes
nemoclaw-blueprint/policies/presets/heygen.yaml— New preset:api.heygen.com: REST (GET/POST/PATCH/PUT/DELETE on/**).api.heygen.com: second endpoint withaccess: fullfor long-lived WebSocket (wss://…/v1/ws/…), consistent with Discord/Slack ([Bug] openshell-sandbox egress proxy kills WebSocket connections after ~2 minutes — Discord (and other WS-based plugins) cannot run inside sandbox #409).api2.heygen.com: OAuth —POST /v1/oauth/**,GET /v1/user/**(token exchange, refresh, user info).upload.heygen.com/files.heygen.com: asset upload and read-only GET for file retrieval (with comment thatvideo_urlhosts may need extra approval or custom policy).binaries:/usr/local/bin/node.src/lib/onboard.ts— IfHEYGEN_API_KEY,HEYGEN_ACCESS_TOKEN, orHEYGEN_REFRESH_TOKENis set (credential store or env), suggest theheygenpreset during policy setup. AddHEYGEN_API_KEY,HEYGEN_ACCESS_TOKEN, andHEYGEN_REFRESH_TOKENto the sandbox env blocklist.docs/network-policy/customize-network-policy.md— Preset table row forheygen..agents/skills/nemoclaw-user-manage-policy/SKILL.md— Regenerated from docs (scripts/docs-to-skills.py).Tests —
test/policies.test.ts: includeheygenin expected preset names, derive count from the canonical list, assertapi2.heygen.comin preset hosts.test/credential-exposure.test.ts: assert HeyGen env names in the blocklist.src/lib/preflight.ts(if included in this PR) — WhenlsofOutputis explicitly injected (including empty string), skipsudo -n lsofso unit tests and callers fully control the lsof path; fixes flakycheckPortAvailabletests when port 18789 is in use on the host.Type of Change
Testing
npx prek run --all-filespasses (or equivalentlymake check).npm testpasses.make docsbuilds without warnings. (doc/skill updates)Checklist
General
Code Changes
npx prek run --all-filesauto-fixes formatting (ormake formatfor targeted runs).Doc Changes
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests