Add server-side unique-ID or unique token validations

Created on 24 September 2018, about 6 years ago
Updated 18 August 2024, 3 months ago

Overview:

Implement an "advanced" server-side validation for the field.

The field should have the user session ID as a value which is checked on the server via a table to make sure that the form cannot be submitted with just any value or empty.

Purpose:

The purpose of this improvement is to extend the security of a hidden field to a specific-value-per-user check which can make it harder for spammers to get past your honeypot.

Giveaways:

Caching can be a problem if the field value gets cached and used by multiple users, so the page caching should be disabled if server-side validation is enabled.

Considerations:

One should be able to switch on/off the server-side validation, since some people might be more with performance than security (cached form pages vs. non-cached form pages) ruled out, since caching is disabled by default in honeypot.

Solution:

Extend the honeypot_add_form_protection function to add the session_id to the field, add a token field, save the value on a table, and use another validation function _honeypot_advanced_validate to validate the value of the field against the token being used which should be saved in the table.

The token gets invalidated when the form is successfully submitted. The records are deleted with cron jobs using the same expiration time than the log records.

✨ Feature request
Status

Needs work

Version

2.2

Component

Code

Created by

πŸ‡¨πŸ‡·Costa Rica esteban.arias

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024