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.
association_reflections
Advanced tools
This gem lets you access form parameters in your model.
gem 'association_reflections'
class User < ApplicationRecord
include AssociationReflections::Concern
has_many :projects
accepts_nested_attributes_for :projects, allow_destroy: true
validate :validate_associations
private
def validate_associations
reflection = self.association_reflections
# => <AssociationReflections::Association>
reflection.params
# {
# "email" => "",
# "projects_attributes" => {
# "0" => {
# "id" => "1",
# "name" => "",
# "_destroy" => "1",
# "categories_attributes" => {
# "0" => {
# "name" => ""
# }
# }
# }
# }
# }
end
end
class Project < ApplicationRecord
belongs_to :user
has_many :categories
accepts_nested_attributes_for :categories, allow_destroy: true
validate :validate_associations
private
def validate_associations
reflection = self.user.association_reflections
end
end
class Category < ApplicationRecord
belongs_to :project
validate :validate_associations
private
def validate_associations
reflection = self.project.user.association_reflections
end
end
It must be noted that this only works when using update
and create
methods.
FAQs
Unknown package
We found that association_reflections 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.