Commit de02d0b
authored
Authenticate naive local SOCKS loopback (MatsuriDayo#1166 part 2) (#45)
* feat(security): authenticate naive local SOCKS loopback (MatsuriDayo#1166 part 2)
Generate per-port credentials for the naive external-plugin SOCKS listener and
dial it from the sing-box socks outbound with the same creds. Android does not
isolate 127.0.0.1 per app, so an unauthenticated plugin SOCKS listener could be
reached by any local app to leak the egress IP. Verified on-device: the naive
SOCKS port now rejects unauthenticated connections (curl: 'No authentication
method was acceptable') and accepts with creds.
Scoped to naive only; other external plugins (mieru/trojan-go/hysteria v1) need
separate per-plugin auth verification before enabling.
* review: address Greptile feedback (skip creds on export, rename shadowed params)
- ConfigBuilder: gate naive loopback creds on !forExport so the exported sing-box
config stays credential-free and matches the credential-free exported naive config
(ProxyEntity.buildNaiveConfig), avoiding a broken standalone export.
- NaiveFmt: rename buildNaiveConfig params username/password -> listenUsername/
listenPassword to stop shadowing NaiveBean.username/.password receiver properties.1 parent d391cba commit de02d0b
3 files changed
Lines changed: 41 additions & 4 deletions
File tree
- app/src/main/java/io/nekohasekai/sagernet
- bg/proto
- fmt
- naive
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| |||
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
72 | 80 | | |
73 | 81 | | |
74 | 82 | | |
| |||
95 | 103 | | |
96 | 104 | | |
97 | 105 | | |
| 106 | + | |
| 107 | + | |
98 | 108 | | |
99 | 109 | | |
100 | 110 | | |
| |||
377 | 387 | | |
378 | 388 | | |
379 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
380 | 404 | | |
381 | 405 | | |
382 | 406 | | |
| |||
941 | 965 | | |
942 | 966 | | |
943 | 967 | | |
944 | | - | |
| 968 | + | |
| 969 | + | |
945 | 970 | | |
946 | 971 | | |
947 | 972 | | |
| |||
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
79 | 89 | | |
80 | 90 | | |
81 | 91 | | |
| |||
0 commit comments