@@ -2679,9 +2679,11 @@ func TestAllowedRequest(t *testing.T) {
26792679 }
26802680 opts.SkipAuthRegex = []string{
26812681 "^/skip/auth/regex$",
2682+ "^/public/.*/endpoint$",
26822683 }
26832684 opts.SkipAuthRoutes = []string{
26842685 "GET=^/skip/auth/routes/get",
2686+ "^/foo/.*/bar$",
26852687 }
26862688 err := validation.Validate(opts)
26872689 assert.NoError(t, err)
@@ -2714,6 +2716,18 @@ func TestAllowedRequest(t *testing.T) {
27142716 url: "/wrong/denied",
27152717 allowed: false,
27162718 },
2719+ {
2720+ name: "Regex allowed with fragment-free path",
2721+ method: "GET",
2722+ url: "/public/legit/endpoint",
2723+ allowed: true,
2724+ },
2725+ {
2726+ name: "Regex denied when path contains encoded fragment suffix",
2727+ method: "GET",
2728+ url: "/public/secret%23/endpoint",
2729+ allowed: false,
2730+ },
27172731 {
27182732 name: "Route allowed",
27192733 method: "GET",
@@ -2738,6 +2752,18 @@ func TestAllowedRequest(t *testing.T) {
27382752 url: "/skip/auth/routes/wrong/path",
27392753 allowed: false,
27402754 },
2755+ {
2756+ name: "Route allowed with fragment-free path",
2757+ method: "GET",
2758+ url: "/foo/public/bar",
2759+ allowed: true,
2760+ },
2761+ {
2762+ name: "Route denied when path contains encoded fragment suffix",
2763+ method: "GET",
2764+ url: "/foo/secret%23/bar",
2765+ allowed: false,
2766+ },
27412767 }
27422768
27432769 for _, tc := range testCases {
@@ -2778,9 +2804,11 @@ func TestAllowedRequestWithForwardedUriHeader(t *testing.T) {
27782804 }
27792805 opts.SkipAuthRegex = []string{
27802806 "^/skip/auth/regex$",
2807+ "^/public/.*/endpoint$",
27812808 }
27822809 opts.SkipAuthRoutes = []string{
27832810 "GET=^/skip/auth/routes/get",
2811+ "^/foo/.*/bar$",
27842812 }
27852813 err := validation.Validate(opts)
27862814 assert.NoError(t, err)
@@ -2813,6 +2841,18 @@ func TestAllowedRequestWithForwardedUriHeader(t *testing.T) {
28132841 url: "/wrong/denied",
28142842 allowed: false,
28152843 },
2844+ {
2845+ name: "Regex allowed with fragment-free path",
2846+ method: "GET",
2847+ url: "/public/legit/endpoint",
2848+ allowed: true,
2849+ },
2850+ {
2851+ name: "Regex denied when X-Forwarded-Uri contains an encoded fragment suffix",
2852+ method: "GET",
2853+ url: "/public/secret%23/endpoint",
2854+ allowed: false,
2855+ },
28162856 {
28172857 name: "Route allowed",
28182858 method: "GET",
@@ -2837,6 +2877,18 @@ func TestAllowedRequestWithForwardedUriHeader(t *testing.T) {
28372877 url: "/skip/auth/routes/wrong/path",
28382878 allowed: false,
28392879 },
2880+ {
2881+ name: "Route allowed with fragment-free path",
2882+ method: "GET",
2883+ url: "/foo/public/bar",
2884+ allowed: true,
2885+ },
2886+ {
2887+ name: "Route denied when X-Forwarded-Uri contains an encoded fragment suffix",
2888+ method: "GET",
2889+ url: "/foo/secret%23/bar",
2890+ allowed: false,
2891+ },
28402892 }
28412893
28422894 for _, tc := range testCases {