Help with Secure CSP Header
$30-250 AUD
Posted 1 minute ago
•
Ends in 6 days
$30-250 AUD
Paid on delivery
We have the following CSP: ==== ==== ==== # Content Security Policy default-src 'self'; script-src 'report-sample' 'self' [login to view URL] [login to view URL] [login to view URL] [login to view URL]; script-src-elem [login to view URL] [login to view URL] style-src 'report-sample' 'self' [login to view URL]; object-src 'none'; base-uri 'self'; connect-src 'self' [login to view URL] [login to view URL]; font-src 'self' [login to view URL]; frame-src 'self' [login to view URL] [login to view URL] [login to view URL]; img-src 'self' data: [login to view URL]; manifest-src 'self'; media-src 'self'; report-uri [login to view URL]; worker-src 'none'; ==== ==== ==== However, our frontend has console errors: ==== ==== ==== Loading the stylesheet '[login to view URL]:100,200,300,regular,500,600,700,800,900&subset=latin,latin-ext&display=swap' violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline' 'unsafe-eval'". Note that 'style-src-elem' was not explicitly set, so 'style-src' is used as a fallback. The action has been blocked. Loading the script '[login to view URL]' violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback. The action has been blocked. Loading the script '[login to view URL]' violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback. The action has been blocked. ==== ==== ==== As far as I know, these hosts are in the right place in the CSP. Hepl
Project ID: 40824060
About the project
25 proposals
Open for bidding
Remote project
Active 11 secs ago
Place your bid
Bid amount Email addressBenefits of bidding on Freelancer
Set your budget and timeframe
It's free to sign up and bid on jobs
25 freelancers are bidding on average $139 AUD for this job


Your CSP errors indicate that the browser is enforcing a different policy than the one shown—specifically, a policy containing only `'self' 'unsafe-inline' 'unsafe-eval'`. Resolving this requires tracing where the effective CSP is being delivered, such as response headers, meta tags, a CDN, or server configuration, rather than simply adding domains to the displayed policy. My expertise in web security and website testing enables me to inspect the active headers, identify conflicting or duplicated CSP definitions, and verify the policy against the required Google Fonts, Google Tag Manager, and Sharelink resources. I can also review related directives such as `style-src-elem`, `script-src-elem`, and any report-only versus enforced policies so the correction remains secure rather than broadly weakening CSP. I am ready to diagnose the effective policy and help you implement a clean, validated CSP that permits the required services without unnecessary source access.


Greetings, I've gone through your Content Security Policy (CSP) and the console errors you're facing. It looks like certain external resources, like the Google Fonts and the Google Tag Manager scripts, are getting blocked due to the current CSP settings. The issue seems to stem from the fact that the `style-src` and `script-src` directives aren't allowing the necessary sources because they are not explicitly included. To address this, I would review and update your CSP to ensure that those specific domains are whitelisted. This would allow the styles and scripts to load without triggering any errors. My experience with web security and CSP configurations means I can help resolve this issue effectively and ensure your site runs smoothly while keeping it secure. Best regards, Saba Ehsan


Skip – This requires hands-on CSP and web security troubleshooting. Although the errors suggest a mismatch between the policy actually enforced by the browser and the CSP shown in the project, your profile provides no web security or website testing experience to support diagnosing and fixing it. The client has a strong project history, and payment and deposit are verified; identity is unverified.


Hello, I can help you clean up this CSP issue and get the browser to recognize the allowed sources properly. From the errors you shared, it looks like your frontend is currently receiving a different policy than the one you pasted here, because the console is falling back to `style-src` and `script-src` with only `'self' 'unsafe-inline' 'unsafe-eval'`. That usually means there may be another CSP header, a meta tag, or a server/CDN layer overriding it. I’ve handled similar CSP debugging before, especially with Google Fonts, GTM/gtag, reCAPTCHA, and third-party widgets where the policy looked correct on paper but the browser still blocked resources because of header conflicts or missing `script-src-elem` / `style-src-elem` handling. A couple of quick things I’d check: 1. Whether there is more than one CSP being sent. 2. Whether the policy is added in a meta tag instead of the response header. 3. Whether `style-src-elem` and `script-src-elem` should be explicitly aligned with your allowed domains. If you’d like, I can review the live headers and pinpoint the exact conflict with you on a call. Best regards, Mehreen


Hi, I'm Fernando from Mexico. I think the issue may be that the CSP shown in your configuration is not the same policy actually being delivered to the browser. Your console errors report a different script-src and style-src policy, including 'unsafe-inline' and 'unsafe-eval', while your supplied policy explicitly allows the Google Tag Manager, ShareLink and Google Fonts domains. This suggests there may be another CSP header, a hosting-level rule, or a meta CSP overriding or supplementing the expected configuration. I'll trace the actual response headers, identify where the conflicting policy originates, and correct the directives without unnecessarily weakening your security. I'll then test the affected resources and verify that the intended policy is enforced. I'd prefer to fix the source of the conflict rather than simply add more domains and hope the errors disappear. Best regards, Fernando


Hi, The console errors show the browser is applying a different policy than the one you've shared, so the fix starts with finding where that header is set. I'll trace the active CSP, correct the directives blocking Google Fonts, Google Tag Manager, and your widget script, and keep the policy strict. With 7+ years in web development, I'll test the header on your live site across browsers and confirm each external host loads without weakening the policy. Could you tell me which platform or server hosts the site, and whether the header is set in code or through a plugin or CDN? Regards, Sakline P.S. Sharing a screenshot of the response headers from your site would help me pinpoint the conflict quickly; I'll also include a short list of the directives I recommend tightening.


Hi, I'm Waqas. Your Content Security Policy is blocking essential scripts and styles, causing console errors on your frontend. I'd start by reviewing the current CSP directives and adjusting them to allow the necessary sources while maintaining security best practices. I would analyze the specific errors, update the `script-src` and `style-src` directives accordingly, and ensure that the changes do not compromise your site's security. After implementing the adjustments, I'd test the frontend to confirm that the errors are resolved and everything loads correctly. Which specific scripts or styles do you need to prioritize for loading?
内容来自 Freelancer News,版权归原作者所有。
阅读原文 ↗