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/hPrint.h src/hg/inc/hPrint.h index 6c8f612..8d58f7f 100644 --- src/hg/inc/hPrint.h +++ src/hg/inc/hPrint.h @@ -44,31 +44,31 @@ void hPutc(char c); /* putc that can be suppressed if not making html. */ void hWrites(char *string); /* Write string with no '\n' if not suppressed. */ void hButton(char *name, char *label); /* Write out button if not suppressed. */ void hButtonWithMsg(char *name, char *label, char *msg); /* Write out button with msg if not suppressed. */ void hButtonWithOnClick(char *name, char *label, char *msg, char *onClick); /* Write out button with onclick javascript if not suppressed. */ -void hOnClickButton(char *command, char *label); +void hOnClickButton(char *id, char *command, char *label); /* Write out push button if not suppressed. */ void hTextVar(char *varName, char *initialVal, int charSize); /* Write out text entry field if not suppressed. */ void hIntVar(char *varName, int initialVal, int maxDigits); /* Write out numerical entry field if not supressed. */ void hDoubleVar(char *varName, double initialVal, int maxDigits); /* Write out numerical entry field if not supressed. */ void hCheckBox(char *varName, boolean checked); /* Make check box if not suppressed. */ void hCheckBoxJS(char *varName, boolean checked, char *javascript);