Closed dzuluaga closed 2 months ago
We've removed debug.keystore
from source control and implemented on the fly keystore creation from GH Actions
This issue should be fixed once https://github.com/openmobilehub/react-native-omh-storage/pull/57 is mergerd.
Hey Adam,
Thank you for working on the keystore issue. I encountered a problem when building the APK locally—the APK is not stored in the expected folder but ends up in a different system directory. The error message is:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:validateSigningDebug'.
> Keystore file '/Users/diegozuluaga/tools/git/react-native-omh-storage/apps/sample-app/android/app/debug.keystore' not found for signing config 'debug'.
To address this, I suggest a potential solution that allows the use of the debug.keystore
from GitHub Secrets while maintaining the default local configuration. Here’s how you could approach it:
Modify build.gradle
: Adjust the signing configuration based on whether the build is running locally or in a CI environment.
signingConfigs {
debug {
def isCI = project.hasProperty('isCI') ? project.getProperty('isCI').toBoolean() : false
def debugKeystorePath = isCI ? "${rootProject.projectDir}/ci/debug.keystore" : "${System.getenv('HOME')}/.android/debug.keystore"
storeFile file(debugKeystorePath)
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
Add to gradle.properties
: Define the environment variable to distinguish between CI and local builds.
# gradle.properties
isCI=false
Set Environment Variables in GitHub Actions:
- name: Build with Gradle
run: ./gradlew assembleDebug -PisCI=true
This setup should help in using the correct keystore
location depending on whether the build is running locally or on CI, ensuring that the APK is stored in the right folder in both cases.
However, please consider this as a suggestion. It’s important to assess whether this approach aligns with the best practices for your project. I recommend testing it in all environments to confirm it resolves the issue without introducing new problems.
Looking forward to hearing your thoughts!
Best,
Diego
@Nataliagros @adamTrz Friendly ping.
Hi @dzuluaga I've added a CI check to distinguish android builds done locally and with Github Actions. You can check out successful build here: https://github.com/openmobilehub/react-native-omh-storage/actions/runs/10811047878
Issue Description
We have identified several security and usability concerns related to the handling of the debug keystore and the APK generation process in our sample app. These issues potentially pose security risks and negatively impact the developer experience.
Concerns
debug.keystore checked into source code
debug.keystore
file is currently checked into the source code repository.APK Generation in GitHub Actions
Confusing Instructions in Sample App
MICROSOFT_CLIENT_ID
andMICROSOFT_SIGNATURE_HASH
inlocal.properties
.local.properties
and another from the debug keystore used to sign the APK).Impact
Proposed Solutions
debug.keystore
from the source code repository and update the.gitignore
file accordingly.local.properties
and explaining the signature hash generation process.Questions
Please let me know if you need any further information or clarification on these points.