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.
Creates and manages git repositories in the operating system's temporary directory. It does this by providing a thin wrapper around the git binary that's pointed at a randomly generated temporary folder.
gem install tmp-repo
require 'tmp-repo'
Creating a new TmpRepo
will automatically create a randomly named folder in your system's temp directory and initialize a git repository in it:
repo = TmpRepo.new
repo.working_dir # => #<Pathname:/var/folders/3x/n10r69b16bq_rlcqr3fy0rwc0000gn/T/b068487773901ffe23e66a8259711fa1>
Once created, you can ask your TmpRepo
questions and perform operations on it. Don't forget to clean up after yourself when you're finished:
repo.unlink
repo.create_file('foo.txt') do |f|
f.write("I'm a new file!")
end
OR
file = repo.create_file('foo.txt')
file.write("I'm a new file!")
file.close
To create a new branch:
repo.create_branch('my_new_branch')
To check out a branch:
repo.checkout('my_other_branch')
To get the current branch:
repo.current_branch # => 'master'
To add all files to the git stage:
repo.add_all
To commit staged files:
repo.commit('Commit message')
TmpRepo
instances provide a convenient way to retrieve the status of the repository via the status
method. status
return values are a simple hash of arrays:
status = repo.status
status[:new_file] # => ['file1.txt', 'file2.txt']
status[:deleted] # => ['file3.txt']
status[:modified] # => ['file4.txt']
This library only provides wrapper methods around the most common git commands. To run additional git commands, use the git
method:
repo.git('rebase master')
In addition, the lower-level in_repo
method wraps the given block in a Dir.chdir
, meaning the block is executed in the context of the repo's working directory:
repo.in_repo do
`ls` # list files in the repo's working directory
end
No external requirements.
bundle exec rake
should do the trick.
FAQs
Unknown package
We found that tmp-repo 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.