Skip to content

feat: sanitize filesystem paths across UI, API, and service logs - #60

Merged
Foxlider merged 10 commits into
developfrom
feat/path-sanitisation
Aug 12, 2026
Merged

feat: sanitize filesystem paths across UI, API, and service logs#60
Foxlider merged 10 commits into
developfrom
feat/path-sanitisation

Conversation

@Foxlider

Copy link
Copy Markdown
Owner

Summary

This PR introduces a centralized output/path sanitization layer to prevent absolute filesystem paths and sensitive host details from leaking into UI messages, API responses, install/mod logs, telemetry, and runtime exceptions. It applies the sanitizer consistently across core infrastructure and Razor pages, adds guardrail tests for markup usage, and updates nightly release publishing so repeated develop pushes no longer fail when the nightly tag/release already exists.


Type of Change

  • feat — new feature
  • fix — bug fix
  • perf — performance improvement
  • refactor — code restructure, no behaviour change
  • docs — documentation only
  • chore / ci — build, tooling, dependencies
  • Breaking change — existing behaviour changes (add ! to the PR title type)

What Changed

  • Added IOutputSanitizer contract and OutputSanitizer implementation with support for:
    • absolute path scrubbing (Windows, Unix, UNC, file URI)
    • virtual root mapping (for safe user-facing display paths)
    • traversal normalization and fallback-to-filename behavior
    • sanitized exception formatting
  • Wired sanitizer through dependency injection and integrated it into:
    • content orchestration/install flows
    • server instance/process/mod services
    • Steam-related services and endpoint handling
    • UI notifications, step details, install logs, and error display paths
  • Updated Razor components to use sanitized output rather than raw path-containing messages.
  • Added workflow hardening for nightly release publishing:
    • move nightly tag to current commit safely
    • create or update nightly prerelease idempotently
    • upload nightly artifacts with clobber behavior to avoid duplicate asset failures
  • Minor UI behavior improvements included in this branch:
    • mods tab bulk actions (load all / unload all)
    • preset import behavior refined for client-side replacement flow

Testing

  • Existing tests pass (dotnet test)
  • New tests added for the changed behaviour
  • Manually tested — describe below if relevant

New/expanded test coverage includes:

  • OutputSanitizer unit tests for path root stripping, traversal handling, virtual root mapping, symlink-related cases, and exception/message sanitization.
  • UI path sanitization guard tests that scan Razor markup and fail if sensitive path fields are rendered without sanitizer usage.
  • Updates to related installer/service/API tests to align with sanitized outputs.

Checklist

  • PR title follows Conventional Commits format
  • Targets the correct branch (develop for features, main for hotfixes)
  • No unrelated changes mixed in (whitespace, refactors, unrelated fixes)
  • EF Core migration included if any entity model changed
  • I have read CONTRIBUTING.md

If you want, I can also provide a shorter version optimized for reviewer scanning (1-paragraph summary + 6 bullets max).

bluefield-creator and others added 10 commits May 28, 2026 22:59
feat: add update instance mod loading controls

fix: resolve rellative instance profile
fix: relative pathing & incorrect instanceID access
- Integrated IOutputSanitizer across various components to sanitize error messages and paths, enhancing security and readability.
- Removed command line preview functionality from GeneralTab.razor.
- Updated Snackbar error messages in ServerEdit.razor, Servers.razor, Settings.razor, and other components to use sanitized exceptions.
- Refactored logging in ActivityEventLoggerProvider and KastLoggerProvider to utilize OutputSanitizer for consistent log message formatting.
- Added OutputSanitizerTests to ensure proper sanitization of paths and error messages.
- Updated tests across multiple services and components to include OutputSanitizer, ensuring consistent behavior in error handling.

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@Foxlider
Foxlider merged commit 9eb9efd into develop Aug 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants