Skip to content

Verify and ensure cross-platform support (Windows vs macOS/Linux) #19

@data-douser

Description

@data-douser

Summary

PR #18 (Security fixes for TOCTOU & OS tmp files) introduced several cross-platform issues that were caught during code review. While those specific problems have been fixed, this issue tracks the broader effort to verify equivalent Windows support across the CodeQL Development MCP Server and prevent regressions through CI workflow improvements.

Background

The following categories of cross-platform bugs were found and fixed in PR #18:

Category Example Fix Applied
Invalid file URI construction `file://${path}` produces broken URIs on Windows (backslashes, spaces) Use pathToFileURL() from node:url
ESM __dirname unavailable __dirname is not defined in ESM modules, would throw ReferenceError Use fileURLToPath(import.meta.url) + dirname()
Hardcoded POSIX separators getProjectTmpDir('quickeval') + '/quickeval.bqrs' Use path.join()
POSIX-only path.includes() __dirname.includes('src/utils') fails on Windows src\utils Normalize separators before checking
POSIX-only split('/') tempDir.split('/').pop() fails on Windows paths Use path.basename()

These patterns may exist elsewhere in the codebase and should be systematically audited.

Goals

1. Code changes for Windows compatibility

  • Audit all file:// URI construction across server/src/ and server/test/ — replace any string concatenation with pathToFileURL().
  • Audit all uses of __dirname and __filename — ensure ESM-safe equivalents (fileURLToPath + dirname) are used consistently.
  • Audit all path string manipulation — replace hardcoded / separators with path.join(), path.sep, or path.basename() as appropriate.
  • Audit all string.includes() / string.split() calls on file paths — ensure they handle both \ and / separators.
  • Verify client/src/ JavaScript files for the same patterns.

2. CI workflow improvements for multi-platform validation

  • Update .github/workflows/client-integration-tests.yml to run on a matrix of windows-latest and ubuntu-latest runners for pushes and pull requests.
  • Review other .github/workflows/*.yml workflows for opportunities to add Windows runner coverage.
  • Ensure test setup steps (CodeQL CLI installation, database creation, etc.) work correctly on Windows runners.
  • Add any Windows-specific environment configuration needed (e.g., path normalization, shell selection).

Acceptance Criteria

  • All existing unit tests pass on both ubuntu-latest and windows-latest CI runners.
  • All client integration tests pass on both ubuntu-latest and windows-latest CI runners.
  • No remaining hardcoded POSIX path separators or file:// string concatenation in server source or test code.

Metadata

Metadata

Labels

bugSomething isn't workingenhancementNew feature or request

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions