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

Ensure Array has been decorated with #extract_options #1185

Merged
merged 1 commit into from
Oct 2, 2023

Conversation

ragaskar
Copy link

@ragaskar ragaskar commented Jan 24, 2023

(sorry for the missing description -- the github code editor doesn't make the PR generation flow entirely obvious)

My team maintains a sinatra-based application that uses delayed_job (http://github.com/cloudfoundry/bosh). Only the activesupport gem is present as a dependency. We recently upgraded activesupport to latest in response to the recent Rails CVE. After this change our integration tests began failing.

What we have observed is in versions of activesupport > 6.0.x, the #extract_options! method is not "automatically" applied to Arrays. It is not clear to me when how this behavior change has been introduced, but I don't think it is too important, as I expect it is likely desired behavior from the Rails team (e.g, I see this behavior being explicitly loaded elsewhere in the Rails codebase) and probably best fixed by explicitly requiring this library. I notice there is a similar pattern in the delayed_job codebase (e.g. lib/delayed/worker.rb) for pulling in active_support dependencies.

I suspect this is not an issue in your tests because it appears the entire Rails dependency stack is pulled in. I believe parts of Rails are likely to automatically load this file at some point which may explain why tests aren't failing and there are no other complaints from other users.

For now we will likely workaround by explicitly loading this active_support file whenever we require delayed_job but it would be great if we could get this change integrated into delayed_job itself so we could remove this extra require call.

Thank you!

ragaskar added a commit to cloudfoundry/bosh that referenced this pull request Jan 24, 2023
- `activesupport` versions > 6.0.x do not automatically extend Array
  with `#extract_options!`, used by delayed_job in their JobPreparer
  class. When this class is instantiated, it throws a method missing
  error. We must be on a > 6.0.x version to pick up the fix for
  CVE-2023-22796.
- A [PR](collectiveidea/delayed_job#1185) has
  been opened against `delayed_job` to incorporate this require into
  their library code. If/when it is accepted this require can be
  removed.
- We observed green integration tests after adding the require to the
  main director.rb file. It was also added to the other instance where
  delayed_job is required in worker.rb, as it seems likely this process
  might be started separately. There is one instance where we require
  `delayed_job_sequel` (which presumedly, in turn requires
  `delayed_job`) in models.rb, but this seems unlikely to run in a
  context where we would hit the observed issue.
@albus522 albus522 merged commit 6a1c712 into collectiveidea:master Oct 2, 2023
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.

None yet

2 participants