WordPress · Drupal · Site Maintenance · Technical SEO · Editorial Policy

How to Protect a Contentful Site From Bots and Brute-Force Logins

Contentful is a hosted headless CMS, so a bot-defence plan looks different from a self-hosted CMS. Contentful runs the editing platform and its APIs. You control who can sign in, which API keys and tokens exist, which apps and webhooks are connected, and the separate front-end that your visitors actually load. Bots can target every one of those layers, so this guide takes them in turn.

Know where bots can actually reach you

There is no public login page on your own domain, because the content editor lives on Contentful’s side. That removes one common target, but it leaves four others:

  • Contentful user accounts in the web app, which attackers may try with reused passwords from other breaches (credential stuffing).
  • API tokens that sit in code, build settings or old documents.
  • Your front-end, which can be scraped or flooded with requests.
  • Forms on your site, such as contact, newsletter or lead forms, which spam bots love.

Contentful is responsible for the security of its own platform. Everything else on this list is configuration you own. The vendor’s developer documentation is the reference for exact settings, and some of them depend on your plan.

Lock down Contentful accounts

Credential stuffing works because people reuse passwords. Your goal is to make a stolen password useless on its own.

  • Turn on two-factor authentication for every user, starting with organisation owners and admins. Contentful supports an authenticator app as a second factor in account settings.
  • Use single sign-on if your plan offers it. SSO moves login, password rules and lockouts to your identity provider, and it makes offboarding a single step. Availability depends on your Contentful plan, so check before you design around it.
  • Require a password manager. A long, unique password for each person beats any complexity rule.
  • Review organisation and space roles. Give editors the editor role, not admin. Keep the number of organisation owners small.
  • Remove people who have left. Freelancers and agencies are the usual forgotten accounts.

If you use a shared login for a team inbox or an agency, replace it with named accounts. A shared password cannot be traced, and it cannot be protected by a personal second factor.

Treat API keys and tokens as the real passwords

In a headless setup, a leaked token is often worse than a guessed login, because bots never need to sign in at all. Contentful uses several kinds of credential, and they carry very different risk:

  • Content Delivery API tokens read published content. They are designed to be used by a front-end, so assume they can be seen. Never use them for anything that should stay private.
  • Content Preview API tokens read draft content. Keep them on the server side and out of public pages.
  • Content Management API tokens, including personal access tokens and OAuth applications, can change or delete content. Treat them like admin passwords.

Practical habits that apply to all three:

  1. Store tokens in your hosting platform’s environment variables or a secrets manager, never in the repository or in front-end bundles.
  2. Create a separate token for each environment and integration, so you can revoke one without breaking the rest.
  3. Revoke any token you cannot identify an owner for.
  4. Rotate a token straight away if it appeared in a commit, a screenshot, a support ticket or a chat message.
  5. Prefer personal access tokens tied to a named person only for short-lived scripts, and delete them when the work is done.

Contentful’s own APIs apply rate limits, so a bot hammering them will be slowed down. That protects the platform. It does not protect your quota or your front-end, so a stolen token still needs to be revoked quickly.

Protect the front-end that you host

Your website is where scraping and request floods land, and it is yours to defend. How much you can do depends on where it runs.

  • Put a CDN or web application firewall in front of it. Most hosting platforms and CDNs offer rate limiting, bot scoring and country or network rules. Availability and tuning depend on your hosting plan.
  • Rate limit by route. Search, form endpoints and any API route you built should have tighter limits than static pages.
  • Cache aggressively. Static or cached pages cost almost nothing to serve, so a scraper gains nothing from hitting them again and again.
  • Keep your own API routes thin. If a server route calls Contentful on every request, a flood of bot traffic becomes a flood of API calls. Cache the responses.
  • Use robots.txt for polite crawlers only. It is a request, not a barrier, and bad bots ignore it.

Published content is public by design, so you cannot fully stop copying. You can make it expensive at scale with rate limits and bot detection. Keep the front-end’s framework and dependencies patched, because unlike the CMS, nobody updates them for you. The OWASP Top Ten is a sound checklist for the web application layer.

Stop spam on forms, webhooks and installed apps

Contentful stores content; it does not process visitor form submissions for you. Spam therefore arrives at whichever form handler you chose, such as a serverless function, a form service or your CRM.

  • Add a CAPTCHA or challenge to public forms, and verify the result on the server. A check done only in the browser is trivial for a bot to skip.
  • Add a honeypot field, a hidden input that real people never fill in, as a cheap extra layer.
  • Rate limit the submission endpoint and reject payloads that are oversized or malformed.
  • Do not write raw submissions straight into Contentful through a management token. Validate them first and keep them in a separate system.
  • Secure webhooks. Contentful lets you add custom headers to a webhook, so use a secret value and check it in the receiving endpoint. Otherwise anyone who finds the URL can trigger your builds.
  • Audit installed apps. Remove Marketplace apps and extensions nobody uses, and check what access the remaining ones are granted.

Accessible challenges matter too. Pick a CAPTCHA option that works with keyboards and screen readers, so you do not lock out real visitors. For the underlying HTTP behaviour, such as status codes for throttled requests, the MDN HTTP documentation is a stable reference.

A routine to keep it working

Bot defence decays quietly as people join, leave and add integrations. A short recurring review keeps it current:

  1. Check that every active user has two-factor authentication or SSO.
  2. List all tokens and delete the ones with no clear owner.
  3. Review organisation and space roles against who really needs access.
  4. Look at your CDN or firewall logs for spikes on form and search routes.
  5. Send a test submission through each public form and confirm the CAPTCHA and server check still run.

Contentful’s help centre explains the account and organisation settings mentioned above for your current plan.

Frequently asked questions

Can bots brute-force my Contentful login?

They can attempt it against the Contentful sign-in, as with any online service, but the platform side is run by the vendor. Your part is to enable two-factor authentication, use unique passwords or SSO, and remove unused accounts, so that a guessed or leaked password is not enough.

Should I hide my Content Delivery API token?

It is meant to be used by a front-end, so it can be exposed to visitors, and it only reads published content. Hide your Preview and Management tokens instead, and keep them out of any code that reaches the browser.

Does a CAPTCHA protect my content from scrapers?

Not by itself. A CAPTCHA is aimed at form spam. For scraping, rely on caching, rate limiting and bot detection at your CDN or firewall, and accept that public pages can always be read by someone.

We use essential cookies to make this site work and remember your preferences. We do not use advertising or analytics cookies. Privacy Policy. Cookie Policy.