mofilo_content_filter 1.0.0
mofilo_content_filter: ^1.0.0 copied to clipboard
A comprehensive content filtering package for Flutter that blocks offensive language, hate speech, profanity, and harmful content in multiple languages with advanced bypass detection.
Mofilo Content Filter #
A comprehensive, military-grade content filtering package for Flutter that protects your app from offensive, inappropriate, and harmful content.
Features #
- Multi-layer Detection: 12+ detection layers to catch sophisticated bypass attempts
- Multi-language Support: Filters offensive content in English, Spanish, French, German, Polish, Russian, Portuguese, Italian, Dutch
- Advanced Normalization: Catches l33tspeak, Unicode tricks, zero-width characters, emojis, and visual lookalikes
- Bypass Prevention: Detects encoding (Base64, ROT13, Hex, reversed text), spacing tricks, and character substitution
- Security Protection: Blocks SQL injection, XSS, and other attack patterns
- Comprehensive Coverage: Filters profanity, slurs, hate speech, violence, sexual content, self-harm, and more
- Fuzzy Matching: Uses Levenshtein distance to catch misspellings and variations
- Context-Aware: Analyzes combined text to catch context-based violations
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
mofilo_content_filter: ^0.0.1
Usage #
Basic Usage #
import 'package:mofilo_content_filter/mofilo_content_filter.dart';
// Validate a single field
final result = ContentFilter.validateFoodName("apple");
if (result.isAllowed) {
print("Content is safe!");
} else {
print("Blocked: ${result.reason}");
print("Violations: ${result.violations}");
print("Severity: ${result.severity}");
}
Validate Multiple Fields #
// Validate food name and brand together
final results = ContentFilter.validateAll(
foodName: "chocolate cake",
brandName: "Generic Brand",
);
if (results.isEmpty) {
print("All content is safe!");
} else {
results.forEach((field, result) {
print("$field blocked: ${result.reason}");
});
}
Custom Validation #
// Validate with custom fields
final result = ContentFilter.filter(
foodName: "pizza",
brandName: "Pizza Hut",
);
if (!result.isAllowed) {
// Handle blocked content
showError(result.reason);
}
What Gets Blocked #
The filter detects and blocks:
Language-Based #
- Profanity and vulgar language (multiple languages)
- Racial, ethnic, and religious slurs
- Homophobic and transphobic slurs
- Sexist and misogynistic language
- Ableist slurs
Threat-Based #
- Violence and death threats
- Terrorism and extremism
- Hate speech and symbols
- Nazi/white supremacy content
- Holocaust denial
Harmful Content #
- Self-harm and suicide encouragement
- Child abuse and pedophilia references
- Sexual content and harassment
- Drug references
- Animal abuse
Technical Attacks #
- SQL injection attempts
- XSS (Cross-Site Scripting)
- Spam and gibberish patterns
- Encoded malicious content (Base64, ROT13, etc.)
Bypass Techniques Defended Against #
- Character Substitution: l33tspeak (f0ck, sh1t), symbols (@ss, f*ck)
- Spacing/Separators: f.u.c.k, f-u-c-k, f u c k
- Unicode Tricks: Cyrillic (фuck), fullwidth (fuck), circled (ⓕⓤⓒⓚ)
- Zero-Width Characters: fuck (invisible chars)
- Emojis: f😀u😀c😀k
- Encoding: Base64, ROT13, Hex, reversed text
- Mixed Case: FuCk, FUCK, fUcK
- Asterisks: fk, ner
- Homoglyphs: Using visually similar characters
- Fuzzy Spelling: fck, fuk, fuuk (Levenshtein distance matching)
Result Object #
class ContentFilterResult {
final bool isAllowed; // Whether content passes filter
final String? reason; // Reason for blocking (if blocked)
final List<String> violations; // List of specific violations
final ContentFilterSeverity severity; // Severity level
}
enum ContentFilterSeverity {
none, // Content is safe
low, // Suspicious but might be legitimate
medium, // Likely violation
high, // Definite violation
critical, // Severe violation (slurs, hate speech, CSAM)
}
Publishing Checklist #
Before publishing to pub.dev:
- Update homepage/repository URLs in
pubspec.yaml - Ensure all tests pass:
flutter test - Check package score:
flutter pub publish --dry-run - Update
CHANGELOG.mdwith version notes - Publish:
flutter pub publish
Contributing #
Contributions are welcome! Please:
- Test thoroughly with edge cases
- Follow existing code style
- Update documentation
- Add tests for new features
License #
[Your License Here]
Disclaimer #
This filter aims to block offensive content but no filter is 100% perfect. Always combine with human moderation for critical applications.