Skip to content

fix(security): turn pinning off only for a recognised spelling, and refuse a release that carries another - #1005

Merged
koniz-dev merged 2 commits into
mainfrom
fix/pinning-flag-strict
Oct 30, 2026
Merged

koniz-dev merged 2 commits into
mainfrom
fix/pinning-flag-strict

Conversation

@koniz-dev

@koniz-dev koniz-dev commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

ENABLE_SSL_PINNING was read through EnvConfig.getBool, which treats anything but true/1/yes/on as false. So a typo (ture, enabled) or a stray blank silently turned pinning off in a staging or production release, with valid fingerprints and no warning. Both build helpers passed such a value through.

Change.

  • AppConfig.enableSslPinning honours only the on spellings (true, 1, yes, on) and the off spellings (false, 0, no, off), in any case and trimmed. Any other value keeps the environment's default.
  • New AppConfig.sslPinningFlagUnrecognised reports such a value, and main() refuses to start a release that carries one, naming the value. tool/golden/stripped/lib/main.dart mirrors the change.
  • scripts/ci/ssl_pinning_defines.sh and fastlane/ssl_pinning.rb refuse a staging or production build with such a value. They now trim the flag as the app does, so " OFF " is an opt-out in all three places.
  • .env.example and docs/guides/configuration.md list the accepted spellings.

Tests.

  • test/core/config/ssl_pinning_flag_test.dart: in staging and production, enabled, ture and " " keep pinning on and are reported. False , OFF, 0 and no opt out. An unset flag is not reported. With the old parsing, the six unrecognised cases fail.
  • startup_reachability_test.dart: a production release with valid fingerprints and ENABLE_SSL_PINNING=enabled boots into the failure screen, naming "enabled".
  • build_all_analyze_size_test.dart and fastlane_ssl_pinning_rb_test.dart: enabled and " " are refused even with fingerprints, and a padded upper-case opt-out builds. With the old helpers, these 4 fail.

Pre-merge review (a fresh qa subagent on the diff): the fail-open is closed in all three places. Its findings, fixed in the second commit:

  • Inner whitespace. The shell helper deleted every space, so "o n" and "t r u e" passed it while the app refuses to start on them. It now trims only the ends. Tests were added; against the first commit they fail.
  • Debug output. printConfig and getDebugInfo now report an unrecognised value, so a debug run is not silent either.
  • Message length. The release refusal shows at most 32 characters of the raw value.
  • Docs. The security guide's settings table lists the accepted spellings, and the misconfiguration message no longer says ENABLE_SSL_PINNING=true.

It also confirmed:

  • no other getBool flag fails open in its unsafe direction (debug features and HTTP logging fail closed);
  • the refusal order in main() is right;
  • refusing on web as well is consistent with the build helpers.

Refs #991

🤖 Generated with Claude Code

koniz-dev and others added 2 commits October 31, 2026 04:04
…efuse a release that carries another

ENABLE_SSL_PINNING was read as false for anything but true/1/yes/on, so a
typo or a stray blank silently shipped a staging or production release
unpinned, and the build helpers passed it. Only the on and off spellings
now override the default; any other value keeps it, AppConfig reports it,
main() refuses a release that carries it, and scripts/ci/ssl_pinning_defines.sh
and fastlane/ssl_pinning.rb refuse to build it. .env.example and
configuration.md list the accepted values.

Refs #991

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…helper, and report an unrecognised value

The shell helper deleted every space, so "o n" passed it while the app
refuses to start on it. It now trims only the ends, as the app and the Ruby
helper do. printConfig and getDebugInfo report an unrecognised value, the
release refusal shows at most 32 characters of it, and the security guide
lists the accepted spellings.

Refs #991

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@koniz-dev
koniz-dev merged commit 8e8df75 into main Oct 30, 2026
7 checks passed
@koniz-dev
koniz-dev deleted the fix/pinning-flag-strict branch October 30, 2026 21:24
koniz-dev added a commit that referenced this pull request Oct 30, 2026
Refs #991

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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