Skip to content

Scrub the Gravity Forms Mailchimp Add-On's API credentials - #222

Merged
Ninodevo merged 1 commit into
trunkfrom
fix/gf-mailchimp-api-key
Nov 10, 2026
Merged

Ninodevo merged 1 commit into
trunkfrom
fix/gf-mailchimp-api-key

Conversation

@Ninodevo

Copy link
Copy Markdown
Contributor

Summary

  • Scrub the Gravity Forms Mailchimp Add-On's credentials. On a copy of a production site, Safety Net left the add-on's OAuth token and legacy API key in place, so a form submitted on the copy could subscribe people to the live Mailchimp audience if the add-on ran.
  • includes/integrations/mailchimp.php now blanks access_token and apiKey in gravityformsaddon_gravityformsmailchimp_settings through partial_options, with the usual _sn_backup. The option name, slug and keys were checked against the add-on's source (5.7.2).
  • The rest of the settings array stays, server_prefix and the group_key_* entries among them: the add-on's get_group_setting_key() writes into that array, which throws a TypeError on PHP 8 when the whole option has been blanked to ''.
  • The add-on's feeds in gf_addon_feed stay. Their fields hold audience IDs, field mappings, tags and conditions, not credentials.
  • README: one line in the Mailchimp section.

Notes

  • The existing mailchimp plugin pattern already matches gravityformsmailchimp/mailchimp.php, so the add-on is deactivated as before; the new fixture plugin and the A14 assertion keep that covered.
  • Not in this PR: the add-on's form entries (gf_entry, gf_entry_meta, gf_entry_notes, gf_draft_submissions) and the Jetpack CRM Mailchimp extension's settings, which the same copy also kept.

Test plan

  • npm test -- staging-plugin: A2-A13 shows access_token and apiKey blanked, server_prefix and the group key kept and the backup holding the token; A14 shows gravityformsmailchimp/mailchimp.php deactivated.
  • npm test -- wp-cli: C8 lists the Mailchimp integration with 4 options and the new partial_options entry in its JSON.
  • npm test: every scenario passes (304 passed locally on PHP 8.3, WordPress latest).
  • phpcs includes/integrations/mailchimp.php reports no errors.

A copy of a production site kept the add-on's OAuth token and legacy API
key, so a form submitted on the copy could subscribe people to the live
audience. Blank access_token and apiKey inside its settings array and keep
the rest, since the add-on fatals on PHP 8 when it writes a group key into
a blanked settings value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@t51eng-poseidon

Copy link
Copy Markdown

🔱 Poseidon started reviewing this PR — central run.

@t51eng-poseidon t51eng-poseidon Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔱 Poseidon Review

No issues found on this pass. The new partial_options entry goes through the existing partial path in scrub_options(): it keeps the _sn_backup and only blanks keys that exist (scrub_option_keys()), so server_prefix and the group_key_* entries stay. The C8 count of 4 matches how the CLI sums options and partial_options.


ℹ️ Review info
  • Commit: 571e28a
  • Files reviewed: README.md, includes/integrations/mailchimp.php, tests/smoke/fixtures/php/seed.php, tests/smoke/fixtures/plugins/gravityformsmailchimp/mailchimp.php, tests/smoke/scenarios/staging-plugin.test.mjs, tests/smoke/scenarios/wp-cli.test.mjs
  • Files skipped: none
  • Model: claude-opus-5-5

@Ninodevo
Ninodevo merged commit 245d860 into trunk Nov 10, 2026
20 checks passed
@Ninodevo Ninodevo mentioned this pull request Nov 10, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant