Skip to content

CI-sichere Release-Signing-Konfiguration für app und humanoperator#89

Closed
Android-PowerUser wants to merge 3 commits into
update-database-export-and-retrieval-processfrom
add-ci-friendly-signing-configuration
Closed

CI-sichere Release-Signing-Konfiguration für app und humanoperator#89
Android-PowerUser wants to merge 3 commits into
update-database-export-and-retrieval-processfrom
add-ci-friendly-signing-configuration

Conversation

@Android-PowerUser
Copy link
Copy Markdown
Owner

Motivation

  • CI-Builds brauchen eine sichere, nicht im Repo gespeicherte Signing-Konfiguration, die über Umgebungsvariablen gesetzt wird.
  • Die Build-Skripte sollen bei fehlenden Release-Secrets klar fehlschlagen, statt still geheimniskrämerisch unsignierte Artefakte zu erzeugen.
  • google-services.json soll unverändert versioniert bleiben und nicht Teil der Signing-Logik werden.

Description

  • In app/build.gradle.kts werden die Variablen ANDROID_KEYSTORE_PATH, ANDROID_KEY_ALIAS, ANDROID_KEYSTORE_PASSWORD und ANDROID_KEY_PASSWORD aus System.getenv gelesen und in einer signingConfigs { create("release") { ... } } verwendet.
  • buildTypes.release ist in app und humanoperator explizit mit signingConfig = signingConfigs.getByName("release") verknüpft und Nicht-Release-Builds bleiben unverändert.
  • Guard-Logik prüft, ob ein Release-Task angefordert wurde (gradle.startParameter.taskNames) und löst bei fehlenden Variablen ein klares error(...) mit den fehlenden Variablen aus.
  • Analoges Setup wurde in humanoperator/build.gradle.kts ergänzt und eine kurze Dokumentation docs/ci-signing.md angelegt; README.md wurde um einen Link zur CI-Dokumentation ergänzt.

Testing

  • ./gradlew :app:help :humanoperator:help wurde erfolgreich ausgeführt und bestätigt, dass die Gradle-Skripte syntaktisch auswertbar sind.
  • ./gradlew :app:assembleRelease --dry-run und ./gradlew :humanoperator:assembleRelease --dry-run wurden ausgeführt und liefern die erwartete, klare Guard-Fehlermeldung, wenn die Signing-Umgebungsvariablen nicht gesetzt sind.
  • ./gradlew :app:lintDebug :humanoperator:lintDebug wurde versucht; Lint schlug fehl wegen einer bestehenden Kotlin-Metadata-Inkompatibilität in einer Abhängigkeit, die unabhängig von diesen Signing-Änderungen ist.

Codex Task

Copy link
Copy Markdown
Contributor

@amazon-q-developer amazon-q-developer Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

This PR implements CI-friendly release signing configuration for the app and humanoperator modules. The approach of using environment variables for signing credentials is sound, but critical issues must be addressed before merge:

Critical Issues (Must Fix)

  1. Logic Error in both modules: Release build types unconditionally reference signing configs that may be uninitialized when environment variables are missing. The current guard logic doesn't protect against all build invocation scenarios (IDE builds, indirect task invocations), which could produce unsigned APKs without clear errors.

  2. Security Vulnerability in both modules: Path traversal risk in keystore path handling - the file() function accepts unvalidated paths from environment variables, enabling potential unauthorized file access on build systems.

Recommendation

Address the signing config conditional assignment and add path validation before merge. These defects could compromise build integrity and security in CI environments.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Comment thread app/build.gradle.kts
signingConfigs {
create("release") {
if (missingReleaseSigningEnv.isEmpty()) {
storeFile = file(releaseSigningEnv.getValue("ANDROID_KEYSTORE_PATH")!!)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 Security Vulnerability: Using file() with environment variable path enables path traversal attacks1. An attacker controlling ANDROID_KEYSTORE_PATH could read arbitrary files from the build system (e.g., ../../../../etc/passwd). Validate the path resolves within expected directories or use absolute path validation before passing to file().

Footnotes

  1. CWE-22: Path Traversal - https://cwe.mitre.org/data/definitions/22.html

signingConfigs {
create("release") {
if (missingReleaseSigningEnv.isEmpty()) {
storeFile = file(releaseSigningEnv.getValue("ANDROID_KEYSTORE_PATH")!!)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 Security Vulnerability: Using file() with environment variable path enables path traversal attacks1. An attacker controlling ANDROID_KEYSTORE_PATH could read arbitrary files from the build system (e.g., ../../../../etc/passwd). Validate the path resolves within expected directories or use absolute path validation before passing to file().

Footnotes

  1. CWE-22: Path Traversal - https://cwe.mitre.org/data/definitions/22.html

Comment thread app/build.gradle.kts Outdated
Comment thread humanoperator/build.gradle.kts Outdated
Android-PowerUser and others added 2 commits April 26, 2026 22:36
Co-authored-by: amazon-q-developer[bot] <208079219+amazon-q-developer[bot]@users.noreply.github.com>
Co-authored-by: amazon-q-developer[bot] <208079219+amazon-q-developer[bot]@users.noreply.github.com>
@Android-PowerUser Android-PowerUser deleted the branch update-database-export-and-retrieval-process May 11, 2026 18:19
@Android-PowerUser Android-PowerUser deleted the add-ci-friendly-signing-configuration branch May 11, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant