Improving a website’s security score often involves addressing a mix of frontend, server-level, and third-party script concerns. In this case, multiple WordPress sites required enhancements to meet modern security standards, including Subresource Integrity (SRI), HTTP Strict Transport Security (HSTS) validation, and a form markup issue affecting accessibility and security scans.
By implementing targeted fixes through must-use plugins and validating server configurations, the sites achieved stronger security compliance without breaking functionality.
Issue Background
A security audit identified several areas for improvement:
- Missing Subresource Integrity (SRI) attributes on external assets
- Questions around HTTP to HTTPS redirects and HSTS enforcement
- A malformed label element tied to a form field
- A need to improve overall security scan scores
The challenge was to implement these improvements without disrupting third-party integrations, caching, or core functionality.
Diagnosis
- WordPress does not natively add SRI attributes
- Many third-party scripts are dynamic and cannot reliably use static hashes
- Redirects and HSTS were already correctly configured at the server level
- A Gravity Forms markup issue caused a misaligned label tied to reCAPTCHA
Resolution Steps
1. Implement SRI for stable assets
A must-use plugin was created to add integrity attributes only to stable WordPress core assets, using a controlled hash map.
2. Exclude dynamic third-party scripts
Scripts such as Google Tag Manager and reCAPTCHA were excluded due to frequently changing hashes that would break functionality.
3. Verify redirects
Confirmed all legacy domains correctly redirect to the primary HTTPS domain without loops or issues.
4. Validate HSTS
Confirmed HSTS headers were already active and correctly configured at the server level.
5. Fix form markup issue
Implemented a small MU plugin to correct or remove the invalid label associated with a form field, resolving accessibility and scan warnings.
6. Test in staging
All changes were deployed to staging environments first to confirm there were no SRI errors, script failures, or form issues.
7. Deploy safely
Changes were deployed via MU plugins using SFTP, allowing for instant rollback if needed. No downtime was required.
Final Outcome
- Security scan scores improved
- SRI applied safely to stable assets
- HTTPS and HSTS confirmed properly configured
- Form markup issue resolved
- No impact on performance or integrations
If you’re looking to improve your WordPress site’s security without risking performance or integrations, Freshy can help implement best practices safely.
Contact Freshy