From e816abcf68050a8d61d4fdef477a2aa254d6818e Mon Sep 17 00:00:00 2001 From: whyKusanagi <169282093+whykusanagi@users.noreply.github.com> Date: Mon, 25 May 2026 15:26:13 -0700 Subject: [PATCH] fix(security): address 4 CodeQL warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves four of the five CodeQL findings surfaced when default code scanning was enabled. The fifth (js/tainted-format-string in countdown-widget.js) is dismissed as false-positive — V8 does not reinterpret %s in JS template literals. - src/lib/celeste-widget.js: generateSessionId() now uses crypto.randomUUID() instead of Math.random(). Fixes js/insecure-randomness. Backward-compatible: sessionId is set in the constructor and not parsed downstream, only logged/routed. - examples/components/websocket-manager.html: log() now builds child spans with textContent instead of innerHTML, so incoming WebSocket frames can't inject markup into the demo log. Fixes js/xss-through-dom. - examples/components/png-export.html: pinned html2canvas script now carries an SRI hash (sha384) and crossorigin="anonymous", matching the SRI guidance we publish for consumers in docs/CDN_CONSUMPTION.md. Fixes js/functionality-from-untrusted-source. - .github/workflows/checks.yml: declare permissions: contents:read at the job level. The workflow only needs to read repo contents (checkout + npm install + build + test); the default GITHUB_TOKEN with broad write scope is gratuitously permissive in a public package. Fixes actions/missing-workflow-permissions. 166/166 tests still pass. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/checks.yml | 4 ++++ examples/components/png-export.html | 5 ++++- examples/components/websocket-manager.html | 10 +++++++++- src/lib/celeste-widget.js | 8 ++++++-- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 9c7dbfd..d67bf15 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -11,6 +11,10 @@ jobs: checks: runs-on: ubuntu-latest timeout-minutes: 5 + # Minimum scope needed: checkout reads repo contents, no other API calls. + # Closes CodeQL actions/missing-workflow-permissions warning. + permissions: + contents: read steps: - uses: actions/checkout@v4 diff --git a/examples/components/png-export.html b/examples/components/png-export.html index a98b2ad..6b4d7bf 100644 --- a/examples/components/png-export.html +++ b/examples/components/png-export.html @@ -239,9 +239,12 @@

Usage

- +