Repository navigation
Commit b676200
committed
fix(auth): support IPv6 callback targets in browser login flows
An IPv6-only callback bind (OPENSHELL_CALLBACK_BIND_ADDRESS=::1) was
accepted but both browser flows still directed callbacks at
127.0.0.1, so the listener was unreachable and login timed out.
Route callbacks to the address the listener actually bound:
- The CLI derives the browser-facing callback target from the bound
address. Wildcard binds map to the matching loopback (0.0.0.0 to
127.0.0.1, :: to [::1]) because a wildcard listener accepts
loopback connections of its family; IPv6 addresses render
bracketed per RFC 3986/RFC 8252.
- The OIDC redirect URI therefore becomes
http://[::1]:<port>/callback for ::1-bound listeners, and the
bundled Keycloak realm now allows http://[::1]:* redirects for
the CLI client alongside the existing IPv4 entries.
- The edge flow passes the unbracketed loopback literal to the
gateway connect page as callback_host. The page strictly
validates it to a loopback IP literal (anything missing,
non-loopback, or malformed falls back to 127.0.0.1) before
embedding it in the fetch URL and CSP connect-src, so a crafted
parameter can never direct the embedded edge token to an
external host. The host is preserved across the waiting-page
refresh, and older gateways that ignore the new parameter keep
the historical 127.0.0.1 behavior.
Defaults are unchanged: the listener still binds 127.0.0.1 on an
ephemeral port unless the environment variables say otherwise.
Adds a callback-reachability test (connecting to the advertised
[::1] target succeeds while 127.0.0.1 is refused for a ::1 bind),
host-derivation table tests, OIDC redirect tests for ::1 and ::
binds, edge URL tests, and server-side validation and render tests.
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>1 parent a9426dc commit b676200
6 files changed
Lines changed: 322 additions & 38 deletions
File tree
- crates
- openshell-cli/src
- openshell-server/src/auth
- docs/how-it-works/gateways
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
86 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
87 | 97 | | |
88 | | - | |
| 98 | + | |
89 | 99 | | |
90 | 100 | | |
91 | 101 | | |
| |||
123 | 133 | | |
124 | 134 | | |
125 | 135 | | |
| 136 | + | |
126 | 137 | | |
127 | 138 | | |
128 | 139 | | |
129 | | - | |
| 140 | + | |
130 | 141 | | |
131 | 142 | | |
132 | 143 | | |
| |||
892 | 903 | | |
893 | 904 | | |
894 | 905 | | |
895 | | - | |
| 906 | + | |
896 | 907 | | |
897 | 908 | | |
898 | 909 | | |
| |||
923 | 934 | | |
924 | 935 | | |
925 | 936 | | |
926 | | - | |
| 937 | + | |
927 | 938 | | |
928 | 939 | | |
929 | 940 | | |
930 | 941 | | |
| 942 | + | |
931 | 943 | | |
932 | 944 | | |
933 | 945 | | |
| |||
947 | 959 | | |
948 | 960 | | |
949 | 961 | | |
950 | | - | |
951 | | - | |
952 | | - | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
953 | 966 | | |
954 | 967 | | |
955 | 968 | | |
956 | 969 | | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
957 | 993 | | |
958 | 994 | | |
959 | 995 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
70 | 99 | | |
71 | 100 | | |
72 | 101 | | |
| |||
108 | 137 | | |
109 | 138 | | |
110 | 139 | | |
111 | | - | |
112 | 140 | | |
113 | 141 | | |
114 | 142 | | |
| |||
159 | 187 | | |
160 | 188 | | |
161 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
162 | 251 | | |
163 | 252 | | |
164 | 253 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
180 | 182 | | |
181 | | - | |
182 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
183 | 186 | | |
184 | 187 | | |
185 | 188 | | |
| |||
1051 | 1054 | | |
1052 | 1055 | | |
1053 | 1056 | | |
1054 | | - | |
| 1057 | + | |
1055 | 1058 | | |
1056 | 1059 | | |
1057 | 1060 | | |
| |||
1103 | 1106 | | |
1104 | 1107 | | |
1105 | 1108 | | |
1106 | | - | |
1107 | | - | |
| 1109 | + | |
| 1110 | + | |
1108 | 1111 | | |
1109 | 1112 | | |
1110 | 1113 | | |
1111 | 1114 | | |
1112 | 1115 | | |
1113 | 1116 | | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
1114 | 1155 | | |
1115 | 1156 | | |
1116 | 1157 | | |
| |||
0 commit comments