Membrane API Gateway links to this page when the sqlInjectionProtection plugin finds a SQL injection pattern in a message and blocks it. The detection rules are derived from the OWASP Core Rule Set.
The response contains the problem type https://membrane-api.io/problems/security, a link to this page and the header X-Protection: Content violates SQL injection security policy. The type security means that a security plugin blocked the message. The status depends on the flow:
The request of the client contains content that matches a rule. The request does not reach the backend.
The response of the backend contains content that matches a rule, for example a SQL error message. The client receives this error instead of the response. In production mode, the title of this 502 is replaced by Internal Server Error.
The plugin checks the path, query parameters, form fields, JSON values and text bodies, and optionally headers. level selects the paranoia level from 1 to 4: higher levels enable more rules and cause more false positives.
api:
port: 2000
flow:
- limit:
maxBodyLength: 100000
- sqlInjectionProtection:
level: 1
target:
url: https://api.predic8.de
api:
port: 2000
flow:
- limit:
maxBodyLength: 100000
- sqlInjectionProtection:
level: 1
target:
url: https://api.predic8.de
A parameter or body contains SQL fragments such as ' OR 1=1 --. This is what the plugin is designed to block.
Legitimate content looks like SQL to the rules, for example free text with quotes and keywords like select or union. False positives are more likely at higher levels.
With inspectHeaders: true, headers such as User-Agent or Referer can match a rule.
In the response flow, content returned by the backend matches a rule.
level: 1 and leave inspectHeaders off.onDetect: warn so that hits are only logged.request flow.api:
port: 2000
flow:
- sqlInjectionProtection:
level: 1
onDetect: warn
target:
url: https://api.predic8.de
api:
port: 2000
flow:
- sqlInjectionProtection:
level: 1
onDetect: warn
target:
url: https://api.predic8.de
By default, Membrane runs in development mode and adds details to error responses that help you find the problem. These details may reveal information about your setup. In production, turn them off:
configuration:
production: trueconfiguration: production: true
Add the configuration document to your apis.yaml and separate it from the APIs with ---.
Configuration reference:
Tutorials with runnable examples:
Still stuck? See the troubleshooting guide or ask on GitHub Issues. For commercial support, contact info@predic8.de.