Commit 4655b11
authored
SSH/server utility cleanup and small code security improvements (#1221)
* Update dartssh2 package
* Remove dead code: DecyptPem and tryParseCompletedOutput
- Remove unused DecyptPem function (zero call sites)
- Remove unused tryParseCompletedOutput static method (only used in tests)
- Fix typo: loadIndentity -> loadIdentity
- Update persistent_shell_test.dart to drop tests for removed method
* Harden security: avoid password in process args, use system temp for keys
- sftp_sudo: use shell builtin printf instead of echo to pipe sudo
password, so the password does not appear in the process argument
list visible via ps
- server_func_btns: write temp private key to system temp directory
instead of the predictable app doc path, and extend retention to
5s for SSH connection establishment
- server_func_btns: unconditionally clear clipboard after password
copy timeout instead of skipping when content changed
* Reduce redundant store fetches and reuse listEquals
- server_dedup: accept optional existingServers param to avoid
duplicate ServerStore.fetch() calls in _resolveServers
- all.dart: replace manual _isSameOrder with listEquals
- server_private_info: replace _sameStringList with listEquals
* Improve robustness: fix async void, skip empty workers, narrow failover
- chan: change updateHomeWidget from void async to Future<void> with
try-catch so callers can use unawaited properly
- home: mark updateHomeWidget calls with unawaited
- main: skip Computer.shared.turnOn when no servers configured
- server: narrow _isJumpFailoverError keyword matching to avoid
false positives on unrelated errors containing 'network' or 'socket'
* Fix naming inconsistencies and document enum ordering
- setting: rename backupasswd -> backupPassword
- misc: rename multiBlankreg -> multiBlankReg for consistency
- server: add ordering invariant comment for ServerConn operator<
* Restore decryptPem and fix typo in caller
- Restore decryptPem (was wrongly removed as dead code, actually
called in private_key/edit.dart via Computer.shared.start)
- Fix typo: decyptPem -> decryptPem in both definition and call site
* Preserve user clipboard content when clearing SSH password
Revert to checking clipboard content before clearing: only wipe
the clipboard if it still holds the password. If the user copied
something else during the 25s window, preserve their content.
* Revert dartssh2 package
* Address review findings: failover match, Computer init, temp key, dedup
- server.dart: add 'network is unreachable' to failover error matching
- main.dart: restore unconditional Computer.shared.turnOn to avoid
hangs when backup/private-key flows call Computer.shared.start with
zero servers configured
- server_func_btns: use unique temp directory per launch instead of
stable filename, and extend key cleanup delay to 30s, delete the
whole temp directory on cleanup
- ssh.dart: reuse a single Stores.server.fetch() call in
_processSSHServers for both deduplicateServers and
resolveNameConflicts
* Delete temp SSH key dir immediately when launch fails
Track whether SSH actually started via sshLaunched flag set after
each successful Process.start. On failure paths (exception, unsupported
platform, or key prep error) the temp key directory is deleted right
away in the finally block instead of waiting 30 seconds.1 parent 0e7b71b commit 4655b11
17 files changed
Lines changed: 110 additions & 118 deletions
File tree
- lib
- core
- utils
- data
- model
- container
- server
- provider/server
- res
- ssh
- store
- view
- page
- private_key
- setting/entries
- widget
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | | - | |
| 30 | + | |
26 | 31 | | |
27 | 32 | | |
28 | 33 | | |
| |||
214 | 219 | | |
215 | 220 | | |
216 | 221 | | |
217 | | - | |
| 222 | + | |
218 | 223 | | |
219 | 224 | | |
220 | 225 | | |
| |||
249 | 254 | | |
250 | 255 | | |
251 | 256 | | |
252 | | - | |
253 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
254 | 260 | | |
255 | | - | |
| 261 | + | |
256 | 262 | | |
257 | 263 | | |
258 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
16 | | - | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
| |||
111 | 117 | | |
112 | 118 | | |
113 | 119 | | |
114 | | - | |
115 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
116 | 126 | | |
117 | 127 | | |
118 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | | - | |
241 | 240 | | |
242 | 241 | | |
243 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
244 | 247 | | |
245 | 248 | | |
246 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
148 | 149 | | |
149 | 150 | | |
150 | 151 | | |
151 | | - | |
| 152 | + | |
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
| |||
208 | 209 | | |
209 | 210 | | |
210 | 211 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
335 | 336 | | |
336 | 337 | | |
337 | 338 | | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
| 339 | + | |
| 340 | + | |
350 | 341 | | |
351 | 342 | | |
352 | 343 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | 290 | | |
301 | 291 | | |
302 | 292 | | |
| |||
0 commit comments