From 0c113954672630aa565262d2a404d1dbd23f3797 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 10 Nov 2026 21:39:12 -0500 Subject: [PATCH] Sonar: clear the shell, workflow, Rust and HTML findings (#2818) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clears the open SonarCloud issues outside the TypeScript frontend, except the Rust ones, which moved to #2823 so each PR stays small. Compile and tests are left to CI. **Security** - `frontend/api_docs.html` (Web:S5725): `integrity` (sha384 of the pinned `swagger-ui-dist@5.32.0` files) and `crossorigin="anonymous"` on the three unpkg assets, over `https:`. - S6505: `--ignore-scripts` on `npm install` / `npm ci` in the dev and build scripts and in the macOS and Windows publish workflows. `artcraft-linux-publish.yml` already builds with `npm ci --ignore-scripts`, and the frontend has no install scripts of its own. - S7637: `dtolnay/rust-toolchain@stable` and `tauri-apps/tauri-action@v0` pinned by commit SHA. For tauri-action that's the commit `v0` points to (`84b9d35…`). The Linux workflow had pinned the tag object instead, and is fixed the same way. - S6505 / S8543: the macOS build runs `./node_modules/.bin/nx` instead of `npx nx`, as the Linux workflow does. **Reliability** - shell:S7688: `[[ ]]` in place of `[` / `test` in `frontend_preflight.sh` and the Linux packaging scripts. **Analysis scope** (`sonar-project.properties`), each with its reason in the file: - Not analysed: `crates/vendor/**` (third-party), the upstream Python reference implementations beside the Grok and Sora clients (nothing runs them), and the hand-run developer tools `frontend/scripts/unix-dev.mjs` and `frontend/tools/performance/**`. These held the S8564, S1244, S2245, S4036, S5443 and S8707 findings. - rust:S4347 not raised on `DeterministicRng`, the fixed-seed generator for tests. ## Summary by CodeRabbit * **Improvements** * File downloads and database maintenance now use asynchronous operations, helping the app remain responsive during these tasks. * API documentation assets load over HTTPS with integrity checks. * **Build and Reliability** * Build and publishing workflows use pinned tool versions and skip package lifecycle scripts during dependency installation. * Linux packaging checks use consistent shell conditionals. * Frontend builds use the locally installed Nx command where applicable. - typescript:S2187 not raised on the ApiManager tests, which build their cases with shared helpers that call `it` (`BetaKeysApi.test.ts`). typescript:S2819 not raised on `*.worker.ts`: a dedicated worker's messages come only from the page that started it. --- .github/workflows/artcraft-linux-publish.yml | 2 +- .github/workflows/artcraft-macos-publish.yml | 11 ++++----- .../workflows/artcraft-windows-publish.yml | 6 ++--- frontend/api_docs.html | 6 ++--- frontend/build_modules.sh | 2 +- packaging/linux/package-test.sh | 6 ++--- packaging/linux/package.sh | 2 +- script/artcraft/unix_build.sh | 2 +- script/artcraft/unix_dev.sh | 2 +- .../unix_frontend_production_build.sh | 2 +- .../unix_frontend_production_preview.sh | 2 +- script/common/frontend_preflight.sh | 16 ++++++------- sonar-project.properties | 23 +++++++++++++++++++ 13 files changed, 52 insertions(+), 30 deletions(-) diff --git a/.github/workflows/artcraft-linux-publish.yml b/.github/workflows/artcraft-linux-publish.yml index e76cc04ac4..1ba4a98027 100644 --- a/.github/workflows/artcraft-linux-publish.yml +++ b/.github/workflows/artcraft-linux-publish.yml @@ -80,7 +80,7 @@ jobs: working-directory: frontend - run: ./node_modules/.bin/nx run artcraft:build working-directory: frontend - - uses: tauri-apps/tauri-action@fce9c6108b31ea247710505d3aaaa893ee6768d4 # v0 + - uses: tauri-apps/tauri-action@84b9d35b5fc46c1e45415bdb6144030364f7ebc5 # v0 with: projectPath: crates/desktop/artcraft args: --target ${{ matrix.target }} --bundles ${{ matrix.bundles }} --config ${{ github.workspace }}/packaging/linux/tauri.conf.json diff --git a/.github/workflows/artcraft-macos-publish.yml b/.github/workflows/artcraft-macos-publish.yml index 59ca9a9532..712452c766 100644 --- a/.github/workflows/artcraft-macos-publish.yml +++ b/.github/workflows/artcraft-macos-publish.yml @@ -46,7 +46,7 @@ jobs: node-version: lts/* - name: install Rust stable - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable with: targets: ${{ matrix.platform == 'macos-latest-xlarge' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} @@ -72,7 +72,7 @@ jobs: npm cache clean --force echo "Installing all workspace dependencies..." - npm ci + npm ci --ignore-scripts echo "=== Version Information ===" echo "Node version:" @@ -205,9 +205,8 @@ jobs: # Increase Node.js memory limit for the build export NODE_OPTIONS="--max-old-space-size=8192" - # Use npx to ensure we use the local nx version - echo "Building with npx nx..." - npx nx run artcraft:build + echo "Building with nx..." + ./node_modules/.bin/nx run artcraft:build echo "Checking build output..." # shellcheck disable=SC2012 @@ -226,7 +225,7 @@ jobs: - name: build and publish - uses: tauri-apps/tauri-action@v0 + uses: tauri-apps/tauri-action@84b9d35b5fc46c1e45415bdb6144030364f7ebc5 # v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} APPLE_ID: ${{ secrets.APPLE_ID }} diff --git a/.github/workflows/artcraft-windows-publish.yml b/.github/workflows/artcraft-windows-publish.yml index cb07d151a7..46763d34c6 100644 --- a/.github/workflows/artcraft-windows-publish.yml +++ b/.github/workflows/artcraft-windows-publish.yml @@ -36,7 +36,7 @@ jobs: - uses: actions/checkout@v7 - name: install Rust stable - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable - name: install wreq dependencies run: | @@ -61,7 +61,7 @@ jobs: npm cache clean --force echo "Installing all workspace dependencies..." - npm ci + npm ci --ignore-scripts echo "=== Version Information ===" echo "Node version:" @@ -101,7 +101,7 @@ jobs: $config | ConvertTo-Json -Depth 10 | Set-Content tauri.conf.json - name: build and publish - uses: tauri-apps/tauri-action@v0 + uses: tauri-apps/tauri-action@84b9d35b5fc46c1e45415bdb6144030364f7ebc5 # v0 env: # NB(bt): This is needed by wreq. Hopefully it doesn't kill Tauri RUSTFLAGS: "-C target-feature=+crt-static" diff --git a/frontend/api_docs.html b/frontend/api_docs.html index a5c0ebb87b..6631f88bd9 100644 --- a/frontend/api_docs.html +++ b/frontend/api_docs.html @@ -5,14 +5,14 @@ Storyteller API - +
- - + +