Skip to content

fix: replace jQuery CDN dependency in addons:open SSO template with vanilla JS - #3837

Merged
heroku-johnny merged 2 commits into
mainfrom
W-23597891
Jul 28, 2026
Merged

fix: replace jQuery CDN dependency in addons:open SSO template with vanilla JS#3837
heroku-johnny merged 2 commits into
mainfrom
W-23597891

Conversation

@heroku-johnny

Copy link
Copy Markdown
Contributor

Summary

  • Removes the <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"> tag from the SSO HTML page generated by writeSudoTemplate in src/commands/addons/open.ts
  • Replaces the jQuery-dependent form-building code ($.each, $('<input>'), $(document).ready) with a vanilla JS equivalent using document.addEventListener('DOMContentLoaded', ...) and Object.keys(params).forEach(...)
  • Updates the existing unit test (test/unit/commands/addons/open.unit.test.ts) to assert: the generated HTML does not contain googleapis.com, and does contain DOMContentLoaded and form.submit()

Motivation: The SSO template is a locally-generated HTML page that handles authentication. Loading jQuery 2.0.0 (released 2013) from an external Google CDN at auth time is a supply-chain risk — the page silently fetches a decade-old, potentially compromised script from a third party. Vanilla JS removes the external dependency entirely with no loss of functionality.

Fixes #1541 | W-23597891

Test plan

  • Run npm test -- --grep "file path using sudo via sso" — verifies the generated HTML has no googleapis.com and does contain DOMContentLoaded / form.submit()
  • Manually set HEROKU_SUDO=true and run heroku addons:open <addon> --app <app> against an app with a POST-method SSO add-on to confirm the browser opens the add-on dashboard correctly

🤖 Generated with Claude Code

…anilla JS

Removes the external jQuery 2.0.0 script tag (loaded from
ajax.googleapis.com) in writeSudoTemplate and replaces the
jQuery-dependent form-building logic with vanilla JS using
DOMContentLoaded and Object.keys(). Eliminates a supply-chain risk
where a locally-generated auth page silently fetched a decade-old
library from an external CDN. Fixes #1541 (W-23597891).

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@heroku-johnny
heroku-johnny requested a review from a team as a code owner July 27, 2026 19:27

@tlowrimore-heroku tlowrimore-heroku left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@heroku-johnny
heroku-johnny merged commit 1df4b3d into main Jul 28, 2026
19 checks passed
@heroku-johnny
heroku-johnny deleted the W-23597891 branch July 28, 2026 18:53
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.

remove jquery from open commands

2 participants