Skip to content

Withhold a hand-back's request from the dev log when field security is unknown - #391

Merged
alexkroman merged 1 commit into
mainfrom
fix/handback-log-unverified
Nov 25, 2026
Merged

alexkroman merged 1 commit into
mainfrom
fix/handback-log-unverified

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

Problem

An automated security review of DictationSession+Pipeline.swift found a gap between two paths that should behave the same.

#358 withholds a dictation's transcript from the developer-mode log when the target field's security is unknown: the Accessibility read hadn't landed, or reached no focused element. The log then records DictationLog.unverifiedTranscript instead of the words.

The hand-back ending (read-aloud's "ask about the selection", the Rewrite and Compose keys) returns before that substitution. So a spoken request over a field of unknown security was logged verbatim. A known password field was already safe on both paths, because DictationLog withholds on targetIsSecure itself.

Fix

security and the loggable text are now read once, before either ending, and both logTranscript calls use them. The remember decision is unchanged; it uses the same security it always did.

Test

DictationSessionUnknownSecurityTests.handBackOverUnknownFieldIsWithheld: a hand-back press over an .unreachable field ends .handedBack and logs unverifiedTranscript. It fails against main's code and passes with the fix.

The full engine suite passes, and swift-format and SwiftLint (strict) are clean.

The review's other two findings

  • "Password in developer log" on the paste path: not an issue. capturedContext is pressContext?.resolved (DictationSession.swift:93), the same value targetSecurity comes from. A .secure verdict therefore always reaches the log as targetIsSecure == true, and the log withholds it.
  • "Conceal the clipboard for unknown targets too": left as is, and raised separately as a product decision. unknown covers every dictation whose Accessibility read didn't land in time or found no focused element, which is routine in Electron apps and browsers. Concealing those would mark ordinary "Copied" leave-behinds as secret and clear them after 90 s. It also wouldn't match Never replay dictations into fields whose security is unknown #358's own split, where unknown stays local (Recent) but never goes on the wire.

🤖 Generated with Claude Code

…s security is unknown

The hand-back ending returned before the unknown-security substitution, so
a request spoken over a field Accessibility couldn't read was logged
verbatim, where a pasted dictation into the same field is logged as
unverifiedTranscript. security and the loggable text are now read once,
before either ending. Found by an automated security review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alexkroman
alexkroman enabled auto-merge November 25, 2026 03:16
@alexkroman
alexkroman added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 1359e94 Nov 25, 2026
15 checks passed
@alexkroman
alexkroman deleted the fix/handback-log-unverified branch November 25, 2026 04:26
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.

2 participants