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.
YamlExporter is a Ruby gem that provides YAML serialization and deserialization functionality for ActiveRecord models, with JSON schema generation for validation.
Add this line to your application's Gemfile:
gem 'yaml_exporter'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install yaml_exporter
Include the YamlExporter
module in your ActiveRecord model and define the YAML structure:
class Quiz < ApplicationRecord
include YamlExporter
yaml_structure do
yaml_attribute :title, :quiz_type
yaml_has_many :questions do
yaml_attribute :text, :question_type, :feedback
yaml_has_many :answers do
yaml_attribute :text, :is_correct, :impact
end
end
end
end
To serialize a model instance to YAML:
quiz = Quiz.find(1)
yaml_string = quiz.yaml_export
To deserialize YAML back to a model instance:
quiz = Quiz.new
quiz.yaml_import(yaml_string)
To generate a JSON schema for validation:
schema = Quiz.yaml_schema
The YamlExporter automatically infers types based on the database column types. JSON and JSONB columns are treated as objects in the generated schema.
Bug reports and pull requests are welcome on GitHub at https://github.com/itadventurer/yaml_exporter.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that yaml_exporter 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.