Skip to content

fix(app): stop evaluating firebase.json content as Ruby/Python source in ios_config.sh - #9294

Open
russellwheatley wants to merge 2 commits into
mainfrom
fix/ios-config-firebase-json-ruby-injection
Open

fix(app): stop evaluating firebase.json content as Ruby/Python source in ios_config.sh#9294
russellwheatley wants to merge 2 commits into
mainfrom
fix/ios-config-firebase-json-ruby-injection

Conversation

@russellwheatley

@russellwheatley russellwheatley commented Sep 4, 2026

Copy link
Copy Markdown
Member

packages/app/ios_config.sh spliced firebase.json content straight into ruby -e / python3 -c source strings when reading config keys during the iOS Xcode build phase. A single quote in a string value breaks out of the Ruby string literal, so the rest of the value runs as Ruby with the build user's privileges (CWE-94). Reported privately through our security disclosure process, credit to the reporter.

Exploiting this needs attacker control over firebase.json content (a malicious project contribution, a copied config artifact, or a compromised config-supply chain), it isn't reachable from the mobile runtime.

  • Pass firebase.json's path and the requested key(s) through ARGV/sys.argv instead of interpolating file content into interpreter source, for both the root parse and getFirebaseJsonKeyValue
  • Regenerate the CocoaPods-embedded copy of the same script in tests/ios/testing.xcodeproj/project.pbxproj to match (this is the copy Xcode actually runs for the e2e test app)
  • Apply the same fix to the identical copy in test-rn-bare/ios/testrnbare.xcodeproj/project.pbxproj, which carried the same vulnerable pattern
  • Add packages/app/__tests__/iosConfig.test.js, a regression test that runs the script against a crafted firebase.json containing the injection payload and asserts it doesn't execute

… in ios_config.sh

A single quote in a firebase.json string value breaks out of the Ruby
string literal that ios_config.sh interpolates config values into,
letting arbitrary Ruby run as the build user during the iOS Xcode
build phase (CWE-94). Pass firebase.json's path and the requested key
through ARGV/sys.argv instead of splicing file content into Ruby/Python
source strings, and regenerate the CocoaPods-embedded copy of the
script in the test app's Xcode project to match.

Adds a regression test that reproduces the original PoC and asserts
the injected code no longer executes.
@russellwheatley russellwheatley changed the title Fix code injection when parsing firebase.json during iOS builds fix(app): stop evaluating firebase.json content as Ruby/Python source in ios_config.sh Sep 4, 2026
…are fixture

test-rn-bare/ios/testrnbare.xcodeproj/project.pbxproj carried the same
pre-fix, vulnerable copy of the Core Configuration build phase script.
Its own CI workflow only triggers on test-rn-bare/** and a few native
paths this PR doesn't touch, so it would otherwise stay unpatched and
untested after this merges.
@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.43%. Comparing base (afaba0b) to head (302e882).
⚠️ Report is 24 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9294      +/-   ##
============================================
- Coverage     69.45%   69.43%   -0.01%     
+ Complexity     2122     2121       -1     
============================================
  Files           443      443              
  Lines         25537    25537              
  Branches       4259     4259              
============================================
- Hits          17733    17728       -5     
- Misses         6404     6406       +2     
- Partials       1400     1403       +3     
Flag Coverage Δ
android-native 65.74% <ø> (-<0.01%) ⬇️
e2e-ts-android 54.09% <ø> (-0.05%) ⬇️
e2e-ts-ios 53.61% <ø> (ø)
e2e-ts-macos 49.88% <ø> (ø)
ios-ruby 100.00% <ø> (ø)
jest 47.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@russellwheatley
russellwheatley marked this pull request as ready for review September 8, 2026 10:14
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