Skip to content

Sync PathHelpers.SafePathCombine null validation with TemplateDotNetTool#27

Merged
Malcolmnixon merged 2 commits intomainfrom
copilot/check-path-helpers-security
Mar 1, 2026
Merged

Sync PathHelpers.SafePathCombine null validation with TemplateDotNetTool#27
Malcolmnixon merged 2 commits intomainfrom
copilot/check-path-helpers-security

Conversation

Copy link
Contributor

Copilot AI commented Mar 1, 2026

PathHelpers.SafePathCombine was missing the ArgumentNullException.ThrowIfNull guards present in the TemplateDotNetTool reference implementation. The implementation (including all inline comments) is now identical to the template, differing only in namespace.

  • PathHelpers.cs — Add // Validate inputs block with null guards before the path traversal checks:
    // Validate inputs
    ArgumentNullException.ThrowIfNull(basePath);
    ArgumentNullException.ThrowIfNull(relativePath);
  • PathHelpersTests.cs — Add NullBasePath_ThrowsArgumentNullException and NullRelativePath_ThrowsArgumentNullException tests

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code quality improvement

Related Issues

Pre-Submission Checklist

Before submitting this pull request, ensure you have completed the following:

Build and Test

  • Code builds successfully: dotnet build --configuration Release
  • All unit tests pass: dotnet test --configuration Release
  • Self-validation tests pass:
    dotnet run --project src/DemaConsulting.VersionMark --configuration Release --framework net10.0
    --no-build -- --validate
  • Code produces zero warnings

Code Quality

  • Code formatting is correct: dotnet format --verify-no-changes
  • New code has appropriate XML documentation comments
  • Static analyzer warnings have been addressed

Quality Checks

Please run the following checks before submitting:

  • Spell checker passes: cspell "**/*.{md,cs}"
  • Markdown linter passes: markdownlint "**/*.md"
  • YAML linter passes: yamllint .

Testing

  • Added unit tests for new functionality
  • Updated existing tests if behavior changed
  • All tests follow the AAA (Arrange, Act, Assert) pattern
  • Test coverage is maintained or improved

Documentation

  • Updated README.md (if applicable)
  • Updated ARCHITECTURE.md (if applicable)
  • Added code examples for new features (if applicable)
  • Updated requirements.yaml (if applicable)

Additional Notes

CodeQL scan returned 0 alerts.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…otNetTool

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copilot AI changed the title [WIP] Review security improvements in PathHelpers.cs Sync PathHelpers.SafePathCombine null validation with TemplateDotNetTool Mar 1, 2026
@Malcolmnixon Malcolmnixon marked this pull request as ready for review March 1, 2026 01:09
@Malcolmnixon Malcolmnixon merged commit 1581cf4 into main Mar 1, 2026
11 checks passed
@Malcolmnixon Malcolmnixon deleted the copilot/check-path-helpers-security branch March 1, 2026 01:09
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