Skip to content

Conversation

Umekawa
Copy link
Member

@Umekawa Umekawa commented Oct 8, 2025

What

  • Add a dependency on the uri gem to use version 1.0.4 or higher.

Why

Ref

@Copilot Copilot AI review requested due to automatic review settings October 8, 2025 08:23
@Umekawa Umekawa self-assigned this Oct 8, 2025
Copy link

Summary of Changes

Hello @Umekawa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This PR updates the qiita-markdown.gemspec to include a dependency on the uri gem, requiring version 1.0.4 or higher, to fix a security vulnerability (CVE-2025-61594) in older versions of the uri gem.

Highlights

  • Intent: This pull request addresses a security vulnerability (CVE-2025-61594) found in uri gem versions 1.0.3 and earlier. The goal is to ensure the project uses a patched version of the uri gem to mitigate the credential leakage issue.
  • Changes: The primary change involves modifying the qiita-markdown.gemspec file. A new runtime dependency on the uri gem has been added, specifically requiring version 1.0.4 or higher (spec.add_dependency "uri", ">= 1.0.4"). This ensures that any installation of this gem will pull in the secure version of the uri gem.
  • Reviewer Activity: No specific reviewer activity has been recorded or is available in the provided context.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a security-focused dependency update to address a vulnerability in the uri gem. The change requires uri gem version 1.0.4 or higher to mitigate CVE-2025-61594, which involves URI credential leakage that bypassed previous fixes.

  • Added minimum version constraint for the uri gem dependency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Umekawa Umekawa requested review from a team and kimkim0814 and removed request for a team October 8, 2025 08:24
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a security vulnerability by updating the uri gem dependency, which is a crucial change. I've added one suggestion to improve the long-term stability of the dependency management. Thank you for your contribution!

spec.add_dependency "qiita_marker", "~> 0.23.9"
spec.add_dependency "rouge", "~> 4.2"
spec.add_dependency "sanitize"
spec.add_dependency "uri", ">= 1.0.4"

Choose a reason for hiding this comment

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

medium

For better dependency management and to prevent potential future breakages, it's recommended to use a pessimistic version constraint.

While >= 1.0.4 correctly resolves the security vulnerability, it allows any future version of the uri gem, including major versions with breaking changes (e.g., 2.0.0).

Using ~> 1.0.4 (which is equivalent to >= 1.0.4 and < 1.1.0) will ensure you get security patches within the 1.0.x series while protecting against breaking changes in future minor or major releases. This is also consistent with other versioned dependencies in this file like qiita_marker and rouge.

This approach enhances the stability for consumers of this gem.

  spec.add_dependency "uri", "~> 1.0.4"

Copy link
Member Author

Choose a reason for hiding this comment

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

Since it's a library, I don't think there's a strong need to pessimistic version.

Copy link
Member

@kimkim0814 kimkim0814 left a comment

Choose a reason for hiding this comment

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

✍️
I performed the following verification.
After running bundle install, I confirmed that the installation was successful using bundle list | grep uri, and then proceeded with the validation.

Running existing tests

All tests passed.

# Run all tests to verify that existing functionality is not broken
bundle exec rspec

~~~

Finished in 1.28 seconds (files took 9.58 seconds to load)
595 examples, 0 failures

Manual testing of URI processing functionality

Executed with:

bundle exec ruby test_uri_functionality.rb
#!/usr/bin/env ruby
require_relative 'lib/qiita-markdown'

# Test for ExternalLink filter
processor = Qiita::Markdown::Processor.new(hostname: "example.com")

test_cases = [
  "http://external.com/test",
  "https://example.com/internal",
  "[link](http://external.com/path?param=value)",
  "[internal link](https://example.com/internal/path)",
]

puts "=== URI processing test ==="
test_cases.each do |markdown|
  result = processor.call(markdown)
  puts "Input: #{markdown}"
  puts "Output: #{result[:output]}"
  puts "---"
end

# Test for iframe/script embedding functionality
puts "\n=== Embed functionality test ==="
embed_tests = [
  '<iframe src="https://www.youtube.com/embed/example"></iframe>',
  '<script src="https://example.com/script.js"></script>',
  '<iframe src="malicious-site.com/bad-content"></iframe>',
]

embed_tests.each do |markdown|
  result = processor.call(markdown)
  puts "Input: #{markdown}"
  puts "Output: #{result[:output]}"
  puts "---"
end

puts "\n=== URI gem version ==="
puts "URI gem version: #{Gem.loaded_specs['uri']&.version || 'Not found'}"

@kimkim0814
Copy link
Member

kimkim0814 commented Oct 9, 2025

✍️

When using the + operator to combine URIs, sensitive information like passwords from the original URI can be leaked, violating RFC3986 and making applications vulnerable to credential exposure.
Please update URI gem to version 0.12.5, 0.13.3, 1.0.4 or later.

ref: https://www.ruby-lang.org/en/news/2025/10/07/uri-cve-2025-61594/

Copy link
Member

@kimkim0814 kimkim0814 left a comment

Choose a reason for hiding this comment

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

Confirmed that action is required for the security vulnerability (#215 (comment)), and also performed verification (#215 (review)).

LGTM!

@Umekawa Umekawa merged commit 69875dd into master Oct 9, 2025
7 checks passed
@Umekawa Umekawa deleted the add-dependency-uri branch October 9, 2025 07:46
@Umekawa Umekawa mentioned this pull request Oct 9, 2025
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