Commit d15448b
committed
fix(ssrf): block unparseable host notations and add bypass tests
- Reject URLs where URI.getHost() is null but URI.getAuthority() is
non-null: this covers octal (0251.0376.0251.0376) and Unicode digit
hosts that java.net.URI cannot parse into a standard hostname. Without
this guard, octal-encoded private IPs pass validation entirely.
- Use authority != null instead of StringUtils.hasText() — getAuthority()
is never an empty string, so the plain null-check is exact and clearer.
- Add BypassAttempts test class covering: decimal-encoded IPs (resolved
correctly by InetAddress), octal and Unicode (caught by the new guard),
and uppercase scheme normalisation (SBA's own toLowerCase logic).
Tests that only exercise JDK URI parsing or Spring Boot's InetAddressFilter
internals were not added — those are tested by their respective owners.1 parent a5b270f commit d15448b
2 files changed
Lines changed: 64 additions & 1 deletion
File tree
- spring-boot-admin-server/src
- main/java/de/codecentric/boot/admin/server/utils
- test/java/de/codecentric/boot/admin/server/utils
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
95 | 105 | | |
96 | 106 | | |
97 | 107 | | |
| |||
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
86 | 139 | | |
87 | 140 | | |
88 | 141 | | |
| |||
0 commit comments