Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ assumed.
new route could not otherwise reach it. Left abstract rather than given a no-op default: a custom
store that silently declined to clear would fail invisibly, which is worse than failing to compile.

- **The protected-artifact verifier is now one task per protected variant**, named
`verify<Variant>DevConsoleProtectedArtifacts`. `verifyDevConsoleProtectedArtifacts` survives as an
aggregate that depends on all of them, so `check`, the sample apps' CI invocations, and any host
release script that names it keep working unchanged. A host that wants to verify one variant on its
own can now ask for that variant's task by name.

### Fixed

- **Building one flavor's release no longer builds every other flavor's release.** The verifier used
to be a single task holding *every* protected variant's runtime classpath and packaged APK/AAB as
its own task inputs, and it was wired onto each protected variant's `assemble`/`bundle`. On a
flavored project that meant `assembleProductionRelease` pulled
`verifyStagingReleaseDevConsolePackagedArtifact` into the graph, which in turn pulled
`dexBuilderStagingRelease`, `bundleStagingRelease` and the rest — so the build resolved and
downloaded every other flavor's dependencies, and produced artifacts nobody asked for. A host whose
flavors carry environment-specific SDK coordinates saw its production build reach for
internal-only artifacts and stall or fail when that repository was unreachable. Splitting the
verifier per variant keeps each variant's inputs to itself: building `productionRelease` now
touches `productionRelease` only, with no loss of enforcement.

## 1.2.4 — 2026-08-20

### Fixed
Expand Down
74 changes: 72 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,81 @@ Don't take the table's word for it. Check any build yourself:
aapt2 dump permissions app/build/outputs/apk/release/app-release.apk
```

The Gradle plugin enforces the same split mechanically. `verifyDevConsoleProtectedArtifacts` fails
the build if the full runtime reaches a protected variant, checking declared dependencies, the
The Gradle plugin enforces the same split mechanically. `verify<Variant>DevConsoleProtectedArtifacts`
fails the build if the full runtime reaches a protected variant, checking declared dependencies, the
resolved runtime classpath, and the final APK/AAB bytes. See
[Build variants and production safety](docs/BUILD_VARIANTS_AND_PRODUCTION_SAFETY.md).

## Flavored projects: verify the variant you ship

**If your app has product flavors, read this before wiring the plugin into a release pipeline.**

By default every non-debug variant is `PROTECTED`, so a project with `production`, `staging`, and
`partner` flavors gets three protected release variants and three verifiers:

```
verifyProductionReleaseDevConsoleProtectedArtifacts
verifyStagingReleaseDevConsoleProtectedArtifacts
verifyPartnerReleaseDevConsoleProtectedArtifacts
```

Each one is wired onto **its own** `assemble<Variant>` / `bundle<Variant>` and nothing else, so
`./gradlew :app:assembleProductionRelease` verifies `productionRelease` and resolves
`productionRelease`'s classpath — no other flavor is touched. That matters most when your flavors
carry environment-specific coordinates:

```groovy
productionImplementation "com.example.sdk:analytics-production-release:1.8.0"
stagingImplementation "com.example.sdk:analytics-staging-release:1.8.0"
partnerImplementation "com.example.sdk:analytics-partner-release:1.8.0"
```

A production build must never reach for another environment's artifacts — especially when those live
in a repository only reachable from an internal network. It doesn't.

The aggregate `verifyDevConsoleProtectedArtifacts` still exists and still verifies **every** protected
variant — that is its job, and `check` depends on it. On the project above it therefore resolves and
builds all three release variants. Use it in a CI job that is meant to cover everything; don't put it
on the critical path of a single-flavor release build:

```bash
./gradlew :app:assembleProductionRelease # ships production, verifies production
./gradlew :app:verifyProductionReleaseDevConsoleProtectedArtifacts # the same check on its own
./gradlew :app:verifyDevConsoleProtectedArtifacts # full sweep, all flavors, CI
```

### Upgrading from 1.2.4 or earlier

Up to and including 1.2.4 there was one shared verifier task carrying every protected variant's
inputs, wired onto every protected variant's `assemble`/`bundle`. Building one flavor's release
therefore built all of them. If you recognise any of these, that was the cause and this release fixes
it:

- a single-flavor release build downloading another flavor's dependencies
- `assembleProductionRelease` running `dexBuilderStagingRelease`, `bundlePartnerRelease`, or similar
- a release build failing or hanging on a repository only one flavor's artifacts live in
- release builds several times slower than the flavor being shipped could explain

No migration is needed — the task name your scripts and CI already call still works, it is now the
aggregate. If you worked around this by excluding the verifier (`-x verifyDevConsoleProtectedArtifacts`)
or by narrowing `protectedVariantPatterns` to one flavor, undo it: those workarounds bought speed by
dropping enforcement, and you no longer have to pay for one with the other.

### Narrowing what gets protected

If you genuinely want fewer protected variants — a flavor whose release build is never distributed,
say — lower the default and name what you protect. Understand that a variant left out is a variant
nobody checks:

```kotlin
devConsole {
defaultPolicy.set(DevConsoleVariantPolicy.DISABLED)
protectedVariantPatterns.set(listOf("(?i)production.*release"))
}
```

`DISABLED` variants still get `devconsole-noop` auto-wired — they simply are not verified.

## Security model

DevConsole deliberately exposes your app's internals to a browser, and two of its defaults trade
Expand Down
23 changes: 18 additions & 5 deletions docs/BUILD_VARIANTS_AND_PRODUCTION_SAFETY.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,32 @@ artifact, but only `PROTECTED` variants fail the build if the full runtime shows

## `devConsoleVariantReport` and `verifyDevConsoleProtectedArtifacts`

Two tasks come with the plugin:
The plugin registers:

- `devConsoleVariantReport` writes `build/reports/devconsole/variants.json` listing the effective
policy (`ENABLED`/`DISABLED`/`PROTECTED`) for every variant.
- `verifyDevConsoleProtectedArtifacts` inspects each protected variant's dependency graph for a
direct `ProjectDependency` on any path in `protectedDependencyPaths`, and fails the build if one
is found. Run it as part of your release checklist — the three sample apps run it in CI on every
push (see [`.github/workflows/verify.yml`](../.github/workflows/verify.yml)).
- `verify<Variant>DevConsoleProtectedArtifacts` — one task per protected variant — inspects that
variant's dependency graph for a direct `ProjectDependency` on any path in
`protectedDependencyPaths`, and fails the build if one is found. Each variant's
`assemble<Variant>` and `bundle<Variant>` depends on its own verifier, so building a protected
artifact always runs its checks.
- `verifyDevConsoleProtectedArtifacts` is the aggregate: it depends on every per-variant verifier,
and `check` hangs off it. Run it as part of your release checklist — the three sample apps run it
in CI on every push (see [`.github/workflows/verify.yml`](../.github/workflows/verify.yml)).

```bash
./gradlew :app:assembleRelease :app:verifyDevConsoleProtectedArtifacts
```

On a flavored project, ask for the variant you are actually shipping. The aggregate verifies *every*
protected variant, so on a project with `production`/`staging`/`partner` flavors it resolves — and
builds — all three release variants:

```bash
./gradlew :app:assembleProductionRelease # verifies productionRelease only
./gradlew :app:verifyProductionReleaseDevConsoleProtectedArtifacts # the same check, on its own
```

## Full/no-op parity

`devconsole` and `devconsole-noop` are compiled from the same shared facade source
Expand Down
11 changes: 11 additions & 0 deletions docs/FAQ_TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ dashboard assets, and storage layer live only in `sdk:full`, and `verifyDevConso
checks specifically for a dependency on that module, not for the absence of every DevConsole class.
See [BUILD_VARIANTS_AND_PRODUCTION_SAFETY.md](BUILD_VARIANTS_AND_PRODUCTION_SAFETY.md).

**Why is my release build downloading another flavor's dependencies?** Up to 1.2.4 the plugin
registered a single `verifyDevConsoleProtectedArtifacts` task holding *every* protected variant's
runtime classpath and packaged artifact as its own inputs, and wired it onto each protected variant's
`assemble`/`bundle` — so `assembleProductionRelease` dragged `dexBuilderStagingRelease`,
`bundlePartnerRelease` and every other flavor's dependency download into the graph. Since then there
is one verifier per variant (`verifyProductionReleaseDevConsoleProtectedArtifacts`), each wired only
onto its own variant's tasks, and `verifyDevConsoleProtectedArtifacts` is an aggregate you invoke
deliberately.
Upgrade, and drop any `-x verifyDevConsoleProtectedArtifacts` workaround. See the flavored-projects
section in the [README](../README.md#flavored-projects-verify-the-variant-you-ship).

**I toggled a feature flag in the dashboard but my app didn't change.** Flags are pulled, not
pushed. Call `DevConsole.featureFlagValue(key)` wherever you'd otherwise check a local flag. There
is no change notification, so re-check after whatever user action would plausibly follow a QA
Expand Down
Loading
Loading