nginxinc / nginx-go-crossplane

A library for working with NGINX configs in Go
Apache License 2.0
46 stars 12 forks source link

Implements NGINX App Protect v5 modules through custom parse options #85

Closed ornj closed 4 months ago

ornj commented 4 months ago

Proposed changes

Added an API for allowing the caller of Parse to specify bitmasks for directives outsides the "core" set of NGINX directives. This would allow the caller to parse an NGINX configuration that contained directives from a dynamic module even if it is a unknown custom one as long as the configuration still matches the expected grammar.

As part of this I moved the NAP WAF v4 directives out of the main directives map before adding directives for WAF v5. The two versions of this module have a different set of directives that I did not want to layer on top of each other. I want to specifically call out that this means the v4 directives are not included in the main directives dictionary which means a configuration using v4 NAP directives that was parsed without error before updating Crossplane would no longer pass until the ParseOptions are updated to include the optional match function. cc: @yluf5 @nickchen

The NGINXaaS team is currently working on adding support for additional versions of NGINX and dynamic modules (including Lua) for which this seems like a viable way to add support for directives outside the core directive set that do not require something heavier such as a customer lexer or parser.

Checklist

Before creating a PR, run through this checklist and mark each as complete.