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.
test-cmd.rb provides an object-oriented interface for spawning a command.
The success and failure callbacks provide hooks for when a command exits successfully or unsuccessfully. The callbacks are passed an instance of Test::Cmd:
require "test-cmd"
cmd("ruby", "-e", "exit 0")
.success { print "The command [#{_1.pid}] was successful", "\n" }
.failure { print "The command [#{_1.pid}] was unsuccessful", "\n" }
The following example demonstrates how tests might be written with
test-unit from the standard library. The
cmd
method takes the name or path of a command, alongside any arguments:
require "test/unit"
require "test/cmd"
class CmdTest < Test::Unit::TestCase
def test_ruby_stdout
assert_equal "42\n", ruby("puts 42").stdout
end
def test_ruby_stderr
assert_equal "42\n", ruby("warn 42").stderr
end
def test_ruby_success_exit_status
assert_equal 0, ruby("exit 0").exit_status
end
def test_ruby_failure_exit_status
assert_equal 1, ruby("exit 1").exit_status
end
private
def ruby(code)
cmd("ruby", "-e", code)
end
end
A complete API reference is available at 0x1eef.github.io/x/test-cmd.rb
test-cmd.rb can be installed via rubygems.org:
gem install test-cmd.rb
FAQs
Unknown package
We found that test-cmd.rb 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.