A Contentful site is really two systems. Contentful hosts the content platform. You manage who can sign in, which API keys exist, which apps and webhooks are connected, and the separate front end that displays the content. A compromise almost always happens in the parts you control, so the first job is working out which part was affected.
This guide covers the warning signs, how to confirm what happened, and the first steps to take. Exact features and log detail depend on your Contentful plan and your hosting setup, so check what your own organisation has available.
The two places a problem can start
Sort every symptom into one of two groups before you act.
- Contentful side: people, roles, tokens, apps and webhooks in your organisation and spaces. A problem here means someone gained access to your content or to the way it is delivered.
- Front-end side: the website, app or build pipeline that fetches content and renders it. A problem here can leave Contentful untouched while visitors still see injected code or spam.
Contentful content is usually delivered as structured data. Many injected-script or spam-page problems therefore come from the front-end code, its dependencies, its hosting account or its deployment pipeline, not from the content itself. The reverse is also possible: a malicious script pasted into a rich text or long text field can end up on the page if your front end renders it without sanitising it.
Signs a Contentful site may be compromised
Unexpected people or permissions
Open your organisation settings and review the list of users, invitations and teams. Look for accounts you do not recognise, former staff or contractors who still have access, and roles that are broader than the person’s job needs. A new administrator or a sudden change in space roles is a strong signal.
Content that nobody remembers changing
Check recently edited and recently published entries. Pay attention to changed links, new calls to action, altered legal or pricing text, and entries published outside normal working patterns. Entries keep a version history, so you can compare the current version with earlier ones and see what changed.
Redirects and links that send visitors elsewhere
If your content model includes redirect or URL-slug entries, a changed destination can quietly send visitors, or search engines, to another site. Also check any redirect rules stored in your hosting or CDN configuration, since those sit outside Contentful.
Spam pages and strange URLs
Unfamiliar pages about unrelated products, pages in languages you do not publish, or a sudden jump in indexed URLs can point to new entries created with stolen credentials. They can also point to a front end that generates pages from untrusted input. Search your site on a search engine for terms you would never publish.
Injected scripts and changed page behaviour
Warning signs include pop-ups, unexpected form fields, payment or login prompts you did not build, and requests to domains you do not recognise. A page-source check or the browser developer tools Network tab will show which scripts load and from where.
Search and browser warnings
A search engine notice about hacked content, a browser interstitial warning, or a drop in visibility for your normal pages can all signal a problem. Check the security and manual-actions areas of your search console account if you have one set up.
Unexpected activity in connected systems
Look for webhook deliveries to endpoints you did not create, builds triggered when nobody published anything, and apps installed in a space that nobody on your team recalls adding.
How to confirm what happened
Work through the following in order, and note what you find before you change anything.
- Compare live pages with Contentful. Open a suspect entry in the web app and check the matching live page. If the entry is clean but the page is not, the problem is probably on the front end, in the build, or in a third-party script.
- Review entry versions. For changed content, open the version history and note who saved it and when.
- Review users and roles. Check the organisation and each space, including pending invitations and service-style accounts.
- Review API keys and tokens. List the Content Delivery and Content Preview API keys in each space, and the personal access tokens and any organisation-level tokens used with the Content Management API. Delete anything unrecognised or unused.
- Review apps and webhooks. Check installed apps, custom apps and every webhook URL in each space.
- Check available logs. Depending on your plan, Contentful may offer audit or activity information. If yours does, export what you can. Your hosting, CDN and CI/CD providers keep their own logs, so keep those as well.
- Inspect the front-end repository. Look at recent commits, new collaborators, changed build scripts and dependency changes. Check which deploy keys and environment variables exist.
If you cannot tell whether a change was legitimate, treat it as unconfirmed and ask the person who would have made it.
First steps to take
Act in an order that stops further damage first, then repairs it.
- Limit access. Remove unknown users and cancel unused invitations. Reduce broad roles to what each person needs.
- Require strong sign-in. Ask every user to reset their password and enable two-factor authentication. If your plan includes single sign-on, consider enforcing it so access follows your identity provider.
- Rotate secrets. Revoke and recreate API keys, personal access tokens and webhook secrets. Update your front end and build environment variables with the new values, then confirm the old ones no longer work.
- Remove what you do not trust. Uninstall unknown apps and delete unfamiliar webhooks.
- Restore clean content. Use version history to roll back changed entries, then republish. Delete spam entries only after you have documented them. Keep a record of what was there.
- Clean the front end. Redeploy from a known-good commit, rotate hosting, CDN and repository credentials, and update dependencies. Clear any CDN or site cache so visitors stop receiving the old pages.
- Ask for a re-review. If a search engine or browser flagged the site, request a review once the problem is fixed.
Reduce the chance of a repeat
- Give each person and integration the lowest role that works, and review the user list on a regular schedule.
- Use separate tokens for each integration so one can be revoked without breaking everything.
- Keep Content Management API tokens out of front-end code. Public sites should only need delivery tokens, and those should be read-only by design.
- Sanitise anything rendered from rich text or long text fields, and set a Content Security Policy to limit which scripts can run.
- Review the front end against common web risks such as injection and broken access control, using the OWASP Top 10 as a checklist.
- Add a review step or approval workflow for publishing where your plan supports it.
- Pin and audit dependencies, and protect your repository and deployment pipeline with two-factor authentication.
The Contentful developer documentation describes roles, tokens, apps and webhooks in detail, and is the best place to check what your plan includes.
Frequently asked questions
If my site shows spam, does that mean Contentful was hacked?
Not necessarily. Spam on the live site is often a front-end, hosting or third-party script problem. Compare the entry in Contentful with the live page to find where the change was introduced.
Should I rotate API keys even if I find nothing suspicious?
If you have any reason to doubt who holds a token, rotating it is low-cost and safe, as long as you update every system that uses it. Do it for tokens held by former staff or contractors, and for any token that has appeared in a public repository or a shared document.
Can I see who changed an entry?
Entry version history shows earlier versions of the content. How much detail you get about activity across the organisation depends on your plan, so check which audit features it includes and export that information early if you suspect a problem.