fix(security): harden k8s sample manifest defaults#1324
fix(security): harden k8s sample manifest defaults#1324jyaunches wants to merge 2 commits intoNVIDIA:mainfrom
Conversation
Cherry-picked k8s hardening from @13ernkastel's PR NVIDIA#1149, which was closed after its auth changes were superseded by NVIDIA#1217. Changes to k8s/nemoclaw-k8s.yaml: - automountServiceAccountToken: false - enableServiceLinks: false - workspace container: allowPrivilegeEscalation false, drop ALL caps, RuntimeDefault seccomp - COMPATIBLE_API_KEY from optional Secret with dummy fallback - NEMOCLAW_POLICY_MODE default changed from skip to suggested - Replace curl|bash with download-then-execute pattern Also adds k8s/README.md updates and regression test. Co-authored-by: 13ernkastel <LennonCMJ@live.com>
|
@ericksoa — this came up as a potential follow-up while cleaning up after our recently merged #1217. PR #1149 by @13ernkastel had bundled k8s manifest hardening (pod security context, Secret-backed credentials, safer installer download) alongside the auth changes that #1217 superseded. We closed #1149 but cherry-picked the k8s portion here so it doesn't get lost. Do you agree this is complementary for the k8s deployment path? The changes are scoped to |
📝 WalkthroughWalkthroughSecurity hardening of the Kubernetes sample manifest with stricter pod and container settings, safer installer execution via download-then-execute pattern, optional API key Secret loading, and updated documentation with corresponding test suite validation. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
k8s/README.md (1)
1-2:⚠️ Potential issue | 🟡 MinorMissing SPDX license header.
As per coding guidelines, Markdown files require an HTML comment SPDX license header at the top:
<!-- SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. --> <!-- SPDX-License-Identifier: Apache-2.0 -->🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@k8s/README.md` around lines 1 - 2, Add the required SPDX HTML comment header to the top of the Markdown file that currently starts with the title "# NemoClaw on Kubernetes": insert the two lines for Copyright and License as HTML comments (the SPDX-FileCopyrightText and SPDX-License-Identifier) immediately before the existing content so the README.md contains the SPDX header above the title.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@k8s/README.md`:
- Around line 1-2: Add the required SPDX HTML comment header to the top of the
Markdown file that currently starts with the title "# NemoClaw on Kubernetes":
insert the two lines for Copyright and License as HTML comments (the
SPDX-FileCopyrightText and SPDX-License-Identifier) immediately before the
existing content so the README.md contains the SPDX header above the title.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7672ed34-5739-4886-91b5-e300b1583162
📒 Files selected for processing (3)
k8s/README.mdk8s/nemoclaw-k8s.yamltest/security-configuration-hardening.test.js
|
Reviewed the changes — the API key fallback and policy mode switch both look safe after code analysis (no early consumers for Blocker: workspace securityContext breaks Have you tried running this manifest in a real pod? The workspace container runs (Reproducible with: Since the workspace container doesn't need elevated privileges beyond the package install phase, and DinD is already the privileged sidecar, would it make sense to drop the workspace securityContext from this PR and tackle it separately? The pod-level hardening ( Style: We're moving all new code to TypeScript — could |
Fixes #1323 — Partially addresses #803.
Summary
Hardens the experimental Kubernetes sample manifest (
k8s/nemoclaw-k8s.yaml) with safer defaults. This work was cherry-picked from @13ernkastel's PR #1149, which was closed after its auth hardening portion was superseded by #1217. The k8s hardening in #1149 was independent and valuable, so we're carrying it forward here with proper attribution.Changes
Pod-level
automountServiceAccountToken: false— pod does not need k8s API accessenableServiceLinks: false— prevents service env var injectionWorkspace container security context
allowPrivilegeEscalation: falsecapabilities.drop: [ALL]seccompProfile.type: RuntimeDefaultCredential handling
COMPATIBLE_API_KEYloaded from optional Secret (nemoclaw-compatible-api-key) with dummy fallback for unauthenticated endpoints (Dynamo/vLLM)NEMOCLAW_POLICY_MODEdefault changed fromskiptosuggestedInstaller download
curl ... | bashwith download-then-execute pattern usingcurl --proto =https --tlsv1.2Documentation
k8s/README.mdwith Secret setup instructions and revised config tableTests
test/security-configuration-hardening.test.jswith regression coverage for all k8s manifest hardeningAttribution
Co-authored-by: @13ernkastel (from PR #1149)
Context
This came up during post-merge cleanup of #1217 (
fix(security): harden gateway auth defaults and restrict auto-pair). PR #1149 bundled k8s hardening with auth changes; we split them apart so the k8s work doesn't get lost.Summary by CodeRabbit
New Features
NEMOCLAW_POLICY_MODEenvironment variable for deployment configuration (default:suggested).Documentation
Configuration Changes
dummywhen not provided.Tests