Search code examples
netlify

Netlify honeypot attribute missing on deployment


I have a django website that I'm using the django_distill app to generate a static site which I'm deplying to netlify. I've decided to add a bot protection field to a form (https://docs.netlify.com/forms/spam-filters/#honeypot-field ). When I run the site locally I see

<form data-netlify="true" name="consultdocs" netlify-honeypot="BOTFIELD" action="/contact/" id="form" method="post" novalidate="novalidate"> <input type="hidden" name="csrfmiddlewaretoken" value="rdKh4K2zu9T96aEUO9exSv3QCAm5w"> 
 <input id="id_BOTFIELD" name="BOTFIELD" type="hidden"> 
 ....

When I deploy to netlify:

<form name="consultdocs" action="/contact/" id="form" method="post" novalidate="novalidate"><input type="hidden" name="form-name" value="consultdocs"> <input type="hidden" name="csrfmiddlewaretoken" value="GNnbYgQu6vLduSpWEswAVXfEx"> 

<input id="id_BOTFIELD" name="BOTFIELD" type="hidden"> 
.... 

I no longer see the :

netlify-honeypot="BOTFIELD"

attribute. Does netlify remove this?


Solution

  • In short: Yes, netlify removes this field.

    I thought initially it's because of the missing data-prefix but netflify removes it independently if it's used with data-netlify="true" data-netlify-honeypot="BOTFIELD OR just netlify="true" netlify-honeypot="BOTFIELD.

    I did a quick isolation test to ensure django is not doing some magic. So I simply used two static html files and pushed them to netlify:

    In both cases it disappears. You can check the respective source code for both files here:

    https://github.com/christoph-kluge/netlify-example

    I assume that netlify is parsing your HTML code during deployment and is adjusting it. Additionally netflify already checks if a specific post is a potential bot and drops those requests for you. So they need to do something with those fields.

    Hope this answers your question.