{"_id":"urisanity","_rev":"8-03811448fe07d1c3c2273b40399d0802","name":"urisanity","dist-tags":{"latest":"0.1.6"},"versions":{"0.1.0":{"name":"urisanity","version":"0.1.0","keywords":["xss","URI","sanitization"],"author":{"url":"https://isocroft.com/","name":"Ifeora Okechukwu","email":"isocroft@gmail.com"},"license":"MIT","_id":"urisanity@0.1.0","maintainers":[{"name":"codesplinta","email":"codesplinta.nig@gmail.com"}],"homepage":"https://github.com/codesplinta/URISanity","bugs":{"url":"https://github.com/codesplinta/URISanity/issues"},"dist":{"shasum":"6302b61b275bbbc438e1505a46dada1dadac0be3","tarball":"https://registry.npmjs.org/urisanity/-/urisanity-0.1.0.tgz","fileCount":14,"integrity":"sha512-Nngupj7gbhoPI71YmVR+Wjq6nUmPbSWjHfA9HEgx+4E/QJF4cRy+WKC3BGWPYzcUn6fZwmHLm6KU5yMg2u9nvg==","signatures":[{"sig":"MEUCIQD9pqVZIxqZ0aRsQMCzTPXiWws05KADXZBoq9Z4lSIVJAIgMaV8WE834OqQZ2tHXr567AL4wU4kAUVEpjtB2D5qS/U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":433371,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiCW8GCRA9TVsSAnZWagAASKEP/RvhYI0YeYm54HxO8A62\n383vgGVx6WAGyrQrSNEBMRCoUalsFarkcAs/Kd7pfRvB/3DdTrkKuVadEsDf\nVidGawwKE9Mz+f2m7r3/wH2NNrtvcu3qdfQDo84/iDLbY3NmrrmdobwJfd/V\n/chGSKrDs4wiPFkYXoflxq9Xg3Pl7+5vBISWx2oqk+n8Mv58WZgSX0CO2ubo\nnK2g0hiA2vJmnRJP/SCb+gEmPCfXw43kTKP9eSCCndvYoWKT4po/giHoQC31\nzKLJZMOVfVeV1Zr/iUmpbiS+A0YpVPl1Ro0QMLMXBDcztB5uHA1wDhIjlrEl\np00OaJz3/aXWzoeTl91BfJdZKMoCHejSznhBZrMiMkpAwAFc/qX8V/TOqEmC\nF2EIwL5XVScpX+XJziuLh+Otpn/0Y39lCkkpdrfNrjV3g3ZrIFbLNLnYpZZs\nY6K+ott7FzkWLkeFz68yzwiZy+N95GdK9z3Ik327w28VRaagG/13S7aSnU4i\nvcxTLKpldhzazZkXe9jCERep0AoGlvnmBoz04kVWs4OGrKxd0RcXjbxt0VwX\noU/42lk8C8Iv/w+KCxg9HQPdh4Ff2k5JDOmAuOO5OtbXqlUhgnqcaJqWWePO\neWOZmR7lmpUBKX2Rf+HGFcV1IjZJMTfK3NWETjv4QKtfP5hiCcFbZHmifkz+\nQlez\r\n=SmSg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/urisanity.cjs.js","module":"dist/urisanity.es.js","browser":"dist/urisanity.js","gitHead":"025bbe71fc159c278f1c0bc2dcf959aab3b64cb1","scripts":{"lint":"standard --fix","test":"jest --config=jest.conf.json","build":"cross-env npm run prebuild && npm run build:umd && npm run build:umd:min && npm run build:es && npm run build:cjs","build:es":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f es -o dist/urisanity.es.js","prebuild":"rimraf dist/**","build:cjs":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f cjs -o dist/urisanity.cjs.js","build:umd":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f umd -o dist/urisanity.js","format:js":"prettier --write '{src,demos,scripts,test,website}/*.js'","format:md":"prettier --write --parser markdown '**/*.md'","build:umd:min":"cross-env NODE_ENV=production BABEL_ENV=rollup rollup -c -f umd -o dist/urisanity.min.js","test:coverage":"jest --coverage"},"_npmUser":{"name":"codesplinta","email":"codesplinta.nig@gmail.com"},"standard":{"global":["global","self"],"ignore":["/.github","/examples","/tests"]},"pre-commit":["lint","build"],"repository":{"url":"git://github.com/codesplinta/URISanity.git","type":"git"},"_npmVersion":"6.14.13","description":"vet URIs in web and web-like applications with confidence","directories":{"test":"test"},"_nodeVersion":"14.17.3","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0","babel":"^6.23.0","rimraf":"^3.0.2","rollup":"^0.68.2","prettier":"^2.3.0","standard":"^16.0.4","cross-env":"^7.0.3","babel-core":"^6.26.3","pre-commit":"^1.2.2","rollup-watch":"^4.3.1","babel-preset-env":"^1.7.0","rollup-plugin-babel":"^3.0.3","rollup-plugin-terser":"^7.0.2","rollup-plugin-replace":"^2.2.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","rollup-plugin-commonjs":"^8.4.1","rollup-plugin-includepaths":"^0.2.3","rollup-plugin-node-resolve":"^3.4.0","@babel/plugin-external-helpers":"7.12.13"},"_npmOperationalInternal":{"tmp":"tmp/urisanity_0.1.0_1644785414070_0.9565021778255234","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"urisanity","version":"0.1.1","keywords":["xss","URI","sanitization"],"author":{"url":"https://isocroft.com/","name":"Ifeora Okechukwu","email":"isocroft@gmail.com"},"license":"MIT","_id":"urisanity@0.1.1","maintainers":[{"name":"codesplinta","email":"codesplinta.nig@gmail.com"}],"homepage":"https://github.com/codesplinta/URISanity","bugs":{"url":"https://github.com/codesplinta/URISanity/issues"},"dist":{"shasum":"be594a3f8ca5c4b0f7e1b493184a4672b6597d04","tarball":"https://registry.npmjs.org/urisanity/-/urisanity-0.1.1.tgz","fileCount":14,"integrity":"sha512-jodt1VJNpe2LFO4xvERbpuQcBS97A6SggkYAYIMFxYxiu4fB0HXVXEk/a9goU6h6W2xYiTGi3WH9pWXn50zUIg==","signatures":[{"sig":"MEUCIQDMx9fHqg6UM5lUPNRqWdGEv76afwfNAnxMbnN4RiMoqgIgOkMK7urJzqKLn9P4DDwSYq8xgyKrJEYDT0RU0SQXkoY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":434433,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiDAKfCRA9TVsSAnZWagAAjc4QAJrDfNbkQ6jZUmvDImzS\nWHHlS0r13xSLqZQ62xfObxvDS3uZvgIa5UKirZuLe4hRwmYVT5ymE5esY/YW\n/RgfJvKdEtUX8y7fMvkDVNHPHc5DK4FraKrZuEscF0QQqdR9d3Y2FsExf+x+\nrRbqLapvugtfoZTOdccAuTTBc9Am5TdJE0VUyF81AP+5ia9USkeLduTIzMXI\nnWUOR5xR2rfYnJ483wcdGzRSc8hNQ5q5CJbjmDeLVt7x0deqA0aN7/PzyFBu\nvhYYLTOifOHyjZNz96pXyrofydB4cxZt+kiaF1Ge5cnjQwG7+1e+MgxN99gF\n9YqDz02jG54wFqOOLqK+dZeNk6YR3jVpUl5obSL2i8hJCE3kK6T/4dj1LyhI\nxrzLeHjcGKODYAX7gFBksou83rhxttsHva7aSDPzHBd2/6oT5i/ps0J0K7A6\nATHzkFmzqsxj7Ve+FJofVKZpAQEK2Q9Qyac26V08JiG0DkVcXn3jzhUb+6Di\nCGiX7IAQcXRKl9rF2rtSx6+z6jvSwgqFnuRLqQ1yZXPOAi5PlxGAwI6DXvro\ntM7ig4rSW9a8F7+lPGPIULos2/xVPY3xutkjPNa6F+hhqQf7Ep5ua4g3gtBt\nlIsfIvf2leY062dR5Zxb2yjIixwHGNBuHELobSwl7z+9wLjf18BaANSoKjSd\njzd5\r\n=zzSw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/urisanity.cjs.js","module":"dist/urisanity.es.js","browser":"dist/urisanity.js","gitHead":"4f5b77f17f59a1fe02a1b673a19af7d9ce84a717","scripts":{"lint":"standard --fix","test":"jest --config=jest.conf.json","build":"cross-env npm run prebuild && npm run build:umd && npm run build:umd:min && npm run build:es && npm run build:cjs","build:es":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f es -o dist/urisanity.es.js","prebuild":"rimraf dist/**","build:cjs":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f cjs -o dist/urisanity.cjs.js","build:umd":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f umd -o dist/urisanity.js","format:js":"prettier --write '{src,tests}/*.js'","format:md":"prettier --write --parser markdown '**/*.md'","format:json":"prettier --write --parser json '**/*.json'","build:umd:min":"cross-env NODE_ENV=production BABEL_ENV=rollup rollup -c -f umd -o dist/urisanity.min.js","test:coverage":"jest --coverage"},"_npmUser":{"name":"codesplinta","email":"codesplinta.nig@gmail.com"},"standard":{"global":["global","self"],"ignore":["/.github","/examples","/tests"]},"pre-commit":["lint","build"],"repository":{"url":"git://github.com/codesplinta/URISanity.git","type":"git"},"_npmVersion":"6.14.13","description":"vet URIs in web and web-like applications with confidence","directories":{"test":"test"},"_nodeVersion":"14.17.3","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0","babel":"^6.23.0","rimraf":"^3.0.2","rollup":"^0.68.2","prettier":"^2.3.0","standard":"^16.0.4","cross-env":"^7.0.3","babel-core":"^6.26.3","pre-commit":"^1.2.2","rollup-watch":"^4.3.1","babel-preset-env":"^1.7.0","rollup-plugin-babel":"^3.0.3","rollup-plugin-terser":"^7.0.2","rollup-plugin-replace":"^2.2.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","rollup-plugin-commonjs":"^8.4.1","rollup-plugin-includepaths":"^0.2.3","rollup-plugin-node-resolve":"^3.4.0","@babel/plugin-external-helpers":"7.12.13"},"_npmOperationalInternal":{"tmp":"tmp/urisanity_0.1.1_1644954271793_0.4763853082899989","host":"s3://npm-registry-packages"}},"0.1.2":{"name":"urisanity","version":"0.1.2","keywords":["xss","URI","sanitization"],"author":{"url":"https://isocroft.com/","name":"Ifeora Okechukwu","email":"isocroft@gmail.com"},"license":"MIT","_id":"urisanity@0.1.2","maintainers":[{"name":"codesplinta","email":"codesplinta.nig@gmail.com"}],"homepage":"https://github.com/codesplinta/URISanity","bugs":{"url":"https://github.com/codesplinta/URISanity/issues"},"dist":{"shasum":"abe4010666ee745a3a20c49dadac633078f2a3e4","tarball":"https://registry.npmjs.org/urisanity/-/urisanity-0.1.2.tgz","fileCount":14,"integrity":"sha512-0tDbl+8E8oRUYWJhX3N4HtGiSfpEzpCoSPirvQg1nN8U6f/JTRGlCUCFadmc04mCoyLga//11JpoZFYuaVM30g==","signatures":[{"sig":"MEYCIQDnptJUNCa78XXeZS7m/p0UdNMXynyZmTKWchMM3mOsOAIhAPvLMiG668JddqiWqPiiNzs2WtJdJMxnkV+/ql88Ny1l","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":464189,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJifQpDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqupA/+JF1ceDXZ4202wqfd0HsQJHk4SEl7xevqQv90K9tQWkRWCTkd\r\nKC6WFreN8tamV/JFJVziJXJrQd0CkuUzv/Z5bm/2LlbP7i0K6fU32OCd+/+M\r\nyc7mffpTtnPB4xlqVCPox24nZqWYC8gOkI5GZHaccPq0wf9gcZy2mg0q8UMC\r\nGnKSsNQYCZI+9qCAT2jgkU0+KAfoGpr+p1Ycip5FM+9sGJ6r1KgRdUR8nIpL\r\nexV4ob7XXC5euzwPV6btsKCMPHe8uHncVtdE6Jl/IXCuDPOdoDxQoEF7Jtyt\r\nsXXq0pQTkVGNIbxliN46QhdbTupu55wpDKHr51OTlOLB1LeRoRjObEc1K7Dn\r\npThW6ZZvT23keRDa82+gDS3jbPimwlQbsI942k/vpQ1N6LVSlcnEnESo1kNN\r\nmottx3hjVj84QrboFzhR2fbO5Qk8/u3h795LdkTuTBWgUbMUAy82ho6mG7UE\r\nb5rTJwXAVlTe6qQ5DsuSaonIz22lyRqNNAFcuFVbadyUL0z5kHT44TJrysRH\r\nhQwom2k7/z2qLtJ083O+mQfAMDznUDWK9LprTctz94xdvHrWf5ftgCEYbIrA\r\nUdW4ejn1kOeP+sbyRy6rZY2qm4BIV5PaKEsC49997jAXpv6d3YvzyqlAqngJ\r\nHDAU/PDFDh1KwHFXkrgCnqw/8yt3jK2qYDI=\r\n=eb1Z\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/urisanity.cjs.js","module":"dist/urisanity.es.js","browser":"dist/urisanity.js","gitHead":"f95e840ee321514dd681e7ddc5d6fb4834434ea2","scripts":{"lint":"standard --fix","test":"jest --config=jest.conf.json","build":"cross-env npm run prebuild && npm run build:umd && npm run build:umd:min && npm run build:es && npm run build:cjs","build:es":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f es -o dist/urisanity.es.js","prebuild":"rimraf dist/**","build:cjs":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f cjs -o dist/urisanity.cjs.js","build:umd":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f umd -o dist/urisanity.js","format:js":"prettier --write '{src,tests}/*.js'","format:md":"prettier --write --parser markdown '**/*.md'","format:json":"prettier --write --parser json '**/*.json'","build:umd:min":"cross-env NODE_ENV=production BABEL_ENV=rollup rollup -c -f umd -o dist/urisanity.min.js","test:coverage":"jest --coverage"},"_npmUser":{"name":"codesplinta","email":"codesplinta.nig@gmail.com"},"standard":{"global":["global","self"],"ignore":["/.github","/examples","/tests"]},"pre-commit":["lint","build"],"repository":{"url":"git://github.com/codesplinta/URISanity.git","type":"git"},"_npmVersion":"6.14.13","description":"vet URIs in web and web-like applications with confidence","directories":{"test":"test"},"_nodeVersion":"14.17.3","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0","babel":"^6.23.0","rimraf":"^3.0.2","rollup":"^0.68.2","prettier":"^2.3.0","standard":"^16.0.4","cross-env":"^7.0.3","babel-core":"^6.26.3","pre-commit":"^1.2.2","rollup-watch":"^4.3.1","babel-preset-env":"^1.7.0","rollup-plugin-babel":"^3.0.3","rollup-plugin-terser":"^7.0.2","rollup-plugin-replace":"^2.2.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","rollup-plugin-commonjs":"^8.4.1","rollup-plugin-includepaths":"^0.2.3","rollup-plugin-node-resolve":"^3.4.0","@babel/plugin-external-helpers":"7.12.13"},"_npmOperationalInternal":{"tmp":"tmp/urisanity_0.1.2_1652361794959_0.16910166214590183","host":"s3://npm-registry-packages"}},"0.1.3":{"name":"urisanity","version":"0.1.3","keywords":["xss","URI","sanitization"],"author":{"url":"https://isocroft.com/","name":"Ifeora Okechukwu","email":"isocroft@gmail.com"},"license":"MIT","_id":"urisanity@0.1.3","maintainers":[{"name":"codesplinta","email":"codesplinta.nig@gmail.com"}],"homepage":"https://github.com/codesplinta/URISanity","bugs":{"url":"https://github.com/codesplinta/URISanity/issues"},"dist":{"shasum":"4e0f31cb036d7fa63f30414389112e4454a3d73b","tarball":"https://registry.npmjs.org/urisanity/-/urisanity-0.1.3.tgz","fileCount":14,"integrity":"sha512-H7CP79lmlT2Zj8wmm7vngQPHVI460+J4OTZ0DWHDiDmqNO9+KwXTknacdPmcmh2dKyKJLKIuyy67K0UPNNWTHw==","signatures":[{"sig":"MEUCICoPJdndBLzyE5UXouts9rGKF8250uDGSEbAS3ERH7n3AiEAgWMTn6aintzsCFNlrnpwcnQCRElUJaV309wtiROSCRk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":175505},"main":"dist/urisanity.cjs.js","module":"dist/urisanity.es.js","browser":"dist/urisanity.js","gitHead":"c9b7073ff21f6abc92a05a01d8d0fe8c3830d89f","scripts":{"lint":"standard --fix","test":"jest --config=jest.conf.json","build":"cross-env npm run prebuild && npm run build:umd && npm run build:umd:min && npm run build:es && npm run build:cjs","build:es":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f es -o dist/urisanity.es.js","prebuild":"rimraf dist/**","build:cjs":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f cjs -o dist/urisanity.cjs.js","build:umd":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f umd -o dist/urisanity.js","format:js":"prettier --write '{src,tests}/*.js'","format:md":"prettier --write --parser markdown '**/*.md'","format:json":"prettier --write --parser json '**/*.json'","build:umd:min":"cross-env NODE_ENV=production BABEL_ENV=rollup rollup -c -f umd -o dist/urisanity.min.js","test:coverage":"jest --coverage"},"_npmUser":{"name":"codesplinta","email":"codesplinta.nig@gmail.com"},"standard":{"global":["global","self"],"ignore":["/.github","/examples","/tests"]},"pre-commit":["lint","build"],"repository":{"url":"git://github.com/codesplinta/URISanity.git","type":"git"},"_npmVersion":"9.5.0","description":"vet URIs in web and web-like applications with confidence","directories":{"test":"test"},"_nodeVersion":"18.15.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0","babel":"^6.23.0","rimraf":"^3.0.2","rollup":"^0.68.2","prettier":"^2.3.0","standard":"^16.0.4","cross-env":"^7.0.3","babel-core":"^6.26.3","pre-commit":"^1.2.2","rollup-watch":"^4.3.1","babel-preset-env":"^1.7.0","rollup-plugin-babel":"^3.0.3","rollup-plugin-terser":"^7.0.2","rollup-plugin-replace":"^2.2.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","rollup-plugin-commonjs":"^8.4.1","rollup-plugin-includepaths":"^0.2.3","rollup-plugin-node-resolve":"^3.4.0","@babel/plugin-external-helpers":"7.12.13"},"_npmOperationalInternal":{"tmp":"tmp/urisanity_0.1.3_1709732287691_0.5405231524268912","host":"s3://npm-registry-packages"}},"0.1.4":{"name":"urisanity","version":"0.1.4","keywords":["xss","URI","sanitization"],"author":{"url":"https://isocroft.com/","name":"Ifeora Okechukwu","email":"isocroft@gmail.com"},"license":"MIT","_id":"urisanity@0.1.4","maintainers":[{"name":"codesplinta","email":"codesplinta.nig@gmail.com"}],"homepage":"https://github.com/codesplinta/URISanity","bugs":{"url":"https://github.com/codesplinta/URISanity/issues"},"dist":{"shasum":"221ffd85ff98fc5e2b02e6b783cc773d3c70222e","tarball":"https://registry.npmjs.org/urisanity/-/urisanity-0.1.4.tgz","fileCount":14,"integrity":"sha512-HMMR9L8I/e1C6MgjRlMukUtq2Xfxkn3u4Su/uQFDPsnfp+e/B6dO+lqe1UdAQMoJi4SZM3O54/A53hVW5xB7AA==","signatures":[{"sig":"MEUCIFGCdU83XwplqMw7Ib/CxfgbcQLKkze1dh57hjcY5UAdAiEAhS8t5IkvXR5F8iRFwhL7qbFBoxbbHnKoafZcSvFta+4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":180380},"main":"dist/urisanity.cjs.js","module":"dist/urisanity.es.js","browser":"dist/urisanity.js","gitHead":"95afa040eee5623bd0167f98f7fdf1fb8a699a59","scripts":{"lint":"standard --fix","test":"jest --config=jest.conf.json","build":"cross-env npm run prebuild && npm run build:umd && npm run build:umd:min && npm run build:es && npm run build:cjs","build:es":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f es -o dist/urisanity.es.js","prebuild":"rimraf dist/**","build:cjs":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f cjs -o dist/urisanity.cjs.js","build:umd":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f umd -o dist/urisanity.js","format:js":"prettier --write '{src,tests}/*.js'","format:md":"prettier --write --parser markdown '**/*.md'","format:json":"prettier --write --parser json '**/*.json'","build:umd:min":"cross-env NODE_ENV=production BABEL_ENV=rollup rollup -c -f umd -o dist/urisanity.min.js","test:coverage":"jest --coverage"},"typings":"./types/index.d.ts","_npmUser":{"name":"codesplinta","email":"codesplinta.nig@gmail.com"},"standard":{"global":["global","self"],"ignore":["/.github","/examples","/tests"]},"pre-commit":["lint","build"],"repository":{"url":"git://github.com/codesplinta/URISanity.git","type":"git"},"_npmVersion":"9.5.0","description":"vet URIs in web and web-like applications with confidence","directories":{"test":"test"},"_nodeVersion":"18.15.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0","babel":"^6.23.0","rimraf":"^3.0.2","rollup":"^0.68.2","prettier":"^2.3.0","standard":"^16.0.4","cross-env":"^7.0.3","babel-core":"^6.26.3","pre-commit":"^1.2.2","rollup-watch":"^4.3.1","babel-preset-env":"^1.7.0","rollup-plugin-babel":"^3.0.3","rollup-plugin-terser":"^7.0.2","rollup-plugin-replace":"^2.2.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","rollup-plugin-commonjs":"^8.4.1","rollup-plugin-includepaths":"^0.2.3","rollup-plugin-node-resolve":"^3.4.0","@babel/plugin-external-helpers":"7.12.13"},"_npmOperationalInternal":{"tmp":"tmp/urisanity_0.1.4_1712183462782_0.9784929164561595","host":"s3://npm-registry-packages"}},"0.1.5":{"name":"urisanity","version":"0.1.5","keywords":["xss","URI","sanitization"],"author":{"url":"https://isocroft.com/","name":"Ifeora Okechukwu","email":"isocroft@gmail.com"},"license":"MIT","_id":"urisanity@0.1.5","maintainers":[{"name":"codesplinta","email":"codesplinta.nig@gmail.com"}],"homepage":"https://github.com/codesplinta/URISanity","bugs":{"url":"https://github.com/codesplinta/URISanity/issues"},"dist":{"shasum":"097b3ab62f92b157a8dd8a481cb327fdf7367041","tarball":"https://registry.npmjs.org/urisanity/-/urisanity-0.1.5.tgz","fileCount":14,"integrity":"sha512-4Kl0cpoOOYZN2wbfP7jEOHjnGSVf7xpDnS4zxb75oGuk8ClUiXTk0I09b//4b0LlhAPpDP5bPShSxhlW5x3Itw==","signatures":[{"sig":"MEUCIQCN+vXM1NE27qyrZFuzAZ6K2xgjzTtEko0RmoUa5pstZAIgLeKl4xy3s4IyTBpHT+rEhmjRKvXl5U6UrPAGqaqw3/o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":183372},"main":"dist/urisanity.cjs.js","module":"dist/urisanity.es.js","browser":"dist/urisanity.js","gitHead":"94735858a78bd09e4b65678a9901a51a1e82d78b","scripts":{"lint":"standard --fix","test":"jest --config=jest.conf.json","build":"cross-env npm run prebuild && npm run build:umd && npm run build:umd:min && npm run build:es && npm run build:cjs","build:es":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f es -o dist/urisanity.es.js","prebuild":"rimraf dist/**","build:cjs":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f cjs -o dist/urisanity.cjs.js","build:umd":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f umd -o dist/urisanity.js","format:js":"prettier --write '{src,tests}/*.js'","format:md":"prettier --write --parser markdown '**/*.md'","format:json":"prettier --write --parser json '**/*.json'","build:umd:min":"cross-env NODE_ENV=production BABEL_ENV=rollup rollup -c -f umd -o dist/urisanity.min.js","test:coverage":"jest --coverage"},"typings":"./types/index.d.ts","_npmUser":{"name":"codesplinta","email":"codesplinta.nig@gmail.com"},"standard":{"global":["global","self"],"ignore":["/.github","/examples","/tests"]},"pre-commit":["lint","build"],"repository":{"url":"git://github.com/codesplinta/URISanity.git","type":"git"},"_npmVersion":"9.5.0","description":"vet URIs in web and web-like applications with confidence","directories":{"test":"test"},"_nodeVersion":"18.15.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0","babel":"^6.23.0","rimraf":"^3.0.2","rollup":"^0.68.2","prettier":"^2.3.0","standard":"^16.0.4","cross-env":"^7.0.3","babel-core":"^6.26.3","pre-commit":"^1.2.2","rollup-watch":"^4.3.1","babel-preset-env":"^1.7.0","rollup-plugin-babel":"^3.0.3","rollup-plugin-terser":"^7.0.2","rollup-plugin-replace":"^2.2.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","rollup-plugin-commonjs":"^8.4.1","rollup-plugin-includepaths":"^0.2.3","rollup-plugin-node-resolve":"^3.4.0","@babel/plugin-external-helpers":"7.12.13"},"_npmOperationalInternal":{"tmp":"tmp/urisanity_0.1.5_1726708712872_0.9477466455153678","host":"s3://npm-registry-packages"}},"0.1.6":{"name":"urisanity","version":"0.1.6","keywords":["xss","URI","sanitization"],"author":{"url":"https://isocroft.com/","name":"Ifeora Okechukwu","email":"isocroft@gmail.com"},"license":"MIT","_id":"urisanity@0.1.6","maintainers":[{"name":"codesplinta","email":"codesplinta.nig@gmail.com"}],"homepage":"https://github.com/codesplinta/URISanity","bugs":{"url":"https://github.com/codesplinta/URISanity/issues"},"dist":{"shasum":"18aec8f814ec9cf4c152e751e33124d575391f0b","tarball":"https://registry.npmjs.org/urisanity/-/urisanity-0.1.6.tgz","fileCount":14,"integrity":"sha512-vBsEuST6RNlWaS5YbCbB73jHa7xEa8JHgjUv299WZS0pDf8MNB4hxpm8mEE/b+elm/bBzq+ZilBQmMN0FJajEw==","signatures":[{"sig":"MEQCIDovQw4+rgB9qGMbGP8UJzqiMTAPKs25OAGBEbJeRD8lAiA/ZFvwQ3fZWJ6gy6fwo+LhCz17KSyqhtvLe3AgkTXRuQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":183372},"main":"dist/urisanity.cjs.js","module":"dist/urisanity.es.js","browser":"dist/urisanity.js","gitHead":"9144b68ffdc8baddfd811cbad41b744d20d604b4","scripts":{"lint":"standard --fix","test":"jest --config=jest.conf.json","build":"cross-env npm run prebuild && npm run build:umd && npm run build:umd:min && npm run build:es && npm run build:cjs","build:es":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f es -o dist/urisanity.es.js","prebuild":"rimraf dist/**","build:cjs":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f cjs -o dist/urisanity.cjs.js","build:umd":"cross-env NODE_ENV=development BABEL_ENV=rollup rollup -c -f umd -o dist/urisanity.js","format:js":"prettier --write '{src,tests}/*.js'","format:md":"prettier --write --parser markdown '**/*.md'","format:json":"prettier --write --parser json '**/*.json'","build:umd:min":"cross-env NODE_ENV=production BABEL_ENV=rollup rollup -c -f umd -o dist/urisanity.min.js","test:coverage":"jest --coverage"},"typings":"./types/index.d.ts","_npmUser":{"name":"codesplinta","email":"codesplinta.nig@gmail.com"},"standard":{"global":["global","self"],"ignore":["/.github","/examples","/tests"]},"pre-commit":["lint","build"],"repository":{"url":"git://github.com/codesplinta/URISanity.git","type":"git"},"_npmVersion":"9.5.0","description":"vet URIs in web and web-like applications with confidence","directories":{"test":"test"},"_nodeVersion":"18.15.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0","babel":"^6.23.0","rimraf":"^3.0.2","rollup":"^0.68.2","prettier":"^2.3.0","standard":"^16.0.4","cross-env":"^7.0.3","babel-core":"^6.26.3","pre-commit":"^1.2.2","rollup-watch":"^4.3.1","babel-preset-env":"^1.7.0","rollup-plugin-babel":"^3.0.3","rollup-plugin-terser":"^7.0.2","rollup-plugin-replace":"^2.2.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","rollup-plugin-commonjs":"^8.4.1","rollup-plugin-includepaths":"^0.2.3","rollup-plugin-node-resolve":"^3.4.0","@babel/plugin-external-helpers":"7.12.13"},"_npmOperationalInternal":{"tmp":"tmp/urisanity_0.1.6_1726708793388_0.5285559029930997","host":"s3://npm-registry-packages"},"deprecated":"this package version is now deprecated"}},"time":{"created":"2022-02-13T20:50:14.069Z","modified":"2024-09-19T01:24:25.222Z","0.1.0":"2022-02-13T20:50:14.320Z","0.1.1":"2022-02-15T19:44:31.994Z","0.1.2":"2022-05-12T13:23:15.113Z","0.1.3":"2024-03-06T13:38:07.878Z","0.1.4":"2024-04-03T22:31:02.964Z","0.1.5":"2024-09-19T01:18:33.018Z","0.1.6":"2024-09-19T01:19:53.534Z"},"bugs":{"url":"https://github.com/codesplinta/URISanity/issues"},"author":{"url":"https://isocroft.com/","name":"Ifeora Okechukwu","email":"isocroft@gmail.com"},"license":"MIT","homepage":"https://github.com/codesplinta/URISanity","keywords":["xss","URI","sanitization"],"repository":{"url":"git://github.com/codesplinta/URISanity.git","type":"git"},"description":"vet URIs in web and web-like applications with confidence","maintainers":[{"name":"codesplinta","email":"codesplinta.nig@gmail.com"}],"readme":"![@isocroft](https://img.shields.io/badge/@isocroft-CodeSplinta-blue) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-cyan.svg?style=flat-square)](http://makeapullrequest.com) [![Made in Nigeria](https://img.shields.io/badge/made%20in-nigeria-008751.svg?style=flat-square)](https://github.com/acekyd/made-in-nigeria)\n\n# URI Sanity\n\nA small library used in the Browser and NodeJS to vet URIs (to mitigate vulnerabilities) with confidence. In other words, It's the [DOMPurify](https://www.github.com/cure53/DOMPurify) for URIs. A uniform resource locator (URL) is, in fact, a subset of [uniform resource identifiers](https://whatis.techtarget.com/definition/URI-Uniform-Resource-Identifier?_gl=1*7pixwg*_ga*NDg2NjQ5NTIxLjE2NDQ3MTE5NjA.*_ga_TQKE4GS5P9*MTY0NDcxMTk1OC4xLjAuMTY0NDcxMTk1OC4w&_ga=2.95812444.1772810844.1644711960-486649521.1644711960) (URI). Therefore, this library covers the super set of all resource identifiers where possible.\n\n## Motivation\n\nThere are many web-based zero-day vulnerabilities that can be expolited in Browsers/NodeJS servers using Standard and/or Custom URI schemes. Certain browsers like Safari and Firefox are usually subceptible to launching such URIs without a prompt or restrictions and enable [Arbitrary File Execution](https://en.wikipedia.org/wiki/Arbitrary_code_execution#:~:text=arbitrary%20code%20execution%20(ACE)%20is%20an%20attacker's%20ability%20to%20run%20any%20commands%20or%20code%20of%20the%20attacker's%20choice%20on%20a%20target%20machine%20or%20in%20a%20target%20process.), [Remote Code Execution](https://www.checkpoint.com/cyber-hub/cyber-security/what-is-remote-code-execution-rce/#:~:text=Remote%20code%20execution%20(RCE)%20attacks,control%20over%20a%20compromised%20machine.) and/or [Connection String Pollution](https://link.springer.com/chapter/10.1007/978-3-642-16120-9_16?noAccess=true) (on the server) where possible. This is why this library was built. It moves to create a layer of protection for your web applications both on the Browser and on the Server (NodeJS only) by blocking badly formed/suspicious URIs.\n\nFurthermore, other solutions like [braintree/sanitize-url](https://www.github.com/braintree/sanitize-url) are quite naive and a bit too specific in [it's approach](https://github.com/braintree/sanitize-url/issues/14) to URL sanitization. Also, most web front-end frameworks like **Angular** and **Vue** (safe for **React**) do not do a very robust and serious (non-trivial) job of sanitiziting URLs either. This is why this library is very important to web application developers who need reliability in sanitizing URLs.\n\n## Validation\n\nThis library has been validated against popular malicious URIs delineated [here](https://book.hacktricks.xyz/pentesting-web/xss-cross-site-scripting) and [here](https://cheatsheetseries.owasp.org/cheatsheets/XSS_Filter_Evasion_Cheat_Sheet.html)\n\n## Installation\n\nInstall using `npm`\n\n```bash\nnpm install urisanity\n```\n\n or install using `yarn`.\n\n```bash\nyarn add urisanity\n```\n\n\n## Getting Started\n\nAll you need to do is import the package appropriately depending on the environment (Browser OR Node) being used\n\n### Browser environment\n\n> Using a `script` tag directly inside a web page\n\n```html\n<script type=\"text/javascript\" src=\"https://unpkg.com/browse/urisanity@0.1.6/dist/urisanity.min.js\" crossorigin=\"anonymous\"></script>\n```\n\n> import as ES6 module - no setup required\n\n```js\nimport URISanity from 'urisanity';\n\nconst sanitizedUrl = URISanity.vet('blob:https://www.foo-.evil.com/undefined', {\n  // All flag options set - valid\n  allowScriptOrDataURI: false,\n  allowFileSystemURI: false,\n  allowCommsAppURI: true,\n  allowDBConnectionStringURI: false,\n  allowBrowserSpecificURI: false,\n  allowWebTransportURI: false,\n  allowServiceAPIURI: false,\n});\n\nconsole.log(sanitizedUrl); // \"about:blank\"\n\nconst sanitizedDBUri = URISanity.vet(\"jdbc:sqlserver://;servername=server_name;integratedSecurity=true;authenticationScheme=JavaKerberos\", {\n  // One flag option set - valid\n  allowDBConnectionStringURI: true,\n  allowFileSystemURI: false, // you can omit this since it's `false`\n  allowCommsAppURI: false, // you can omit this since it's `false`\n  allowScriptOrDataURI: false, // you can omit this since it's `false`\n  allowWebTransportURI: false, // you can omit this since it's `false`\n  allowServiceAPIURI: false // you can omit this since it's `false`\n})\n\nconsole.log(sanitizedDBUri) // \"jdbc:sqlserver://;servername=server_name;integratedSecurity=true;authenticationScheme=JavaKerberos\"\n\nconst sanitizedCustomUrl = URISanity.vet(\n  'icloud-sharing://www.icloud.com/photos/01eFfrthOPvnfZqlKMn', {\n    /* No flag options set - valid */\n});\n\nconsole.log(sanitizedCustomUrl); // \"about:blank\"\n\nconst santizedBadUrl = URISanity.vet('http://aa.com/</script>\"><img src=x onerror=\"prompt(document.domain)\">)', {\n  allowWebTransportURI: true,\n  allowScriptOrDataURI: true\n})\n\nconsole.log(sanitizedBadUrl); // \"about:blank\"\n\n\n\nconst paramValue = URISanity.extractParamValueFromUri(\n  'https://www.example.com?xyz=%200000#intro',\n  'xyz'\n);\n\nconsole.log(paramValue); // \" 0000\"\n\nconst checkPassed = URISanity.checkParamsOverWhiteList(\n  'grpc://api.broker.rt-msg.io:443?user=sal%C3%A1ta',\n  ['user']\n);\n\nconsole.log(checkPassed); // true\n\nconst isSame = URISanity.isSameOrigin(window.location.href)\n\nconsole.log(isSame) // true\n```\n\n### NodeJS (commonjs) environment\n\n> Setup an env file in your NodeJS app and include an `ORIGIN`\n\n```.env\nORIGIN=http://127.0.0.1:4050\n```\n\n```js\nconst URISanity = require('urisanity');\n\nconst sanitizedFileUrl = URISanity.vet(\n  'file://www.airbnb.com/Users/xxx/Desktop/index.html',\n  {\n    allowWebTransportURI: true\n  }\n);\n\nconsole.log(sanitizedFileUrl) // \"about:blank\"\n```\n\n```js\nconst URISanity = require('urisanity');\n\nlet sanitizedUrl = URISanity.vet(\n  'file://www.airbnb.com/Users/xxx/Desktop/index.html',\n  {\n    allowWebTransportURI: false,\n    allowFileSystemURI: true\n  }\n);\n\nconsole.log(sanitizedUrl) // \"file://www.airbnb.com/Users/xxx/Desktop/index.html\"\n```\n## Implementing Trusted Types\n\n> You can make use of [**Trusted Types**](https://w3c.github.io/webappsec-trusted-types/dist/spec/#trused-script-url) while using **URI Sanity**. An excerpt from a [_**2021 report from Google on Trusted Types**_](https://storage.googleapis.com/pub-tools-public-publication-data/pdf/2cbfffc0943dabf34c499f786080ffa2cda9cb4c.pdf) reads:\n\n_Trusted Types are supported in several popular frameworks and libraries including\nAngular, React (with a feature flag), Lit, Karma, and Webpack. Enforcing Trusted Types\nin applications built on top of these frameworks is now [relatively simple](https://auth0.com/blog/securing-spa-with-trusted-types/); in some cases\nno application-level code changes are required._\n\nBefore the advent of **Trusted Types** (specifically, in the days of Angular 1.x), frontend web engineers used [this approach](https://stackoverflow.com/questions/15606751/angularjs-changes-urls-to-unsafe-in-extension-page) in sanitizing URIs for web applications and it was grossly inefficient and/or naive. This is also [another approach](https://github.com/angular/angular/blob/master/packages/core/src/sanitization/url_sanitizer.ts#L36) that still doesn't cater to a much braoder system for URI sanitization. Now, with **URISanity**, you have the broader systems needed for quality URI sanitization.\n\n```js\nimport URISanity from 'urisanity';\nimport DOMPurify from 'dompurify';\n\nwindow.addEventListener('securitypolicyviolation', console.error.bind(console));\n\n/* @HINT: feature / object detection */\nif (typeof window.trustedTypes !== 'undefined') {\n  trustedTypes.createPolicy('default', {\n    createHTML: (html) => {\n      /* @HINT: \n        \n        sanitize all potentially malicious characters from HTML string \n      */\n      return DOMPurify.sanitize(html, {\n        USE_PROFILES: {\n          html: true,\n          svg: true,\n        },\n      })\n    },\n    createScriptURL: (url) => {\n      /* @HINT: \n        \n        vet URL string and return \"about:blank\" if URL string is suspicious\n      */\n      return URISanity.vet(url, {\n        allowWebTransportURI: true,\n      })\n    },\n  });\n}\n```\n\n## More Use Cases\n\n**URISanity** can be used to improve the web security of browser API sinks (injection sinks) that make use if URIs and aren't covered and/or catered for by **Trusted Types** and basic **CSP**. By instrumenting these API sinks (sinks for Document Object Model / Browser Object Model) and utilizing browser custom event API(s), the solution is quite elegant. Take a look below:\n\n>Let's define some basic browser custom events and their handler\n\n```javascript\n/* @NOTE: Can also be the \"connect-src\" whitelist of urls from a CSP directive */\n/* @HINT: The whitelist below is for excluding URLs that are not known to the web app and may be expoitative/suspicious */\nconst whitelistedURLEndpoints = [\n  'https://www.facebook.com/tr',\n  'https://www.google-analytics.com/collect'\n]\n\n/* @HINT: Setting custome events to check and validate URLs */\ndocument.addEventListener( 'beforerequest', onBeforeURIUsed, false )\ndocument.addEventListener( 'beforeinclude', onBeforeURIUsed, false )\n\n/* @HINT: Event handler common to the two events above */\nfunction onBeforeURIUsed ( event ) {\n  /* @CHECK: https://www.npmjs.com/package/urisanity ; urisanity */\n  /* @HINT: Vet the URL endpoint being requested/included for safety */\n  if (window.urisanity.vet(\n    event.detail.endpoint,\n    { allowWebTransportURI: true }\n  ) !== 'about:blank') {\n    const { origin, pathname } = new URL(event.detail.endpoint)\n\n    /* @HINT: Make sure the endpoint being requested/included is part of the whitelist */\n    if (whitelistedURLEndpoints.includes(`${origin}${pathname}`)) {\n      if (origin.includes('.google-analytics.')) {\n        /* @HINT: Check that only the request params we need are attached */\n        /* @HINT: Any other extra params should not be allowed */\n        if (window.urisanity.checkParamsOverWhiteList(\n          event.detail.endpoint,\n          ['tid', 'cid'],\n          event.detail.data\n        )) {\n          return;\n        }\n      }\n    }\n  }\n\n  /* @HINT: trigger an error to be thrown when the endpoint is not in the whitelist above */\n  /* @HINT: Or the validation above for any origin (or for google-analytics) doesn't pass */\n  event.preventDefault()\n}\n```\n>Now, let's instrument certain browser API sinks and make them able to throw errors on suspicion of a malformed/malicious API.\n\n```javascript\n /*!\n  * FIRST SECTION\n  *\n  */\n\n/* @HINT: Extract the native definitions of these APIs from the DOM Interfaces */\nconst originalSetAttributeMethod = HTMLElement.prototype.setAttribute\n\n/* @HINT: Create a new definition for `setAttribute` that instruments the API to detect suspicious URIs */\nHTMLElement.prototype.setAttribute = function setAttribute (attributeName, newValue) {\n\t  const that = this;\n\t  const previousValue = that.getAttribute(attributeName);\n\n\t  const timerID = window.setTimeout(function () { \n      /* @HINT: Stop [ DOMSubtreeModified ] event from firing before [ DOMAttrModified ] event */\n\t\t  originalSetAttributeMethod.call(that, attributeName, newValue);\n\t  }, 0);\n\n    /* @HINT: Whenever the attribute name is `href`, then check the URL that is the value */\n    if (attributeName === 'href') {\n      /* @HINT: Fire a custom event `beforeinclude` to track manual whitelisting of URL endpoints */\n      let event = new window.CustomEvent('beforeinclude', {\n        detail: {\n          endpoint: newValue,\n          sink: \"HTMLElement.setAttribute\",\n          data: null\n        },\n        bubbles: true,\n        cancelable: true\n      });\n\n      /* @HINT: Detect if the dispatched custom event was cancelled by a call to `event.preventDefault()` */\n      /* @HINT: If the event was cancelled, it means the URL endpoint above was disallowed by the checks */\n      const cancelled = !document.dispatchEvent(event)\n\n       /* @HINT: If it's cancelled, stop the `setTimeout` call above from being executed by clearing the timeout */\n       /* @HINT: Also, we throw an error to stop the call to `setAttribute` from being requested */\n       if (cancelled) {\n         window.clearTimeout(timerID)\n         throw new Error(\n           \"Suspicious Activity: \"\n           +\n           event.detail.endpoint\n           +\n           \" request, using [ \" + event.detail.data + \" ] in \"\n           +\n           \" [ \" + event.detail.sink + \" ]\"\n         )\n       }\n    }\n\n    /* @HINT: When listening to mutation events, might be okay to stagger certain event sequences properly */\n\t  if (newValue !== previousValue) {\n\t    let event = document.createEvent(\"MutationEvent\");\n\t    event.initMutationEvent(\n\t      \"DOMAttrModified\",\n\t      true,\n\t      false,\n\t      that,\n\t      previousValue || \"\",\n\t      newValue || \"\",\n\t      attributeName,\n\t      (previousValue === null) ? event.ADDITION : event.MODIFICATION\n\t    );\n\t\t  \n\t    that.dispatchEvent(\n        event\n      );\n\t  }\n\t};\n\n\n /*!\n  * NEXT SECTION\n  *\n  */\n\n\n/* @HINT: craete a function/constructor that does nothing a.k.a no-operation function */\nconst noop = function noOperation () {}\n\n/* @HINT: Copy out the user-agent interface function `sendBeacon` */\nconst NativeSendBeacon = window.Navigator.prototype.sendBeacon || noop\n\nwindow.Navigator.prototype.sendBeacon = function sendBeacon (url, data) {\n  /* @HINT: Fire a custom event `beforerequest` to track manual whitelisting of URL endpoints */\n  const event = new window.CustomEvent('beforerequest', {\n    detail: {\n      endpoint: url,\n      method: \"POST\",\n      sink: \"Navigator.sendBeacon\",\n      data: data\n    },\n    bubbles: true,\n    cancelable: true\n  })\n\n  /* @HINT: Detect if the dispatched custom event was cancelled by a call to `event.preventDefault()` */\n  /* @HINT: If the event was cancelled, it means the URL endpoint above was disallowed by the checks */\n  const cancelled = !document.dispatchEvent(event)\n\n   /* @HINT: If it's cancelled, we throw an error to stop the call to `sendBeacon` from being requested */\n   if (cancelled) {\n     throw new Error(\n       \"Suspicious Activity: \"\n       +\n       event.detail.endpoint\n       +\n       \" request, using [ \" + event.detail.data + \" ] in \"\n\t      +\n\t      \" [ \" + event.detail.sink + \" ]\"\n     )\n   }\n\n   /* @HINT: If all checks out and no error was thrown above then proceed as usual */\n   return NativeSendBeacon.call(this, url, data);\n};\n\n/* @HINT: define property `name` on custom function */\n  Object.defineProperty(sendBeacon, 'name', {\n    writable: false,\n    value: 'sendBeacon'\n  });\n\n/* @HINT: define property function `toString` on custom function */\nObject.defineProperty(sendBeacon, 'toString', {\n  writable: true,\n  value: function toString () {\n    return NativeSendBeacon.toString()\n  }\n})\n\n/* @HINT: Take care of the special Firefox/IceWeasel (Gecko) property `toSource` */\nif ('toSource' in NativeSendBeacon) {\n  Object.defineProperty(sendBeacon, 'toSource', {\n    writable: true,\n    value: function toSource () {\n      return NativeSendBeacon.toSource()\n    }\n  })\n}\n```\n\nFinally, the code above in the event handler get triggered whenever `navigator.sendBeacon()` is called and the URLs are using **URISanity**. The [zhorn](https://www.npmjs.com/package/zhorn) package provides all of this functionality and depends on **URISanity**.\n\n## Documentation\n\nHere is a brief guide to using this library and it's API method(s)\n\n### Flag Options\n>When using the `.vet(uri: String [, options: Object])` API method, there are flag option(s) to filter out different URI categories in the vetting process. They are as follows:\n\n1. **allowCommsAppURI** : This applies only to the deep links that are used by communication tools and apps like Whatsapp, Zoom, Slack, Skype or browser comms URIs e.g. _sms, tel, whatsapp, slack_\n2. **allowDBConnectionStringURI** :  This applies only to database connection string URIs e.g. _postgresql, mongodb, jdbc:mysql_\n3. **allowBrowserSpecificURI** : This applies only to browser extensions, packaged apps and browser data display URIs e.g. _view-source, moz-extension_\n4. **allowServiceAPIURI** : This appies only to third-party data storage services whos have specialized URIs for data transfer and storage operations e.g. _cloudinary, s3, grpc_\n5. **allowScriptOrDataURI** : This applies only to script and/or data URIs e.g. _data, javascript_\n6. **allowFileSystemURI** : This applies only to URIs related to the local filesystem e.g. _blob, file, local_\n7. **allowWebTransportURI** : This applies only to web data transport URIs e.g. _http, ws, https, wss, blob:https_\n\n### API Methods\n\n### `URISanity.vet(uri: String [, options: Object]): String`\n>The `.vet(uri: String [, options: Object])` method is used to sanitize a URI of any [standard form](https://en.wikipedia.org/wiki/List_of_URI_schemes) to ensure that it doesn't contain unwanted and/or malicious content. Only the second argument is optional. If the second ( **options** ) argument isn't passed, it means that all [flag options](https://github.com/codesplinta/URISanity#flag-options) are `false`.\n\n### `URISanity.extractParamValueFromUri(uri: String, queryParamName: String): String`\n>The `.extractParamValueFromUri(uri: String, queryParamName: String)` method is used to extract the value of a query parameter from a given URI. Both arguments are not optional.\n\n### `URISanity.checkParamsOverWhiteList(uri: String, paramNamesWhiteList: Array [, querySearch: String]): Boolean`\n>The `.checkParamsOverWhiteList(uri: String, queryParamNames: Array [, querySearch: String | Object])` method is used to check whether the params (query OR body) associated with a given URI is correct, allowed and valid for it's use case. Only the third argument for this method is optional.\n\n### `URISanity.isSameOrigin(uri: String): Boolean`\n>The `.isSameOrigin(uri: String)` method is used to check if the URI being inspected has the sam origin (protocol + host) as the environment (Browser or NodeJS). The only argument for this method is not optional.\n\n## License\n\nMIT License\n\n## Contributing\n\nIf you wish to contribute to this project, you are very much welcome. Please, create an issue first before you proceed to create a PR (either to propose a feature or fix a bug). Make sure to clone the repo, checkout to a contribution branch and build the project before making modifications to the codebase.\n\nRun all the following command (in order they appear) below:\n\n```bash\n\n$ npm run lint\n\n$ npm run build\n\n$ npm run test\n```\n\n## TypeScript\n\nYou can find the TS declaration [here](https://gist.github.com/isocroft/021098c660318bf92f7ab05bba042f48) (simply copy from the gist and paste in the root of your project as `urisanity.d.ts`)\n","readmeFilename":"README.md"}