feat(secrets): Android signing passwords and Firebase keys; our gitleaks config only #456

Merged
sharang merged 1 commits from feat/mobile-secret-rules into main 2026-10-05 18:31:34 +00:00
Owner

Item 5 (leftover from #437): secrets in mobile apps, plus a gap in how gitleaks was called.

Gap: the repository could switch gitleaks rules off

gitleaks ran without --config and therefore read a .gitleaks.toml from the scanned repository. An [allowlist] paths = [".*"] there switched off every rule. It now always runs with compliance-agent/rules/gitleaks.toml ([extend] useDefault = true, plus our rules), written per run into its own temp directory, so concurrent scans don't collide.

New rules (verified against gitleaks 8.21.2 from the image, and 8.30)

Rule Finds Severity
android-keystore-password storePassword / keyPassword as a literal in build.gradle(.kts), but not System.getenv(…) or findProperty(…) High
android-signing-password-property *STORE/KEY/SIGNING*PASSWORD=… in gradle.properties High
firebase-config-api-key the AIza… key in google-services.json and GoogleService-Info.plist (gitleaks' default rules missed the plist) Low, with an explanation: the key identifies the app and isn't a secret on its own, but it must be restricted to the app and its APIs in the Google Cloud console
  • gitleaks' own gcp-api-key on the same key in those two files is dropped, so it's reported once and not as High.
  • Committed keystore files (.jks/.keystore) are already covered by secret-files (#447).

Not changed (verified)

A .gitleaksignore in the repository is still honoured. gitleaks reads it from the scanned directory regardless of --gitleaks-ignore-path (checked on 8.21 and 8.30). That's the same as an inline gitleaks:allow or nosemgrep: a deliberate suppression by the customer. Whether to show those suppressions is a product decision for later.

Side effect

A Firebase key previously reported as gcp-api-key (High) now appears as firebase-config-api-key (Low). With #443, the old finding closes as "nicht mehr gefunden".

Tests

  • the_firebase_key_is_reported_once.
  • our_rules_extend_gitleaks_own: the config is valid TOML, useDefault, and the 3 rule IDs.
  • With real gitleaks (skipped if it isn't installed): planted build.gradle, gradle.properties and google-services.json, plus a repository .gitleaks.toml that allow-lists everything. Result: exactly the keystore password (High), the properties password (High) and the Firebase key (Low). The getenv password is not reported.
  • fmt and clippy with the CI flags; gitleaks tests 14/14.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

Item 5 (leftover from #437): **secrets in mobile apps**, plus a gap in how gitleaks was called. ## Gap: the repository could switch gitleaks rules off gitleaks ran **without `--config`** and therefore read a `.gitleaks.toml` from the scanned repository. An `[allowlist] paths = [".*"]` there switched off every rule. It now always runs with `compliance-agent/rules/gitleaks.toml` (`[extend] useDefault = true`, plus our rules), written per run into its own temp directory, so concurrent scans don't collide. ## New rules (verified against gitleaks 8.21.2 from the image, and 8.30) | Rule | Finds | Severity | |---|---|---| | `android-keystore-password` | `storePassword` / `keyPassword` as a literal in `build.gradle(.kts)`, but not `System.getenv(…)` or `findProperty(…)` | High | | `android-signing-password-property` | `*STORE/KEY/SIGNING*PASSWORD=…` in `gradle.properties` | High | | `firebase-config-api-key` | the `AIza…` key in `google-services.json` **and** `GoogleService-Info.plist` (gitleaks' default rules missed the plist) | **Low**, with an explanation: the key identifies the app and isn't a secret on its own, but it must be restricted to the app and its APIs in the Google Cloud console | - gitleaks' own `gcp-api-key` on the same key in those two files is dropped, so it's reported once and not as High. - Committed keystore files (`.jks`/`.keystore`) are already covered by `secret-files` (#447). ## Not changed (verified) A **`.gitleaksignore`** in the repository is still honoured. gitleaks reads it from the scanned directory regardless of `--gitleaks-ignore-path` (checked on 8.21 and 8.30). That's the same as an inline `gitleaks:allow` or `nosemgrep`: a deliberate suppression by the customer. Whether to show those suppressions is a product decision for later. ## Side effect A Firebase key previously reported as `gcp-api-key` (High) now appears as `firebase-config-api-key` (Low). With #443, the old finding closes as "nicht mehr gefunden". ## Tests - `the_firebase_key_is_reported_once`. - `our_rules_extend_gitleaks_own`: the config is valid TOML, `useDefault`, and the 3 rule IDs. - **With real gitleaks** (skipped if it isn't installed): planted `build.gradle`, `gradle.properties` and `google-services.json`, plus a repository `.gitleaks.toml` that allow-lists everything. Result: exactly the keystore password (High), the properties password (High) and the Firebase key (Low). The `getenv` password is not reported. - fmt and clippy with the CI flags; gitleaks tests 14/14. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-10-05 17:58:59 +00:00
feat(secrets): Android signing passwords and Firebase keys; our gitleaks config only
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 7m50s
d42b429273
gitleaks ran without --config, so it read a `.gitleaks.toml` from the
scanned repository, which could allow-list everything. It now always runs
with rules/gitleaks.toml: gitleaks' own rules plus
- android-keystore-password: storePassword/keyPassword literals in
  build.gradle(.kts) (not System.getenv / findProperty);
- android-signing-password-property: *STORE/KEY/SIGNING*PASSWORD in
  gradle.properties;
- firebase-config-api-key: the API key in google-services.json and
  GoogleService-Info.plist (the default rules missed the plist), at low
  severity with what to do: it identifies the app and must be restricted
  in the Google Cloud console. gitleaks' own gcp-api-key for the same key
  in those files is dropped, so it is reported once.
The config is written per run into its own temp directory.

A `.gitleaksignore` in the repository is still honoured: gitleaks reads it
from the scanned directory whatever it is told (8.21 and 8.30 checked).

Refs #437.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang merged commit 6c9756bebf into main 2026-10-05 18:31:34 +00:00
Sign in to join this conversation.