Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
PoliteText is making your users' input polite 👀
👉 Replace the swear words or execute callbacks if the input is not polite based on a default swear words list or your own.
Add this line to your application's Gemfile:
gem 'polite_text'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install polite_text
PoliteText has a default list of forbidden words, this list includes the most common swear words used on the web. You can acces the list of swear words here.
include PoliteText
str = "This gem is a fucking big shit but let's try it"
PoliteText.be_polite!(str)
=> "This gem is a *** big *** but let's try it"
include PoliteText
str = "This gem is a fucking big shit but let's try it"
PoliteText.is_polite?(str)
=> false
# == Schema Information
#
# Table name: articles
#
# id :bigint not null, primary key
# text :string default(""), not null
# created_at :datetime not null
# updated_at :datetime not null
#
class Article < ApplicationRecord
include PoliteText
# Callbacks
before_save :make_text_polite
# Methods
def make_text_polite
PoliteText.be_polite!(text)
end
end
Create a custom list in a YAML file following this format :
# custom_swear_words.yml
swear_words:
- gem
- big
- but
Place it where you want in your app, we recommend here : ./lib/polite_text/my_custom_swear_words.yml
📄 Create an initializer named polite_text.rb
✌️ Add the path to your custom swear words list like this :
# ./config/initializers/polite_text.rb
PoliteText.configure do |config|
config.custom_swear_words_path = "#{__dir__}/../../lib/polite_text/custom_swear_words.yml"
end
PoliteText is now configured with your custom list ✨💫
str = "This gem is a fucking big shit but let's try it"
<<<<<<< HEAD
PoliteText.be_polite!(str)
=> "This *** is a fucking *** shit *** let's try it"
PoliteText.is_polite?(str)
=> false
Bug reports and pull requests are welcome on GitHub at https://github.com/OpenGems/polite_text. 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 polite_text 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.