Shopware 6: protect your forms with SilentShield
The “SilentShield” extension plugs into the captcha selection of Shopware 6. Every form that Shopware protects with a captcha is then checked by SilentShield, without a puzzle for your customers and without code of your own.
Beta
The extension is in beta and not yet published in the Shopware Store. You can get the installation package (ZIP file) from our support.
Requirements
- Shopware 6.6 or 6.7 (fully tested with 6.7.2.2)
- PHP 8.2 or later with the PHP extension curl
- A SilentShield account with an API key for your shop's domain
How the protection works
- On the page with the form, the extension loads the SilentShield script. It observes how the form is used and puts a one-time proof into a hidden field. Your visitors solve no puzzle and click nothing extra.
- When the form is submitted, your server uses the secret key to ask SilentShield whether a person filled it in.
- In “Enforce” mode, only a submission that SilentShield judges human gets through. All others are rejected with an error message at the form.
Installation
In the Administration the extension is called “SilentShield”. Its technical name is “Forge12SilentShield” (manufacturer: Forge12 Interactive); you see it in the package file name and in command-line commands.
- In the Shopware Administration, open “Extensions → My extensions”.
- Click “Upload extension” and select the ZIP file (Forge12SilentShield-<version>.zip).
- Click “Install” next to “SilentShield”, then “Activate”.
Alternatively, on your shop's command line:
bin/console plugin:zip-import Forge12SilentShield-<version>.zip
bin/console plugin:refresh
bin/console plugin:install --activate Forge12SilentShieldYou do not need Composer: the SilentShield PHP SDK is included in the package. If it is already installed in your shop via Composer, the extension uses that copy.
Enter your keys
You need two values from the SilentShield dashboard. You find both under “API keys” with your key:
- Site key (in the extension: “Site key”): public. It loads the script and appears in your page source. It is valid for the domain you entered when you created it.
- Secret key (in the extension: “Server secret”): stays on your server and is never sent to the browser. Do not share it.
- Open “Extensions → My extensions” and the configuration of “SilentShield”.
- Enter the site key under “Site key (public)” and the secret key under “Server secret”.
- Choose the mode (“Enforce” or “Observe”) and, under “If SilentShield cannot be reached”, whether submissions are then accepted (default) or rejected.
- Under “SilentShield endpoint” you can choose “EU (api-eu.silentshield.io)”; the default is api.silentshield.io.
- Save.
The settings apply per sales channel. “All sales channels” is the default that the others inherit.
Recommended start
Set the mode to “Observe” for the first few days. No submission is rejected then, and the extension records what would have been rejected (where, see “Check that it works”). If everything looks as expected, switch to “Enforce”.
Switch on the captcha
- Open “Settings → Basic information” and go to the “Captcha” section.
- Switch on “SilentShield (invisible)” and save.
The entry is created during installation but not switched on. Your forms are protected only after this step.
Protected forms
- Contact form, including the contact page in the footer
- Newsletter subscription
- Customer registration, including guest checkout
Not protected: password recovery, product reviews and login. Shopware does not call a captcha there, so the extension cannot check these forms.
Check that it works
- Open a page with a protected form and view the page source (right-click, “View page source”). Search for “client.js?k=”. If you find a script from api.silentshield.io or api-eu.silentshield.io with your site key, the script is in place.
- Fill in the form like a visitor and submit it. It must go through without an error message.
- Counter-check in “Enforce” mode: turn off JavaScript for the page in your browser, reload it and submit the form again. The proof is then missing, and the submission is rejected with an error message, just like a bot that skips the script.
What the extension records is in the Shopware log (folder var/log, channel forge12_silentshield): in “Observe” mode every submission that would have been rejected, plus every submission that was accepted unchecked during an outage. The secret key, the proof and form contents are never logged.
If SilentShield cannot be reached
If SilentShield cannot be reached (outage, maintenance, timeout) or your secret key is refused, the extension's outage setting decides. With “accept” (default), submissions go through unchecked and are logged: your forms keep working but are not protected during that time. With “reject”, they stay protected but accept nothing from real visitors either. A bot verdict is never let through, whatever is set.
Troubleshooting
- The page source shows no client.js
- Check that “SilentShield (invisible)” is switched on under “Settings → Basic information → Captcha” and that a site key is entered for the sales channel. The script only loads if both are true.
- Real visitors are rejected
- Usually the script does not load, for example because a Content Security Policy blocks it. Without the script the proof is missing, and that cannot be told apart from a bot. Shopware sets no Content Security Policy by default. If you have set one up, allow the SilentShield address (https://api.silentshield.io or https://api-eu.silentshield.io) in script-src and connect-src, plus 'self' for the extension's script under /bundles/forge12silentshield/.
- Submissions go through and the log shows warnings
- SilentShield could not be reached, or your secret key was refused (reason “auth”). Check the secret key and the status of your API key in the dashboard.
- Real visitors are rejected for a short time
- If a very large number of submissions arrives in a short time, SilentShield temporarily rejects further ones, even if submissions should be accepted during an outage. Otherwise an attacker could first fill the limit and then get every bot through. After a short time, real visitors get through again.
- Forms appear in the dashboard under a new name
- The extension reports the supported forms to SilentShield under their own name, so a verdict only applies to that form. Check the settings of the forms under the new name in the dashboard.
Limits
- Only forms for which Shopware calls a captcha are protected (see “Protected forms”). Captcha forms of other extensions are checked too, but without a form name of their own.
- While SilentShield cannot be reached and submissions are accepted, your forms are not protected. Every such submission is logged.
- The script runs on every page of your shop while the captcha is switched on and a site key is entered.
- The three forms report to SilentShield as shopware-contact, shopware-newsletter and shopware-register.