Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚨 [security] Update yard 0.9.34 → 0.9.36 (minor) #731

Closed
wants to merge 1 commit into from

Conversation

depfu[bot]
Copy link
Contributor

@depfu depfu bot commented Mar 1, 2024


🚨 Your current dependencies have known security vulnerabilities 🚨

This dependency update fixes known security vulnerabilities. Please see the details below and assess their impact carefully. We recommend to merge and deploy this as soon as possible!


Here is everything you need to know about this update. Please take a good look at what changed and the test results before merging this pull request.

What changed?

✳️ yard (0.9.34 → 0.9.36) · Repo · Changelog

Security Advisories 🚨

🚨 YARD's default template vulnerable to Cross-site Scripting in generated frames.html

Summary

The "frames.html" file within the Yard Doc's generated documentation
is vulnerable to Cross-Site Scripting (XSS) attacks due to inadequate
sanitization of user input within the JavaScript segment of the
"frames.erb" template file.

Details

The vulnerability stems from mishandling user-controlled data retrieved
from the URL hash in the embedded JavaScript code within the "frames.erb"
template file. Specifically, the script lacks proper sanitization of
the hash data before utilizing it to establish the top-level window's
location. This oversight permits an attacker to inject malicious
JavaScript payloads through carefully crafted URLs.

Snippet from "frames.erb":

<script type="text/javascript">
  var match = unescape(window.location.hash).match(/^#!(.+)/);
  var name = match ? match[1] : '<= url_for_main >';
  name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
  window.top.location = name;
</script>

PoC (Proof of Concept)

To exploit this vulnerability:

  1. Gain access to the generated Yard Doc.
  2. Locate and access the "frames.html" file.
  3. Construct a URL containing the malicious payload in the hash
    segment, for instance: #!javascript:xss

Impact

This XSS vulnerability presents a substantial threat by enabling
an attacker to execute arbitrary JavaScript code within the user's
session context. Potential ramifications include session hijacking,
theft of sensitive data, unauthorized access to user accounts, and
defacement of websites. Any user visiting the compromised page is
susceptible to exploitation. It is critical to promptly address
this vulnerability to mitigate potential harm to users and preserve
the application's integrity.

Release Notes

0.9.36

  • Further XSS fixes for generated frameset pages (#1538)
  • Improve tests for Ruby 3.3 compatibility (#1519, #1531)
  • Documentation improvements (#1524)

0.9.35

  • Fix possible XSS on generated YARD frameset pages (thanks to @RedYetiDev for finding and patching) (2069e2b).
  • Fix errors when using @option on non-method objects (#1508)
  • Support Ruby 3.3 changes in Ripper parser (#1510)

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by 27 commits:


Depfu Status

Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase.

All Depfu comment commands
@​depfu rebase
Rebases against your default branch and redoes this update
@​depfu recreate
Recreates this PR, overwriting any edits that you've made to it
@​depfu merge
Merges this PR once your tests are passing and conflicts are resolved
@​depfu cancel merge
Cancels automatic merging of this PR
@​depfu close
Closes this PR and deletes the branch
@​depfu reopen
Restores the branch and reopens this PR (if it's closed)
@​depfu pause
Ignores all future updates for this dependency and closes this PR
@​depfu pause [minor|major]
Ignores all future minor/major updates for this dependency and closes this PR
@​depfu resume
Future versions of this dependency will create PRs again (leaves this PR as is)

@depfu depfu bot added the depfu label Mar 1, 2024
Copy link

codecov bot commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.89%. Comparing base (cfa73ba) to head (0a7e283).
Report is 12 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #731   +/-   ##
=======================================
  Coverage   90.89%   90.89%           
=======================================
  Files          71       71           
  Lines        3414     3414           
=======================================
  Hits         3103     3103           
  Misses        311      311           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor Author

depfu bot commented Sep 5, 2024

Closed in favor of #802.

@depfu depfu bot closed this Sep 5, 2024
@depfu depfu bot deleted the depfu/update/yard-0.9.36 branch September 5, 2024 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants