Commit c70bdc8
committed
fix: encode & and + in modelarmor create-template query value
build_create_template_url embeds template_id into a query string via
raw format!(), not a .query() builder. encode_path_segment (this PR's
prior commit) deliberately leaves & and + unencoded since both are
legal in a bare path segment — but neither is safe in a query string:
an unencoded & splits the value into two parameters (silently
truncating the intended template_id), and + is commonly decoded
server-side as a space.
validate_resource_name (which template_id passes through first) does
not reject & or +, so this was reachable from --template-id input.
Confirmed by compiling and running url::Url::parse against the actual
encode set before this fix.
Add a fork-local encode_query_value in modelarmor.rs rather than
reusing/exporting validate::encode_path_segment's encode set, so that
function can stay a byte-for-byte match with the upstream fix (googleworkspace#867)
it backports.1 parent 1f44901 commit c70bdc8
1 file changed
Lines changed: 58 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
369 | 408 | | |
370 | 409 | | |
371 | 410 | | |
372 | 411 | | |
373 | 412 | | |
374 | 413 | | |
375 | 414 | | |
376 | | - | |
| 415 | + | |
377 | 416 | | |
378 | 417 | | |
379 | 418 | | |
| |||
763 | 802 | | |
764 | 803 | | |
765 | 804 | | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
766 | 823 | | |
767 | 824 | | |
768 | 825 | | |
| |||
0 commit comments