- Notifications
You must be signed in to change notification settings - Fork4.9k
Commita460251
committed
Make cancel request keys longer
Currently, the cancel request key is a 32-bit token, which isn't verymuch entropy. If you want to cancel another session's query, you canbrute-force it. In most environments, an unauthorized cancellation ofa query isn't very serious, but it nevertheless would be nice to havemore protection from it. Hence make the key longer, to make it harderto guess.The longer cancellation keys are generated when using the new protocolversion 3.2. For connections using version 3.0, short 4-bytes keys arestill used.The new longer key length is not hardcoded in the protocol anymore,the client is expected to deal with variable length keys, up to 256bytes. This flexibility allows e.g. a connection pooler to add moreinformation to the cancel key, which might be useful for finding theconnection.Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>Reviewed-by: Robert Haas <robertmhaas@gmail.com> (earlier versions)Discussion:https://www.postgresql.org/message-id/508d0505-8b7a-4864-a681-e7e5edfe32aa@iki.fi1 parent285613c commita460251
File tree
14 files changed
+252
-84
lines changed- doc/src/sgml
- src
- backend
- storage/ipc
- tcop
- utils/init
- include
- libpq
- storage
- interfaces/libpq
- test/modules/libpq_pipeline/t
14 files changed
+252
-84
lines changedLines changed: 24 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4062 | 4062 |
| |
4063 | 4063 |
| |
4064 | 4064 |
| |
4065 |
| - | |
| 4065 | + | |
4066 | 4066 |
| |
4067 | 4067 |
| |
4068 | 4068 |
| |
| |||
4080 | 4080 |
| |
4081 | 4081 |
| |
4082 | 4082 |
| |
4083 |
| - | |
| 4083 | + | |
4084 | 4084 |
| |
4085 | 4085 |
| |
4086 |
| - | |
| 4086 | + | |
| 4087 | + | |
| 4088 | + | |
| 4089 | + | |
| 4090 | + | |
| 4091 | + | |
| 4092 | + | |
| 4093 | + | |
| 4094 | + | |
| 4095 | + | |
| 4096 | + | |
| 4097 | + | |
| 4098 | + | |
4087 | 4099 |
| |
4088 | 4100 |
| |
4089 | 4101 |
| |
4090 | 4102 |
| |
| 4103 | + | |
| 4104 | + | |
| 4105 | + | |
4091 | 4106 |
| |
4092 | 4107 |
| |
4093 | 4108 |
| |
| |||
4293 | 4308 |
| |
4294 | 4309 |
| |
4295 | 4310 |
| |
4296 |
| - | |
| 4311 | + | |
4297 | 4312 |
| |
4298 | 4313 |
| |
4299 |
| - | |
| 4314 | + | |
| 4315 | + | |
4300 | 4316 |
| |
4301 | 4317 |
| |
4302 | 4318 |
| |
4303 | 4319 |
| |
| 4320 | + | |
| 4321 | + | |
| 4322 | + | |
4304 | 4323 |
| |
4305 | 4324 |
| |
4306 | 4325 |
| |
|
Lines changed: 12 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
63 | 63 |
| |
64 | 64 |
| |
65 | 65 |
| |
66 |
| - | |
67 |
| - | |
| 66 | + | |
| 67 | + | |
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
| |||
148 | 148 |
| |
149 | 149 |
| |
150 | 150 |
| |
151 |
| - | |
152 |
| - | |
| 151 | + | |
153 | 152 |
| |
154 | 153 |
| |
155 | 154 |
| |
| |||
163 | 162 |
| |
164 | 163 |
| |
165 | 164 |
| |
166 |
| - | |
| 165 | + | |
167 | 166 |
| |
168 | 167 |
| |
169 | 168 |
| |
170 | 169 |
| |
171 | 170 |
| |
| 171 | + | |
172 | 172 |
| |
173 | 173 |
| |
174 | 174 |
| |
| |||
199 | 199 |
| |
200 | 200 |
| |
201 | 201 |
| |
202 |
| - | |
203 |
| - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
204 | 205 |
| |
205 | 206 |
| |
206 | 207 |
| |
| |||
254 | 255 |
| |
255 | 256 |
| |
256 | 257 |
| |
257 |
| - | |
258 |
| - | |
| 258 | + | |
259 | 259 |
| |
260 | 260 |
| |
261 | 261 |
| |
| |||
725 | 725 |
| |
726 | 726 |
| |
727 | 727 |
| |
728 |
| - | |
| 728 | + | |
729 | 729 |
| |
730 | 730 |
| |
731 | 731 |
| |
| |||
754 | 754 |
| |
755 | 755 |
| |
756 | 756 |
| |
757 |
| - | |
| 757 | + | |
| 758 | + | |
758 | 759 |
| |
759 | 760 |
| |
760 | 761 |
| |
|
Lines changed: 33 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
| 63 | + | |
63 | 64 |
| |
64 | 65 |
| |
65 | 66 |
| |
| |||
565 | 566 |
| |
566 | 567 |
| |
567 | 568 |
| |
568 |
| - | |
569 |
| - | |
570 |
| - | |
571 |
| - | |
572 |
| - | |
573 |
| - | |
574 |
| - | |
575 |
| - | |
576 |
| - | |
577 |
| - | |
578 |
| - | |
579 |
| - | |
580 |
| - | |
581 |
| - | |
582 |
| - | |
583 |
| - | |
584 |
| - | |
585 |
| - | |
586 |
| - | |
587 |
| - | |
588 |
| - | |
589 |
| - | |
| 569 | + | |
590 | 570 |
| |
591 | 571 |
| |
592 | 572 |
| |
| |||
886 | 866 |
| |
887 | 867 |
| |
888 | 868 |
| |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
889 | 900 |
| |
890 | 901 |
| |
891 | 902 |
| |
|
Lines changed: 10 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4259 | 4259 |
| |
4260 | 4260 |
| |
4261 | 4261 |
| |
4262 |
| - | |
| 4262 | + | |
4263 | 4263 |
| |
4264 | 4264 |
| |
4265 |
| - | |
| 4265 | + | |
| 4266 | + | |
| 4267 | + | |
| 4268 | + | |
| 4269 | + | |
4266 | 4270 |
| |
4267 | 4271 |
| |
4268 | 4272 |
| |
4269 | 4273 |
| |
4270 | 4274 |
| |
4271 |
| - | |
| 4275 | + | |
4272 | 4276 |
| |
4273 | 4277 |
| |
4274 | 4278 |
| |
| |||
4323 | 4327 |
| |
4324 | 4328 |
| |
4325 | 4329 |
| |
4326 |
| - | |
| 4330 | + | |
4327 | 4331 |
| |
4328 | 4332 |
| |
4329 |
| - | |
| 4333 | + | |
| 4334 | + | |
4330 | 4335 |
| |
4331 | 4336 |
| |
4332 | 4337 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
| 27 | + | |
27 | 28 |
| |
28 | 29 |
| |
29 | 30 |
| |
| |||
48 | 49 |
| |
49 | 50 |
| |
50 | 51 |
| |
51 |
| - | |
52 |
| - | |
| 52 | + | |
| 53 | + | |
53 | 54 |
| |
54 | 55 |
| |
55 | 56 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
753 | 753 |
| |
754 | 754 |
| |
755 | 755 |
| |
756 |
| - | |
| 756 | + | |
757 | 757 |
| |
758 | 758 |
| |
759 | 759 |
| |
|
Lines changed: 7 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
128 | 128 |
| |
129 | 129 |
| |
130 | 130 |
| |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
131 | 135 |
| |
| 136 | + | |
132 | 137 |
| |
133 | 138 |
| |
134 | 139 |
| |
135 | 140 |
| |
136 | 141 |
| |
137 | 142 |
| |
138 | 143 |
| |
139 |
| - | |
| 144 | + | |
| 145 | + | |
140 | 146 |
| |
141 | 147 |
| |
142 | 148 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
191 | 191 |
| |
192 | 192 |
| |
193 | 193 |
| |
194 |
| - | |
195 |
| - | |
| 194 | + | |
| 195 | + | |
196 | 196 |
| |
197 | 197 |
| |
198 | 198 |
| |
|
Lines changed: 12 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
56 | 56 |
| |
57 | 57 |
| |
58 | 58 |
| |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
59 | 69 |
| |
60 | 70 |
| |
61 | 71 |
| |
62 | 72 |
| |
63 | 73 |
| |
64 | 74 |
| |
65 |
| - | |
| 75 | + | |
66 | 76 |
| |
67 | 77 |
| |
68 |
| - | |
| 78 | + | |
69 | 79 |
| |
70 | 80 |
| |
71 | 81 |
| |
|
0 commit comments
Comments
(0)