Skip to content

Instantly share code, notes, and snippets.

@capturetheflag
capturetheflag / safari-print.js
Created March 11, 2019 16:26
window.print() and Safari's print confirmation dialog
// If a user cancels print and then tries to print again, Safari will display its print confirmation dialog.
// We want to perform some actions as soon as printing finishes, neither earlier nor later.
// The problem is: Safari's print confirmatiog dialog does not stop JS code execution flow
// therefore all lines below window.print() are executed before actual printing starts
// More details here: https://stackoverflow.com/q/50455545/1177964
// Tested to work in: Safari 12, macOS 10.14 (Mojave)
function safariPrint() {
// Safari
if (!window.onafterprint) {
@capturetheflag
capturetheflag / veracode_react_xss.json
Created December 24, 2020 17:07
React XSS vulnerability (veracode)
{"MRData":{"xmlns":"http:\/\/ergast.com\/mrd\/1.4","series":"f1","url":"http://ergast.com/api/f1/2018/circuits.json","limit":"30","offset":"0","total":"21","CircuitTable":{"season":"2018","Circuits":[{"circuitId":"albert_park","url":"http:\/\/en.wikipedia.org\/wiki\/Melbourne_Grand_Prix_Circuit","circuitName":"Albert Park Grand Prix Circuit","Location":{"lat":"-37.8497","long":"144.968","locality":"Melbourne","country":"Australia"}},{"circuitId":"americas","url":"http:\/\/en.wikipedia.org\/wiki\/Circuit_of_the_Americas","circuitName":"Circuit of the Americas","Location":{"lat":"30.1328","long":"-97.6411","locality":"Austin","country":"USA"}},{"circuitId":"bahrain","url":"http:\/\/en.wikipedia.org\/wiki\/Bahrain_International_Circuit","circuitName":"Bahrain International Circuit","Location":{"lat":"26.0325","long":"50.5106","locality":"Sakhir","country":"Bahrain"}},{"circuitId":"BAK","url":"http:\/\/en.wikipedia.org\/wiki\/Baku_City_Circuit","circuitName":"Baku City Circuit","Location":{"lat":"40.3725","long":