5abe782bada3c851f1844c94b747cf7c769c71f9 max Fri Sep 4 09:12:46 2026 -0700 cart.c: gate the captcha session-id debug print behind hg.conf captchaDebug, refs #38247 Register captchaDebug in the hg.conf catalog as a permanent debugging knob rather than a release gate. diff --git src/hg/lib/cart.c src/hg/lib/cart.c index cdd5681aaae..7a6035e03ac 100644 --- src/hg/lib/cart.c +++ src/hg/lib/cart.c @@ -1691,30 +1691,31 @@ #define CLOUDFLARESITEKEY "cloudFlareSiteKey" static char *getSessionId() /* Get session id if any from CGI. */ { return cgiOptionalString("hgsid"); } void printCaptcha() /* print an html page that shows the captcha and on success, reloads the page with the token added as token=x */ { char *cfSiteKey = cfgVal(CLOUDFLARESITEKEY); if (!cfSiteKey) return; + if (cfgOptionBooleanDefault("captchaDebug", FALSE)) fprintf(stderr, "CAPTCHA_PRINT %s\n", getSessionId()); cspWriteResponseHeader(); puts("Content-Type:text/html\n"); // puts outputs one newline. Header requires two newlines. puts("<html><head>"); printf("<script nonce='%s'>\n", getNonce()); printf("function showWidget() { \n" "turnstile.render('#myWidget', {\n" "sitekey: '%s',\n" "theme: 'light',\n" "callback: function (token) {\n" " const parser = new URL(window.location);\n" " parser.searchParams.set('token', token);\n" " window.location = parser.href;\n" " },\n" "});\n"