Commit 7a9f4b0
authored
Merge commit from fork
* fix(auth): validate bearer realm host to prevent credential exfiltration
A malicious registry can set the WWW-Authenticate Bearer realm to an
attacker-controlled URL. Without validation, ORAS would send the user's
plaintext credentials or OAuth2 tokens to that arbitrary host.
Validate that the realm URL host matches the registry host before making
any credential-bearing request. Add TrustedRealmHosts to Client for
deployments that legitimately use a separate token service host.
Fixes GHSA-28r5-37g7-p6mp
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
* fix(auth): reject unsafe bearer realm URLs
Replace the prior strict same-host realm check with a narrower
defensive validation that rejects only obviously unsafe realm
destinations:
- schemes other than http or https
- http realms when the registry was contacted over https
(TLS downgrade)
- hosts that are IP literals in loopback, link-local, private,
or unspecified ranges (e.g. cloud instance metadata services
such as 169.254.169.254)
Cross-host realms on public DNS names are preserved so that
distribution-spec-conformant deployments such as Docker Hub
(registry-1.docker.io -> auth.docker.io) continue to work.
The IP-literal check is skipped when the realm hostname matches
the registry hostname so loopback and in-cluster deployments are
unaffected.
Refs: GHSA-xf85-363p-868w
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
---------
Signed-off-by: Terry Howe <terrylhowe@gmail.com>1 parent d593d50 commit 7a9f4b0
3 files changed
Lines changed: 87 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
159 | 203 | | |
160 | 204 | | |
161 | 205 | | |
| |||
257 | 301 | | |
258 | 302 | | |
259 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
260 | 307 | | |
261 | 308 | | |
262 | 309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3743 | 3743 | | |
3744 | 3744 | | |
3745 | 3745 | | |
3746 | | - | |
| 3746 | + | |
3747 | 3747 | | |
3748 | 3748 | | |
3749 | 3749 | | |
| |||
3815 | 3815 | | |
3816 | 3816 | | |
3817 | 3817 | | |
3818 | | - | |
| 3818 | + | |
3819 | 3819 | | |
3820 | 3820 | | |
3821 | 3821 | | |
| |||
3909 | 3909 | | |
3910 | 3910 | | |
3911 | 3911 | | |
3912 | | - | |
| 3912 | + | |
3913 | 3913 | | |
3914 | 3914 | | |
3915 | 3915 | | |
| |||
3976 | 3976 | | |
3977 | 3977 | | |
3978 | 3978 | | |
| 3979 | + | |
| 3980 | + | |
| 3981 | + | |
| 3982 | + | |
| 3983 | + | |
| 3984 | + | |
| 3985 | + | |
| 3986 | + | |
| 3987 | + | |
| 3988 | + | |
| 3989 | + | |
| 3990 | + | |
| 3991 | + | |
| 3992 | + | |
| 3993 | + | |
| 3994 | + | |
| 3995 | + | |
| 3996 | + | |
| 3997 | + | |
| 3998 | + | |
| 3999 | + | |
| 4000 | + | |
| 4001 | + | |
| 4002 | + | |
| 4003 | + | |
| 4004 | + | |
| 4005 | + | |
| 4006 | + | |
| 4007 | + | |
| 4008 | + | |
| 4009 | + | |
| 4010 | + | |
| 4011 | + | |
| 4012 | + | |
| 4013 | + | |
| 4014 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
138 | 137 | | |
139 | 138 | | |
140 | 139 | | |
| |||
0 commit comments