-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EAS CD fingerprinting fails when using file-based secrets for Android configuration #315
Comments
I just wanted to try the new fingerprint action and came accros the same issue @tharakadesilva . Did you find a workaround? |
Hi @mrkpatchaa, I ended up doing the super secure thing of committing the file. |
@wschurman maybe you can take a look? It doesn't seem to have been any activity on the repo since 3 months now. |
A workaround I just found is to ignore fingerprint check on the whole expo config.
|
I took a look at the code and have two proposals: Option 1We add an option here and remove it here similar to how we handle other config options. Downside: This will affect the file-based fingerprinting we do here. Since we want the fingerprint to change when this file changes, I don't recommend this approach. Option 2This approach has two parts:
While this solves one problem, we'd still have a fingerprint mismatch since we're fingerprinting the file here. SolutionWe can resolve this by using standardized filenames instead of full paths for known external files holding secrets
We can also get this mapping as a dict input from the user config to accommodate future secret file references in This would, however, make the file contents to appear in the fingerprint diff (though the current code would too..). Considerations
RecommendationI recommend proceeding with Option 2. If this approach sounds good to everyone, I'll prepare a PR. As always, feedback and alternative approaches are welcome! |
@tharakadesilva I like the option 2 with a slightly difference. ...
expoConfig = normalizeExpoConfig(config.exp, options);
const expoConfigResult = normalizeExpoConfig(config.exp, options); // <--
delete expoConfigResult.android.googleServicesFile; // <--
delete expoConfigResult.ios.googleServicesFile; // <--
loadedModules = stdoutJson.loadedModules;
results.push({
type: 'contents',
id: 'expoConfig',
contents: (0, Utils_1.stringifyJsonSorted)(expoConfigResult), // <--
reasons: ['expoConfig'],
}); I am currently testing this code, and it's working for now. I wonder if there is any other key apart from googleServicesFile to exclude. If yes We can think of moving it to a configuration in sourceskips. |
hi there! much appreciated for digging the problem and fingerprint code. for for the other fields that may appear in app config with absolute paths (absolute paths from eas file based secret like process.env.SECRET_FILE), i think we should prevent using absolute paths in app config. for example, in @mrkpatchaa's repro example. we can do relative paths like const path = require('path');
module.exports = {
expo: {
ios: {
googleServicesFile: path.relative(__dirname, process.env.GOOGLE_SERVICES_PLIST),
},
android: {
googleServicesFile: path.relative(__dirname, process.env.GOOGLE_SERVICES_JSON),
}
},
}; not sure if we can have a heuristic approach to turn all absolute paths to relative paths in fingerprint. lastly, fwiw, other than the risky /** @type {import('@expo/fingerprint').Config} */
const config = {
fileHookTransform: (source, chunk, isEndOfFile, encoding) => {
// Remove googleServicesFile
if (source.type === 'contents' && source.id === 'expoConfig') {
const config = JSON.parse(chunk);
delete config.android.googleServicesFile;
delete config.ios.googleServicesFile;
return JSON.stringify(config);
}
return chunk;
},
}
module.exports = config; |
Hi @Kudo I've tested the fileHookTransform config and it works like a charm. 💪🏾 |
having expo/expo#33926 as a heuristic solution. maybe it would be better than specific to googleServicesFile. |
Topic and scope of discussion
EAS CD fingerprint validation fails when using file-based secrets due to path differences between GitHub CI environment and EAS build environment
Motivation
The continuous deployment process is breaking because the fingerprint generated in the GitHub CI environment doesn't match the fingerprint calculated during the EAS build when using file-based secrets. This prevents successful deployment of builds even when there are no actual changes to the application code.
Additional context
I'm encountering an issue with the continuous deployment fingerprinting system when trying to securely handle the
google-services.json
file for Android builds.Current Setup:
expo-github-action/continuous-deploy-fingerprint
for CDgoogle-services.json
to gitProblem:
The fingerprint validation fails because:
app.config.js
causes the fingerprints to mismatchQuestions:
google-services.json
file that would work better with the fingerprinting system?The text was updated successfully, but these errors were encountered: