diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 5df943ad..00000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: CodeQL - -# Public repo, so Advanced Security / code scanning is available for free - these -# triggers run for real (see the disabled variant used on Jumoo's private repos, -# where the upload step is rejected and the triggers stay commented out until -# Advanced Security is turned on). - -on: - push: - branches: [ "main", "*/main" ] - paths-ignore: - - "**.md" - - "docs/**" - pull_request: - branches: [ "main", "*/main" ] - paths-ignore: - - "**.md" - - "docs/**" - schedule: - # weekly, so advisories published after a change still get picked up - - cron: "33 8 * * 0" - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - analyze: - name: Analyze (${{ matrix.language }}) - runs-on: ubuntu-latest - - permissions: - security-events: write - packages: read - actions: read - contents: read - - strategy: - fail-fast: false - matrix: - include: - # build-mode none: CodeQL scans the source without compiling it, so this - # doesn't need the sdk, node, a restore, or the locked-mode dance. - - language: actions - build-mode: none - - language: csharp - build-mode: none - # the backoffice management client and the history viewer client are both - # TypeScript, and between them cover most of uSync's user facing UI - worth - # scanning too. - - language: javascript-typescript - build-mode: none - - steps: - - name: Checkout repository - uses: actions/checkout@v7 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v4 - with: - languages: ${{ matrix.language }} - build-mode: ${{ matrix.build-mode }} - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4 - with: - category: "/language:${{ matrix.language }}" diff --git a/uSync.Backoffice.Management.Client/usync-assets/package-lock.json b/uSync.Backoffice.Management.Client/usync-assets/package-lock.json index 313d5a1f..3aaed4ef 100644 --- a/uSync.Backoffice.Management.Client/usync-assets/package-lock.json +++ b/uSync.Backoffice.Management.Client/usync-assets/package-lock.json @@ -2309,9 +2309,9 @@ } }, "node_modules/js-yaml": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", - "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", "dev": true, "funding": [ { diff --git a/uSync.Backoffice.Management.Client/usync-assets/package.json b/uSync.Backoffice.Management.Client/usync-assets/package.json index 3f8f9fec..44c9cfde 100644 --- a/uSync.Backoffice.Management.Client/usync-assets/package.json +++ b/uSync.Backoffice.Management.Client/usync-assets/package.json @@ -71,5 +71,8 @@ "typescript": "^5.9.3", "vite": "^8.2.1", "vite-plugin-dts": "^5.0.3" + }, + "overrides": { + "js-yaml": "^4.3.1" } } diff --git a/uSync.Core/Extensions/StringExtensions.cs b/uSync.Core/Extensions/StringExtensions.cs index 5e11f530..e8999d87 100644 --- a/uSync.Core/Extensions/StringExtensions.cs +++ b/uSync.Core/Extensions/StringExtensions.cs @@ -16,14 +16,22 @@ public static class StringExtensions /// /// convert a file name to one that isn't going to cause us any downlevel problems. /// + /// + /// paths aren't always parsed on the OS they came from (e.g. a Windows-style path + /// loaded on Linux), so we split on both separators here rather than using + /// Path.GetFileName/GetDirectoryName, which only recognise the current OS's separator. + /// public static string ToAppSafeFileName(this string value) { - var filename = Path.GetFileName(value); + var separatorIndex = value.LastIndexOfAny(['\\', '/']); + var directory = separatorIndex >= 0 ? value[..(separatorIndex + 1)] : string.Empty; + var filename = separatorIndex >= 0 ? value[(separatorIndex + 1)..] : value; + if (_badNames.InvariantContains(filename)) { - return Path.Combine( - Path.GetDirectoryName(value) ?? string.Empty, - $"__{Path.GetFileNameWithoutExtension(value)}__{Path.GetExtension(value)}"); + var extension = Path.GetExtension(filename); + var nameWithoutExtension = filename[..^extension.Length]; + return $"{directory}__{nameWithoutExtension}__{extension}"; } return value; } diff --git a/uSync.History/history-client/package-lock.json b/uSync.History/history-client/package-lock.json index b762cd37..322dfc4e 100644 --- a/uSync.History/history-client/package-lock.json +++ b/uSync.History/history-client/package-lock.json @@ -1622,9 +1622,9 @@ } }, "node_modules/js-yaml": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", - "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", "dev": true, "funding": [ { diff --git a/uSync.History/history-client/package.json b/uSync.History/history-client/package.json index 4a5d0ddc..9814fd94 100644 --- a/uSync.History/history-client/package.json +++ b/uSync.History/history-client/package.json @@ -27,5 +27,8 @@ "prettier": "^3.9.6", "typescript": "^6.0.3", "vite": "^8.2.1" + }, + "overrides": { + "js-yaml": "^4.3.1" } }