captcha_secret

The captcha_secret directive sets the secret key used for generating captcha hashes.

Syntaxcaptcha_secret string;
Defaultsecret
Contexthttp, server, location
Arguments1

Description

The captcha_secret directive is used within the NGINX Captcha Module to specify a secret string that plays a crucial role in generating captcha hashes. When a captcha is generated, this secret is combined with the captcha text and CSRF token to create an MD5 hash. This hash is then used for validation when responses are submitted back to the server. The security of the captcha system relies on the secrecy of this key; if disclosed, it could allow malicious users to bypass the captcha verification process by crafting valid responses.

In the context of its parameters, the captcha_secret directive expects a single string argument which is specified directly after the directive in the configuration. This should be a robust and unique string to maximize security. Avoid using straightforward secrets or those that could be easily guessed. The directive is usable in various contexts including http, server, and location, enhancing its versatility depending on where you need captcha support within your site's routing.

Proper implementation of this directive is vital when designing forms and user interactions that require bot mitigation strategies. Without it, the risk of unauthorized access increases, as the MD5 hash used to validate captcha responses would lack its necessary secret component to ensure integrity and security.

Config Example

captcha_secret "my_secret_key";

Ensure the secret is kept confidential as its compromise can undermine captcha security.

Using a predictable secret may allow attackers to guess valid responses.

Remember to set the secret for each location where captcha is implemented; it does not default globally.

← Back to all directives