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/inc/jsHelper.h src/hg/inc/jsHelper.h index 38c6943..bd8655d 100644 --- src/hg/inc/jsHelper.h +++ src/hg/inc/jsHelper.h @@ -156,28 +156,31 @@ void jsBeginCollapsibleSectionOldStyle(struct cart *cart, char *track, char *section, char *sectionTitle, boolean isOpenDefault); /* Make the hidden input, collapse/expand button and <TR id=...> needed for utils.js's * setTableRowVisibility(). Caller needs to have already created a <TABLE> and <FORM>. * With support for varying font size */ void jsEndCollapsibleSection(); /* End the collapsible <TR id=...>. */ void jsReloadOnBackButton(struct cart *cart); /* Add some javascript to detect that the back button (or reload) has been pressed, * and to resubmit in that case to redraw the page with the latest cart contents. */ // --- Genome browser specific json stuff - see also inc/json.h for more generic stuff +void jsonDyStringPrint(struct dyString *dy, struct jsonElement *json, char *name, int indentLevel); +// dyStringPrint out a jsonElement, indentLevel -1 means no indenting + void jsonPrint(struct jsonElement *json, char *name, int indentLevel); // print out a jsonElement and children using hPrintf, and for indentLevel >=0 // bracketing with comments. See also jsonPrintToFile. void jsonErrPrintf(struct dyString *ds, char *format, ...) // Printf a json error to a dyString for communicating with ajax code; format is: // {"error": error message here} #if defined(__GNUC__) __attribute__((format(printf, 2, 3))) #endif ; #endif /* JSHELPER_H */