Commit 36ae843
committed
URL-encode client_id in Azure IMDS token request
The `_get_azure_response()` function constructs the Azure IMDS URL by
interpolating `client_id` via f-string without URL encoding. While
`resource` is already encoded (via `quote()` at the call site in
`auth_oidc_shared.py`), `client_id` is not, creating an inconsistency.
Apply `urllib.parse.quote()` to `client_id` before interpolation,
consistent with the handling of `resource` and with the Node.js driver's
use of `url.searchParams.append()` for the same parameter.
Add a test to verify special characters in `client_id` are properly
percent-encoded and cannot introduce additional query parameters.1 parent e67931d commit 36ae843
2 files changed
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
153 | 167 | | |
154 | 168 | | |
155 | 169 | | |
0 commit comments