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.
$ sudo gem install redisque
How to useRedisque has only three methods that you will employ:
Redisque.connect(options)
with the help of this method you can customize your connection to Redis DB. options
is a Hash
and can have the keys: :address, :port, :password
and :db
.
Redisque.enqueue(queue, data)
makes possible to add task represented by data
(Hash) to queue
(String).
Redisque.workoff(queue, pause = 5, &block)
manages the queue: asks the queue
for the next entry (job that is represented with JSONized Hash) and if it gets one then the block
is executed with data received otherwise sleep for pause
time set in seconds, this way we give a chance to another processes to do their job :)
Usage scenario might look like:
in your application:
require "redisque"
[
{:id => 1, :city => 'New York'},
{:id => 2, :city => 'Pekin'},
{:id => 3, :city => 'Mumbai'},
{:id => 4, :city => 'Paris'},
{:id => 5, :city => 'Madrid'}
].each {|chunk| Redisque.enqueue('my_queue', chunk)}
in your [Worker] *.rb file:
require "redisque"
Redisque.connect(:password => 'secret')
Redisque.workoff('my_queue') do |data|
puts "Next city is: %s" % data["city"]
end
Halting Redisque:
Redisque has a key halting
and you can use it to halt the execution, i.e. in your [Worker] *.rb file:
trap('INT') do
print "1. (Q)uit now\n2. (W)ait for current task to finish\n3. (C)ontinue\n"
case gets.chomp
when 'Q'
exit
when 'W'
Redisque.halting = true
print 'Redisque instance resumes until current Job is finished'
else
end
end
trap('TERM') {exit}
require "json"
require "redisque"
...
Redisque creates backup queue when it's run with the following name convention:
original queue
name that is preceded with asterisk symbol
e.g. if your queue name was my_queue
then the backup queue name would be *my_queue
so you should keep it in mind when working with other queues that some names are already automatically reserved for backup queues
In case Worker was interrupted, backup queue data (if any) will be shifted into active queue on next Worker start, thus if task was running but didn't succeed, it's entry will be restored from backup queue. For your Worker to function properly it has to be able to redo all steps regardless the execution moment it was stopped at.
Please do.
If you feel that it lacks some functionality or enhancement or anything else, please feel free to:
to review code and merge the branch.
Thank you
MIT License
Copyright (c) 2012 Yuri Belogub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Unknown package
We found that redisque 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.