Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
BackRun is a backround job system that is compatible with ActiveJob interface of Rails and allows developers to easily enqueue jobs to a Google Pub Sub Backend. BackRun uses threads to handle many jobs at the same time in the same process.
Add this line to your application's Gemfile:
gem 'back_run'
And then execute:
$ bundle
Or install it yourself as:
$ gem install back_run
The ActiveJob adapter must be set to :back_run
. This can be done in config/application.rb
.
Add the Google Pub Sub project id and the path to the credentials file.
class Application < Rails::Application
# ...
config.active_job.queue_adapter = :back_run
config.back_run = {
project_id: 'project_id',
credentials_path: 'path/to/credentials.json'
}
end
Create a job to be processed asynchronously:
rails g job Example
This will generate automatically the following file in app/jobs/example_job.rb
class ExampleJob < ApplicationJob
queue_as :default
def perform(*args)
# Do something later
end
end
Jobs can be added to the job queue from anywhere. We can add a job to the queue by:
ExampleJob.perform_later(args)
This arguments are serialized using to_json
method and deserialized with JSON.parse
. So you should use primitive objects as arguments.
In order to start consuming the Google Pub Sub topics, you should start a worker by running the following command:
bundle exec back_run -q queue-1 queue-2 -c 2
You can specify the queues that the worker should listen to (in this case queue-1 and queue-2) and the number of threads that the worker will use to execute the jobs.
The system provides some information about the jobs performed (the success ones). You should subscribe to the back_run.event_executed' event using
ActiveSupport::Notification`
ActiveSupport::Notifications.subscribe 'back_run.event_executed' do |*args|
event = ActiveSupport::Notifications::Event.new(*args)
# Do something with the event
end
This is an example of the event payload:
{
duration_seconds: 10,
job: 'ExampleJob'
}
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/alanhala/back_run. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the BackRun project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that back_run demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.