An update will be applied December 9th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit 71f27c04 authored by Zack Galbreath's avatar Zack Galbreath Committed by Brad King
Browse files

ctest_submit: show headers as debug info

Hide any headers specified by `ctest_submit(HTTPHEADER ...)` unless ctest
is run with --debug.  This option is used to present bearer tokens to CDash.
We do not want to inadvertently expose this secret data in the console
output log.
parent 4464ef21
...@@ -148,7 +148,7 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, ...@@ -148,7 +148,7 @@ bool cmCTestCurl::UploadFile(std::string const& local_file,
::curl_slist_append(nullptr, "Content-Type: text/xml"); ::curl_slist_append(nullptr, "Content-Type: text/xml");
// Add any additional headers that the user specified. // Add any additional headers that the user specified.
for (std::string const& h : this->HttpHeaders) { for (std::string const& h : this->HttpHeaders) {
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, cmCTestOptionalLog(this->CTest, DEBUG,
" Add HTTP Header: \"" << h << "\"" << std::endl, " Add HTTP Header: \"" << h << "\"" << std::endl,
this->Quiet); this->Quiet);
headers = ::curl_slist_append(headers, h.c_str()); headers = ::curl_slist_append(headers, h.c_str());
...@@ -216,7 +216,7 @@ bool cmCTestCurl::HttpRequest(std::string const& url, ...@@ -216,7 +216,7 @@ bool cmCTestCurl::HttpRequest(std::string const& url,
struct curl_slist* headers = nullptr; struct curl_slist* headers = nullptr;
if (!this->HttpHeaders.empty()) { if (!this->HttpHeaders.empty()) {
for (std::string const& h : this->HttpHeaders) { for (std::string const& h : this->HttpHeaders) {
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, cmCTestOptionalLog(this->CTest, DEBUG,
" Add HTTP Header: \"" << h << "\"" << std::endl, " Add HTTP Header: \"" << h << "\"" << std::endl,
this->Quiet); this->Quiet);
headers = ::curl_slist_append(headers, h.c_str()); headers = ::curl_slist_append(headers, h.c_str());
......
...@@ -314,7 +314,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, ...@@ -314,7 +314,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
// Add any additional headers that the user specified. // Add any additional headers that the user specified.
for (std::string const& h : this->HttpHeaders) { for (std::string const& h : this->HttpHeaders) {
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, cmCTestOptionalLog(this->CTest, DEBUG,
" Add HTTP Header: \"" << h << "\"" << std::endl, " Add HTTP Header: \"" << h << "\"" << std::endl,
this->Quiet); this->Quiet);
headers = ::curl_slist_append(headers, h.c_str()); headers = ::curl_slist_append(headers, h.c_str());
......
*Error when uploading file: .*/Configure.xml
*Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*) *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*)
*Problems when submitting via HTTP
...@@ -5,14 +5,19 @@ set(CASE_DROP_METHOD "http") ...@@ -5,14 +5,19 @@ set(CASE_DROP_METHOD "http")
set(CASE_DROP_SITE "-no-site-") set(CASE_DROP_SITE "-no-site-")
set(CASE_CTEST_SUBMIT_ARGS "") set(CASE_CTEST_SUBMIT_ARGS "")
#-----------------------------------------------------------------------------
# Test bad argument combinations.
function(run_ctest_submit CASE_NAME) function(run_ctest_submit CASE_NAME)
set(CASE_CTEST_SUBMIT_ARGS "${ARGN}") set(CASE_CTEST_SUBMIT_ARGS "${ARGN}")
run_ctest(${CASE_NAME}) run_ctest(${CASE_NAME})
endfunction() endfunction()
function(run_ctest_submit_debug CASE_NAME)
set(CASE_CTEST_SUBMIT_ARGS "${ARGN}")
run_ctest(${CASE_NAME} "--debug")
endfunction()
#-----------------------------------------------------------------------------
# Test bad argument combinations.
run_ctest_submit(BadArg bad-arg) run_ctest_submit(BadArg bad-arg)
run_ctest_submit(BadPARTS PARTS bad-part) run_ctest_submit(BadPARTS PARTS bad-part)
run_ctest_submit(BadFILES FILES bad-file) run_ctest_submit(BadFILES FILES bad-file)
...@@ -25,8 +30,8 @@ run_ctest_submit(CDashUploadNone CDASH_UPLOAD) ...@@ -25,8 +30,8 @@ run_ctest_submit(CDashUploadNone CDASH_UPLOAD)
run_ctest_submit(CDashUploadMissingFile CDASH_UPLOAD bad-upload) run_ctest_submit(CDashUploadMissingFile CDASH_UPLOAD bad-upload)
run_ctest_submit(CDashUploadRetry CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo RETRY_COUNT 2 RETRY_DELAY 1 INTERNAL_TEST_CHECKSUM) run_ctest_submit(CDashUploadRetry CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo RETRY_COUNT 2 RETRY_DELAY 1 INTERNAL_TEST_CHECKSUM)
run_ctest_submit(CDashSubmitQuiet QUIET) run_ctest_submit(CDashSubmitQuiet QUIET)
run_ctest_submit(CDashSubmitHeaders HTTPHEADER "Authorization: Bearer asdf") run_ctest_submit_debug(CDashSubmitHeaders HTTPHEADER "Authorization: Bearer asdf")
run_ctest_submit(CDashUploadHeaders CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo HTTPHEADER "Authorization: Bearer asdf") run_ctest_submit_debug(CDashUploadHeaders CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo HTTPHEADER "Authorization: Bearer asdf")
function(run_ctest_CDashUploadFTP) function(run_ctest_CDashUploadFTP)
set(CASE_DROP_METHOD ftp) set(CASE_DROP_METHOD ftp)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment