Skip to content

Commit 3d0ff8e

Browse files
authored
Merge pull request #54 from GravityKit/develop
Release 1.7.1
2 parents ea9699c + 4a31c89 commit 3d0ff8e

4 files changed

Lines changed: 26 additions & 4 deletions

File tree

gravityforms-zero-spam.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Gravity Forms Zero Spam
44
* Plugin URI: https://www.gravitykit.com?utm_source=plugin&utm_campaign=zero-spam&utm_content=pluginuri
55
* Description: Enhance Gravity Forms to include effective anti-spam measures—without using a CAPTCHA.
6-
* Version: 1.7.0
6+
* Version: 1.7.1
77
* Author: GravityKit
88
* Author URI: https://www.gravitykit.com?utm_source=plugin&utm_campaign=zero-spam&utm_content=authoruri
99
* Requires PHP: 7.4

includes/class-gf-zero-spam-token.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,26 @@ public static function validate( string $token, int $expected_form_id ): array {
152152
* @return string The derived HMAC secret.
153153
*/
154154
public static function get_site_secret( int $salt_version ): string {
155-
return hash_hmac( 'sha256', $salt_version . '|' . AUTH_KEY, SECURE_AUTH_KEY );
155+
$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
156+
$secure_auth_key = defined( 'SECURE_AUTH_KEY' ) ? SECURE_AUTH_KEY : '';
157+
158+
// Fall back to a DB-stored secret if wp-config.php salts are missing.
159+
if ( '' === $auth_key && '' === $secure_auth_key ) {
160+
$fallback = get_option( 'gf_zero_spam_fallback_secret' );
161+
162+
if ( ! $fallback ) {
163+
$fallback = wp_generate_password( 64, true, true );
164+
165+
if ( ! add_option( 'gf_zero_spam_fallback_secret', $fallback, '', false ) ) {
166+
$fallback = get_option( 'gf_zero_spam_fallback_secret' );
167+
}
168+
}
169+
170+
$auth_key = $fallback;
171+
$secure_auth_key = $fallback;
172+
}
173+
174+
return hash_hmac( 'sha256', $salt_version . '|' . $auth_key, $secure_auth_key );
156175
}
157176

158177
/**

phpstan.dist.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ parameters:
1616
- %currentWorkingDirectory%/vendor/php-stubs/gravity-forms-stubs/gravity-forms-stubs.php
1717
ignoreErrors:
1818
- '#(Used )?[Cc]onstant GF_ZERO_SPAM_\w+ not found#'
19-
- '#Constant (AUTH_KEY|SECURE_AUTH_KEY) not found#'
2019
- '#Parameter \#6 \$sub_type of static method GFAPI::add_note\(\) expects null, string given#'
2120
- '#Function gf_apply_filters invoked with \d+ parameters, 2 required#'
2221
- '#Action callback returns bool but should not return anything#'

readme.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: gravityview
33
Tags: gravity forms, spam, captcha, honeypot, anti-spam
44
Requires at least: 4.7
55
Tested up to: 6.9.1
6-
Stable tag: 1.7.0
6+
Stable tag: 1.7.1
77
Requires PHP: 7.4
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -110,6 +110,10 @@ You can enable a spam summary report email. This email will be sent to the email
110110

111111
== Changelog ==
112112

113+
= 1.7.1 on March 6, 2026 =
114+
115+
* Fixed: Fatal error on sites where `AUTH_KEY` or `SECURE_AUTH_KEY` constants are not defined in `wp-config.php`
116+
113117
= 1.7.0 on March 5, 2026 =
114118

115119
* Added: Stronger spam prevention using signed, time-limited tokens

0 commit comments

Comments
 (0)