Guide Overview
Summary:
This guide explains how to configure your Content Security Policy (CSP) so the TrustedForm Certify Web SDK can successfully generate certificates for leads on your website.
Learning Objectives:
- Understand what a Content Security Policy (CSP) is and why it matters
- Learn which domains must be allowed in your CSP
- Confirm that TrustedForm Certify is working correctly under your CSP configuration
Quick Start Workflow
- Review your existing Content Security Policy
- Allow necessary script and network domains
- Deploy the updated CSP
- Submit a test form
- Confirm the TrustedForm certificate field is present
Step-by-Step Instructions
Step 1. Understand Your Content Security Policy (CSP)
- Goal: Know how CSP affects third-party scripts like TrustedForm Certify
- Context: A CSP defines which sources of scripts, images, and network requests are permitted by the browser. It helps prevent malicious or unauthorized code from running on your site.
Instructions:
- Locate where your CSP is defined (HTTP response headers or
<meta>tags). - Review the existing
script-src,img-src, andconnect-srcdirectives. - Identify whether third-party domains are restricted.
Expected Result:
You understand where and how your CSP is enforced on your site.
Step 2. Allow Required Domains
- Goal: Ensure TrustedForm Certify can load its SDK and communicate with its API
- Context: The TrustedForm Certify Web SDK loads a script from a CDN and communicates with an API to generate a certificate URL. Both actions must be permitted by your CSP.
Instructions:
-
Add the following domains to your CSP:
cdn.trustedform.comapi.trustedform.com
-
Allow these domains in the following directives:
script-srcimg-srcconnect-src
-
Confirm the changes are saved in your CSP configuration.
Expected Result:
Your CSP explicitly allows TrustedForm to load scripts and make network requests.
Step 3. Apply a Minimal Working CSP Example
- Goal: Quickly validate a known-good CSP configuration
- Context: The example below shows the minimum CSP entries required for TrustedForm to function correctly.
Instructions:
- Compare your CSP against the example below.
- Add or merge the required TrustedForm entries as needed.
Content-Security-Policy:
default-src 'self';
script-src 'self' 'unsafe-inline' https://api.trustedform.com https://cdn.trustedform.com;
img-src 'self' https://api.trustedform.com https://cdn.trustedform.com;
connect-src 'self' https://api.trustedform.com https://cdn.trustedform.com;
- Deploy the updated policy to your environment and install the TrustedForm Certify Web SDK on your form pages.
Expected Result:
Your CSP includes all required TrustedForm domains while preserving your existing security rules.
Validate Your Setup
After updating your CSP:
- Open the page containing your form.
- Open your browser’s developer tools.
- Inspect the form fields.
- Look for a hidden field named
xxTrustedFormCertUrl(or your custom field name).
If the field is present, TrustedForm is working correctly under your CSP.
Troubleshooting
| Symptom / Error Message | Likely Cause | Resolution |
|---|---|---|
| TrustedForm certificate not created | TrustedForm domains blocked by CSP | Add cdn.trustedform.com and api.trustedform.com to CSP directives |
Missing xxTrustedFormCertUrl field |
SDK unable to load or connect | Confirm script-src and connect-src allow TrustedForm domains |
| CSP console errors in browser | Incomplete CSP configuration | Review and update CSP using the provided example |
Frequently Asked Questions (FAQ)
Q: Why does TrustedForm Certify require CSP changes?
A: TrustedForm Certify loads its SDK from a CDN and sends requests to its API. A restrictive CSP must explicitly allow both actions.
Q: Do I need to replace my existing CSP?
A: No. You can add the domains to your existing policy while keeping all other rules intact.
Q: Which field confirms TrustedForm Certify is working?
A: The hidden form field named xxTrustedFormCertUrl (or a custom field name) confirms successful certificate generation.
Glossary
| Term | Definition |
|---|---|
| Content Security Policy (CSP) | A browser security feature that restricts which sources can load scripts, images, and network requests |
| TrustedForm Certify Web SDK | A JavaScript SDK that generates TrustedForm certificates |
| CDN | Content Delivery Network |
| Certificate URL | A URL generated by TrustedForm Certify that represents proof of lead origin |
Comments
0 comments
Please sign in to leave a comment.