Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package:sanitize_html - Added containsDisallowedContent Function for Detecting Prohibited HTML in User-Defined Validation Scenarios #263

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jawad111
Copy link

Motivation:
In scenarios where users only want to detect malicious or disallowed HTML content without sanitizing it, a validation mechanism becomes crucial. This feature allows applications to abort processes or take corrective actions when encountering unsafe HTML, ensuring robustness and security.

Use Cases:

  1. Prevent Malicious Submissions:
    Detect malicious content in user-generated inputs, such as comment fields or form submissions, and reject the input early without modifying the HTML.

  2. Abort Application Flow:
    Halt the execution of specific workflows (e.g., data processing or rendering) if unsafe HTML is detected, ensuring that the application does not proceed with invalid data.

  3. Custom Security Workflows:
    Integrate with security pipelines to log, monitor, or analyze the occurrence of unsafe HTML without sanitizing or altering the input.

  4. Audit User Content:
    Validate HTML against custom policies for compliance audits without altering the original content, useful for applications dealing with regulatory constraints or collaborative platforms.

Summary of Changes:

  • Introduced containsDisallowedContent, a validation function to detect prohibited HTML tags, attributes, or links.
  • Allows developers to define custom rules for id, class, and attribute handling.
  • Empowers applications to proactively handle invalid content without performing sanitization.

This feature extends the library's utility by providing a lightweight, focused mechanism for HTML validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant