arkavo-org / arkavo-org/app

Track 5 identity plane: deferred findings from #246

Open
#247 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
0
Forks
0
Avg merge
1h 41m
Merged PRs (30d)
1

Description

Deferred, non-blocking findings from the Track 5 identity-plane branch (#246). Each was raised by a task or whole-branch review, triaged as fine-to-defer, and recorded rather than fixed, to keep that PR's diff scoped. Grouped by area; none is a known-broken path.

### Entitlement canonicalization (`AgentEntitlementCanonicalizer.swift`)
- [ ] FQN passthrough accepts any `https://…/attr/…/value/…` regardless of namespace, so a foreign-namespace FQN passes through instead of being dropped. The server-side subset check is the real gate, so this is defense-in-depth.
- [ ] `hasPrefix("https://")` is case-sensitive — `HTTPS://…` is silently dropped.
- [ ] Trims `.whitespaces` rather than `.whitespacesAndNewlines`, so `"read\n"` is dropped.

### Identity client (`ArkavoIdentityClient.swift`)
- [ ] Device-check body/response structs are `Encodable`-only / `Decodable`-only rather than full `Codable`. Functionally correct; inconsistent with the rest of the file.
- [ ] No test asserts `Content-Type: application/json` is set on POSTs.
- [ ] The challenge→POST session-cookie reuse cannot be exercised through the `URLProtocol` stub. Verifiable only against a live authnz-rs; the highest residual risk in the branch.

### Agent authorization (`AgentAuthorizationView.swift`, `AgentAuthorizationFlow.swift`, `ContactsCreateView.swift`)
- [ ] `request.name ?? "Authorized Agent"` is defaulted independently in two places; nothing keeps the name sent to the server in sync with the name stored on the local `Profile`.
- [ ] `AgentRPCPairingOutcome.failed` is logged but never surfaced. A user whose local RPC pairing fails after a successful cloud delegation gets no indication they should re-pair.
- [ ] `displayNameForEntitlement` splits on `.`, so a spec-§4.1 FQN payload renders as `Ai/Attr/Action/Value/Read`. The consent list also shows raw values that the canonicalizer will silently drop. Display-only and fails safe (never shows less than is granted), but it will look wrong as soon as Track 4 ships FQNs in QR codes.
- [ ] `ChatsView.swift:446-452` ignores its `AgentQRScannerView` request argument. Pre-existing; would be resolved by restructuring `AgentQRScannerView` into a pure scan-then-hand-off (it currently authorizes inline and calls back only afterwards), which would also touch `ChatsView`.

### Delegations list (`AgentDelegationsView.swift`)
- [ ] Revoking removes the row locally, but the next `load()` reconciles it back as `.revoked` (the server keeps returning it with `revoked: true`), so a pull-to-refresh makes it reappear.
- [ ] A `.notFound` from `revokeDelegation` is treated as success. Reasonable — it mirrors the documented 409-as-success rule for `authorizeAgent` — but that server behavior is assumed client-side, not documented.
- [ ] Error states surface raw server response bodies verbatim in the UI.

### Device attestation (`DeviceAttestationService.swift`, `ArkavoAuthState.swift`)
- [ ] `runLoop()`'s strong `self` keeps the service alive for the loop's lifetime, so `deinit`'s `loopTask?.cancel()` never fires. Harmless for an app-lifetime `@StateObject`, but it means the type cannot be torn down.
- [ ] Refresh-loop failures land only in `@Published lastError`, with no logging and no current reader.
- [ ] The new foreground-return refresh trigger has no test (adding one needs a new test file).
- [ ] `ArkavoAuthState.checkStoredCredentials`'s catch-all clears the device CWT on *any* auto-login failure, including a transient network error. Mirrors the pre-existing human-token behavior on that path, and the App Attest key id survives so it self-heals.

### Pre-existing, found while working nearby
- [ ] **`ArkavoClient.deleteAccount()` can leave the human token in the keychain.** Its human-token clear sits inside `disconnect()`, which returns early on `guard currentState == .connected` — so deleting an account while disconnected never clears it. #246 sidestepped this for the device token and App Attest key id by clearing them directly in `deleteAccount()`, but the human-token hole remains.
- [ ] **`ArkavoClient.swift:611` prints an auth-completion response body containing `ntdf_token` in plaintext.** No new code in #246 logs any token; this one predates it.
- [ ] The full `cd ArkavoKit && swift test` cannot complete headlessly: `NTDFStreamingTests` needs a CoreData XPC store and retries forever (`CoreData: XPC: Unable to connect to server`). The package compiles and links and every other suite passes, so this blocks whole-package CI, not correctness.

### Follow-ups owned elsewhere
- [ ] **App Attest environment is `development` in release builds** (see #246's Known Limitations). Only one `Arkavo.entitlements` exists and both configurations point at it. Needs a build-setting-driven entitlements split.
- [ ] **Revisit `PlatformTokenProvider`'s human-first preference** once authnz-rs extends the device CWT's `aud` to the platform audience and the platform fork's `mode: arkavo` class-ceiling table is deployed (spec §5.2 steps 1-2).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01PrbFu42oZM4ukgnhBc6dbu

Contributor guide

No contributing guide indexed for this repository

Research direction

This is a deferred tracking issue covering multiple Swift files, including AgentEntitlementCanonicalizer.swift, ArkavoIdentityClient.swift, AgentAuthorizationView.swift, AgentDelegationsView.swift, and DeviceAttestationService.swift. Start by selecting and splitting out one finding, then read its named file and related tests; done criteria differ for each item and are not defined for the umbrella issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
authentication, authorization, mobile, security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.