Repository navigation
Commit 9d7f58e
authored
fix: redact credential headers on API error requests (#4316)
Use the existing sensitive-header list for request copies attached to
API errors. Both `error.request` and `error.response.request` point to
the same copy. Redirect history and pending redirects follow the same
rule. The transport keeps its original request.
Callers that resend a request from an error must reapply authentication.
This change is limited to known request headers on these public
attributes.
Verified with sync and async client, streaming, authentication, and
redirect tests (654 passed, 36 skipped), Ruff, and ty.1 parent fa01235 commit 9d7f58e
4 files changed
Lines changed: 72 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
46 | 78 | | |
47 | 79 | | |
48 | 80 | | |
| |||
64 | 96 | | |
65 | 97 | | |
66 | 98 | | |
67 | | - | |
| 99 | + | |
68 | 100 | | |
69 | 101 | | |
70 | 102 | | |
| |||
85 | 117 | | |
86 | 118 | | |
87 | 119 | | |
88 | | - | |
| 120 | + | |
89 | 121 | | |
90 | 122 | | |
91 | 123 | | |
| |||
98 | 130 | | |
99 | 131 | | |
100 | 132 | | |
101 | | - | |
| 133 | + | |
102 | 134 | | |
103 | 135 | | |
104 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1062 | 1062 | | |
1063 | 1063 | | |
1064 | 1064 | | |
1065 | | - | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
1066 | 1069 | | |
1067 | 1070 | | |
1068 | 1071 | | |
| |||
1334 | 1337 | | |
1335 | 1338 | | |
1336 | 1339 | | |
| 1340 | + | |
| 1341 | + | |
1337 | 1342 | | |
1338 | 1343 | | |
1339 | 1344 | | |
| |||
2476 | 2481 | | |
2477 | 2482 | | |
2478 | 2483 | | |
2479 | | - | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
2480 | 2488 | | |
2481 | 2489 | | |
2482 | 2490 | | |
| |||
2727 | 2735 | | |
2728 | 2736 | | |
2729 | 2737 | | |
| 2738 | + | |
| 2739 | + | |
2730 | 2740 | | |
2731 | 2741 | | |
2732 | 2742 | | |
| |||
3585 | 3595 | | |
3586 | 3596 | | |
3587 | 3597 | | |
3588 | | - | |
| 3598 | + | |
| 3599 | + | |
| 3600 | + | |
3589 | 3601 | | |
3590 | 3602 | | |
3591 | 3603 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
268 | 270 | | |
269 | 271 | | |
270 | 272 | | |
| |||
0 commit comments