Skip to content

Research pass: literal path handling for inventory and exports - #85

Merged
cursor[bot] merged 1 commit into
mainfrom
cursor/research-and-improve-510f
Sep 16, 2026
Merged

cursor[bot] merged 1 commit into
mainfrom
cursor/research-and-improve-510f

Conversation

@jacobyoby

Copy link
Copy Markdown
Owner

Research summary

Reviewed README.md, AGENTS.md, CI (three-OS Pester + smoke + PSScriptAnalyzer), and the NetDiagram-PS Public/Private split. The module already follows solid patterns: XML escaping via SecurityElement in Export-DrawIO, SNMP argument-injection guards in Invoke-SnmpWalk, and -LiteralPath on several import/export cmdlets (Import-Topology, Import-NmapScan, most exporters' existence checks).

Gap found: a few user-path entry points still used -Path for Test-Path / Get-Content / Out-File. On Windows (and anywhere PowerShell treats [] as wildcards), inventory or credential-map files under paths like inventory[site1].json could fail to open or match the wrong file.

Changes

  1. Import-Inventory — -LiteralPath for existence check and JSON read.
  2. Get-SnmpNeighbors / Get-SnmpBridgeNeighbors — same for credential-map paths.
  3. Compare-NetworkScans — literal metadata reads and report Out-File.
  4. Export-DrawIO — literal Out-File (aligned with existing Test-Path -LiteralPath on -OutFile).
  5. Tests — bracketed inventory path; XML metacharacters in hostname/vendor plus bracketed .drawio output path.
  6. CHANGELOG.md — Unreleased fix note.

Tests

POSIX runner: ./tests/run-tests.sh → exit 2 (CANNOT-RUN) — pwsh not available in the cloud agent environment. CI on the PR should run the full matrix.

Scope

Small, behavior-compatible hardening/DX fix; no manifest version bump.

…xport

Use -LiteralPath for Test-Path, Get-Content, and Out-File where user-supplied
paths may contain wildcard metacharacters. Add Pester coverage for bracket paths
and XML-special characters in diagram output.

Co-authored-by: Jacobrakai <jacobyoby@users.noreply.github.com>
@cursor
cursor Bot marked this pull request as ready for review September 16, 2026 21:20
@cursor
cursor Bot merged commit da38502 into main Sep 16, 2026
7 checks passed
@cursor
cursor Bot deleted the cursor/research-and-improve-510f branch September 16, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants