
| Audited | android/nowinandroid at commit a49ed253d75e61a2b6ab80a8da677b57437b08eb |
|---|---|
| Date | 11 October 2026 (audited again; first audit 11 October 2026) |
| How it ran | local run on our workstation, full audit, Standard review |
| Verdict after review | Pass with notes (Fail if a High finding remains after review, otherwise Pass with notes) |
Compared with the first audit
Same commit as the first audit: the project's default branch has no later commits (checked 11 October 2026), so nothing could have been fixed upstream in between. Each finding of the first audit (11 October 2026) was checked again against the code audited now. 27 findings in the first audit; 27 still open (18 found again, 9 not reported again but still present). This audit has 42 findings after review, 25 of them new.
| First audit | Finding | Reviewed rating then | Now | In this audit |
|---|---|---|---|---|
| #1 | Article link launch can crash / any scheme | Low | Still open | #1 |
| #2 | Jetifier not pinned | Info | Still open | not reported again |
| #3 | Deep-link no duplicate guard | Info | Still open | not reported again |
| #4 | FTS MATCH raw user input | Low | Still open | #37 |
| #5 | Placeholder google-services key | Info | Still open | not reported again |
| #6 | Two scrollbar gesture writers | Info | Still open | #3 |
| #7 | Compose foundation pinned alpha | Info | Still open | #8 |
| #8 | Onboarding rule on some write paths | Info | Still open | #14 |
| #9 | Placeholder topic rows | Info | Still open | #13 |
| #10 | BACKEND_URL placeholder | Low | Still open | #18 |
| #11 | Sync failures logged at info | Low | Still open | #28 |
| #12 | headerImageUrl required | Low | Still open | #19 |
| #13 | Topic sync no size cap | Info | Still open | #36 |
| #14 | Tuning values compiled in | Info | Still open | not reported again |
| #15 | No override path for UI text | Info | Still open | not reported again |
| #16 | Prefs writes handle IOException inconsistently | Low | Still open | #16 |
| #17 | 5_000 sharing timeout copied | Info | Still open | not reported again |
| #18 | Repeated UI-state hierarchies | Info | Still open | not reported again |
| #19 | Release APK without checksum | Info | Still open | #27 |
| #20 | Release workflow skips verification | Info | Still open | not reported again |
| #21 | Release script copies unchecked | Info | Still open | not reported again |
| #22 | ListToMapMigration never registered | Medium | Still open | #12 |
| #23 | FTS duplicate rows each sync | Medium | Still open | #34 |
| #24 | Push-topic subscribe aborts sync | Medium | Still open | #33 |
| #25 | Swallowed cursor write reports success | Low | Still open | #17 |
| #26 | Undo remembers only last bookmark | Low | Still open | #39 |
| #27 | Release signed with debug key | Low | Still open | #32 |
Each finding keeps the number it has in the audit report. The rating shown first is the one after review; the first automated rating is listed with it. 20 findings were first rated Medium or High; 6 of them are Medium or High after review. Text marked "From the report" is quoted from the audit report; fixes are suggestions and were not tested. Code locations link to the file and line at the audited commit.
Medium after review (6)
From the report
migrations = listOf(
IntToStringIdsMigration,
),
ListToMapMigration exists in the main source set and has unit tests, but it is not in the DataStore's migration list. The registered migration moves old integer ids into the legacy string lists. Nothing then moves those lists into the map fields the app reads now. A user upgrading from the list-format storage silently loses every followed topic and bookmark, with no error.
Register it after the existing one: listOf(IntToStringIdsMigration, ListToMapMigration). Add a test that opens the store from a legacy-format file.
From the report
TopicUiState.Error -> TODO()
TopicViewModel maps any upstream exception to TopicUiState.Error. One example is a topic id with no database row, such as one opened from a link before topics have synced, which fails when the missing row is mapped to the model. Kotlin's TODO() then throws NotImplementedError during composition, and the app crashes on the main thread.
Render a real error state (a message with back or retry) for TopicUiState.Error.
sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorker.kt:70From the report
syncSubscriber.subscribe()
// First sync the repositories in parallel
In the production flavour this awaits a Firebase topic subscription with no error handling. On devices without Google Play services, or when the subscription call fails, the exception leaves doWork before any repository is synced, so the offline cache is never refreshed.
Wrap the subscription in a try/catch that rethrows CancellationException and logs other failures, or run it after the data sync.
From the report
newsResourceFtsDao.insertAll(
newsResourceDao.getNewsResources(
The search entities have no key mapped to the row id, so the "replace" conflict strategy never matches an existing row. Each successful sync appends a full copy of all news and topics. The database grows without bound, the "search ready" count is inflated, and edited items stay searchable under their old text.
Map the source id to the row id so replace works, or clear and refill the search tables in one transaction.
From the report
newsResourceDao.insertOrIgnoreTopicCrossRefEntities(
newsResourceTopicCrossReferences = networkNewsResources
A changed news item is upserted in place, so no cascade delete fires, and its topic links are only ever added. When the server removes a topic from an item, the item keeps appearing in that topic's feed and notifications.
In one transaction with the upsert, delete the existing links for each changed item before inserting the new set.
From the report
DataStoreFactory.create(
serializer = userPreferencesSerializer,
scope = CoroutineScope(scope.coroutineContext + ioDispatcher),
The serializer throws CorruptionException on unreadable data, and no corruption handler is set. User data is read at start-up, so one damaged file crashes the app on every launch until the user clears app data.
Pass corruptionHandler = ReplaceFileCorruptionHandler { UserPreferences.getDefaultInstance() }.
Low after review (21)
From the report
customTabsIntent.launchUrl(context, uri)
The URL comes from synced backend data through Uri.parse(userNewsResource.url) at three call sites (NewsFeed, NewsResourceCardList, ForYouScreen). Nothing checks that a browser or Custom Tabs handler exists, or that the scheme is http or https. On a device with no browser, a tap on a card throws ActivityNotFoundException and crashes the app. A non-web scheme from the backend is handed to whatever app claims it.
Accept only http and https before launching. Wrap launchUrl in a try/catch for ActivityNotFoundException and fall back to a chooser or a short message.
From the report
snapshotFlow { pressedOffset }.collect { pressedOffset -> ...
onThumbMoved(currentThumbMovedPercent)
snapshotFlow { draggedOffset }.collect { draggedOffset -> ... onThumbMoved(currentTravel)
The press handler runs a stepping loop with delay inside a plain collect. A press that turns into a drag therefore has two writers on onThumbMoved and interactionThumbTravelPercent at once, and the press loop keeps running to its old target after the finger has moved or lifted. The result is a thumb and list position that jitter and jump.
Give the gesture one owner. Use collectLatest, or cancel the press loop when a drag starts or the press ends.
feature/foryou/impl/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/impl/ForYouScreen.kt:459 (line corrected on review; the report cites :460)From the report
if (status is Denied && !status.shouldShowRationale) {
notificationsPermissionState.launchPermissionRequest()
The system permission dialog appears as soon as the home screen is composed, before the user has done anything that needs notifications. Requests like this are more often denied, and a user who denies twice can no longer be asked.
Ask after a related action, such as following a topic, or show a short explanation first.
From the report
Vertical -> width(12.dp).fillMaxHeight()
Horizontal -> height(12.dp).fillMaxWidth()
The draggable thumb sits at the screen edge and is well below a comfortable touch size, so it is hard to grab.
Keep the visual thumb thin but give the touch area at least 48dp, for example with transparent padding on the track.
From the report
android:pathData="M0,0h364v182h-364z"
android:fillColor="#FCFCFC"
In dark theme, loading and error states show a bright, full-bleed light rectangle.
Take the fill from a theme attribute or a night-qualified colour resource.
core/data/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/model/NewsResource.kt:41From the report
fun NetworkNewsResource.topicEntityShells() =
topics.map { topicId ->
TopicEntity(
News sync inserts empty-named "shell" topic rows to satisfy the foreign key. The topic reader query (SELECT * FROM topics) does not exclude them. Topic and news sync run in parallel, so if topic sync has not yet filled a shell, or fails, the interests list shows topics with blank names. Nothing checks after sync that no shell rows remain.
Mark shell rows explicitly (or filter name <> '' in reader queries), and check after sync that no shells remain.
sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorker.kt:80From the report
if (syncedSuccessfully) {
searchContentsRepository.populateFtsData()
A sync with an empty change list still reads every news item and topic and rewrites the search tables, which wastes battery and I/O on every app start and push-triggered sync (see also finding 34).
Have the repositories report whether anything changed, and rebuild only then.
From the report
niaPreferencesDataSource.setTopicIdFollowed(followedTopicId, followed)
analyticsHelper.logTopicFollowToggled(followedTopicId, followed)
setTopicIdFollowed, setNewsResourceBookmarked and setFollowedTopicIds catch IOException, log it and return normally (NiaPreferencesDataSource.kt:88). The repository then logs analytics for a change that never happened, and the user sees no error. Sibling setters (theme, dark mode, viewed state) do not catch at all, so the same failure behaves two different ways.
Choose one policy. Either let the exception propagate, or return a success flag. Log analytics only after the write has committed.
From the report
} catch (ioException: IOException) {
Log.e("NiaPreferences", "Failed to update user preferences", ioException)
}
updateChangeListVersion swallows the failure, so changeListSync still returns success and the worker records a successful sync. The version was never saved. The next sync processes the same changes again and, because notifications are posted before the version is committed, notifies the user about the same news again.
Propagate the failure, or return a result, so the sync reports failure and retries. Record notified ids, or commit the version before notifying.
core/network/build.gradle.kts:57From the report
}.orElse("http://example.com")
A production build made without BACKEND_URL in local.properties compiles without any warning and ships pointing at an http placeholder host. Cleartext traffic is blocked by default at the app's target SDK, so every sync fails. The only trace is an info-level log.
Fail the build for production variants when the value is missing, require https, and keep any placeholder to the demo flavour.
From the report
val headerImageUrl: String,
val publishDate: Instant,
val type: String,
The database entity and the domain model both allow a missing header image. The wire model requires it and has no defaults. One item with a null or absent image fails deserialization for the whole fetched batch, so sync fails and retries indefinitely with no news loaded.
Declare headerImageUrl: String? = null, and give the other optional fields defaults, as the topic model already does.
From the report
Text("FOLLOWING")
...
Text("NOT FOLLOWING")
The follow labels, the "Error" text (line 253) and the "Loading news" accessibility description (line 249) bypass string resources. They cannot be translated, and they are inconsistent with the rest of the app.
Move them to the feature's strings.xml and load them with stringResource.
.github/workflows/Build.yaml:137From the report
run: ./gradlew :app:assemble -PminifyWithR8=false
Release builds are minified by default (app/build.gradle.kts:46), but CI builds every variant with minification off and runs instrumented tests only on demo debug. If R8 strips serialization, Retrofit or Room classes, the failure would reach users undetected.
Add a CI job that builds the production release with R8 enabled and runs a smoke test on it.
core/data/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/SyncUtilities.kt:60From the report
Log.i(
"suspendRunCatching",
"Failed to evaluate a suspendRunCatchingBlock. Returning failure Result",
Sync failures are logged at info level under a generic tag, and the worker returns retry indefinitely (SyncWorker.kt:84). A persistent failure (findings 18, 19, 36) becomes a silent retry loop that is hard to spot in logs.
Log at warning or error level with a tag that names the repository and step, and cap retries using the attempt count.
app/build.gradle.kts:55From the report
// TODO: Abstract the signing configuration to a separate file to avoid hardcoding this.
signingConfig = signingConfigs.named("debug").get()
The release build type uses the debug signing configuration, and the release workflow publishes that APK as a GitHub release asset. A debug key is not protected, so anyone can produce an APK with the same signature, and users cannot trust updates. The catalog app (app-nia-catalog/build.gradle.kts:62) does the same.
Sign release builds with a private key supplied from CI secrets or an untracked keystore file. Keep a debug-signed variant only for local, non-distributed builds.
From the report
filterNewsIds = changedIds.toSet(),
Network fetches are chunked, but the database queries and deletes receive the whole change list in one IN (...) clause. On older Android versions the limit is 999 parameters. After a long offline period the query throws, the sync version is never advanced, and every retry fails the same way.
Chunk these id lists (for example 500 per query) for the queries and the deletes, and for the topic id list sent in one request.
From the report
val newsResourceIds = newsResourceFtsDao.searchAllNewsResources("*$searchQuery*")
Quotes, parentheses, operators and column filters typed by the user are parsed as query syntax. The query then fails with a database error, and searches such as text containing a quote, or "kotlin:", show a failure instead of results.
Split the input into terms, quote each term (doubling embedded quotes) or strip operator characters, then add the wildcard.
From the report
shouldDisplayUndoBookmark = true
lastRemovedBookmarkId = newsResourceId
Only the most recent removal is remembered. The snackbar effect is keyed on a boolean that is already true, so a second removal does not start a new snackbar. Undo restores only the second item, and the first removal is lost.
Keep a list of removed ids, or key the effect on a value that changes with each removal.
From the report
extras = listOf(element = Param(key = SEARCH_QUERY, value = query)),
In the production flavour, free text typed by the user is sent to a third-party analytics backend. Search input can contain personal data, and nothing asks for consent.
Log only derived values, such as query length or result count, or add explicit consent and disclose it.
.github/workflows/Build.yaml:250From the report
if: matrix.api-level == 30
The test matrix is [26, 34], but the local-test, coverage-report, coverage-threshold (min-coverage-overall: 40) and coverage-upload steps all require API level 30. None of them ever runs, so the coverage requirements are not enforced.
Change the conditions to a level that is in the matrix (for example 34), or add 30 to the matrix.
.github/workflows/Release.yml:69From the report
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
The workflow can be started manually (workflow_dispatch). In that case github.ref is a branch ref such as refs/heads/main, so the release is created with a wrong tag and name. The release actions it uses are also archived and no longer maintained.
Take the tag from a validated dispatch input, or allow only tag pushes, and move to a maintained release action.
Info after review (15)
app/src/main/AndroidManifest.xml:41From the report
<profileable android:shell="true" tools:targetApi="q" />
This element sits in the main source set, so it ships in release APKs and lets anyone with adb profile the production app. It exists for benchmarking.
Move it to a benchmark or debug source-set manifest, so release builds do not carry it.
From the report
var themeSettings by mutableStateOf(
ThemeSettings(
darkTheme = resources.configuration.isSystemInDarkTheme,
The splash screen is released once the ViewModel state has loaded. The saved theme preference, and the edge-to-edge bar styling, are applied later by a separate collector. A user who chose a theme different from the system setting can see a frame in the wrong theme.
Keep the splash until themeSettings has been applied, or derive the first value from the already-loaded UI state.
From the report
<style name="Theme.NiaCatalog" parent="android:Theme.Material.Light.NoActionBar" />
The Compose content follows the system dark setting, but the window background is fixed to light. There is no values-night variant (we searched the catalog res tree). The window flashes light before the dark Compose content draws.
Add a values-night theme, or use a DayNight parent.
gradle/libs.versions.toml:11From the report
androidxComposeFoundation = "1.8.0-alpha07"
Every other Compose artifact gets its version from the (alpha) BOM, while foundation is pinned to its own pre-release version. Mixed Compose versions are a common cause of runtime API mismatches.
Take foundation from the BOM, as foundation-layout already does, and prefer the stable BOM for a shipped app.
From the report
private const val SEARCH_QUERY = "searchQuery"
The same string is the saved-state key, the analytics event type and the analytics parameter key. Renaming it for one purpose silently changes the other two. A saved-state key change also drops restored state.
Use separate, clearly named constants for each role.
From the report
if (onThumbMoved == null) return
// Process presses
LaunchedEffect(Unit) {
Whether the composable's effects exist depends on an early return. The effects are keyed on Unit, so they also keep the first onThumbMoved lambda they see, even after it changes.
Call the effects unconditionally, check the callback inside them, and wrap it in rememberUpdatedState.
core/datastore/src/main/kotlin/com/google/samples/apps/nowinandroid/core/datastore/NiaPreferencesDataSource.kt:197 (line corrected on review; the report cites :196)From the report
if (followedTopicIds.isEmpty() && followedAuthorIds.isEmpty()) {
shouldHideOnboarding = false
The rule "onboarding hidden implies something is followed" is applied when follows change, but setShouldHideOnboarding writes the flag without checking it. The check also depends on a legacy author field that nothing writes any more.
Route every write of the flag through one guarded function, and drop the legacy author condition.
From the report
Evidence: the 620-line file holds the feed grid, the onboarding topic selector, NotificationPermissionEffect() (about line 449) and DeepLinkEffect() (about line 466).
Unrelated state and behaviour in one file make changes riskier and reviews harder as features are added.
Move onboarding and the permission and deep-link effects into their own files.
From the report
Evidence: the 605-line file holds SearchToolbar and SearchTextField, RecentSearchesBody, SearchResultBody and EmptySearchResultBody.
Same reason as finding 21. The view model also mixes search state with bookmark, follow and viewed writes.
Split the toolbar, the recent-searches body and the results body into separate files.
core/ui/src/main/kotlin/com/google/samples/apps/nowinandroid/core/ui/NewsResourceCard.kt:182From the report
var isLoading by remember { mutableStateOf(true) }
var isError by remember { mutableStateOf(false) }
This repeats the load, error and placeholder logic of DynamicAsyncImage. The card click wiring (analytics, open the tab, mark viewed) is also copied in NewsFeed.kt and NewsResourceCardList.kt, and the topic screen keeps its own card list. Fixes such as the one for finding 1 must be applied several times.
Reuse DynamicAsyncImage with parameters, and extract one shared card-click handler.
feature/foryou/impl/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/impl/ForYouViewModel.kt:118 (line corrected on review; the report cites :119)From the report
fun updateNewsResourceSaved(newsResourceId: String, isChecked: Boolean) {
viewModelScope.launch {
userDataRepository.setNewsResourceBookmarked(newsResourceId, isChecked)
Every tap starts a new coroutine with no ordering per item. The same pattern is in the bookmarks, topic, search and interests view models. Rapid toggles can finish out of order.
Serialize writes per item, for example with a mutex or a conflated channel keyed by id.
From the report
niaPreferencesDataSource.setNewsResourcesViewed(changedIds, true)
...
notifier.postNewsNotifications(
One lambda fetches and stores data, writes per-user viewed state and decides on notifications. That coupling is part of why finding 17 re-notifies.
Keep the repository to fetch and store. Move first-sync viewed marking and the notification decision into a separate component that runs after the change set is committed.
.github/workflows/Release.yml:80From the report
asset_path: app/build/outputs/apk/demo/release/app-demo-release.apk
Users who download the release asset have no way to check that it is complete and unmodified.
Publish a SHA-256 checksum and the expected size next to the APK.
From the report
Evidence: workManager.enqueueUniqueWork(SYNC_WORK_NAME, ExistingWorkPolicy.KEEP, SyncWorker.startUpSyncWork()) is repeated in initializers/SyncInitializer.kt:30-34.
The work name and policy must stay identical in both places, as a code comment says, but they have no single owner.
Route both call sites through one helper.
From the report
val METHOD_NAMES = mapOf(
"MaterialTheme" to "NiaTheme",
The mapping from Material components to design-system components is maintained by hand in the lint module. A new design-system wrapper is not enforced until someone remembers to update the table.
Move the mapping into a small shared JVM module, or generate it from the design system.