How to apply regular protection policy for formparam in apigee edge?

sravanig231
Participant III

Hello Team,

How to apply regular protection policy for incoming request form params. In my request iam passing client id,username,password,client-secret and grant-type.

If any user can not add more than these fields.

How we can restrict this by using regular expression.

Can anyone please refer how to write regular expressions.

Thank you,

0 2 82
2 REPLIES 2

Regex over request.content would be one way to do this, but writing and testing a regex that could successfully do it would probably difficult for a regex beginner to understand.

Using the regex playground at https://www.freeformatter.com/java-regex-tester.html it seems to be possible with this regex:

(^|&)(?!(field1|field2))[^=]+=

where field1 and field2 are the permitted fields.

For this specific use case, you may find it easier to simply read request.formparams.names inside a javascript policy and iterate through the results though.

Not applicable

can take help of this https://regexr.com