Commit 4b385ee
Harden OIDC device-flow input validation
Address the minor hardening findings from the device-flow review.
endpointPathHasEncodedSeparator() out-decoded the endpoint path with a
byte-oriented percentDecodeOnce and scanned each level for %2f/%5c/%25,
but missed encodings it does not resolve - an overlong-UTF-8 %c0%ae or
an IIS-style %u002e that a permissive server decodes to '.'/'/'. Such a
segment, sitting past the issuer prefix, slipped the path scope. A real
OIDC endpoint path is plain ASCII, so reject any '%' or '\' in it
outright; a provider that encodes its path must be configured
explicitly with builder(), which pins the origin only.
adopt() accepted an empty served token (hasOnlyTokenChars("") is
vacuously true) and would serve it as a blank "Bearer " header that
only draws a 401. Reject an empty served token too, so a corrupt or
tampered entry falls through to a refresh or an interactive sign-in.
Endpoint.parse() let Integer.parseInt read a ":+443" port as 443,
slipping the range check, and accepted a backslash in the host that the
WHATWG URL spec folds to '/'. Reject a leading '+' on the port and a
backslash in the host.
Correct the JsonLexer.unescape() default-case comment: a '\' before a
recognized escape letter is still decoded, so the "Windows path is not
dropped" note held only for genuinely unknown escapes.
Add regression tests for each - overlong-UTF-8 / %u endpoint paths, an
empty served token, and the +port / backslash-host cases; every one
fails on the reverted production line and passes with the fix.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 6334bba commit 4b385ee
4 files changed
Lines changed: 79 additions & 32 deletions
File tree
- core/src
- main/java/io/questdb/client/cutlass
- auth
- json
- test/java/io/questdb/client/test/cutlass/auth
Lines changed: 36 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
680 | 671 | | |
681 | | - | |
682 | 672 | | |
683 | 673 | | |
684 | 674 | | |
| |||
1032 | 1022 | | |
1033 | 1023 | | |
1034 | 1024 | | |
1035 | | - | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
1036 | 1028 | | |
1037 | | - | |
| 1029 | + | |
1038 | 1030 | | |
1039 | 1031 | | |
1040 | 1032 | | |
| |||
2016 | 2008 | | |
2017 | 2009 | | |
2018 | 2010 | | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
2019 | 2019 | | |
2020 | | - | |
| 2020 | + | |
2021 | 2021 | | |
2022 | 2022 | | |
2023 | 2023 | | |
| |||
2038 | 2038 | | |
2039 | 2039 | | |
2040 | 2040 | | |
2041 | | - | |
| 2041 | + | |
| 2042 | + | |
2042 | 2043 | | |
2043 | 2044 | | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
2044 | 2051 | | |
2045 | 2052 | | |
2046 | 2053 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
419 | | - | |
420 | | - | |
421 | | - | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
422 | 423 | | |
423 | 424 | | |
424 | 425 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
595 | 595 | | |
596 | 596 | | |
597 | 597 | | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
598 | 625 | | |
599 | 626 | | |
600 | 627 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1075 | 1075 | | |
1076 | 1076 | | |
1077 | 1077 | | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
1078 | 1081 | | |
1079 | 1082 | | |
1080 | 1083 | | |
| |||
1105 | 1108 | | |
1106 | 1109 | | |
1107 | 1110 | | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
1108 | 1114 | | |
1109 | 1115 | | |
1110 | 1116 | | |
| |||
1934 | 1940 | | |
1935 | 1941 | | |
1936 | 1942 | | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
1937 | 1949 | | |
1938 | 1950 | | |
1939 | 1951 | | |
| |||
0 commit comments