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.
= Foreigner
Foreigner introduces a few methods to your migrations for adding and removing foreign key constraints. It also dumps foreign keys to schema.rb.
The following adapters are supported:
== Installation
Add the following to your Gemfile:
gem 'foreigner'
== API Examples
Foreigner adds two methods to migrations.
(Options are documented in connection_adapters/abstract/schema_definitions.rb):
For example, given the following model:
class Comment < ActiveRecord::Base belongs_to :post end
class Post < ActiveRecord::Base has_many :comments, :dependent => :delete_all end
You should add a foreign key in your migration:
add_foreign_key(:comments, :posts)
The :dependent option can be moved from the has_many definition to the foreign key:
add_foreign_key(:comments, :posts, :dependent => :delete)
If the column is named article_id instead of post_id, use the :column option:
add_foreign_key(:comments, :posts, :column => 'article_id')
A name can be specified for the foreign key constraint:
add_foreign_key(:comments, :posts, :name => 'comment_article_foreign_key')
== Change Table Methods
Foreigner adds extra methods to change_table.
Add a missing foreign key to comments:
change_table :comments do |t| t.foreign_key :posts, :dependent => :delete end
Remove an unwanted foreign key:
change_table :comments do |t| t.remove_foreign_key :users end
== License
Copyright (c) 2011 Matthew Higgins, released under the MIT license
FAQs
Unknown package
We found that ws-foreigner 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.