The web application firewall
A web application firewall sits in front of the shops. It filters out common and more complex attack vectors such as SQL injections and the injection of JavaScript before a request even reaches the shop system. The firewall is part of operations and does not need to be set up or maintained in the shop.Invalid characters are removed from input
When reading input, the shop removes control characters and other non-printable characters. These characters have no place in an address, a form field or a search query, and experience shows that they are mainly used to bypass checks. Line breaks, on the other hand, are retained where they are needed from a business perspective, for example in a multi-line message field.For email fields, the shop takes into account the characters that may occur in an address according to the standard. These characters are retained, even if they would be filtered elsewhere.
Defining your own checks
Character filtering says nothing about whether an input is correct from a business perspective. The input checks in the<InputCheck> section of the shop configuration are responsible for this. With them, you specify for each field what is allowed.
The more narrowly you define a field, the smaller the attack surface it offers. A postal code that only accepts digits is preferable to a postal code without a check, even if both are output securely in the end.
Reference: InputCheck section · Guide: Defining checks for address data
Output is secured
This is the load-bearing layer. When the shop outputs a value on a page, it converts the characters that could be used to create markup or code from data. This affects the five characters", &, ', < and >. They appear as HTML entities and therefore as visible text, not as markup.
An input such as <script> is therefore inserted into the page as a character string and displayed by the browser instead of being executed.
The conversion is not built in at a central location but directly in the tags, at the points where values from outside can be inserted. The shop therefore outputs values from a buyer’s input encoded, while purely internal values, such as a calculated quantity, are taken over into the page unchanged.
There are separate encodings for the other contexts. Values that go into a database query, an address, XML or JavaScript are masked for the respective context.
File uploads
For the upload module, the permitted file types can be stored per file extension. If this is set up, the shop determines the actual type of the file during upload and compares it with the extension. This reveals an executable file that was named as an image. If the two do not match, the file is moved to a quarantine area instead of being taken over into the shop, depending on the setting. This process is logged. In addition, a virus scan can be set up for each upload. Guide: Upload module · Reference: Configuration wsupload.configWhat this means for your templates
This results in three things for your daily work. If you output values with the tags intended for this purpose, the protection applies automatically. You do not need to add anything. Do not switch off the protection to solve a display problem. If a value is supposed to appear as markup, the markup belongs in the template and the value goes inside it, not the other way around. Define input fields as narrowly as possible. This does not prevent an attack, but it reduces the attack surface and catches typing errors at the same time.Related topics
- Guide: Security concept and data protection
- Guide: Defining checks for address data
- Reference: InputCheck section
