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.
The Cont
module is a Ruby library that provides an implementation of
continuations using the fiber
library. Continuations are advanced control flow
constructs that allow you to save the state of a computation at a certain point
and then resume it later. This library is useful for managing complex control
flows and implementing advanced features like coroutines, generators, and
cooperative multitasking.
To use the Cont
library, simply require it in your Ruby project:
require 'cont'
Cont.reset
Cont.reset
limits the continuation to the current block.
It takes a block of code and returns the result of that block.
result = Cont.reset do
42
end
puts result # => 42
Cont.shift
Cont.shift
captures the current continuation and allows you to resume it.
It takes a block of code, which should call a lambda to resume the continuation.
result = Cont.reset do
Cont.shift do |k|
k.call(42) + 1
end
end
puts result # => 43
Cont.reset_at
Cont.reset_at
limits the continuation to the current block and assigns it a tag.
It takes a tag and a block of code, allowing you to manage multiple continuation points.
result = Cont.reset_at(:x) do
1 + Cont.shift_at(:x) { |cont| cont.call(2) }
end
puts result # => 3
Cont.shift_at
Cont.shift_at
captures the current continuation associated with a specific tag and allows you to resume it.
It takes a tag and a block of code, enabling more complex control flow by using multiple continuations.
result = Cont.reset_at(:x) do
Cont.shift_at(:x) do |k|
k.call(42) + 1
end
end
puts result # => 43
Cont::DeadContinuationError
This exception is raised when an attempt is made to resume a dead continuation.
Cont::UnexpectedStatusError
This exception is raised when an unexpected status is encountered.
MIT License
Copyright (c) 2024 Masaya Taniguchi
FAQs
Unknown package
We found that cont demonstrated a healthy version release cadence and project activity because the last version was released less than 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.