This is an automated email from the ASF dual-hosted git repository. cmcfarlen pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 5a8479e80e00aa71c7226530dc93bfeb1d4c286a Author: Evan Zelkowitz <[email protected]> AuthorDate: Wed Jul 24 11:47:43 2024 -0600 Remove pathset (#11599) Added 2 tests, one with a bad path param and one with a properly encoded path param. ATS returns 403 and 200 properly but cannot get autest to register these outputs yet Added path param checks for success and failure, shuffled tests for correct logging output (cherry picked from commit 9d6c2b2dac530eb8357ad52b25c3a6b6b2f27a22) --- plugins/experimental/url_sig/url_sig.cc | 1 - tests/gold_tests/pluginTest/url_sig/url_sig.gold | 3 ++ .../gold_tests/pluginTest/url_sig/url_sig.test.py | 36 +++++++++++++++++----- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/plugins/experimental/url_sig/url_sig.cc b/plugins/experimental/url_sig/url_sig.cc index 741bf41656..ec1167c20f 100644 --- a/plugins/experimental/url_sig/url_sig.cc +++ b/plugins/experimental/url_sig/url_sig.cc @@ -890,7 +890,6 @@ allow: if (*new_path) { TSUrlPathSet(rri->requestBufp, rri->requestUrl, new_path, strlen(new_path)); } - TSUrlHttpParamsSet(rri->requestBufp, rri->requestUrl, nullptr, 0); } TSfree((void *)current_url); diff --git a/tests/gold_tests/pluginTest/url_sig/url_sig.gold b/tests/gold_tests/pluginTest/url_sig/url_sig.gold index 12043d8f3b..14e00ff5e3 100644 --- a/tests/gold_tests/pluginTest/url_sig/url_sig.gold +++ b/tests/gold_tests/pluginTest/url_sig/url_sig.gold @@ -13,3 +13,6 @@ < HTTP/1.1 200 OK < HTTP/1.1 200 OK < HTTP/1.1 200 OK +< HTTP/1.1 403 Forbidden +< HTTP/1.1 200 OK +< HTTP/1.1 200 OK diff --git a/tests/gold_tests/pluginTest/url_sig/url_sig.test.py b/tests/gold_tests/pluginTest/url_sig/url_sig.test.py index a483ed173c..0818a959da 100644 --- a/tests/gold_tests/pluginTest/url_sig/url_sig.test.py +++ b/tests/gold_tests/pluginTest/url_sig/url_sig.test.py @@ -221,6 +221,34 @@ tr = Test.AddTestRun() tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Command = (f"curl --verbose --proxy http://127.0.0.1:{ts.Variables.port} '{url}'" + LogTee) +# With client / MD5 / P=101 / URL pristine / URL altered. +# uses url_type pristine in config +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Command = ( + f"curl --verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" + + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=586ef8e808caeeea025c525c89ff2638'" + LogTee) + +# Single fail test - check for bad path param inserted +# With client / MD5 / P=101 / URL pristine / URL altered. Bad Path Param +# uses url_type pristine in config +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Command = ( + f"curl --verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" + + "foo/abcde/qrstuvwxyz;badparam=true?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=586ef8e808caeeea025c525c89ff2638'" + LogTee) + +# Success +# With client / SHA1 / P=1 / URL pristine / URL altered. Base64 Encoded Path Param +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Command = ( + f"curl --verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" + + "foo/abcde;urlsig=Qz0xMjcuMC4wLjE7RT0zMzA0NjYyMDAwODtBPTI7Sz0xMztQPTEwMTtTPTA1MDllZjljY2VlNjUxZWQ1OTQxM2MyZjE3YmVhODZh/qrstuvwxyz'" + + LogTee) + +# Success +# This test must be last since it converts from the long to the short log output # No client / SHA1 / P=1 / URL not pristine / URL not altered -- HTTPS. # path = "foo/abcde/qrstuvwxyz?E=33046618506&A=1&K=7&P=1&S=" @@ -233,14 +261,6 @@ tr.Processes.Default.Command = ( f"curl --verbose --http1.1 --insecure --header 'Host: one.two.three' '{url}'" + LogTee + " ; grep -F -e '< HTTP' -e Authorization {0}/url_sig_long.log > {0}/url_sig_short.log ".format(ts.RunDirectory)) -# With client / MD5 / P=101 / URL pristine / URL altered. -# uses url_type pristine in config -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Command = ( - f"curl --verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=586ef8e808caeeea025c525c89ff2638'" + LogTee) - # Overriding the built in ERROR check since we expect some ERROR messages ts.Disk.diags_log.Content = Testers.ContainsExpression("ERROR", "Some tests are failure tests") ts.Disk.diags_log.Content += Testers.ExcludesExpression("Error parsing", "Verify that we can accept long comment lines")
