Skip to content

Ruby: Avoid a forced CP. #18927

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Ruby: Avoid a forced CP. #18927

wants to merge 1 commit into from

Conversation

alexet
Copy link
Contributor

@alexet alexet commented Mar 4, 2025

The disjunction mentions request on one side and requestNode on the other. This means that the disjunction can't go first and the call the the charpred must be done first. Due to a inline_late bindingset[...] call inside the inlined new.getReturn(_) we can't start with that inside the disjunct and we therefore must choose a CP. Luckily in most databases the CP ends up small but it messes up the normal CP detection heuristics as all the CPs are weighted equally.

@github-actions github-actions bot added the Ruby label Mar 4, 2025
@alexet alexet marked this pull request as ready for review April 29, 2025 17:41
@Copilot Copilot AI review requested due to automatic review settings April 29, 2025 17:41
@alexet alexet requested a review from a team as a code owner April 29, 2025 17:41
Copy link
Contributor

@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 pull request refactors the URL part extraction in a Net::HTTP request to avoid a forced CP by extracting the inline logic into a dedicated helper predicate.

  • Moved inline URL part extraction to a new helper function
  • Added documentation for the helper predicate to clarify its purpose
Comments suppressed due to low confidence (1)

ruby/ql/lib/codeql/ruby/frameworks/http_clients/NetHttp.qll:67

  • [nitpick] Consider renaming the variable 'new' to something more descriptive to avoid potential confusion with object instantiation keywords.
new = API::getTopLevelMember("Net").getMember("HTTP").getInstance() and

@hvitved hvitved added the no-change-note-required This PR does not need a change note label Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Ruby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants