Skip to content

Feature: Pm custom separator #349

@M4tteoP

Description

@M4tteoP

Summary

Hi folks, I'm opening this issue in order to extend the conversation about providing a custom separator for the @pm operator.
It is an open feature request from such a long time inside the Modsecurity repo (see owasp-modsecurity/ModSecurity#682) and Wasm is yet another player that would take advantage of such a feature.

Basic example

I made a first PoC under ModSec repo: owasp-modsecurity/ModSecurity#2786.
This first proposal takes advantage of a fixed string at the beginning of the rule (PmCustomSeparator:) in order to provide and figure out that we are going to use a custom separator.
An overall example of rule syntax is the following:

SecRule REQUEST_BODY "@Pm PmCustomSeparator:| single_word|<this> <is> <a> <string>|trailing_space " "id:999,phase:2,t:lowercase,deny"

Motivation

  • Make the @pm operator more flexible and able to handle some cases that currently can only be managed by PmFromFile.
  • Wasm environment that is lacking file system support would benefit from it.
  • Depending on the design agreed, it may lead also to looking for piped payloads (currently, to the best of my knowledge, it is not possible to match the pipe | character and do not interpret it as Suricata syntax)

Extra details

  • Even a different operator may be a way to go in order to avoid tweaking a known one and not messing with its default design.
  • If we agree on the usefulness of that feature and on a proper design, I would be happy to implement it on Coraza.

Thanks for any feedback!

cc: @jcchavezs

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions