a53b9958fa734f73aeffb9ddfe2fbad1ca65f90c galt Mon Jan 30 16:18:41 2017 -0800 Check-in of CSP2 Content-Security-Policy work. All C-language CGIs should now support CSP2 in browser to stop major forms of XSS javascript injection. Javascript on pages is gathered together, and then emitted in a single script block at the end with a nonce that tells the browser, this is js that we generated instead of being injected by a hacker. Both inline script from script blocks and inline js event handlers had to be pulled out and separated. You will not see js sprinkled through-out the page now. Older browsers that support CSP1 or that do not understand CSP at all will still work, just without protection. External js libraries loaded at runtime need to be added to the CSP policy header in src/lib/htmshell.c. diff --git src/hg/lib/hCommon.c src/hg/lib/hCommon.c index 1db46ce..193a2bd 100644 --- src/hg/lib/hCommon.c +++ src/hg/lib/hCommon.c @@ -329,61 +329,61 @@ { puts(""); puts(""); puts(""); } static boolean stackDumpDisabled = FALSE; // prevent accidental recursion or undesired dumps static void hDumpStackAbortHandler() /* abort handle that prints stack dump then invokes the previous abort * handler on the stack. */ { if (!stackDumpDisabled) { stackDumpDisabled = TRUE; - popWarnHandler(); // remove us from the stack + popAbortHandler(); // remove us from the stack dumpStack("\nStack dump:"); // continue with next abort handler noWarnAbort(); } } boolean hDumpStackEnabled(void) /* is browser.pstack enabled? */ { return cfgOptionBooleanDefault("browser.dumpStack", FALSE); } void hDumpStackDisallow(void) /* prevent any dumping of the stack */ { stackDumpDisabled = TRUE; } void hDumpStackPushAbortHandler(void) /* push the stack dump abort handler on the stack if it's enabled. This should be pushed * after the warn handle that will do the actual reporting */ { if (hDumpStackEnabled()) { errAbortDebugnPushPopErr(); pushAbortHandler(hDumpStackAbortHandler); } } -void hDumpStackPopAbortHandler(void) +void hDumpStackPopAbortHandler() /* pop the stack dump abort handler from the stack if it's enabled */ { if (hDumpStackEnabled() && !stackDumpDisabled) popAbortHandler(); } void hVaUserAbort(char *format, va_list args) /* errAbort when a `user' error is detected. This is an error that comes * from user input. This disables the logging stack dumps. */ { hDumpStackDisallow(); vaErrAbort(format, args); } void hUserAbort(char *format, ...)