Repository navigation
fix: accept labeled Shared key paste in Observer - #223
Conversation
Mostro mobile v2 shares K_conv as "Shared key: <hex>", which the Observer rejected because Enter validated the whole field as hex. On Enter, reduce the field to the single 64-char hex run (zeroizing the original text) before validating and loading the chat. Longer hex runs are rejected rather than truncated.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 22 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughObserver chat submission now extracts a 64-character hexadecimal key from pasted text, normalizes the input field, and validates the normalized value before fetching. ChangesObserver Shared Key Input
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant User
participant EnterHandler
participant AppState
participant ChatUtils
participant ObserverFetch
User->>EnterHandler: Submit pasted key
EnterHandler->>AppState: Normalize key input
AppState->>ChatUtils: Extract 64-character hex run
ChatUtils-->>AppState: Return extracted key or no match
AppState-->>EnterHandler: Return normalization result
EnterHandler->>ObserverFetch: Fetch with valid normalized key
Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0325da9f1a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Pasting a labeled key after an old one without clearing the field left two 64-char hex runs; normalization picked the first and silently reloaded the previous conversation. Return None when the field holds two different keys so Enter reports invalid input.
Summary
Mostro mobile v2 shares the conversation key (
K_conv) as text with a label:When a solver pasted that into the Observer tab and pressed Enter, Mostrix showed
Shared key must be a valid 64-char hex secret (32 bytes). Enter only trimmed thefield and then validated the whole string, label included, as hex.
Now, when the solver presses Enter, the field is reduced to the 64-char hex key
before it is validated and loaded:
chat_utils::extract_shared_key_hex()returns the first run of exactly 64 ASCIIhex digits. It rejects a longer hex run rather than truncating it, so it never loads
a wrong key without telling the solver.
AppState::normalize_observer_shared_key_input()replaces the field with that hex.It zeroizes the original text first, as the other Observer secrets are handled. The
field then shows exactly the key that was loaded, which keeps the
observer_loaded_shared_keypin and the divergence check consistent.left unchanged.
Test plan
extract_shared_key_hex: text with the mobile label, a bare key, a key padded with whitespace, and hex of the wrong length (empty, short, 63 and 65 chars)normalize_observer_shared_key_input: the label is stripped, and the field is unchanged when no key is presentcargo fmt --all -- --check,cargo clippy --all-targets --all-features -- -D warnings,cargo test --all-featuresShared key: <hex>from Mostro mobile v2 into the Observer tab and pressed Enter; the chat loadedSummary by CodeRabbit