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

To expose directives APi to create a directive #864

Open
Tracked by #945
VermaShivansh opened this issue Aug 10, 2023 · 4 comments
Open
Tracked by #945

To expose directives APi to create a directive #864

VermaShivansh opened this issue Aug 10, 2023 · 4 comments
Labels
v4 Work for v4

Comments

@VermaShivansh
Copy link

VermaShivansh commented Aug 10, 2023

Summary

The feature should expose something similar to plugins.RegisterAction to register custom directives.

Basic example

One should be able to add a custom directive with plugins.RegisterDirective(). There was something similar in v2 according to this plugin but seems missing in v3.

Motivation

This will help in extending the flexibility of creating plugins.
Current Issue:- Right now I am creating a plugin for rate-limit support for Coraza but I have to mention the configuration for rate-limit using an action called rate-limit (part of the plugin) for each rule. Once I have the capability to add directives I can add a directive that saves default rate-limit plugin configuration.

@jptosso
Copy link
Member

jptosso commented Aug 10, 2023

I agree.

I have been doing some research, and we have certain limitations:

  • Directives should only affect operators and actions
  • We can easily add values from directives into OperatorOptions, but what about actions? They receive RuleMetadata. Should we only implement it for operators?
  • Where do we store custom data from custom operators? The current implementation of directives has access to sensitive low-level stuff we want to avoid exposing, like rule parsing.

cc @corazawaf/core-developers

@jcchavezs
Copy link
Member

@jcchavezs
Copy link
Member

Wanna take a stab @VermaShivansh ?

@VermaShivansh
Copy link
Author

Sure

@jptosso jptosso mentioned this issue Dec 27, 2023
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v4 Work for v4
Projects
None yet
Development

No branches or pull requests

3 participants