Repository navigation
fix(security): backport libssh2 public key fixes - #8941
Conversation
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
📝 WalkthroughWalkthroughUpdates libssh2 from Changeslibssh2 revision 2 update
Estimated code review effort: 3 (Moderate) | ~30 minutes Mergeability Score: 🟠 High · up to The libssh2 security backport does not yet cap attacker-controlled public-key attribute counts before allocation and parsing, leaving the intended vulnerability fix incomplete and potentially allowing excessive resource use. The PR is not merge-ready until this security correction is added or explicitly accepted. Sequence Diagram(s)sequenceDiagram
participant BuildScript
participant Libssh2Patch
participant PackageTests
participant ManagedImages
BuildScript->>Libssh2Patch: Build libssh2 nemoclaw2
Libssh2Patch->>PackageTests: Provide patched source
PackageTests->>ManagedImages: Validate package revision and patch boundaries
ManagedImages->>ManagedImages: Verify inventory and installed package version
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in commit 1c73e55 in the TypeScript / code-coverage/cliThe overall coverage in commit 1c73e55 in the Show a code coverage summary of the most impacted files.
Updated |
PR Review Advisor — No blocking findings reportedAdvisor assessment: No blocking advisor findings reported Model lanes
Second-opinion terminology and E2E selections are advisory. Live E2E does not run automatically for pull requests. 3 semantic terminology decisionsTerminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.
E2E guidanceAdvisory only. A maintainer can dispatch the default E2E suite for the commit under review. Recommended E2E: None Manual-only E2E: This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
Signed-off-by: Senthil Ravichandran <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/security/patches/libssh2-1.11.1-cve-2026.patch`:
- Around line 184-263: In libssh2_publickey_list_fetch, validate
list[keys].num_attrs against LIBSSH2_PACKET_MAXPAYLOAD before allocating the
attribute array or entering its parsing loop. On violation, report
LIBSSH2_ERROR_OUT_OF_BOUNDARY with an appropriate error message and jump to
err_exit; clear list[keys] as needed so sentinel-based cleanup remains valid.
Apply the same fix in `@scripts/security/patches/libssh2-1.11.1-cve-2026.patch`
around lines 9 - 10: The bundle-level omission and the allocation-site defect
are the same missing CVE-2026-58050 remediation.
🪄 Autofix
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: Enterprise
Run ID: 445630da-a8de-4a9d-bc46-4633be4a406b
📒 Files selected for processing (15)
DockerfileDockerfile.baseagents/hermes/Dockerfileagents/hermes/Dockerfile.baseagents/langchain-deepagents-code/Dockerfileagents/langchain-deepagents-code/Dockerfile.basedocs/security/managed-base-libssh2-1.11.1-nemoclaw2-dependency-review.mdscripts/security/build-native-security-packages.shscripts/security/patches/libssh2-1.11.1-cve-2026.patchsrc/lib/onboard/dockerfile-remote-dashboard-bind-contract.tssrc/lib/sandbox-base-image/security-inventory.tstest/helpers/base-apt-security-functions.tstest/helpers/onboard-script-mocks.cjstest/native-security-packages.test.tstest/sandbox-base-security-packages.test.ts
| @@ -1029,6 +1060,12 @@ libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY * pkey, unsigned long *num_keys, | ||
| goto err_exit; | ||
| } | ||
|
|
||
| + if(list[keys].name_len > LIBSSH2_PACKET_MAXPAYLOAD) { | ||
| + _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, | ||
| + "Public key name too large"); | ||
| + goto err_exit; | ||
| + } | ||
| + | ||
| if(pkey->listFetch_s + list[keys].name_len <= | ||
| pkey->listFetch_data + pkey->listFetch_data_len) { | ||
| list[keys].name = pkey->listFetch_s; | ||
| @@ -1051,6 +1088,12 @@ libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY * pkey, unsigned long *num_keys, | ||
| goto err_exit; | ||
| } | ||
|
|
||
| + if(list[keys].blob_len > LIBSSH2_PACKET_MAXPAYLOAD) { | ||
| + _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, | ||
| + "Public key blob too large"); | ||
| + goto err_exit; | ||
| + } | ||
| + | ||
| if(pkey->listFetch_s + list[keys].blob_len <= | ||
| pkey->listFetch_data + pkey->listFetch_data_len) { | ||
| list[keys].blob = pkey->listFetch_s; | ||
| @@ -1076,6 +1119,12 @@ libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY * pkey, unsigned long *num_keys, | ||
| goto err_exit; | ||
| } | ||
|
|
||
| + if(list[keys].name_len > LIBSSH2_PACKET_MAXPAYLOAD) { | ||
| + _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, | ||
| + "Public key name too large"); | ||
| + goto err_exit; | ||
| + } | ||
| + | ||
| if(pkey->listFetch_s + list[keys].name_len <= | ||
| pkey->listFetch_data + pkey->listFetch_data_len) { | ||
| list[keys].name = pkey->listFetch_s; | ||
| @@ -1098,6 +1147,12 @@ libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY * pkey, unsigned long *num_keys, | ||
| goto err_exit; | ||
| } | ||
|
|
||
| + if(list[keys].blob_len > LIBSSH2_PACKET_MAXPAYLOAD) { | ||
| + _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, | ||
| + "Public key blob too large"); | ||
| + goto err_exit; | ||
| + } | ||
| + | ||
| if(pkey->listFetch_s + list[keys].blob_len <= | ||
| pkey->listFetch_data + pkey->listFetch_data_len) { | ||
| list[keys].blob = pkey->listFetch_s; | ||
| @@ -1145,6 +1200,13 @@ libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY * pkey, unsigned long *num_keys, | ||
| goto err_exit; | ||
| } | ||
|
|
||
| + if(list[keys].attrs[i].name_len > | ||
| + LIBSSH2_PACKET_MAXPAYLOAD) { | ||
| + _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, | ||
| + "Public key attribute name too large"); | ||
| + goto err_exit; | ||
| + } | ||
| + | ||
| if(pkey->listFetch_s + list[keys].attrs[i].name_len <= | ||
| pkey->listFetch_data + pkey->listFetch_data_len) { | ||
| list[keys].attrs[i].name = | ||
| @@ -1171,6 +1233,13 @@ libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY * pkey, unsigned long *num_keys, | ||
| goto err_exit; | ||
| } | ||
|
|
||
| + if(list[keys].attrs[i].value_len > | ||
| + LIBSSH2_PACKET_MAXPAYLOAD) { | ||
| + _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, | ||
| + "Public key attribute value too large"); | ||
| + goto err_exit; | ||
| + } | ||
| + | ||
| if(pkey->listFetch_s + | ||
| list[keys].attrs[i].value_len <= | ||
| pkey->listFetch_data + pkey->listFetch_data_len) { |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Bound list[keys].num_attrs before allocation and parsing.
The bundle initializes expanded public-key entries and checks packet field sizes, but it still omits the CVE-2026-58050 fix that caps attacker-controlled list[keys].num_attrs at 1024 before allocation and the parsing loop. Add that bound before allocation; otherwise oversized attribute counts can still drive excessive allocation/parsing and the backport remains incomplete.
📍 Affects 1 file
scripts/security/patches/libssh2-1.11.1-cve-2026.patch#L184-L263(this comment)scripts/security/patches/libssh2-1.11.1-cve-2026.patch#L9-L10
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/security/patches/libssh2-1.11.1-cve-2026.patch` around lines 184 -
263, In libssh2_publickey_list_fetch, validate list[keys].num_attrs against
LIBSSH2_PACKET_MAXPAYLOAD before allocating the attribute array or entering its
parsing loop. On violation, report LIBSSH2_ERROR_OUT_OF_BOUNDARY with an
appropriate error message and jump to err_exit; clear list[keys] as needed so
sentinel-based cleanup remains valid.
Apply the same fix in `@scripts/security/patches/libssh2-1.11.1-cve-2026.patch`
around lines 9 - 10: The bundle-level omission and the allocation-site defect
are the same missing CVE-2026-58050 remediation.
<!-- markdownlint-disable MD041 --> ## Summary Backport the upstream fixes for `CVE-2026-58050` and `CVE-2026-58051` into the checksum-pinned libssh2 1.11.1 package used by all three managed base images. The package revision advances from `+nemoclaw1` to `+nemoclaw2` so image inventory and runtime checks require the corrected build. ## Changes - Add upstream commits `a9758da45a52bc8c630ec9493804d0c6ea30b24a` and `7c8a170c6dca3cd4cf24de836f43ba1a20e662d5` to the existing reviewed libssh2 patch bundle. - Initialize each expanded public-key list entry before parsing or cleanup. - Reject oversized public-key packet fields above `LIBSSH2_PACKET_MAXPAYLOAD`. - Require `libssh2-1t64=1.11.1-1+deb13u1+nemoclaw2` in the builder, completed images, immutable inventories, and test fixtures. - Preserve the full upstream libssh2 test selection and add exact commit and patch-contract checks. - Record the new package contract, affected image boundaries, removal condition, and remaining multi-architecture publication gate. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [x] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates - [x] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [ ] Tests not applicable — justification: - [ ] Docs updated for user-facing behavior changes - [x] Docs not applicable — justification: The package update changes no user-facing command, configuration, policy, or workflow; the repository-owned security dependency review is included. - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [x] Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: Codex Desktop reviewed commit `93f1899f9` against all nine security-rubric categories and found no actionable issue. Source and original Debian packages remain HTTPS-only and SHA-256 pinned; patch application, architecture, symbol, soname, runtime, inventory, and package-state checks fail closed. - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Documentation Writer Review - [x] Documentation writer subagent reviewed the completed changes - Result: `docs-updated` - Evidence: `docs/security/managed-base-libssh2-1.11.1-nemoclaw2-dependency-review.md` records the reviewed artifacts, security concerns, package contract, affected images, removal condition, and remaining publication and rescan gates. - Agent: Codex Desktop <!-- docs-review-head-sha: f6171c1 --> <!-- docs-review-agents-blob-sha: c4923a3 --> ## DGX Station Hardware Evidence - [ ] Tested on DGX Station - Tested commit: Not applicable - Station profile/scenario: Not applicable; `scripts/prepare-dgx-station-host.sh` is unchanged. - Result: Not applicable - Supporting evidence: Not applicable ## Verification - [x] PR description includes a `Signed-off-by:` line and every commit appears as `Verified` in GitHub - [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or `npm run validate:pr` passed after refreshing `origin/main` when hooks were skipped or unavailable - [x] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — the native package, managed security-package, remote-dashboard lifecycle, and managed-image workflow suites pass, 101 tests total; the patched source also compiled successfully against OpenSSL 3. - [ ] Applicable broad gate passed — GitHub CI remains the authoritative broad and multi-architecture image gate. - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) — the build passed with zero errors and two existing Fern warnings. - [x] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) — this Markdown security review includes the required SPDX header; frontmatter is not used for this directory. --- Signed-off-by: Senthil Ravichandran <[email protected]> --------- Signed-off-by: Senthil Ravichandran <[email protected]> Co-authored-by: Prekshi Vyas <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> (cherry picked from commit ce96811)
<!-- markdownlint-disable MD041 --> ## Summary Refresh the Deep Agents Code staging QA source from `af2a73f…` to PR #8941's merge commit, `ce96811…`. The rebuilt staging base now contains the `libssh2` `nemoclaw2` inventory required by current candidate images, so unrelated PRs such as #8903 no longer inherit this mismatch from `main`. ## Changes - Pin `STAGING_QA_SOURCE_SHA` to `ce96811ddb418ad01c040521a1fe912b5bcb405e`. - Update the workflow comment and exact integration assertion for the `nemoclaw2` contract. - Root cause: PR #8941 advanced the managed-image `libssh2` contract, while the staging QA source remained on the earlier `nemoclaw1` inventory. - Detection gap: the source test enforced the recorded SHA but could not establish image compatibility. The staging QA job detected the package mismatch and remains the integration evidence for this repair. ## Type of Change - [x] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates - [x] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [ ] Tests not applicable — justification: - [ ] Docs updated for user-facing behavior changes - [x] Docs not applicable — justification: This change only refreshes an internal staging QA source pin and its exact workflow assertion. It changes no CLI, public configuration, API, default, or supported user workflow. - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [x] Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: Codex Desktop reviewed commit `7445324bf` across all nine security categories. The full commit SHA remains immutable, checkout credentials remain disabled, permissions remain `contents: read`, and identity failures still stop the job. - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Documentation Writer Review - [x] Documentation writer subagent reviewed the completed changes - Result: `no-docs-needed` - Evidence: Independent review: PASS — the internal staging comment identifies the exact libssh2 inventory mismatch and the workflow assertion pins the same reviewed source; no supported user-facing behavior changes. - Agent: Codex Desktop <!-- docs-review-head-sha: 7445324 --> <!-- docs-review-agents-blob-sha: c4923a3 --> ## DGX Station Hardware Evidence - [ ] Tested on DGX Station - Tested commit: Not applicable - Station profile/scenario: Not applicable; `scripts/prepare-dgx-station-host.sh` is unchanged. - Result: Not applicable - Supporting evidence: Not applicable ## Verification - [x] PR description includes a `Signed-off-by:` line and every commit appears as `Verified` in GitHub - [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or `npm run validate:pr` passed after refreshing `origin/main` when hooks were skipped or unavailable - [x] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — `npx vitest run --project integration test/managed-image-publication-workflow.test.ts` passed 19 tests. - [ ] Applicable broad gate passed — `npm test` for broad runtime/test-harness changes; `npm run check` for repo-wide validation/coverage changes — not applicable to this focused workflow pin update. - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) - [ ] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) --- Signed-off-by: San Dang <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated the staging quality-assurance workflow to use the latest approved source revision and description. * Improved consistency between staging validation settings and the intended candidate configuration. * **Tests** * Updated workflow validation expectations to reflect the revised staging source revision. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
Claiming the remaining Hermes main E2E image-build failures. Run 31697332892 job 94439945297 consumes the stale default Hermes base digest 4295138eb70f938189430f8dc7b3cd5db0aa762234e64e398a6a5ef60803126c, then fails the completed-image security package contract introduced here. Images / Base Images run 31695217175 published and validated replacement digest c9a3abd9e99816677d221a4d36001cf243263719f9065150a95603ba048c60c0 in job 94432455087. Exact-digest and Hermes base-refresh searches found no open PR owner. I will send a small draft PR that refreshes this one pin and its owning contract documentation. |
|
Correction to the digest role above after reading the publication contract artifact: 10c9ad00c5355b91cc905d44b74623b48477adca4b6ae69868af614710a18666 is the published multi-platform OCI index that the Dockerfile must pin. c9a3abd9e99816677d221a4d36001cf243263719f9065150a95603ba048c60c0 is its validated linux/amd64 child used by job 94432455087; linux/arm64 is 7f22df12550d7f137ee601c8dbad6b3832e0bce66180733d7f88008ac6d518a5. The exact 10c9ad00 index search also found no open PR owner. |
Summary
Backport the upstream fixes for
CVE-2026-58050andCVE-2026-58051into the checksum-pinned libssh2 1.11.1 package used by all three managed base images.The package revision advances from
+nemoclaw1to+nemoclaw2so image inventory and runtime checks require the corrected build.Changes
a9758da45a52bc8c630ec9493804d0c6ea30b24aand7c8a170c6dca3cd4cf24de836f43ba1a20e662d5to the existing reviewed libssh2 patch bundle.LIBSSH2_PACKET_MAXPAYLOAD.libssh2-1t64=1.11.1-1+deb13u1+nemoclaw2in the builder, completed images, immutable inventories, and test fixtures.Type of Change
Quality Gates
93f1899f9against all nine security-rubric categories and found no actionable issue. Source and original Debian packages remain HTTPS-only and SHA-256 pinned; patch application, architecture, symbol, soname, runtime, inventory, and package-state checks fail closed.Documentation Writer Review
docs-updateddocs/security/managed-base-libssh2-1.11.1-nemoclaw2-dependency-review.mdrecords the reviewed artifacts, security concerns, package contract, affected images, removal condition, and remaining publication and rescan gates.DGX Station Hardware Evidence
scripts/prepare-dgx-station-host.shis unchanged.Verification
Signed-off-by:line and every commit appears asVerifiedin GitHubpre-commit,commit-msg, andpre-pushhooks passed, ornpm run validate:prpassed after refreshingorigin/mainwhen hooks were skipped or unavailablenpm run docsbuilds without warnings (doc changes only) — the build passed with zero errors and two existing Fern warnings.Signed-off-by: Senthil Ravichandran [email protected]