
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Glin-Profanity is a lightweight and efficient Python package designed to detect and filter profane language in text inputs across multiple languages.
A lightweight and efficient Python package designed to detect and filter profane language in text inputs across multiple languages.
pip install glin-profanity
from glin_profanity import Filter
# Basic usage
filter_instance = Filter()
# Check if text contains profanity
if filter_instance.is_profane("This is a damn example"):
print("Profanity detected!")
# Get detailed results
result = filter_instance.check_profanity("This is a damn example")
print(result["profane_words"]) # ['damn']
print(result["contains_profanity"]) # True
from glin_profanity import Filter, SeverityLevel
# Advanced configuration
config = {
"languages": ["english", "spanish"], # Specific languages
"case_sensitive": False, # Case sensitivity
"word_boundaries": True, # Enforce word boundaries
"replace_with": "***", # Replacement text
"severity_levels": True, # Enable severity detection
"custom_words": ["badword"], # Add custom words
"ignore_words": ["exception"], # Ignore specific words
"allow_obfuscated_match": True, # Detect obfuscated text
"fuzzy_tolerance_level": 0.8, # Fuzzy matching threshold
}
filter_instance = Filter(config)
__init__(config: Optional[FilterConfig] = None)
Initialize the filter with optional configuration.
is_profane(text: str) -> bool
Check if text contains profanity. Returns True
if profanity is detected.
check_profanity(text: str) -> CheckProfanityResult
Perform comprehensive profanity analysis with detailed results.
matches(word: str) -> bool
Check if a single word matches profanity patterns. Alias for is_profane()
.
check_profanity_with_min_severity(text: str, min_severity: SeverityLevel) -> Dict
Check profanity with minimum severity filtering.
CheckProfanityResult
{
"contains_profanity": bool,
"profane_words": List[str],
"processed_text": Optional[str], # If replace_with is set
"severity_map": Optional[Dict], # If severity_levels is True
"matches": Optional[List[Match]], # Detailed match information
"context_score": Optional[float], # Context analysis score
"reason": Optional[str] # Analysis reason
}
SeverityLevel
SeverityLevel.EXACT
: Exact word matchSeverityLevel.FUZZY
: Fuzzy/approximate matchArabic, Chinese, Czech, Danish, English, Esperanto, Finnish, French, German, Hindi, Hungarian, Italian, Japanese, Korean, Norwegian, Persian, Polish, Portuguese, Russian, Spanish, Swedish, Thai, Turkish
# Clone the repository
git clone https://github.com/GLINCKER/glin-profanity
cd glin-profanity/packages/py
# Install with development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run tests with coverage
pytest --cov=glin_profanity
# Format code
black glin_profanity tests
# Sort imports
isort glin_profanity tests
# Type checking
mypy glin_profanity
# Linting
ruff check glin_profanity tests
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
See CHANGELOG.md for a list of changes and updates.
FAQs
Glin-Profanity is a lightweight and efficient Python package designed to detect and filter profane language in text inputs across multiple languages.
We found that glin-profanity demonstrated a healthy version release cadence and project activity because the last version was released less than 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 flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.