Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Content filter to determine the XSS, spam and profanity content of text
The easiest way to install is with Bundler
gem 'stoolie'
Stoolie will work on Ruby 1.8.7+, however the development gems (such as rspec) will only work on 1.9.3+.
In Rails, create an initializer such as config/initializers/stoolie.rb
and add your SmartFilter rule key and API key
MyApplication::Application.config.stoolie.smart_filter.api_key = 'my api key'
MyApplication::Application.config.stoolie.smart_filter.rule_key = 'my rule key'
Otherwise, add the keys like so:
Stoolie.configure do |config|
config.smart_filter = {rule_key: 'rule-key', api_key: 'api-key'}
end
Stoolie uses Prevoty's SmartFilter by default, but it's possible to add other clients as long as they implement stoolie's API requirements.
These are the default thresholds.
All thresholds can be configured using the names given above.
MyApplication.config.stoolie.smart_filter.profanity_threshold = 5
> result = Stoolie::Filter.new.analyze('<script>xss is bad.</script>')
=> #<Stoolie::Result>
> result.is_insecure?
=> true
> result = Stoolie::Filter.new.analyze('http://mylink.com http://anotherlink.com http://yetanotherlink.com')
=> #<Stoolie::Result>
> result.is_spam?
=> true
> filter = Stoolie::Filter.new
> result = filter.analyze('some text')
=> #<Stoolie::Result>
> result.is_blacklisted?
=> false
> result = filter.analyze('an incredibly racist word')
=> #<Stoolie::Result>
> result.is_blacklisted?
=> true
> result = Stoolie::Filter.new.analyze('enough curse words to trip the threshold')
=> #<Stoolie::Result>
> result.is_offensive?
=> true
If you want to add your own filter client, create one in lib/stoolie/clients/
and make sure it meets the API requirements:
analyze
instance method return @result = Stoolie::Result.new(self)
To use your new client instead of SmartFilter, you can set it in your configuration:
MyApplication::Application.config.client = MyFilterClient
Or on the fly
filter = Stoolie::Filter.new(MyFilterClient)
Copyright (c) 2014 Aaron Wallis. See LICENSE.txt for further details.
FAQs
Unknown package
We found that stoolie 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.