Skip to content

PhoenixKit 2.23.1: Real Google credential check, encrypted payment secrets

PhoenixKit 2.23.1 makes Test Credentials for Google sign-in ask Google itself, encrypts payment and Apple sign-in secrets, and fixes settings that read as empty from a cold cache.

For Google, Test Credentials used to check only that the fields were not empty, so a wrong secret passed. It now asks Google and reports one of three results: Google accepted the credentials, Google rejected them (invalid_client), or the answer was inconclusive, shown as a warning. A secret that is blank or under 16 characters is now refused on save, and stray spaces are trimmed.

The Apple private key and the Stripe, PayPal, Razorpay and EveryPay secrets are now stored encrypted. Saved values keep working and are encrypted on the next save.

Also fixed: batched settings reads returned nil for every key when the cache was cold, which affected modules such as web analytics and publishing. Activity lists keep a stable order, and mix phoenix_kit.status, doctor and update report a module whose database is newer than its code as “ahead of code”.

Upgrading

mix phoenix_kit.status --exit-code now fails for a module that is ahead of code, so a deploy gated on it stops after rolling code back past a module migration.

Full release notes: PhoenixKit 2.23.1

2.23.1 · 13 September 2026

Changed

  • A module whose database schema is newer than its code is now reported as “ahead of code”, not “up to date” (#806). PhoenixKit.Migrations.Modules.classify/2 returns a new :ahead_of_code status for installed > target (a rollback, or a dependency pinned backwards), with a matching Modules.ahead_of_code/1 filter. mix phoenix_kit.status shows it in red with a new {:modules_ahead_of_code, names} next action; mix phoenix_kit.doctor warns; mix phoenix_kit.update names it instead of printing “up to date”. When another module is genuinely behind, update is still the next action and the ahead module is listed as an extra reason. Note: mix phoenix_kit.status --exit-code exits non-zero for this state, as it does for every non-Ready action, so a deploy gated on it fails after a code rollback past a module migration.
  • Apple Sign-In and billing-provider secrets are encrypted at rest (#807). oauth_apple_private_key, billing_stripe_secret_key, billing_stripe_webhook_secret, billing_stripe_api_key, billing_paypal_client_secret, billing_paypal_webhook_secret, billing_razorpay_key_secret, billing_razorpay_webhook_secret and billing_everypay_api_secret join restricted_setting_keys/0, so writes through Settings.update_setting/2 store enc:v1: ciphertext and Settings.get_setting/2 decrypts. phoenix_kit_billing reads every one of them through get_setting/2 and needs no change. Existing plaintext values keep reading correctly and are encrypted on the next save or mix phoenix_kit.integrations.rotate_key. The public identifiers (Stripe publishable key, PayPal client/webhook ID, Razorpay key ID, EveryPay username/account) stay unencrypted. A new test-support perimeter scan asserts that every secret-shaped setting key core references or seeds is restricted.

Fixed

  • Settings batch reads now actually fill cache misses from the database (#810). Settings.get_settings_cached/2 and get_json_settings_cached/2 looked for a missing key in Cache.get_multiple/3’s result, but that function returns every requested key and substitutes the default on a miss, so a miss was never detected. A cold or expired cache read as nil for every key without querying the database. This affected every get_settings_cached/2 caller, including phoenix_kit_web_analytics and phoenix_kit_publishing. Misses are now detected with a sentinel. A restricted key that fails to decrypt is answered but not cached, so the next read retries, matching the boot warmer. A JSON read of a row with no JSON value now caches nil instead of “not found”.
  • Activity feed order is stable when timestamps tie (#809). Activity.list/1 and Activity.recent/1 sorted by inserted_at alone, so rows with the same timestamp (every pre-V185 whole-second row) could come back in any order. They now add uuid as a tiebreak.
  • A blocked role-permissions click shows a translated reason (#805). The Roles page flashed the raw error atom (owner_immutable). The message mapping moved from PermissionsMatrix to Permissions.edit_role_permissions_error_message/1, and both pages use it.
  • The OAuth “Test Credentials” button now actually tests the credentials. It compared each field to "" and nothing else, so a 9-character Google client secret — or a field containing only a space — read as “properly formatted” while Google itself answered the same values with 401 invalid_client. For Google, the button now POSTs the current client ID/secret to oauth2.googleapis.com/token with a deliberately invalid authorization code and reads Google’s own verdict: invalid_client means the credentials are wrong; invalid_grant means they are right (only the fake code was rejected, as expected) — this “right credentials” leg follows from Google’s documented error definitions and was not itself exercised against a real registered app, and falls back to inconclusive if Google ever answers a correct pair with anything else. No redirect_uri is sent — this used to send an RFC 2606 .invalid placeholder, which fails Google’s “Host TLDs must belong to the public suffix list” redirect-URI rule and came back invalid_request regardless of the credentials, making the check permanently inconclusive; a placeholder on a real public-suffix host was not affected (verified live with fabricated credentials: example.com/localhost and no redirect_uri all answered the same invalid_client). A third outcome — could not reach Google, or a response that isn’t cleanly one of the two verdicts above — is reported as inconclusive (a distinct :inconclusive result, shown as a warning rather than an error flash), never folded into either a pass or a fail. GitHub and Facebook keep the previous format-only check (now actually enforcing it — see below) rather than an unverified live check against their token endpoints.
  • A short or blank-looking OAuth secret is now rejected on save, not just by the button. PhoenixKit.Users.OAuthConfig.validate_secret_format/2 rejects a value that is only whitespace or implausibly short (under 16 characters — real secrets from all three providers are at least 24) before PhoenixKitWeb.Live.Settings.Authorization persists it; the generic settings schema (PhoenixKit.Settings.Setting) is deliberately left alone, since a Google-secret-shaped format check does not belong in a schema shared by every setting in the app. A secret already saved before this fix does not retroactively block saving an unrelated field. A secret with leading/trailing whitespace (a copy-paste artifact) is now trimmed before it is persisted or tested, instead of being saved and sent to the provider padded.
  • OAuth test-result messages are now translated. The success message was never wrapped in gettext — a translated button produced an English response, and the wording (“…properly formatted. Initiate OAuth flow to test actual connection.”) was easy to mistake for “this works” at a glance. All three providers’ messages, on all three (now honest) outcomes, are gettext-wrapped, along with the adjacent “Reload Config” flash and the “Test Credentials” button name repeated in the on-page setup instructions.
  • Post-merge review fixes (#808, #807). The nine new OAuth msgids had never been extracted, so every locale still rendered them in English. They are now extracted and translated into de/es/et/fr/it/pl/ru. The Google credential check no longer logs an exit/throw reason verbatim (a GenServer.call exit reason embeds the call’s arguments), matching the rescue branch’s rule. The secret-key perimeter test no longer runs under DataCase, which had silently excluded it on database-less runs.

PhoenixKit 2.23.1. Install or update: {:phoenix_kit, "~> 2.23"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.