Skip to content

Source API version from package.json and validate infoURL protocol#32

Merged
Johnaverse merged 2 commits intofix/sonarqube-code-quality-v1.1.0from
copilot/sub-pr-31
Mar 7, 2026
Merged

Source API version from package.json and validate infoURL protocol#32
Johnaverse merged 2 commits intofix/sonarqube-code-quality-v1.1.0from
copilot/sub-pr-31

Conversation

Copy link
Contributor

Copilot AI commented Mar 6, 2026

The GET / endpoint returned a hardcoded version: '1.0.0' regardless of package.json, and showWebsite() in the frontend created anchor elements from data.infoURL without protocol validation, allowing non-http(s) schemes (e.g., javascript:) to be rendered as clickable links.

Changes

  • index.js — Replace hardcoded '1.0.0' with pkg.version via JSON import assertion:

    import pkg from './package.json' with { type: 'json' };
    // ...
    version: pkg.version,
  • public/app.js — Validate URL.protocol in showWebsite() before creating an anchor; any non-http:/https: scheme or invalid URL falls back to plain text:

    const url = new URL(data.infoURL);
    const protocol = url.protocol;
    if (protocol === 'http:' || protocol === 'https:') {
        // render anchor
    } else {
        webElem.textContent = data.infoURL; // unsafe scheme → plain text
    }
  • tests/integration/api.test.js — Update version assertion from '1.0.0' to '1.1.0' to match package.json.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Johnaverse <110527930+Johnaverse@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix SonarQube issues and bump version to 1.1.0 Source API version from package.json and validate infoURL protocol Mar 6, 2026
@Johnaverse Johnaverse marked this pull request as ready for review March 7, 2026 00:22
@Johnaverse Johnaverse merged commit d2f1aeb into fix/sonarqube-code-quality-v1.1.0 Mar 7, 2026
@Johnaverse Johnaverse deleted the copilot/sub-pr-31 branch March 9, 2026 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants