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.
Active Record ENUM based state machine. Whether you can control enum transation from one state to another state. Suppose you have an user model and you want to once user has been rejected he can't be verified, You can achive this job easily using this library.
Add this line to your application's Gemfile:
gem "snm-enum-transition"
And then execute:
$ bundle
Or install it yourself as:
$ gem install snm-enum-transition
# You have an user model and you want to specify status transitions: initial to verified, initial to rejected and rejected to initial
class User
include Snm::Enum::Transition
enum status: {initial: 0, verified: 1, rejected: 2]
# Specify (allow enum transition) column name, from and to
snm_enum_transitions :status, :initial, [:verified, :rejected]
snm_enum_transitions :status, [:rejected], [:initial]
end
user = User.create(status: :initial)
# IF user status is initial
user.verified! # Okay
user.rejected! # Okay
# IF user status is verified
user.rejected! # ActiveRecord::RecordInvalid: Validation failed: Status can't be changed from verified to rejected
user.initial! # ActiveRecord::RecordInvalid: Validation failed: Status can't be changed from verified to initial
# IF user status is rejected
user.initial! # Okay
user.verified! # ActiveRecord::RecordInvalid: Validation failed: Status can't be changed from rejected to verified
Bug reports and pull requests are welcome on GitHub at https://github.com/snmmaurya/snm-enum-transition. 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.
FAQs
Unknown package
We found that snm-enum-transition 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.