Commit a021786
fix(dashboard): embedding Test Connection expands {file:}/{env:} tokens and allows http/loopback/LAN
Two user-reported bugs in the dashboard 'Test Connection' probe, both from the
probe applying untrusted-project-config security policy to what is actually the
user-config editor:
1. A {file:~/...key} api_key (the pattern we document and recommend) was refused
with an {env:}-flavored message ('variable is not set in this process / shell
exports the var') that is nonsense for a file token.
2. A self-hosted http://127.0.0.1:1234/v1 endpoint was rejected as 'must start
with http:// or https://' (it does) — the validator was https-only, and even
with http allowed the SSRF guard then blocked loopback, so localhost servers
(LMStudio/Ollama/llama.cpp, the most common local setup) couldn't be tested.
The probe's only input is the USER-level ConfigEditor; project-tier editing covers
only dreamer schedule/model, never embedding. So the 'malicious project config
picks a hostile endpoint/secret-file and the user clicks Test' precondition is not
reachable here, and the probe now mirrors doctor (which it is documented to
mirror):
- expand_config_value() resolves {env:VAR} and {file:~|/abs|rel} exactly like the
plugin's load-time variable.ts (file contents trimmed; relative paths resolve
against the user config dir). Unresolved tokens still don't reach the network.
- {file:} tokens resolving into credential dirs (~/.ssh, ~/.aws, ~/.gnupg,
~/.config/gh) are REFUSED (new BlockedSensitiveFile outcome) — defense in depth.
- http:// is now accepted alongside https://.
- loopback + private/LAN (incl. IPv6 ULA) are now allowed. Cloud instance-metadata
(169.254.169.254, AWS IPv6 fd00:ec2::254, incl. IPv4-mapped), IPv4/IPv6
link-local, and unspecified stay blocked; URL userinfo still rejected.
- Frontend message branches on token kind (file vs env) so the guidance is
accurate, and renders the new sensitive-file refusal.
Documented the reversal of the prior probe-SSRF audit finding as A53 so future
audits don't re-flag it. Rust 133/0 (incl. new metadata/loopback/scheme/expand
tests), tsc + biome + build clean.
Co-authored-by: Alfonso [Magic Context] <288211368+alfonso-magic-context@users.noreply.github.com>1 parent 1821164 commit a021786
5 files changed
Lines changed: 381 additions & 64 deletions
File tree
- docs
- packages/dashboard
- src-tauri/src
- src/components/ConfigEditor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
862 | 862 | | |
863 | 863 | | |
864 | 864 | | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
903 | 905 | | |
904 | 906 | | |
905 | 907 | | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
910 | 929 | | |
911 | 930 | | |
912 | 931 | | |
| |||
917 | 936 | | |
918 | 937 | | |
919 | 938 | | |
920 | | - | |
921 | | - | |
922 | | - | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
927 | | - | |
928 | | - | |
929 | | - | |
930 | | - | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
931 | 952 | | |
932 | 953 | | |
933 | 954 | | |
| |||
1130 | 1151 | | |
1131 | 1152 | | |
1132 | 1153 | | |
1133 | | - | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
1134 | 1158 | | |
1135 | 1159 | | |
1136 | | - | |
| 1160 | + | |
1137 | 1161 | | |
1138 | 1162 | | |
1139 | | - | |
| 1163 | + | |
1140 | 1164 | | |
1141 | 1165 | | |
1142 | | - | |
| 1166 | + | |
1143 | 1167 | | |
1144 | 1168 | | |
1145 | 1169 | | |
1146 | | - | |
| 1170 | + | |
1147 | 1171 | | |
1148 | | - | |
1149 | | - | |
1150 | | - | |
1151 | | - | |
1152 | | - | |
1153 | | - | |
1154 | | - | |
1155 | | - | |
1156 | | - | |
1157 | | - | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
1158 | 1175 | | |
1159 | 1176 | | |
1160 | 1177 | | |
1161 | | - | |
1162 | | - | |
1163 | | - | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
1164 | 1181 | | |
1165 | 1182 | | |
1166 | 1183 | | |
1167 | 1184 | | |
1168 | 1185 | | |
1169 | 1186 | | |
1170 | | - | |
| 1187 | + | |
1171 | 1188 | | |
1172 | 1189 | | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
1173 | 1205 | | |
1174 | 1206 | | |
1175 | | - | |
1176 | | - | |
| 1207 | + | |
| 1208 | + | |
1177 | 1209 | | |
1178 | 1210 | | |
1179 | 1211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1254 | 1254 | | |
1255 | 1255 | | |
1256 | 1256 | | |
1257 | | - | |
| 1257 | + | |
1258 | 1258 | | |
1259 | | - | |
| 1259 | + | |
1260 | 1260 | | |
1261 | 1261 | | |
1262 | 1262 | | |
| |||
6775 | 6775 | | |
6776 | 6776 | | |
6777 | 6777 | | |
6778 | | - | |
| 6778 | + | |
| 6779 | + | |
| 6780 | + | |
| 6781 | + | |
6779 | 6782 | | |
6780 | 6783 | | |
6781 | 6784 | | |
| |||
0 commit comments