mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-24 00:50:44 +00:00
4db44e2ede1996cd52f48c422fd78a34322f0d13
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
904af93a1d |
fix(credentials): 防止解密失败后二次加密污染本地与云端 (#2702) (#2770)
* fix(credentials): stop double-encrypting undecryptable safeStorage blobs When local decrypt failed (e.g. OSCrypt key churn after reboot), encrypt used to wrap the leftover enc:v1 ciphertext again, permanently poisoning the vault. Startup sync could also push those placeholders to cloud and make download restore the same poison. - Keep real enc:v1 blobs unchanged on encrypt (header check, no wrap) - Strip device-bound placeholders when applying portable sync payloads - Guard startup local-wins / merge round-trips before upload - Skip vault init re-encrypt writes when secrets are still undecrypted Fixes #2702 Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(sync): strip enc:v1 secrets from smart-merge uploads Bugbot found that after local apply sanitized placeholders, legacy v1 smart-merge could still decrypt an unstripped remote, merge it, and re-upload the poison. Strip device-bound credentials on remote decrypt and again on the merged payload before upload. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(credentials): address Codex P2 review on #2702 - Always re-encrypt vault init batches so plaintext siblings are not left unprotected when one record is a stale enc:v1 placeholder - Sanitize device-bound secrets before convergent restore prepare so CRDT replica commit matches vault import - Require a complete safeStorage blob (header + min 31 bytes) before treating enc:v1 as ciphertext; encrypt header-only coincidences Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(credentials): address Codex P1 review on #2702 - Decode enc:v1 payloads with atob in the renderer-safe domain helper - Heal poisoned remote secrets from local/base before smart-merge so good credentials are not discarded as remote-only deletions - Keep post-merge strip so leftover enc:v1 never uploads Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(credentials): address Codex P1 CBC min and startup heal - Accept 19-byte v10/v11 CBC OSCrypt blobs (not only 31-byte GCM) - Heal poisoned remote secrets before startup smart-merge - Strip unresolved placeholders on merge round-trip upload Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(sync): sanitize payloads at every apply/commit boundary Codex P1: vault apply stripped enc:v1 while commitRemoteInspection and convergent materialization could keep the poison. Sanitize merged/remote payloads before apply+base commit, strip on CRDT materialization, and sanitize convergent apply inputs. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(sync): heal local and remote secrets before smart-merge Smart-merge could select a locally-changed entity whose only secret delta was enc:v1 poison, then strip and upload empty secrets. Heal both sides from the opposite payload/base before merge on all sync paths. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(sync): keep enc:v1 intact during convergent materialize Stripping device-bound secrets inside materializeSyncPayloadFromConvergentState broke envelope validation for poisoned-but-consistent v2 snapshots, so decrypt could not hydrate the clouds #2702 needs to recover. Portable stripping stays at apply/upload boundaries. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(credentials): detect Windows DPAPI by decoded header bytes Real DPAPI blobs start with 01 00 00 00 d0 8c... and base64-encode as AQAAANCM..., so the previous AQAAAA string prefix rejected them and allowed double-wrapping after key rotation. Match decoded headers in both the main-process bridge and renderer predicate. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * test(credentials): use complete enc:v1 fixtures for stricter detector Short placeholders like enc:v1:djEwAAAA no longer pass the platform header + minimum-size checks. Update auth/SFTP/proxy/sync fixtures to full v10-shaped blobs so npm test matches production validation. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(sync): treat preferred credential deletions as authoritative When healing enc:v1 before merge, an empty/missing secret on a present preferred entity is an intentional clear and must not be revived from base. Only fall back to base when preferred is absent or also poisoned. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(credentials): reject impossible v10/v11 ciphertext lengths Accept only CBC-aligned sizes (19+16n) or GCM-sized blobs (>=31) so coincidental enc:v1 plaintext of intermediate length is encrypted instead of treated as an undecryptable placeholder. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(credentials): require full DPAPI provider GUID signature Accept Windows safeStorage blobs only when they start with version 01 00 00 00 plus provider GUID df9d8cd0-1501-11d1-8c7a-00c04fc297eb, so coincidental 01 00 00 00 prefixes are not treated as ciphertext. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> |
||
|
|
18b2f435bc |
feat(terminal): configurable su/sudo password prompt assist (#2156) (#2176)
* feat(terminal): configurable su/sudo password prompt assist (#2156) Extend the existing confirm-to-fill sudo assist to arm on su as well, and add a Terminal setting for off / quick Enter fill / WindTerm-like credential picker. Picker candidates come from the host password plus keychain password identities; secrets are never shown in the list or sent without confirmation. * fix(terminal): tighten password prompt assist after codex review - Hint mode only uses the session host password, never an arbitrary keychain identity as a silent Enter target. - Build autofill candidates from the effective session host so group- inherited passwords participate. - Clear a stale credential picker when the session disconnects. * fix(terminal): more password-assist polish from codex review - Do not swallow arrow keys while the quick-fill hint is pending; only the multi-credential picker consumes them. - Clear the picker overlay on hibernate and wake so it cannot outlive the autofill controller. - Show the resolved auth username on the host candidate row (identityId / group identity), not a stale host.username after password dedupe. * fix(terminal): keep password picker select callback stable Avoid forcing TerminalView memo invalidation on every Terminal render by using a stable useCallback for credential selection. * fix(terminal): do not offer full keychain on unarmed sudo prompts Picker mode only lists all password identities after a real su/sudo command was armed. Unarmed explicit [sudo] lines still get host-password quick-fill only, blocking remote prompt phishing of other credentials. * fix(terminal): fix picker mode switch and armed picker test Arm before inspecting the picker payload, and when switching settings mid-prompt recompute whether the command arm is still valid so picker mode can open the full list. * fix(terminal): reopen password picker after a wrong credential Keep the su/sudo arm active after confirm-to-fill so a rejected password re-prompt can offer the full credential list again instead of falling back to host-only unarmed assist. * fix(terminal): only re-assist real auth retries after fill Keep a short post-fill arm for wrong-password re-prompts, but require an explicit [sudo] line or authentication-failure text before reopening assist. Prevents sending the host password into child prompts after a successful sudo (e.g. sudo mysql -p). * fix(terminal): scope sudo assist away from child password prompts Track whether the armed command was sudo or su. su still accepts bare Password: lines; sudo only assists on [sudo] tags or user-scoped prompts (password for … / 输入密码), not generic Enter password when sudo is cached. * fix(terminal): tighten when the full credential picker may open Exclude child-program prompts (Enter password, Password for user …). Full keychain picker only for explicit [sudo] lines or armed su Password: prompts; Kylin-style sudo bare prompts still get host-password hint only. * fix(terminal): limit full credential picker to armed su only Multi-identity picker is the WindTerm-style su workflow (#2156). Sudo keeps host-password quick-fill only, so a cached sudo child cannot open the full keychain list via a forged or nested password prompt. * fix(terminal): derive password assist candidates in Terminal + mode gate - Standalone Terminal popups without TerminalLayer now resolve candidates from host/keys/identities so su picker mode still works. - When switching to picker mid-prompt, keep the su-only full-list gate (do not open multi-identity list for an armed sudo prompt). * fix(terminal): reject SSH-style prompts for su assist and drop dupe keys - su bare matching only accepts short Password:/密码 lines, not user@host SSH password prompts after passwordless su -c. - Remove duplicate sudoAutofillCandidates keys that failed eslint. * fix(terminal): cursor-anchor password picker and soft-dismiss Esc Position the su credential picker with the same cursor-relative layout helpers as autocomplete instead of fixed bottom-center. Esc only closes the UI while keeping the arm so Esc/arrows can reopen the list on the same Password: prompt. |