Skip to content

Network Cloud CLI 6.0.0b2 - path traversal fix. - #10549

Merged
Ethan Yang (necusjz) merged 15 commits into
Azure:mainfrom
idanielsteven:main
Nov 11, 2026
Merged

Ethan Yang (necusjz) merged 15 commits into
Azure:mainfrom
idanielsteven:main

Conversation

@idanielsteven

@idanielsteven idanielsteven commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Suppressions
⚠️ None ️✔️ None
⚠️Azure CLI Extensions Breaking Change Test
⚠️networkcloud
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd networkcloud baremetalmachine run-command cmd networkcloud baremetalmachine run-command added parameter expected_sha256
⚠️ 1006 - ParaAdd networkcloud baremetalmachine run-command cmd networkcloud baremetalmachine run-command added parameter expected_storage_host
⚠️ 1006 - ParaAdd networkcloud baremetalmachine run-data-extract cmd networkcloud baremetalmachine run-data-extract added parameter expected_sha256
⚠️ 1006 - ParaAdd networkcloud baremetalmachine run-data-extract cmd networkcloud baremetalmachine run-data-extract added parameter expected_storage_host
⚠️ 1006 - ParaAdd networkcloud baremetalmachine run-data-extracts-restricted cmd networkcloud baremetalmachine run-data-extracts-restricted added parameter expected_sha256
⚠️ 1006 - ParaAdd networkcloud baremetalmachine run-data-extracts-restricted cmd networkcloud baremetalmachine run-data-extracts-restricted added parameter expected_storage_host
⚠️ 1006 - ParaAdd networkcloud baremetalmachine run-read-command cmd networkcloud baremetalmachine run-read-command added parameter expected_sha256
⚠️ 1006 - ParaAdd networkcloud baremetalmachine run-read-command cmd networkcloud baremetalmachine run-read-command added parameter expected_storage_host
⚠️ 1006 - ParaAdd networkcloud storageappliance run-read-command cmd networkcloud storageappliance run-read-command added parameter expected_sha256
⚠️ 1006 - ParaAdd networkcloud storageappliance run-read-command cmd networkcloud storageappliance run-read-command added parameter expected_storage_host

Root cause: The client treats a platform-populated pointer as proof that the referenced bytes are trusted. Its hand-written archive guard checks path prefixes but not link semantics, leaving a known gap that the standard extraction filter addresses.

This PR fixes this issue.

aaz: N/a


This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install azdev required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Copilot AI balanced review requested due to automatic review settings November 2, 2026 20:02
@microsoft-github-policy-service microsoft-github-policy-service Bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Nov 2, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution idanielsteven! We will review the pull request and get back to you soon.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Archive hard links can bypass the extraction budget and write beyond the 1 GiB limit, while truncated gzip downloads raise an unhandled EOFError instead of a handled retrieval error.

2 open issues
What changed in this PR

This PR hardens Network Cloud command-output downloads and archive extraction against path traversal, and prepares release 6.0.0b2.

Changes:

  • Adds trusted-host validation, optional SHA-256 verification, and authenticated downloads without redirects.
  • Uses the standard archive data filter where available, with legacy safeguards and size/member limits.
  • Adds security regression tests and updates release metadata.
File Description
src/​networkcloud/​setup.py Bumps the extension version to 6.0.0b2.
src/​networkcloud/​HISTORY.rst Records the archive traversal fix.
src/​networkcloud/​azext_networkcloud/​tests/​unit/​test_run_command_options.py Tests trust arguments and the required storage host.
src/​networkcloud/​azext_networkcloud/​tests/​unit/​test_custom_properties.py Tests shared download routing and error handling.
src/​networkcloud/​azext_networkcloud/​tests/​unit/​test_archive_output.py Adds download validation, extraction safety, and limit tests.
src/​networkcloud/​azext_networkcloud/​operations/​run_command_options.py Exposes trusted-host and optional checksum arguments.
src/​networkcloud/​azext_networkcloud/​operations/​custom_properties.py Centralizes validated downloads and hardens archive extraction.

Review effort: Balanced

@yonzhan

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The hardening looks solid, and both earlier Copilot findings are fixed. A few things before approval:

  1. Compatibility and documentation: --output-directory now requires --expected-storage-host, so existing scripts will fail without modification. Please add a BREAKING CHANGE release note documenting this requirement and the optional --expected-sha256 argument. 6.0.0b2 is fine under the preview versioning rules.
  2. Usability: please document how users determine the trusted storage hostname and add an example. Could it be derived from trusted cluster configuration instead of requiring manual input?
  3. Error handling: corrupted DEFLATE content raises zlib.error, which escapes both output handlers. Please normalize it to tarfile.ReadError, as done for EOFError, and add a regression test.
  4. Tests: test_legacy_regular_file fails on Python 3.14: patching tarfile.data_filter = None also breaks the default extraction filter there. Please simulate the legacy runtime another way.
  5. Archive compatibility: please confirm service-generated result archives never contain symlinks or hard links, since extraction now rejects them.

@idanielsteven

idanielsteven commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks. The hardening looks solid, and both earlier Copilot findings are fixed. A few things before approval:

  1. Compatibility and documentation: --output-directory now requires --expected-storage-host, so existing scripts will fail without modification. Please add a BREAKING CHANGE release note documenting this requirement and the optional --expected-sha256 argument. 6.0.0b2 is fine under the preview versioning rules.
  2. Usability: please document how users determine the trusted storage hostname and add an example. Could it be derived from trusted cluster configuration instead of requiring manual input?
  3. Error handling: corrupted DEFLATE content raises zlib.error, which escapes both output handlers. Please normalize it to tarfile.ReadError, as done for EOFError, and add a regression test.
  4. Tests: test_legacy_regular_file fails on Python 3.14: patching tarfile.data_filter = None also breaks the default extraction filter there. Please simulate the legacy runtime another way.
  5. Archive compatibility: please confirm service-generated result archives never contain symlinks or hard links, since extraction now rejects them.

I had similar concerns about a chicken/egg scenario. I'm inclined to remove the explicit host checking and optional SHA and just stick with an "HTTPS" URL enforcement. This would remove the need for breaking changes because we wouldn't have new parameters. The analysis that drove this STORM bug in our backlog doesn't seem to have been created with usability in mind.

@necusjz
Ethan Yang (necusjz) merged commit d9efa81 into Azure:main Nov 11, 2026
24 checks passed
@azclibot

Copy link
Copy Markdown
Collaborator

[Release] Update index.json for extension [ networkcloud-6.0.0b2 ] : https://dev.azure.com/msazure/One/_build/results?buildId=190749191&view=results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-quality-productivity-squad Auto-Assign Auto assign by bot customer-reported Issues that are reported by GitHub users external to the Azure organization. Network

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants