@@ -2679,9 +2679,11 @@ func TestAllowedRequest(t *testing.T) {
2680 opts.SkipAuthRegex = []string{
2680 opts.SkipAuthRegex = []string{
2681 "^/skip/auth/regex$",
2681 "^/skip/auth/regex$",
2682+ "^/public/.*/endpoint$",
2683 opts.SkipAuthRoutes = []string{
2684 opts.SkipAuthRoutes = []string{
2684 "GET=^/skip/auth/routes/get",
2685 "GET=^/skip/auth/routes/get",
2686 err := validation.Validate(opts)
2688 err := validation.Validate(opts)
2687 assert.NoError(t, err)
2689 assert.NoError(t, err)
@@ -2714,6 +2716,18 @@ func TestAllowedRequest(t *testing.T) {
2714 url: "/wrong/denied",
2716 url: "/wrong/denied",
2715 allowed: false,
2717 allowed: false,
2720+ name: "Regex allowed with fragment-free path",
2722+ url: "/public/legit/endpoint",
2726+ name: "Regex denied when path contains encoded fragment suffix",
2728+ url: "/public/secret%23/endpoint",
2718 name: "Route allowed",
2732 name: "Route allowed",
2719 method: "GET",
2733 method: "GET",
@@ -2738,6 +2752,18 @@ func TestAllowedRequest(t *testing.T) {
2738 url: "/skip/auth/routes/wrong/path",
2752 url: "/skip/auth/routes/wrong/path",
2739 allowed: false,
2753 allowed: false,
2756+ name: "Route allowed with fragment-free path",
2758+ url: "/foo/public/bar",
2762+ name: "Route denied when path contains encoded fragment suffix",
2764+ url: "/foo/secret%23/bar",
2743 for _, tc := range testCases {
2769 for _, tc := range testCases {
@@ -2778,9 +2804,11 @@ func TestAllowedRequestWithForwardedUriHeader(t *testing.T) {
2779 opts.SkipAuthRegex = []string{
2805 opts.SkipAuthRegex = []string{
2780 "^/skip/auth/regex$",
2806 "^/skip/auth/regex$",
2807+ "^/public/.*/endpoint$",
2782 opts.SkipAuthRoutes = []string{
2809 opts.SkipAuthRoutes = []string{
2783 "GET=^/skip/auth/routes/get",
2810 "GET=^/skip/auth/routes/get",
2785 err := validation.Validate(opts)
2813 err := validation.Validate(opts)
2786 assert.NoError(t, err)
2814 assert.NoError(t, err)
@@ -2813,6 +2841,18 @@ func TestAllowedRequestWithForwardedUriHeader(t *testing.T) {
2813 url: "/wrong/denied",
2841 url: "/wrong/denied",
2814 allowed: false,
2842 allowed: false,
2845+ name: "Regex allowed with fragment-free path",
2847+ url: "/public/legit/endpoint",
2851+ name: "Regex denied when X-Forwarded-Uri contains an encoded fragment suffix",
2853+ url: "/public/secret%23/endpoint",
2817 name: "Route allowed",
2857 name: "Route allowed",
2818 method: "GET",
2858 method: "GET",
@@ -2837,6 +2877,18 @@ func TestAllowedRequestWithForwardedUriHeader(t *testing.T) {
2837 url: "/skip/auth/routes/wrong/path",
2877 url: "/skip/auth/routes/wrong/path",
2838 allowed: false,
2878 allowed: false,
2881+ name: "Route allowed with fragment-free path",
2883+ url: "/foo/public/bar",
2887+ name: "Route denied when X-Forwarded-Uri contains an encoded fragment suffix",
2889+ url: "/foo/secret%23/bar",
2842 for _, tc := range testCases {
2894 for _, tc := range testCases {