Skip to content

feat(ui): warn that the data-export scope reads the whole account - #61

Merged
SiteRelEnby merged 1 commit into
mainfrom
feat/api-key-export-scope-warning
Aug 10, 2026
Merged

feat(ui): warn that the data-export scope reads the whole account#61
SiteRelEnby merged 1 commit into
mainfrom
feat/api-key-export-scope-warning

Conversation

@SiteRelEnby

Copy link
Copy Markdown
Collaborator

Android side of the API key changes in server 1.3.5.

The problem

export:read reaches the full account export - every member, journal, board message, poll and setting - regardless of how narrow the other scopes on the key are. In a picker that lists resources one per row, "Data export: Read" reads like just another resource, so it's easy to hand out a key that reads everything while believing it reads one thing.

What's added

Inline warning in the create sheet as soon as data export is selected, in the theme's warning colours:

Data export read lets this key download a full account export: everything in your account, not just the scopes selected above.

A confirmation before the key is actually created:

This key can read everything
Data export read lets this key download a full account export: every member, journal, board message, poll, and setting in your account, not just the scopes you selected. Only hand it to something you would trust with all of it.

Cancel / Create key anyway

The confirmation is skipped when the key already grants read on every readable resource, since there's nothing surprising left to say. Matches web's behaviour.

The rule is tested, not buried

"Already reads everything" is extracted as a pure grantsEveryRead(levels) with 7 tests, rather than living as a condition inside the composable. It's wrong in both directions in quiet ways: too eager and people learn to click through the warning, too lax and a key that reads the whole account goes out unannounced.

The subtle part is that write-only resources are excluded. Data import grants no read at all, so counting it would mean the check never passed and the warning would fire even on a key that genuinely does read everything. There's a test pinning that.

Not ported

The same release fixed web's "Copy" button claiming success when the browser clipboard was unavailable outside a secure context. That has no Android counterpart: no secure-context restriction, and this screen's copy button makes no success claim to be wrong about. I checked rather than assumed.

Testing

:app:assemblePlayRelease + :app:testPlayReleaseUnitTest green. Device checklist:

  • Select Data export: Read - the inline warning appears; deselect it and the warning goes
  • Create with data export plus a couple of narrow scopes: confirmation appears; Cancel leaves the sheet open with picks intact
  • "Create key anyway" creates it and shows the key as before
  • Set every readable resource to Read or higher, then add data export: no confirmation (nothing new is being granted)
  • A key with no data export scope creates with no warning or confirmation, as before

Matches the server-side API key changes in 1.3.5.

Data export read reaches the full account export, every member, journal, board
message, poll and setting, no matter how narrow the other scopes on the key
are. Picking scopes one resource at a time makes that easy to miss: the row
reads like just another resource.

Selecting it now shows an inline warning in the create sheet, and creating such
a key asks for confirmation first. The confirmation is skipped when the key
already grants read on every readable resource, since there is nothing
surprising left to warn about.

The "already reads everything" rule is a pure function with tests rather than a
condition buried in the composable. It is wrong in both directions in quiet
ways: too eager and people learn to click through the warning, too lax and a
key that reads the whole account goes out without anyone being told.
Write-only resources are excluded from it, since they grant no read at all and
counting them would mean the check never passed.

Nothing to port from the same release's clipboard fix: that was a browser
secure-context problem, and this screen's copy button makes no success claim
to be wrong about.
@SiteRelEnby
SiteRelEnby enabled auto-merge August 10, 2026 22:55
@SiteRelEnby
SiteRelEnby merged commit a4ad832 into main Aug 10, 2026
1 check passed
@SiteRelEnby
SiteRelEnby deleted the feat/api-key-export-scope-warning branch August 10, 2026 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant