From 454709f7e84b1ee7c1880c5c7a25b4baff1ac199 Mon Sep 17 00:00:00 2001 From: Giacomo Debidda Date: Wed, 28 Sep 2022 18:00:52 +0200 Subject: [PATCH 01/15] feat(content-security-policy): add package --- .github/workflows/ci.yaml | 3 + assets/html-pages/404.html | 60 + assets/html-pages/about/index.html | 73 + assets/html-pages/index.html | 69 + config/jest.cjs | 1 + custom-types/himalaya/index.d.ts | 16 + docs/content-security-policy/.nojekyll | 1 + .../assets/highlight.css | 29 + docs/content-security-policy/assets/main.js | 54 + docs/content-security-policy/assets/search.js | 1 + docs/content-security-policy/assets/style.css | 1225 +++++++++++++++++ .../assets/widgets.png | Bin 0 -> 480 bytes .../assets/widgets@2x.png | Bin 0 -> 855 bytes .../functions/cspDirectives.html | 59 + .../functions/cspHeader.html | 59 + .../functions/cspJSON.html | 59 + docs/content-security-policy/index.html | 74 + .../interfaces/Config.html | 72 + .../interfaces/Directives.html | 56 + docs/content-security-policy/modules.html | 66 + .../variables/recommended_policy.html | 94 ++ .../variables/starter_policy.html | 70 + package-lock.json | 759 +--------- .../.ae/content-security-policy.api.md | 62 + packages/content-security-policy/LICENSE | 21 + packages/content-security-policy/README.md | 26 + .../__tests__/constants.mjs | 40 + .../__tests__/csp-directives.test.mjs | 39 + .../__tests__/errors.test.mjs | 55 + .../__tests__/hash.test.mjs | 39 + .../__tests__/html-parser.test.mjs | 42 + .../__tests__/schemas.test.mjs | 54 + .../__tests__/source-values.test.mjs | 85 ++ .../__tests__/utils.test.mjs | 21 + ...ntent-security-policy.config.directives.md | 11 + .../content-security-policy.config.md | 20 + ...content-security-policy.config.patterns.md | 11 + .../content-security-policy.cspdirectives.md | 12 + .../content-security-policy.cspheader.md | 12 + .../content-security-policy.cspjson.md | 12 + .../content-security-policy.directives.md | 12 + .../api-docs/content-security-policy.md | 25 + ...tent-security-policy.recommended_policy.md | 29 + .../content-security-policy.starter_policy.md | 21 + .../content-security-policy/api-docs/index.md | 12 + .../api-extractor.json | 3 + packages/content-security-policy/package.json | 67 + .../release.config.cjs | 27 + .../src/csp-directives.ts | 129 ++ .../content-security-policy/src/directives.ts | 92 ++ .../content-security-policy/src/errors.ts | 67 + packages/content-security-policy/src/hash.ts | 148 ++ .../src/html-parser.ts | 103 ++ packages/content-security-policy/src/index.ts | 9 + .../content-security-policy/src/policies.ts | 38 + .../content-security-policy/src/schemas.ts | 169 +++ .../src/source-values.ts | 154 +++ packages/content-security-policy/src/utils.ts | 95 ++ .../content-security-policy/tsconfig.json | 8 + tsconfig.json | 3 + 60 files changed, 3981 insertions(+), 692 deletions(-) create mode 100644 assets/html-pages/404.html create mode 100644 assets/html-pages/about/index.html create mode 100644 assets/html-pages/index.html create mode 100644 custom-types/himalaya/index.d.ts create mode 100644 docs/content-security-policy/.nojekyll create mode 100644 docs/content-security-policy/assets/highlight.css create mode 100644 docs/content-security-policy/assets/main.js create mode 100644 docs/content-security-policy/assets/search.js create mode 100644 docs/content-security-policy/assets/style.css create mode 100644 docs/content-security-policy/assets/widgets.png create mode 100644 docs/content-security-policy/assets/widgets@2x.png create mode 100644 docs/content-security-policy/functions/cspDirectives.html create mode 100644 docs/content-security-policy/functions/cspHeader.html create mode 100644 docs/content-security-policy/functions/cspJSON.html create mode 100644 docs/content-security-policy/index.html create mode 100644 docs/content-security-policy/interfaces/Config.html create mode 100644 docs/content-security-policy/interfaces/Directives.html create mode 100644 docs/content-security-policy/modules.html create mode 100644 docs/content-security-policy/variables/recommended_policy.html create mode 100644 docs/content-security-policy/variables/starter_policy.html create mode 100644 packages/content-security-policy/.ae/content-security-policy.api.md create mode 100644 packages/content-security-policy/LICENSE create mode 100644 packages/content-security-policy/README.md create mode 100644 packages/content-security-policy/__tests__/constants.mjs create mode 100644 packages/content-security-policy/__tests__/csp-directives.test.mjs create mode 100644 packages/content-security-policy/__tests__/errors.test.mjs create mode 100644 packages/content-security-policy/__tests__/hash.test.mjs create mode 100644 packages/content-security-policy/__tests__/html-parser.test.mjs create mode 100644 packages/content-security-policy/__tests__/schemas.test.mjs create mode 100644 packages/content-security-policy/__tests__/source-values.test.mjs create mode 100644 packages/content-security-policy/__tests__/utils.test.mjs create mode 100644 packages/content-security-policy/api-docs/content-security-policy.config.directives.md create mode 100644 packages/content-security-policy/api-docs/content-security-policy.config.md create mode 100644 packages/content-security-policy/api-docs/content-security-policy.config.patterns.md create mode 100644 packages/content-security-policy/api-docs/content-security-policy.cspdirectives.md create mode 100644 packages/content-security-policy/api-docs/content-security-policy.cspheader.md create mode 100644 packages/content-security-policy/api-docs/content-security-policy.cspjson.md create mode 100644 packages/content-security-policy/api-docs/content-security-policy.directives.md create mode 100644 packages/content-security-policy/api-docs/content-security-policy.md create mode 100644 packages/content-security-policy/api-docs/content-security-policy.recommended_policy.md create mode 100644 packages/content-security-policy/api-docs/content-security-policy.starter_policy.md create mode 100644 packages/content-security-policy/api-docs/index.md create mode 100644 packages/content-security-policy/api-extractor.json create mode 100644 packages/content-security-policy/package.json create mode 100644 packages/content-security-policy/release.config.cjs create mode 100644 packages/content-security-policy/src/csp-directives.ts create mode 100644 packages/content-security-policy/src/directives.ts create mode 100644 packages/content-security-policy/src/errors.ts create mode 100644 packages/content-security-policy/src/hash.ts create mode 100644 packages/content-security-policy/src/html-parser.ts create mode 100644 packages/content-security-policy/src/index.ts create mode 100644 packages/content-security-policy/src/policies.ts create mode 100644 packages/content-security-policy/src/schemas.ts create mode 100644 packages/content-security-policy/src/source-values.ts create mode 100644 packages/content-security-policy/src/utils.ts create mode 100644 packages/content-security-policy/tsconfig.json diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cf61f3ff..82f7f1ef 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -59,6 +59,9 @@ jobs: - name: πŸ” Test @jackdbd/cloud-tasks-utils run: npm run test:ci -w packages/cloud-tasks-utils + - name: πŸ” Test @jackdbd/content-security-policy + run: npm run test:ci -w packages/content-security-policy + - name: πŸ” Test @jackdbd/firestore-utils env: SA_FIRESTORE_USER_TEST: ${{ secrets.SA_FIRESTORE_USER_TEST }} diff --git a/assets/html-pages/404.html b/assets/html-pages/404.html new file mode 100644 index 00000000..a35765a2 --- /dev/null +++ b/assets/html-pages/404.html @@ -0,0 +1,60 @@ +Oops! Not Found (404) \ No newline at end of file diff --git a/assets/html-pages/about/index.html b/assets/html-pages/about/index.html new file mode 100644 index 00000000..b630b5f6 --- /dev/null +++ b/assets/html-pages/about/index.html @@ -0,0 +1,73 @@ + + + A few words about me + + + + + + + + + + + \ No newline at end of file diff --git a/assets/html-pages/index.html b/assets/html-pages/index.html new file mode 100644 index 00000000..8b92ea80 --- /dev/null +++ b/assets/html-pages/index.html @@ -0,0 +1,69 @@ + + + Hi there! + + + + + + + \ No newline at end of file diff --git a/config/jest.cjs b/config/jest.cjs index 388e85c4..9ad21183 100644 --- a/config/jest.cjs +++ b/config/jest.cjs @@ -80,6 +80,7 @@ const projects = [ project('checks'), project('cloud-scheduler-utils'), project('cloud-tasks-utils'), + project('content-security-policy'), project('fattureincloud-client'), project('firestore-utils'), project('keap-client'), diff --git a/custom-types/himalaya/index.d.ts b/custom-types/himalaya/index.d.ts new file mode 100644 index 00000000..c9f26470 --- /dev/null +++ b/custom-types/himalaya/index.d.ts @@ -0,0 +1,16 @@ +declare module 'himalaya' { + export interface HimalayaJson { + children: any + content: string + tagName: string + filter: (predicate: (x: any) => boolean) => any + } + + export interface Options { + includePositions: boolean + } + + export function parse(html: string, options: Options): HimalayaJson + + export const parseDefaults: Options +} diff --git a/docs/content-security-policy/.nojekyll b/docs/content-security-policy/.nojekyll new file mode 100644 index 00000000..e2ac6616 --- /dev/null +++ b/docs/content-security-policy/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/content-security-policy/assets/highlight.css b/docs/content-security-policy/assets/highlight.css new file mode 100644 index 00000000..1b78686f --- /dev/null +++ b/docs/content-security-policy/assets/highlight.css @@ -0,0 +1,29 @@ +:root { + --light-hl-0: #000000; + --dark-hl-0: #D4D4D4; + --light-code-background: #FFFFFF; + --dark-code-background: #1E1E1E; +} + +@media (prefers-color-scheme: light) { :root { + --hl-0: var(--light-hl-0); + --code-background: var(--light-code-background); +} } + +@media (prefers-color-scheme: dark) { :root { + --hl-0: var(--dark-hl-0); + --code-background: var(--dark-code-background); +} } + +:root[data-theme='light'] { + --hl-0: var(--light-hl-0); + --code-background: var(--light-code-background); +} + +:root[data-theme='dark'] { + --hl-0: var(--dark-hl-0); + --code-background: var(--dark-code-background); +} + +.hl-0 { color: var(--hl-0); } +pre, code { background: var(--code-background); } diff --git a/docs/content-security-policy/assets/main.js b/docs/content-security-policy/assets/main.js new file mode 100644 index 00000000..abd0485a --- /dev/null +++ b/docs/content-security-policy/assets/main.js @@ -0,0 +1,54 @@ +"use strict"; +"use strict";(()=>{var Qe=Object.create;var ae=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Oe=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var _e=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Me=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ce(e))!Re.call(t,i)&&i!==n&&ae(t,i,{get:()=>e[i],enumerable:!(r=Pe(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Qe(Oe(t)):{},Me(e||!t||!t.__esModule?ae(n,"default",{value:t,enumerable:!0}):n,t));var de=_e((ce,he)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var h=t.utils.clone(n)||{};h.position=[a,l],h.index=s.length,s.push(new t.Token(r.slice(a,o),h))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. +`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ou?h+=2:a==u&&(n+=r[l+1]*i[h+1],l+=2,h+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}if(s.str.length==0&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}s.str.length==1&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var h=s.str.charAt(0),m=s.str.charAt(1),v;m in s.node.edges?v=s.node.edges[m]:(v=new t.TokenSet,s.node.edges[m]=v),s.str.length==1&&(v.final=!0),i.push({node:v,editsRemaining:s.editsRemaining-1,str:h+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),u=0;u1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof ce=="object"?he.exports=n():e.lunr=n()}(this,function(){return t})})()});var le=[];function j(t,e){le.push({selector:e,constructor:t})}var Y=class{constructor(){this.createComponents(document.body)}createComponents(e){le.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r}),r.dataset.hasInstance=String(!0))})})}};var k=class{constructor(e){this.el=e.el}};var J=class{constructor(){this.listeners={}}addEventListener(e,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push(n)}removeEventListener(e,n){if(!(e in this.listeners))return;let r=this.listeners[e];for(let i=0,s=r.length;i{let n=Date.now();return(...r)=>{n+e-Date.now()<0&&(t(...r),n=Date.now())}};var re=class extends J{constructor(){super();this.scrollTop=0;this.lastY=0;this.width=0;this.height=0;this.showToolbar=!0;this.toolbar=document.querySelector(".tsd-page-toolbar"),this.navigation=document.querySelector(".col-menu"),window.addEventListener("scroll",ne(()=>this.onScroll(),10)),window.addEventListener("resize",ne(()=>this.onResize(),10)),this.searchInput=document.querySelector("#tsd-search input"),this.searchInput&&this.searchInput.addEventListener("focus",()=>{this.hideShowToolbar()}),this.onResize(),this.onScroll()}triggerResize(){let n=new CustomEvent("resize",{detail:{width:this.width,height:this.height}});this.dispatchEvent(n)}onResize(){this.width=window.innerWidth||0,this.height=window.innerHeight||0;let n=new CustomEvent("resize",{detail:{width:this.width,height:this.height}});this.dispatchEvent(n)}onScroll(){this.scrollTop=window.scrollY||0;let n=new CustomEvent("scroll",{detail:{scrollTop:this.scrollTop}});this.dispatchEvent(n),this.hideShowToolbar()}hideShowToolbar(){let n=this.showToolbar;this.showToolbar=this.lastY>=this.scrollTop||this.scrollTop<=0||!!this.searchInput&&this.searchInput===document.activeElement,n!==this.showToolbar&&(this.toolbar.classList.toggle("tsd-page-toolbar--hide"),this.navigation?.classList.toggle("col-menu--hide")),this.lastY=this.scrollTop}},R=re;R.instance=new re;var X=class extends k{constructor(n){super(n);this.anchors=[];this.index=-1;R.instance.addEventListener("resize",()=>this.onResize()),R.instance.addEventListener("scroll",r=>this.onScroll(r)),this.createAnchors()}createAnchors(){let n=window.location.href;n.indexOf("#")!=-1&&(n=n.substring(0,n.indexOf("#"))),this.el.querySelectorAll("a").forEach(r=>{let i=r.href;if(i.indexOf("#")==-1||i.substring(0,n.length)!=n)return;let s=i.substring(i.indexOf("#")+1),o=document.querySelector("a.tsd-anchor[name="+s+"]"),a=r.parentNode;!o||!a||this.anchors.push({link:a,anchor:o,position:0})}),this.onResize()}onResize(){let n;for(let i=0,s=this.anchors.length;ii.position-s.position);let r=new CustomEvent("scroll",{detail:{scrollTop:R.instance.scrollTop}});this.onScroll(r)}onScroll(n){let r=n.detail.scrollTop+5,i=this.anchors,s=i.length-1,o=this.index;for(;o>-1&&i[o].position>r;)o-=1;for(;o-1&&this.anchors[this.index].link.classList.remove("focus"),this.index=o,this.index>-1&&this.anchors[this.index].link.classList.add("focus"))}};var ue=(t,e=100)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>t(r),e)}};var me=De(de());function ve(){let t=document.getElementById("tsd-search");if(!t)return;let e=document.getElementById("search-script");t.classList.add("loading"),e&&(e.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),e.addEventListener("load",()=>{t.classList.remove("loading"),t.classList.add("ready")}),window.searchData&&t.classList.remove("loading"));let n=document.querySelector("#tsd-search input"),r=document.querySelector("#tsd-search .results");if(!n||!r)throw new Error("The input field or the result list wrapper was not found");let i=!1;r.addEventListener("mousedown",()=>i=!0),r.addEventListener("mouseup",()=>{i=!1,t.classList.remove("has-focus")}),n.addEventListener("focus",()=>t.classList.add("has-focus")),n.addEventListener("blur",()=>{i||(i=!1,t.classList.remove("has-focus"))});let s={base:t.dataset.base+"/"};Fe(t,r,n,s)}function Fe(t,e,n,r){n.addEventListener("input",ue(()=>{Ae(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?fe(e,-1):s.key==="ArrowDown"?fe(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function He(t,e){t.index||window.searchData&&(e.classList.remove("loading"),e.classList.add("ready"),t.data=window.searchData,t.index=me.Index.load(window.searchData.index))}function Ae(t,e,n,r){if(He(r,t),!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s=i?r.index.search(`*${i}*`):[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o${pe(u.parent,i)}.${l}`);let h=document.createElement("li");h.classList.value=u.classes??"";let m=document.createElement("a");m.href=r.base+u.url,m.innerHTML=l,h.append(m),e.appendChild(h)}}function fe(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function pe(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(ie(t.substring(s,o)),`${ie(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(ie(t.substring(s))),i.join("")}var Ne={"&":"&","<":"<",">":">","'":"'",'"':"""};function ie(t){return t.replace(/[&<>"'"]/g,e=>Ne[e])}var F="mousedown",ye="mousemove",B="mouseup",Z={x:0,y:0},ge=!1,se=!1,je=!1,H=!1,xe=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(xe?"is-mobile":"not-mobile");xe&&"ontouchstart"in document.documentElement&&(je=!0,F="touchstart",ye="touchmove",B="touchend");document.addEventListener(F,t=>{se=!0,H=!1;let e=F=="touchstart"?t.targetTouches[0]:t;Z.y=e.pageY||0,Z.x=e.pageX||0});document.addEventListener(ye,t=>{if(!!se&&!H){let e=F=="touchstart"?t.targetTouches[0]:t,n=Z.x-(e.pageX||0),r=Z.y-(e.pageY||0);H=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{se=!1});document.addEventListener("click",t=>{ge&&(t.preventDefault(),t.stopImmediatePropagation(),ge=!1)});var K=class extends k{constructor(n){super(n);this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,r=>this.onPointerUp(r)),this.el.addEventListener("click",r=>r.preventDefault()),document.addEventListener(F,r=>this.onDocumentPointerDown(r)),document.addEventListener(B,r=>this.onDocumentPointerUp(r))}setActive(n){if(this.active==n)return;this.active=n,document.documentElement.classList.toggle("has-"+this.className,n),this.el.classList.toggle("active",n);let r=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(r),setTimeout(()=>document.documentElement.classList.remove(r),500)}onPointerUp(n){H||(this.setActive(!0),n.preventDefault())}onDocumentPointerDown(n){if(this.active){if(n.target.closest(".col-menu, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(n){if(!H&&this.active&&n.target.closest(".col-menu")){let r=n.target.closest("a");if(r){let i=window.location.href;i.indexOf("#")!=-1&&(i=i.substring(0,i.indexOf("#"))),r.href.substring(0,i.length)==i&&setTimeout(()=>this.setActive(!1),250)}}}};var oe;try{oe=localStorage}catch{oe={getItem(){return null},setItem(){}}}var Q=oe;var Le=document.head.appendChild(document.createElement("style"));Le.dataset.for="filters";var ee=class extends k{constructor(n){super(n);this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),Le.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } +`}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.checked}setLocalStorage(n){Q.setItem(this.key,n.toString()),this.value=n,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),document.querySelectorAll(".tsd-index-section").forEach(n=>{n.style.display="block";let r=Array.from(n.querySelectorAll(".tsd-index-link")).every(i=>i.offsetParent==null);n.style.display=r?"none":"block"})}};var te=class extends k{constructor(n){super(n);this.calculateHeights(),this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.textContent.replace(/\s+/g,"-").toLowerCase()}`,this.setLocalStorage(this.fromLocalStorage(),!0),this.summary.addEventListener("click",r=>this.toggleVisibility(r)),this.icon.style.transform=this.getIconRotation()}getIconRotation(n=this.el.open){return`rotate(${n?0:-90}deg)`}calculateHeights(){let n=this.el.open,{position:r,left:i}=this.el.style;this.el.style.position="fixed",this.el.style.left="-9999px",this.el.open=!0,this.expandedHeight=this.el.offsetHeight+"px",this.el.open=!1,this.collapsedHeight=this.el.offsetHeight+"px",this.el.open=n,this.el.style.height=n?this.expandedHeight:this.collapsedHeight,this.el.style.position=r,this.el.style.left=i}toggleVisibility(n){n.preventDefault(),this.el.style.overflow="hidden",this.el.open?this.collapse():this.expand()}expand(n=!0){this.el.open=!0,this.animate(this.collapsedHeight,this.expandedHeight,{opening:!0,duration:n?300:0})}collapse(n=!0){this.animate(this.expandedHeight,this.collapsedHeight,{opening:!1,duration:n?300:0})}animate(n,r,{opening:i,duration:s=300}){if(this.animation)return;let o={duration:s,easing:"ease"};this.animation=this.el.animate({height:[n,r]},o),this.icon.animate({transform:[this.icon.style.transform||this.getIconRotation(!i),this.getIconRotation(i)]},o).addEventListener("finish",()=>{this.icon.style.transform=this.getIconRotation(i)}),this.animation.addEventListener("finish",()=>this.animationEnd(i))}animationEnd(n){this.el.open=n,this.animation=void 0,this.el.style.height="auto",this.el.style.overflow="visible",this.setLocalStorage(n)}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.open}setLocalStorage(n,r=!1){this.fromLocalStorage()===n&&!r||(Q.setItem(this.key,n.toString()),this.el.open=n,this.handleValueChange(r))}handleValueChange(n=!1){this.fromLocalStorage()===this.el.open&&!n||(this.fromLocalStorage()?this.expand(!1):this.collapse(!1))}};function be(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,Ee(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),Ee(t.value)})}function Ee(t){document.documentElement.dataset.theme=t}ve();j(X,".menu-highlight");j(K,"a[data-toggle]");j(te,".tsd-index-accordion");j(ee,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("theme");Se&&be(Se);var Be=new Y;Object.defineProperty(window,"app",{value:Be});})(); +/*! + * lunr.Builder + * Copyright (C) 2020 Oliver Nightingale + */ +/*! + * lunr.Index + * Copyright (C) 2020 Oliver Nightingale + */ +/*! + * lunr.Pipeline + * Copyright (C) 2020 Oliver Nightingale + */ +/*! + * lunr.Set + * Copyright (C) 2020 Oliver Nightingale + */ +/*! + * lunr.TokenSet + * Copyright (C) 2020 Oliver Nightingale + */ +/*! + * lunr.Vector + * Copyright (C) 2020 Oliver Nightingale + */ +/*! + * lunr.stemmer + * Copyright (C) 2020 Oliver Nightingale + * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt + */ +/*! + * lunr.stopWordFilter + * Copyright (C) 2020 Oliver Nightingale + */ +/*! + * lunr.tokenizer + * Copyright (C) 2020 Oliver Nightingale + */ +/*! + * lunr.trimmer + * Copyright (C) 2020 Oliver Nightingale + */ +/*! + * lunr.utils + * Copyright (C) 2020 Oliver Nightingale + */ +/** + * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9 + * Copyright (C) 2020 Oliver Nightingale + * @license MIT + */ diff --git a/docs/content-security-policy/assets/search.js b/docs/content-security-policy/assets/search.js new file mode 100644 index 00000000..71fdcf50 --- /dev/null +++ b/docs/content-security-policy/assets/search.js @@ -0,0 +1 @@ +window.searchData = JSON.parse("{\"kinds\":{\"32\":\"Variable\",\"64\":\"Function\",\"256\":\"Interface\",\"1024\":\"Property\",\"65536\":\"Type literal\"},\"rows\":[{\"kind\":32,\"name\":\"starter_policy\",\"url\":\"variables/starter_policy.html\",\"classes\":\"tsd-kind-variable\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/starter_policy.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-variable\",\"parent\":\"starter_policy\"},{\"kind\":1024,\"name\":\"base-uri\",\"url\":\"variables/starter_policy.html#__type.base_uri\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"starter_policy.__type\"},{\"kind\":1024,\"name\":\"connect-src\",\"url\":\"variables/starter_policy.html#__type.connect_src\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"starter_policy.__type\"},{\"kind\":1024,\"name\":\"default-src\",\"url\":\"variables/starter_policy.html#__type.default_src\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"starter_policy.__type\"},{\"kind\":1024,\"name\":\"form-action\",\"url\":\"variables/starter_policy.html#__type.form_action\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"starter_policy.__type\"},{\"kind\":1024,\"name\":\"img-src\",\"url\":\"variables/starter_policy.html#__type.img_src\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"starter_policy.__type\"},{\"kind\":1024,\"name\":\"script-src\",\"url\":\"variables/starter_policy.html#__type.script_src\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"starter_policy.__type\"},{\"kind\":1024,\"name\":\"style-src\",\"url\":\"variables/starter_policy.html#__type.style_src\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"starter_policy.__type\"},{\"kind\":32,\"name\":\"recommended_policy\",\"url\":\"variables/recommended_policy.html\",\"classes\":\"tsd-kind-variable\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/recommended_policy.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-variable\",\"parent\":\"recommended_policy\"},{\"kind\":1024,\"name\":\"font-src\",\"url\":\"variables/recommended_policy.html#__type.font_src\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"recommended_policy.__type\"},{\"kind\":1024,\"name\":\"frame-ancestors\",\"url\":\"variables/recommended_policy.html#__type.frame_ancestors\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"recommended_policy.__type\"},{\"kind\":1024,\"name\":\"manifest-src\",\"url\":\"variables/recommended_policy.html#__type.manifest_src\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"recommended_policy.__type\"},{\"kind\":1024,\"name\":\"object-src\",\"url\":\"variables/recommended_policy.html#__type.object_src\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"recommended_policy.__type\"},{\"kind\":1024,\"name\":\"prefetch-src\",\"url\":\"variables/recommended_policy.html#__type.prefetch_src\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"recommended_policy.__type\"},{\"kind\":1024,\"name\":\"upgrade-insecure-requests\",\"url\":\"variables/recommended_policy.html#__type.upgrade_insecure_requests\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"recommended_policy.__type\"},{\"kind\":1024,\"name\":\"base-uri\",\"url\":\"variables/recommended_policy.html#__type.base_uri\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"recommended_policy.__type\"},{\"kind\":1024,\"name\":\"connect-src\",\"url\":\"variables/recommended_policy.html#__type.connect_src\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"recommended_policy.__type\"},{\"kind\":1024,\"name\":\"default-src\",\"url\":\"variables/recommended_policy.html#__type.default_src\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"recommended_policy.__type\"},{\"kind\":1024,\"name\":\"form-action\",\"url\":\"variables/recommended_policy.html#__type.form_action\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"recommended_policy.__type\"},{\"kind\":1024,\"name\":\"img-src\",\"url\":\"variables/recommended_policy.html#__type.img_src\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"recommended_policy.__type\"},{\"kind\":1024,\"name\":\"script-src\",\"url\":\"variables/recommended_policy.html#__type.script_src\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"recommended_policy.__type\"},{\"kind\":1024,\"name\":\"style-src\",\"url\":\"variables/recommended_policy.html#__type.style_src\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"recommended_policy.__type\"},{\"kind\":64,\"name\":\"cspDirectives\",\"url\":\"functions/cspDirectives.html\",\"classes\":\"tsd-kind-function\"},{\"kind\":64,\"name\":\"cspHeader\",\"url\":\"functions/cspHeader.html\",\"classes\":\"tsd-kind-function\"},{\"kind\":64,\"name\":\"cspJSON\",\"url\":\"functions/cspJSON.html\",\"classes\":\"tsd-kind-function\"},{\"kind\":256,\"name\":\"Config\",\"url\":\"interfaces/Config.html\",\"classes\":\"tsd-kind-interface\"},{\"kind\":1024,\"name\":\"directives\",\"url\":\"interfaces/Config.html#directives\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Config\"},{\"kind\":1024,\"name\":\"patterns\",\"url\":\"interfaces/Config.html#patterns\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Config\"},{\"kind\":256,\"name\":\"Directives\",\"url\":\"interfaces/Directives.html\",\"classes\":\"tsd-kind-interface\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"comment\"],\"fieldVectors\":[[\"name/0\",[0,36.659]],[\"comment/0\",[]],[\"name/1\",[1,30.54]],[\"comment/1\",[]],[\"name/2\",[2,23.635,3,23.635]],[\"comment/2\",[]],[\"name/3\",[4,23.635,5,7.339]],[\"comment/3\",[]],[\"name/4\",[5,7.339,6,23.635]],[\"comment/4\",[]],[\"name/5\",[7,23.635,8,23.635]],[\"comment/5\",[]],[\"name/6\",[5,7.339,9,23.635]],[\"comment/6\",[]],[\"name/7\",[5,7.339,10,23.635]],[\"comment/7\",[]],[\"name/8\",[5,7.339,11,23.635]],[\"comment/8\",[]],[\"name/9\",[12,36.659]],[\"comment/9\",[]],[\"name/10\",[1,30.54]],[\"comment/10\",[]],[\"name/11\",[5,7.339,13,28.371]],[\"comment/11\",[]],[\"name/12\",[14,28.371,15,28.371]],[\"comment/12\",[]],[\"name/13\",[5,7.339,16,28.371]],[\"comment/13\",[]],[\"name/14\",[5,7.339,17,28.371]],[\"comment/14\",[]],[\"name/15\",[5,7.339,18,28.371]],[\"comment/15\",[]],[\"name/16\",[19,23.139,20,23.139,21,23.139]],[\"comment/16\",[]],[\"name/17\",[2,23.635,3,23.635]],[\"comment/17\",[]],[\"name/18\",[4,23.635,5,7.339]],[\"comment/18\",[]],[\"name/19\",[5,7.339,6,23.635]],[\"comment/19\",[]],[\"name/20\",[7,23.635,8,23.635]],[\"comment/20\",[]],[\"name/21\",[5,7.339,9,23.635]],[\"comment/21\",[]],[\"name/22\",[5,7.339,10,23.635]],[\"comment/22\",[]],[\"name/23\",[5,7.339,11,23.635]],[\"comment/23\",[]],[\"name/24\",[22,36.659]],[\"comment/24\",[]],[\"name/25\",[23,36.659]],[\"comment/25\",[]],[\"name/26\",[24,36.659]],[\"comment/26\",[]],[\"name/27\",[25,36.659]],[\"comment/27\",[]],[\"name/28\",[26,30.54]],[\"comment/28\",[]],[\"name/29\",[27,36.659]],[\"comment/29\",[]],[\"name/30\",[26,30.54]],[\"comment/30\",[]]],\"invertedIndex\":[[\"__type\",{\"_index\":1,\"name\":{\"1\":{},\"10\":{}},\"comment\":{}}],[\"action\",{\"_index\":8,\"name\":{\"5\":{},\"20\":{}},\"comment\":{}}],[\"ancestors\",{\"_index\":15,\"name\":{\"12\":{}},\"comment\":{}}],[\"base\",{\"_index\":2,\"name\":{\"2\":{},\"17\":{}},\"comment\":{}}],[\"config\",{\"_index\":25,\"name\":{\"27\":{}},\"comment\":{}}],[\"connect\",{\"_index\":4,\"name\":{\"3\":{},\"18\":{}},\"comment\":{}}],[\"cspdirectives\",{\"_index\":22,\"name\":{\"24\":{}},\"comment\":{}}],[\"cspheader\",{\"_index\":23,\"name\":{\"25\":{}},\"comment\":{}}],[\"cspjson\",{\"_index\":24,\"name\":{\"26\":{}},\"comment\":{}}],[\"default\",{\"_index\":6,\"name\":{\"4\":{},\"19\":{}},\"comment\":{}}],[\"directives\",{\"_index\":26,\"name\":{\"28\":{},\"30\":{}},\"comment\":{}}],[\"font\",{\"_index\":13,\"name\":{\"11\":{}},\"comment\":{}}],[\"form\",{\"_index\":7,\"name\":{\"5\":{},\"20\":{}},\"comment\":{}}],[\"frame\",{\"_index\":14,\"name\":{\"12\":{}},\"comment\":{}}],[\"img\",{\"_index\":9,\"name\":{\"6\":{},\"21\":{}},\"comment\":{}}],[\"insecure\",{\"_index\":20,\"name\":{\"16\":{}},\"comment\":{}}],[\"manifest\",{\"_index\":16,\"name\":{\"13\":{}},\"comment\":{}}],[\"object\",{\"_index\":17,\"name\":{\"14\":{}},\"comment\":{}}],[\"patterns\",{\"_index\":27,\"name\":{\"29\":{}},\"comment\":{}}],[\"prefetch\",{\"_index\":18,\"name\":{\"15\":{}},\"comment\":{}}],[\"recommended_policy\",{\"_index\":12,\"name\":{\"9\":{}},\"comment\":{}}],[\"requests\",{\"_index\":21,\"name\":{\"16\":{}},\"comment\":{}}],[\"script\",{\"_index\":10,\"name\":{\"7\":{},\"22\":{}},\"comment\":{}}],[\"src\",{\"_index\":5,\"name\":{\"3\":{},\"4\":{},\"6\":{},\"7\":{},\"8\":{},\"11\":{},\"13\":{},\"14\":{},\"15\":{},\"18\":{},\"19\":{},\"21\":{},\"22\":{},\"23\":{}},\"comment\":{}}],[\"starter_policy\",{\"_index\":0,\"name\":{\"0\":{}},\"comment\":{}}],[\"style\",{\"_index\":11,\"name\":{\"8\":{},\"23\":{}},\"comment\":{}}],[\"upgrade\",{\"_index\":19,\"name\":{\"16\":{}},\"comment\":{}}],[\"uri\",{\"_index\":3,\"name\":{\"2\":{},\"17\":{}},\"comment\":{}}]],\"pipeline\":[]}}"); \ No newline at end of file diff --git a/docs/content-security-policy/assets/style.css b/docs/content-security-policy/assets/style.css new file mode 100644 index 00000000..958d2c26 --- /dev/null +++ b/docs/content-security-policy/assets/style.css @@ -0,0 +1,1225 @@ +:root { + /* Light */ + --light-color-background: #f2f4f8; + --light-color-background-secondary: #eff0f1; + --light-color-icon-background: var(--light-color-background); + --light-color-accent: #c5c7c9; + --light-color-text: #222; + --light-color-text-aside: #707070; + --light-color-link: #4da6ff; + --light-color-ts: #db1373; + --light-color-ts-interface: #139d2c; + --light-color-ts-enum: #9c891a; + --light-color-ts-class: #2484e5; + --light-color-ts-function: #572be7; + --light-color-ts-namespace: #b111c9; + --light-color-ts-private: #707070; + --light-color-ts-variable: #4d68ff; + --light-external-icon: url("data:image/svg+xml;utf8,"); + --light-color-scheme: light; + + /* Dark */ + --dark-color-background: #2b2e33; + --dark-color-background-secondary: #1e2024; + --dark-color-icon-background: var(--dark-color-background-secondary); + --dark-color-accent: #9096a2; + --dark-color-text: #f5f5f5; + --dark-color-text-aside: #dddddd; + --dark-color-link: #00aff4; + --dark-color-ts: #ff6492; + --dark-color-ts-interface: #6cff87; + --dark-color-ts-enum: #f4d93e; + --dark-color-ts-class: #61b0ff; + --dark-color-ts-function: #9772ff; + --dark-color-ts-namespace: #e14dff; + --dark-color-ts-private: #e2e2e2; + --dark-color-ts-variable: #4d68ff; + --dark-external-icon: url("data:image/svg+xml;utf8,"); + --dark-color-scheme: dark; +} + +@media (prefers-color-scheme: light) { + :root { + --color-background: var(--light-color-background); + --color-background-secondary: var(--light-color-background-secondary); + --color-icon-background: var(--light-color-icon-background); + --color-accent: var(--light-color-accent); + --color-text: var(--light-color-text); + --color-text-aside: var(--light-color-text-aside); + --color-link: var(--light-color-link); + --color-ts: var(--light-color-ts); + --color-ts-interface: var(--light-color-ts-interface); + --color-ts-enum: var(--light-color-ts-enum); + --color-ts-class: var(--light-color-ts-class); + --color-ts-function: var(--light-color-ts-function); + --color-ts-namespace: var(--light-color-ts-namespace); + --color-ts-private: var(--light-color-ts-private); + --color-ts-variable: var(--light-color-ts-variable); + --external-icon: var(--light-external-icon); + --color-scheme: var(--light-color-scheme); + } +} + +@media (prefers-color-scheme: dark) { + :root { + --color-background: var(--dark-color-background); + --color-background-secondary: var(--dark-color-background-secondary); + --color-icon-background: var(--dark-color-icon-background); + --color-accent: var(--dark-color-accent); + --color-text: var(--dark-color-text); + --color-text-aside: var(--dark-color-text-aside); + --color-link: var(--dark-color-link); + --color-ts: var(--dark-color-ts); + --color-ts-interface: var(--dark-color-ts-interface); + --color-ts-enum: var(--dark-color-ts-enum); + --color-ts-class: var(--dark-color-ts-class); + --color-ts-function: var(--dark-color-ts-function); + --color-ts-namespace: var(--dark-color-ts-namespace); + --color-ts-private: var(--dark-color-ts-private); + --color-ts-variable: var(--dark-color-ts-variable); + --external-icon: var(--dark-external-icon); + --color-scheme: var(--dark-color-scheme); + } +} + +html { + color-scheme: var(--color-scheme); +} + +body { + margin: 0; +} + +:root[data-theme="light"] { + --color-background: var(--light-color-background); + --color-background-secondary: var(--light-color-background-secondary); + --color-icon-background: var(--light-color-icon-background); + --color-accent: var(--light-color-accent); + --color-text: var(--light-color-text); + --color-text-aside: var(--light-color-text-aside); + --color-link: var(--light-color-link); + --color-ts: var(--light-color-ts); + --color-ts-interface: var(--light-color-ts-interface); + --color-ts-enum: var(--light-color-ts-enum); + --color-ts-class: var(--light-color-ts-class); + --color-ts-function: var(--light-color-ts-function); + --color-ts-namespace: var(--light-color-ts-namespace); + --color-ts-private: var(--light-color-ts-private); + --color-ts-variable: var(--light-color-ts-variable); + --external-icon: var(--light-external-icon); + --color-scheme: var(--light-color-scheme); +} + +:root[data-theme="dark"] { + --color-background: var(--dark-color-background); + --color-background-secondary: var(--dark-color-background-secondary); + --color-icon-background: var(--dark-color-icon-background); + --color-accent: var(--dark-color-accent); + --color-text: var(--dark-color-text); + --color-text-aside: var(--dark-color-text-aside); + --color-link: var(--dark-color-link); + --color-ts: var(--dark-color-ts); + --color-ts-interface: var(--dark-color-ts-interface); + --color-ts-enum: var(--dark-color-ts-enum); + --color-ts-class: var(--dark-color-ts-class); + --color-ts-function: var(--dark-color-ts-function); + --color-ts-namespace: var(--dark-color-ts-namespace); + --color-ts-private: var(--dark-color-ts-private); + --color-ts-variable: var(--dark-color-ts-variable); + --external-icon: var(--dark-external-icon); + --color-scheme: var(--dark-color-scheme); +} + +h1, +h2, +h3, +h4, +h5, +h6 { + line-height: 1.2; +} + +h1 { + font-size: 1.875rem; + margin: 0.67rem 0; +} + +h2 { + font-size: 1.5rem; + margin: 0.83rem 0; +} + +h3 { + font-size: 1.25rem; + margin: 1rem 0; +} + +h4 { + font-size: 1.05rem; + margin: 1.33rem 0; +} + +h5 { + font-size: 1rem; + margin: 1.5rem 0; +} + +h6 { + font-size: 0.875rem; + margin: 2.33rem 0; +} + +.uppercase { + text-transform: uppercase; +} + +pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; +} + +dl, +menu, +ol, +ul { + margin: 1em 0; +} + +dd { + margin: 0 0 0 40px; +} + +.container { + max-width: 1600px; + padding: 0 2rem; +} + +@media (min-width: 640px) { + .container { + padding: 0 4rem; + } +} +@media (min-width: 1200px) { + .container { + padding: 0 8rem; + } +} +@media (min-width: 1600px) { + .container { + padding: 0 12rem; + } +} + +/* Footer */ +.tsd-generator { + border-top: 1px solid var(--color-accent); + padding-top: 1rem; + padding-bottom: 1rem; + max-height: 3.5rem; +} + +.tsd-generator > p { + margin-top: 0; + margin-bottom: 0; + padding: 0 1rem; +} + +.container-main { + display: flex; + justify-content: space-between; + position: relative; + margin: 0 auto; +} + +.col-4, +.col-8 { + box-sizing: border-box; + float: left; + padding: 2rem 1rem; +} + +.col-4 { + flex: 0 0 25%; +} +.col-8 { + flex: 1 0; + flex-wrap: wrap; + padding-left: 0; +} + +@keyframes fade-in { + from { + opacity: 0; + } + to { + opacity: 1; + } +} +@keyframes fade-out { + from { + opacity: 1; + visibility: visible; + } + to { + opacity: 0; + } +} +@keyframes fade-in-delayed { + 0% { + opacity: 0; + } + 33% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@keyframes fade-out-delayed { + 0% { + opacity: 1; + visibility: visible; + } + 66% { + opacity: 0; + } + 100% { + opacity: 0; + } +} +@keyframes shift-to-left { + from { + transform: translate(0, 0); + } + to { + transform: translate(-25%, 0); + } +} +@keyframes unshift-to-left { + from { + transform: translate(-25%, 0); + } + to { + transform: translate(0, 0); + } +} +@keyframes pop-in-from-right { + from { + transform: translate(100%, 0); + } + to { + transform: translate(0, 0); + } +} +@keyframes pop-out-to-right { + from { + transform: translate(0, 0); + visibility: visible; + } + to { + transform: translate(100%, 0); + } +} +body { + background: var(--color-background); + font-family: "Segoe UI", sans-serif; + font-size: 16px; + color: var(--color-text); +} + +a { + color: var(--color-link); + text-decoration: none; +} +a:hover { + text-decoration: underline; +} +a.external[target="_blank"] { + background-image: var(--external-icon); + background-position: top 3px right; + background-repeat: no-repeat; + padding-right: 13px; +} + +code, +pre { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + padding: 0.2em; + margin: 0; + font-size: 0.875rem; + border-radius: 0.8em; +} + +pre { + padding: 10px; + border: 0.1em solid var(--color-accent); +} +pre code { + padding: 0; + font-size: 100%; +} + +blockquote { + margin: 1em 0; + padding-left: 1em; + border-left: 4px solid gray; +} + +.tsd-typography { + line-height: 1.333em; +} +.tsd-typography ul { + list-style: square; + padding: 0 0 0 20px; + margin: 0; +} +.tsd-typography h4, +.tsd-typography .tsd-index-panel h3, +.tsd-index-panel .tsd-typography h3, +.tsd-typography h5, +.tsd-typography h6 { + font-size: 1em; + margin: 0; +} +.tsd-typography h5, +.tsd-typography h6 { + font-weight: normal; +} +.tsd-typography p, +.tsd-typography ul, +.tsd-typography ol { + margin: 1em 0; +} + +@media (max-width: 1024px) { + html .col-content { + float: none; + max-width: 100%; + width: 100%; + padding-top: 3rem; + } + html .col-menu { + position: fixed !important; + overflow-y: auto; + -webkit-overflow-scrolling: touch; + z-index: 1024; + top: 0 !important; + bottom: 0 !important; + left: auto !important; + right: 0 !important; + padding: 1.5rem 1.5rem 0 0; + max-width: 25rem; + visibility: hidden; + background-color: var(--color-background); + transform: translate(100%, 0); + } + html .col-menu > *:last-child { + padding-bottom: 20px; + } + html .overlay { + content: ""; + display: block; + position: fixed; + z-index: 1023; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0, 0, 0, 0.75); + visibility: hidden; + } + + .to-has-menu .overlay { + animation: fade-in 0.4s; + } + + .to-has-menu :is(header, footer, .col-content) { + animation: shift-to-left 0.4s; + } + + .to-has-menu .col-menu { + animation: pop-in-from-right 0.4s; + } + + .from-has-menu .overlay { + animation: fade-out 0.4s; + } + + .from-has-menu :is(header, footer, .col-content) { + animation: unshift-to-left 0.4s; + } + + .from-has-menu .col-menu { + animation: pop-out-to-right 0.4s; + } + + .has-menu body { + overflow: hidden; + } + .has-menu .overlay { + visibility: visible; + } + .has-menu :is(header, footer, .col-content) { + transform: translate(-25%, 0); + } + .has-menu .col-menu { + visibility: visible; + transform: translate(0, 0); + display: grid; + align-items: center; + grid-template-rows: auto 1fr; + grid-gap: 1.5rem; + max-height: 100vh; + padding: 1rem 2rem; + } + .has-menu .tsd-navigation { + max-height: 100%; + } +} + +.tsd-breadcrumb { + margin: 0; + padding: 0; + color: var(--color-text-aside); +} +.tsd-breadcrumb a { + color: var(--color-text-aside); + text-decoration: none; +} +.tsd-breadcrumb a:hover { + text-decoration: underline; +} +.tsd-breadcrumb li { + display: inline; +} +.tsd-breadcrumb li:after { + content: " / "; +} + +.tsd-comment-tags { + display: flex; + flex-direction: column; +} +dl.tsd-comment-tag-group { + display: flex; + align-items: center; + overflow: hidden; + margin: 0.5em 0; +} +dl.tsd-comment-tag-group dt { + display: flex; + margin-right: 0.5em; + font-size: 0.875em; + font-weight: normal; +} +dl.tsd-comment-tag-group dd { + margin: 0; +} +code.tsd-tag { + padding: 0.25em 0.4em; + border: 0.1em solid var(--color-accent); + margin-right: 0.25em; + font-size: 70%; +} +h1 code.tsd-tag:first-of-type { + margin-left: 0.25em; +} + +dl.tsd-comment-tag-group dd:before, +dl.tsd-comment-tag-group dd:after { + content: " "; +} +dl.tsd-comment-tag-group dd pre, +dl.tsd-comment-tag-group dd:after { + clear: both; +} +dl.tsd-comment-tag-group p { + margin: 0; +} + +.tsd-panel.tsd-comment .lead { + font-size: 1.1em; + line-height: 1.333em; + margin-bottom: 2em; +} +.tsd-panel.tsd-comment .lead:last-child { + margin-bottom: 0; +} + +.tsd-filter-visibility h4 { + font-size: 1rem; + padding-top: 0.75rem; + padding-bottom: 0.5rem; + margin: 0; +} +.tsd-filter-item:not(:last-child) { + margin-bottom: 0.5rem; +} +.tsd-filter-input { + display: flex; + width: fit-content; + width: -moz-fit-content; + align-items: center; + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + cursor: pointer; +} +.tsd-filter-input input[type="checkbox"] { + cursor: pointer; + position: absolute; + width: 1.5em; + height: 1.5em; + opacity: 0; +} +.tsd-filter-input input[type="checkbox"]:disabled { + pointer-events: none; +} +.tsd-filter-input svg { + cursor: pointer; + width: 1.5em; + height: 1.5em; + margin-right: 0.5em; + border-radius: 0.33em; + /* Leaving this at full opacity breaks event listeners on Firefox. + Don't remove unless you know what you're doing. */ + opacity: 0.99; +} +.tsd-filter-input input[type="checkbox"]:focus + svg { + transform: scale(0.95); +} +.tsd-filter-input input[type="checkbox"]:focus:not(:focus-visible) + svg { + transform: scale(1); +} +.tsd-checkbox-background { + fill: var(--color-accent); +} +input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark { + stroke: var(--color-text); +} +.tsd-filter-input input:disabled ~ svg > .tsd-checkbox-background { + fill: var(--color-background); + stroke: var(--color-accent); + stroke-width: 0.25rem; +} +.tsd-filter-input input:disabled ~ svg > .tsd-checkbox-checkmark { + stroke: var(--color-accent); +} + +.tsd-theme-toggle { + padding-top: 0.75rem; +} +.tsd-theme-toggle > h4 { + display: inline; + vertical-align: middle; + margin-right: 0.75rem; +} + +.tsd-hierarchy { + list-style: square; + margin: 0; +} +.tsd-hierarchy .target { + font-weight: bold; +} + +.tsd-panel-group.tsd-index-group { + margin-bottom: 0; +} +.tsd-index-panel .tsd-index-list { + list-style: none; + line-height: 1.333em; + margin: 0; + padding: 0.25rem 0 0 0; + overflow: hidden; + display: grid; + grid-template-columns: repeat(3, 1fr); + column-gap: 1rem; + grid-template-rows: auto; +} +@media (max-width: 1024px) { + .tsd-index-panel .tsd-index-list { + grid-template-columns: repeat(2, 1fr); + } +} +@media (max-width: 768px) { + .tsd-index-panel .tsd-index-list { + grid-template-columns: repeat(1, 1fr); + } +} +.tsd-index-panel .tsd-index-list li { + -webkit-page-break-inside: avoid; + -moz-page-break-inside: avoid; + -ms-page-break-inside: avoid; + -o-page-break-inside: avoid; + page-break-inside: avoid; +} +.tsd-index-panel a, +.tsd-index-panel a.tsd-parent-kind-module { + color: var(--color-ts); +} +.tsd-index-panel a.tsd-parent-kind-interface { + color: var(--color-ts-interface); +} +.tsd-index-panel a.tsd-parent-kind-enum { + color: var(--color-ts-enum); +} +.tsd-index-panel a.tsd-parent-kind-class { + color: var(--color-ts-class); +} +.tsd-index-panel a.tsd-kind-module { + color: var(--color-ts-namespace); +} +.tsd-index-panel a.tsd-kind-interface { + color: var(--color-ts-interface); +} +.tsd-index-panel a.tsd-kind-enum { + color: var(--color-ts-enum); +} +.tsd-index-panel a.tsd-kind-class { + color: var(--color-ts-class); +} +.tsd-index-panel a.tsd-kind-function { + color: var(--color-ts-function); +} +.tsd-index-panel a.tsd-kind-namespace { + color: var(--color-ts-namespace); +} +.tsd-index-panel a.tsd-kind-variable { + color: var(--color-ts-variable); +} +.tsd-index-panel a.tsd-is-private { + color: var(--color-ts-private); +} + +.tsd-flag { + display: inline-block; + padding: 0.25em 0.4em; + border-radius: 4px; + color: var(--color-comment-tag-text); + background-color: var(--color-comment-tag); + text-indent: 0; + font-size: 75%; + line-height: 1; + font-weight: normal; +} + +.tsd-anchor { + position: absolute; + top: -100px; +} + +.tsd-member { + position: relative; +} +.tsd-member .tsd-anchor + h3 { + display: flex; + align-items: center; + margin-top: 0; + margin-bottom: 0; + border-bottom: none; +} +.tsd-member [data-tsd-kind] { + color: var(--color-ts); +} +.tsd-member [data-tsd-kind="Interface"] { + color: var(--color-ts-interface); +} +.tsd-member [data-tsd-kind="Enum"] { + color: var(--color-ts-enum); +} +.tsd-member [data-tsd-kind="Class"] { + color: var(--color-ts-class); +} +.tsd-member [data-tsd-kind="Private"] { + color: var(--color-ts-private); +} + +.tsd-navigation a { + display: block; + margin: 0.4rem 0; + border-left: 2px solid transparent; + color: var(--color-text); + text-decoration: none; + transition: border-left-color 0.1s; +} +.tsd-navigation a:hover { + text-decoration: underline; +} +.tsd-navigation ul { + margin: 0; + padding: 0; + list-style: none; +} +.tsd-navigation li { + padding: 0; +} + +.tsd-navigation.primary .tsd-accordion-details > ul { + margin-top: 0.75rem; +} +.tsd-navigation.primary a { + padding: 0.75rem 0.5rem; + margin: 0; +} +.tsd-navigation.primary ul li a { + margin-left: 0.5rem; +} +.tsd-navigation.primary ul li li a { + margin-left: 1.5rem; +} +.tsd-navigation.primary ul li li li a { + margin-left: 2.5rem; +} +.tsd-navigation.primary ul li li li li a { + margin-left: 3.5rem; +} +.tsd-navigation.primary ul li li li li li a { + margin-left: 4.5rem; +} +.tsd-navigation.primary ul li li li li li li a { + margin-left: 5.5rem; +} +.tsd-navigation.primary li.current > a { + border-left: 0.15rem var(--color-text) solid; +} +.tsd-navigation.primary li.selected > a { + font-weight: bold; + border-left: 0.2rem var(--color-text) solid; +} +.tsd-navigation.primary ul li a:hover { + border-left: 0.2rem var(--color-text-aside) solid; +} +.tsd-navigation.primary li.globals + li > span, +.tsd-navigation.primary li.globals + li > a { + padding-top: 20px; +} + +.tsd-navigation.secondary.tsd-navigation--toolbar-hide { + max-height: calc(100vh - 1rem); + top: 0.5rem; +} +.tsd-navigation.secondary > ul { + display: inline; + padding-right: 0.5rem; + transition: opacity 0.2s; +} +.tsd-navigation.secondary ul li a { + padding-left: 0; +} +.tsd-navigation.secondary ul li li a { + padding-left: 1.1rem; +} +.tsd-navigation.secondary ul li li li a { + padding-left: 2.2rem; +} +.tsd-navigation.secondary ul li li li li a { + padding-left: 3.3rem; +} +.tsd-navigation.secondary ul li li li li li a { + padding-left: 4.4rem; +} +.tsd-navigation.secondary ul li li li li li li a { + padding-left: 5.5rem; +} + +a.tsd-index-link { + margin: 0.25rem 0; + font-size: 1rem; + line-height: 1.25rem; + display: inline-flex; + align-items: center; +} +.tsd-accordion-summary > h1, +.tsd-accordion-summary > h2, +.tsd-accordion-summary > h3, +.tsd-accordion-summary > h4, +.tsd-accordion-summary > h5 { + display: inline-flex; + align-items: center; + vertical-align: middle; + margin-bottom: 0; + user-select: none; + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; +} +.tsd-accordion-summary { + display: block; + cursor: pointer; +} +.tsd-accordion-summary > * { + margin-top: 0; + margin-bottom: 0; + padding-top: 0; + padding-bottom: 0; +} +.tsd-accordion-summary::-webkit-details-marker { + display: none; +} +.tsd-index-accordion .tsd-accordion-summary svg { + margin-right: 0.25rem; +} +.tsd-index-content > :not(:first-child) { + margin-top: 0.75rem; +} +.tsd-index-heading { + margin-top: 1.5rem; + margin-bottom: 0.75rem; +} + +.tsd-kind-icon { + margin-right: 0.5rem; + width: 1.25rem; + height: 1.25rem; + min-width: 1.25rem; + min-height: 1.25rem; +} +.tsd-kind-icon path { + transform-origin: center; + transform: scale(1.1); +} +.tsd-signature > .tsd-kind-icon { + margin-right: 0.8rem; +} + +@media (min-width: 1024px) { + .col-content { + margin: 2rem auto; + } + + .menu-sticky-wrap { + position: sticky; + height: calc(100vh - 2rem); + top: 4rem; + right: 0; + padding: 0 1.5rem; + padding-top: 1rem; + margin-top: 3rem; + transition: 0.3s ease-in-out; + transition-property: top, padding-top, padding, height; + overflow-y: auto; + } + .col-menu { + border-left: 1px solid var(--color-accent); + } + .col-menu--hide { + top: 1rem; + } + .col-menu .tsd-navigation:not(:last-child) { + padding-bottom: 1.75rem; + } +} + +.tsd-panel { + margin-bottom: 2.5rem; +} +.tsd-panel.tsd-member { + margin-bottom: 4rem; +} +.tsd-panel:empty { + display: none; +} +.tsd-panel > h1, +.tsd-panel > h2, +.tsd-panel > h3 { + margin: 1.5rem -1.5rem 0.75rem -1.5rem; + padding: 0 1.5rem 0.75rem 1.5rem; +} +.tsd-panel > h1.tsd-before-signature, +.tsd-panel > h2.tsd-before-signature, +.tsd-panel > h3.tsd-before-signature { + margin-bottom: 0; + border-bottom: none; +} + +.tsd-panel-group { + margin: 4rem 0; +} +.tsd-panel-group.tsd-index-group { + margin: 2rem 0; +} +.tsd-panel-group.tsd-index-group details { + margin: 2rem 0; +} + +#tsd-search { + transition: background-color 0.2s; +} +#tsd-search .title { + position: relative; + z-index: 2; +} +#tsd-search .field { + position: absolute; + left: 0; + top: 0; + right: 2.5rem; + height: 100%; +} +#tsd-search .field input { + box-sizing: border-box; + position: relative; + top: -50px; + z-index: 1; + width: 100%; + padding: 0 10px; + opacity: 0; + outline: 0; + border: 0; + background: transparent; + color: var(--color-text); +} +#tsd-search .field label { + position: absolute; + overflow: hidden; + right: -40px; +} +#tsd-search .field input, +#tsd-search .title { + transition: opacity 0.2s; +} +#tsd-search .results { + position: absolute; + visibility: hidden; + top: 40px; + width: 100%; + margin: 0; + padding: 0; + list-style: none; + box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); +} +#tsd-search .results li { + padding: 0 10px; + background-color: var(--color-background); +} +#tsd-search .results li:nth-child(even) { + background-color: var(--color-background-secondary); +} +#tsd-search .results li.state { + display: none; +} +#tsd-search .results li.current, +#tsd-search .results li:hover { + background-color: var(--color-accent); +} +#tsd-search .results a { + display: block; +} +#tsd-search .results a:before { + top: 10px; +} +#tsd-search .results span.parent { + color: var(--color-text-aside); + font-weight: normal; +} +#tsd-search.has-focus { + background-color: var(--color-accent); +} +#tsd-search.has-focus .field input { + top: 0; + opacity: 1; +} +#tsd-search.has-focus .title { + z-index: 0; + opacity: 0; +} +#tsd-search.has-focus .results { + visibility: visible; +} +#tsd-search.loading .results li.state.loading { + display: block; +} +#tsd-search.failure .results li.state.failure { + display: block; +} + +.tsd-signature { + margin: 0 0 1rem 0; + padding: 1rem 0.5rem; + border: 1px solid var(--color-accent); + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + font-size: 14px; + overflow-x: auto; +} + +.tsd-signature-symbol { + color: var(--color-text-aside); + font-weight: normal; +} + +.tsd-signature-type { + font-style: italic; + font-weight: normal; +} + +.tsd-signatures { + padding: 0; + margin: 0 0 1em 0; + list-style-type: none; +} +.tsd-signatures .tsd-signature { + margin: 0; + border-color: var(--color-accent); + border-width: 1px 0; + transition: background-color 0.1s; +} +.tsd-description .tsd-signatures .tsd-signature { + border-width: 1px; +} + +ul.tsd-parameter-list, +ul.tsd-type-parameter-list { + list-style: square; + margin: 0; + padding-left: 20px; +} +ul.tsd-parameter-list > li.tsd-parameter-signature, +ul.tsd-type-parameter-list > li.tsd-parameter-signature { + list-style: none; + margin-left: -20px; +} +ul.tsd-parameter-list h5, +ul.tsd-type-parameter-list h5 { + font-size: 16px; + margin: 1em 0 0.5em 0; +} +.tsd-sources { + margin-top: 1rem; + font-size: 0.875em; +} +.tsd-sources a { + color: var(--color-text-aside); + text-decoration: underline; +} +.tsd-sources ul { + list-style: none; + padding: 0; +} + +.tsd-page-toolbar { + position: fixed; + z-index: 1; + top: 0; + left: 0; + width: 100%; + color: var(--color-text); + background: var(--color-background-secondary); + border-bottom: 1px var(--color-accent) solid; + transition: transform 0.3s ease-in-out; +} +.tsd-page-toolbar a { + color: var(--color-text); + text-decoration: none; +} +.tsd-page-toolbar a.title { + font-weight: bold; +} +.tsd-page-toolbar a.title:hover { + text-decoration: underline; +} +.tsd-page-toolbar .tsd-toolbar-contents { + display: flex; + justify-content: space-between; + height: 2.5rem; + margin: 0 auto; +} +.tsd-page-toolbar .table-cell { + position: relative; + white-space: nowrap; + line-height: 40px; +} +.tsd-page-toolbar .table-cell:first-child { + width: 100%; +} + +.tsd-page-toolbar--hide { + transform: translateY(-100%); +} + +.tsd-widget { + display: inline-block; + overflow: hidden; + opacity: 0.8; + height: 40px; + transition: opacity 0.1s, background-color 0.2s; + vertical-align: bottom; + cursor: pointer; +} +.tsd-widget:hover { + opacity: 0.9; +} +.tsd-widget.active { + opacity: 1; + background-color: var(--color-accent); +} +.tsd-widget.no-caption { + width: 40px; +} +.tsd-widget.no-caption:before { + margin: 0; +} + +.tsd-widget.options, +.tsd-widget.menu { + display: none; +} +@media (max-width: 1024px) { + .tsd-widget.options, + .tsd-widget.menu { + display: inline-block; + } +} +input[type="checkbox"] + .tsd-widget:before { + background-position: -120px 0; +} +input[type="checkbox"]:checked + .tsd-widget:before { + background-position: -160px 0; +} + +img { + max-width: 100%; +} + +.tsd-anchor-icon { + display: inline-flex; + align-items: center; + margin-left: 0.5rem; + vertical-align: middle; + color: var(--color-text); +} + +.tsd-anchor-icon svg { + width: 1em; + height: 1em; + visibility: hidden; +} + +.tsd-anchor-link:hover > .tsd-anchor-icon svg { + visibility: visible; +} + +.deprecated { + text-decoration: line-through; +} + +* { + scrollbar-width: thin; + scrollbar-color: var(--color-accent) var(--color-icon-background); +} + +*::-webkit-scrollbar { + width: 0.75rem; +} + +*::-webkit-scrollbar-track { + background: var(--color-icon-background); +} + +*::-webkit-scrollbar-thumb { + background-color: var(--color-accent); + border-radius: 999rem; + border: 0.25rem solid var(--color-icon-background); +} diff --git a/docs/content-security-policy/assets/widgets.png b/docs/content-security-policy/assets/widgets.png new file mode 100644 index 0000000000000000000000000000000000000000..c7380532ac1b45400620011c37c4dcb7aec27a4c GIT binary patch literal 480 zcmeAS@N?(olHy`uVBq!ia0y~yU~~YoH8@y+q^jrZML>b&o-U3d6^w6h1+IPUz|;DW zIZ;96kdsD>Qv^q=09&hp0GpEni<1IR%gvP3v%OR9*{MuRTKWHZyIbuBt)Ci`cU_&% z1T+i^Y)o{%281-<3TpPAUTzw5v;RY=>1rvxmPl96#kYc9hX!6V^nB|ad#(S+)}?8C zr_H+lT3B#So$T=?$(w3-{rbQ4R<@nsf$}$hwSO)A$8&`(j+wQf=Jwhb0`CvhR5DCf z^OgI)KQemrUFPH+UynC$Y~QHG%DbTVh-Skz{enNU)cV_hPu~{TD7TPZl>0&K>iuE| z7AYn$7)Jrb9GE&SfQW4q&G*@N|4cHI`VakFa5-C!ov&XD)J(qp$rJJ*9e z-sHv}#g*T7Cv048d1v~BEAzM5FztAse#q78WWC^BUCzQ U&wLp6h6BX&boFyt=akR{0G%$)mH+?% literal 0 HcmV?d00001 diff --git a/docs/content-security-policy/assets/widgets@2x.png b/docs/content-security-policy/assets/widgets@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..4bbbd57272f3b28f47527d4951ad10f950b8ad43 GIT binary patch literal 855 zcmeAS@N?(olHy`uVBq!ia0y~yU}^xe12~w0Jcmn z@(X6T|9^jgLcx21{)7exgY)a>N6m2F0<`Rqr;B4q1>>88jUdw-7W`c)zLE*mq8W2H z-<&Jl_Hco5BuC5n@AbF5GD82~-e8-v=#zCyUX0F-o}8pPfAv`!GN$ff+TL<~@kgt} z62eO?_|&+>xBmM$@p|z`tIKEdpPf8%qI>4r7@jn<=eta*{3~?g(zz{Ke9zc-G^gr? z-7foa?LcS!hmbwzru}ICvbWLlW8;+l-}!^=c32!^nV`+`C*;0-*Y%l94pC;Cb3GXz zzSf%a!{gVr{Y_lVuUj+a)*Ca+!-Hu%xmP&&X-2CuANY8^i{D7Kg6qzP zXz_ps9+lN8ESH{K4`yu&b~I>N9xGlE&;2u*b?+Go!AhN?m-bxlLvtC#MzDF2kFzfHJ1W7ybqdefSqVhbOykd*Yi%EDuhs z4wF{ft^bv2+DDnKb8gj1FuvcV`M}luS>lO<^)8x>y1#R;a=-ZKwWTQQb)ioBbi;zh zD!f5V)8581to1LL7c9!l^PSC$NBPYif!_vAZhmL4)v4U)4UsrLYiH_9rmQDd?)(e5 z^pcH>qvBg*i0dus2r*mp4;zKvu=P#s-ti;2obl`NjjwoYd>e(oo#j_uyRb<7Pv^If zzZ|mGHmV)8^tbO%^>eqMw(@7(&3g{jEp-Najo7V75xI_ZHK*FA`elF{r5}E*d7+j_R literal 0 HcmV?d00001 diff --git a/docs/content-security-policy/functions/cspDirectives.html b/docs/content-security-policy/functions/cspDirectives.html new file mode 100644 index 00000000..9a75eddd --- /dev/null +++ b/docs/content-security-policy/functions/cspDirectives.html @@ -0,0 +1,59 @@ +cspDirectives | @jackdbd/content-security-policy
+
+ +
+
+
+
+ +

Function cspDirectives

+
+
    + +
  • +
    +

    Parameters

    +
    +

    Returns Promise<string[]>

+
+
+

Generated using TypeDoc

+
\ No newline at end of file diff --git a/docs/content-security-policy/functions/cspHeader.html b/docs/content-security-policy/functions/cspHeader.html new file mode 100644 index 00000000..6220def2 --- /dev/null +++ b/docs/content-security-policy/functions/cspHeader.html @@ -0,0 +1,59 @@ +cspHeader | @jackdbd/content-security-policy
+
+ +
+
+
+ +
+
    + +
  • +
    +

    Parameters

    +
    +

    Returns Promise<string>

+
+
+

Generated using TypeDoc

+
\ No newline at end of file diff --git a/docs/content-security-policy/functions/cspJSON.html b/docs/content-security-policy/functions/cspJSON.html new file mode 100644 index 00000000..d2a98974 --- /dev/null +++ b/docs/content-security-policy/functions/cspJSON.html @@ -0,0 +1,59 @@ +cspJSON | @jackdbd/content-security-policy
+
+ +
+
+
+ +
+
    + +
  • +
    +

    Parameters

    +
    +

    Returns Promise<{}>

+
+
+

Generated using TypeDoc

+
\ No newline at end of file diff --git a/docs/content-security-policy/index.html b/docs/content-security-policy/index.html new file mode 100644 index 00000000..83a0500a --- /dev/null +++ b/docs/content-security-policy/index.html @@ -0,0 +1,74 @@ +@jackdbd/content-security-policy
+
+ +
+
+
+
+

@jackdbd/content-security-policy

+
+ +

@jackdbd/content-security-policy

+
+

npm version +Snyk Vulnerabilities for npm package

+

Description...

+ + +
Table of Contents + + + +
+ + + +

Installation

+
+
npm install @jackdbd/content-security-policy
+
+ + +

API

+
+

API docs generated with TypeDoc

+
+
+
+

Generated using TypeDoc

+
\ No newline at end of file diff --git a/docs/content-security-policy/interfaces/Config.html b/docs/content-security-policy/interfaces/Config.html new file mode 100644 index 00000000..51bedd63 --- /dev/null +++ b/docs/content-security-policy/interfaces/Config.html @@ -0,0 +1,72 @@ +Config | @jackdbd/content-security-policy
+
+ +
+
+
+ +
+

Hierarchy

+
    +
  • Config
+
+
+
+ +
+
+

Properties

+
+
+

Properties

+
+ +
directives: Directives
+
+ +
patterns: string[]
+
+
+

Generated using TypeDoc

+
\ No newline at end of file diff --git a/docs/content-security-policy/interfaces/Directives.html b/docs/content-security-policy/interfaces/Directives.html new file mode 100644 index 00000000..2a82991e --- /dev/null +++ b/docs/content-security-policy/interfaces/Directives.html @@ -0,0 +1,56 @@ +Directives | @jackdbd/content-security-policy
+
+ +
+
+
+
+ +

Interface Directives

+
+

Hierarchy

+
    +
  • Directives
+
+

Indexable

+
[k: string]: string[]
+
+
+

Generated using TypeDoc

+
\ No newline at end of file diff --git a/docs/content-security-policy/modules.html b/docs/content-security-policy/modules.html new file mode 100644 index 00000000..99b31900 --- /dev/null +++ b/docs/content-security-policy/modules.html @@ -0,0 +1,66 @@ +@jackdbd/content-security-policy
+
+ +
+
+
+
+

@jackdbd/content-security-policy

+
+

Entry point for the documentation of content-security-policy.

+
+
+
+

Index

+
+

Interfaces

+
+
+

Variables

+
+
+

Functions

+
+
+
+

Generated using TypeDoc

+
\ No newline at end of file diff --git a/docs/content-security-policy/variables/recommended_policy.html b/docs/content-security-policy/variables/recommended_policy.html new file mode 100644 index 00000000..68b8a266 --- /dev/null +++ b/docs/content-security-policy/variables/recommended_policy.html @@ -0,0 +1,94 @@ +recommended_policy | @jackdbd/content-security-policy
+
+ +
+
+
+
+ +

Variable recommended_policyConst

+
recommended_policy: { base-uri: string[]; connect-src: string[]; default-src: string[]; font-src: string[]; form-action: string[]; frame-ancestors: string[]; img-src: string[]; manifest-src: string[]; object-src: string[]; prefetch-src: string[]; script-src: string[]; style-src: string[]; upgrade-insecure-requests: boolean } = ...
+

Recommended policy for most sites.

+

Differences with the standard policy are the following ones:

+ +
+
+

Type declaration

+
    +
  • +
    base-uri: string[]
  • +
  • +
    connect-src: string[]
  • +
  • +
    default-src: string[]
  • +
  • +
    font-src: string[]
  • +
  • +
    form-action: string[]
  • +
  • +
    frame-ancestors: string[]
  • +
  • +
    img-src: string[]
  • +
  • +
    manifest-src: string[]
  • +
  • +
    object-src: string[]
  • +
  • +
    prefetch-src: string[]
  • +
  • +
    script-src: string[]
  • +
  • +
    style-src: string[]
  • +
  • +
    upgrade-insecure-requests: boolean
+
+
+

Generated using TypeDoc

+
\ No newline at end of file diff --git a/docs/content-security-policy/variables/starter_policy.html b/docs/content-security-policy/variables/starter_policy.html new file mode 100644 index 00000000..6ff23928 --- /dev/null +++ b/docs/content-security-policy/variables/starter_policy.html @@ -0,0 +1,70 @@ +starter_policy | @jackdbd/content-security-policy
+
+ +
+
+
+
+ +

Variable starter_policyConst

+
starter_policy: { base-uri: string[]; connect-src: string[]; default-src: string[]; form-action: string[]; img-src: string[]; script-src: string[]; style-src: string[] } = ...
+

This is the starter policy described here: +https://content-security-policy.com/

+
+
+

Type declaration

+
    +
  • +
    base-uri: string[]
  • +
  • +
    connect-src: string[]
  • +
  • +
    default-src: string[]
  • +
  • +
    form-action: string[]
  • +
  • +
    img-src: string[]
  • +
  • +
    script-src: string[]
  • +
  • +
    style-src: string[]
+
+
+

Generated using TypeDoc

+
\ No newline at end of file diff --git a/package-lock.json b/package-lock.json index e3315d36..801cb468 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2250,6 +2250,10 @@ "resolved": "packages/cloud-tasks-utils", "link": true }, + "node_modules/@jackdbd/content-security-policy": { + "resolved": "packages/content-security-policy", + "link": true + }, "node_modules/@jackdbd/fattureincloud-client": { "resolved": "packages/fattureincloud-client", "link": true @@ -10319,6 +10323,11 @@ "node": ">=8" } }, + "node_modules/himalaya": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/himalaya/-/himalaya-1.1.0.tgz", + "integrity": "sha512-LLase1dHCRMel68/HZTFft0N0wti0epHr3nNY7ynpLbyZpmrKMQ8YIpiOV77TM97cNpC8Wb2n6f66IRggwdWPw==" + }, "node_modules/hook-std": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hook-std/-/hook-std-2.0.0.tgz", @@ -22991,9 +23000,34 @@ "@google-cloud/tasks": ">= 3.0.0" } }, + "packages/content-security-policy": { + "version": "0.0.0", + "license": "MIT", + "dependencies": { + "debug": "^4.3.4", + "himalaya": "^1.1.0", + "joi": "^17.6.1" + }, + "devDependencies": {}, + "engines": { + "node": ">=14.19.3" + } + }, + "packages/content-security-policy/node_modules/joi": { + "version": "17.6.1", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.6.1.tgz", + "integrity": "sha512-Hl7/iBklIX345OCM1TiFSCZRVaAOLDGlWCp0Df2vWYgBgjkezaR7Kvm3joBciBHQjZj5sxXs859r6eqsRSlG8w==", + "dependencies": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.3", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, "packages/fattureincloud-client": { "name": "@jackdbd/fattureincloud-client", - "version": "1.0.3", + "version": "1.1.0", "license": "MIT", "dependencies": { "bottleneck": "^2.19.5", @@ -23007,10 +23041,10 @@ }, "packages/firestore-utils": { "name": "@jackdbd/firestore-utils", - "version": "1.4.1-canary.1", + "version": "1.5.0", "license": "MIT", "dependencies": { - "@jackdbd/utils": "1.4.0-canary.1", + "@jackdbd/utils": "1.4.0", "debug": "^4.3.4" }, "devDependencies": { @@ -23037,105 +23071,6 @@ "node": ">=16.0.0" } }, - "packages/keap-client/node_modules/@jackdbd/utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@jackdbd/utils/-/utils-1.3.0.tgz", - "integrity": "sha512-r1In2Ww/x9H9OMCQxytVhS9euIjdwRLGozIZzgoPA6ooQs3KDZFc/Yxiod14vzP/cWs37XpIFEGhPfm6Q3aDSg==", - "dependencies": { - "wait-port": "^0.2.9" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "debug": ">=4.0.0" - } - }, - "packages/keap-client/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "packages/keap-client/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "packages/keap-client/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "packages/keap-client/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "packages/keap-client/node_modules/commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" - }, - "packages/keap-client/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "engines": { - "node": ">=0.8.0" - } - }, - "packages/keap-client/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "engines": { - "node": ">=4" - } - }, - "packages/keap-client/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "packages/keap-client/node_modules/wait-port": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/wait-port/-/wait-port-0.2.14.tgz", - "integrity": "sha512-kIzjWcr6ykl7WFbZd0TMae8xovwqcqbx6FM9l+7agOgUByhzdjfzZBPK2CPufldTOMxbUivss//Sh9MFawmPRQ==", - "dependencies": { - "chalk": "^2.4.2", - "commander": "^3.0.2", - "debug": "^4.1.1" - }, - "bin": { - "wait-port": "bin/wait-port.js" - }, - "engines": { - "node": ">=8" - } - }, "packages/notifications": { "name": "@jackdbd/notifications", "version": "1.0.3", @@ -23655,74 +23590,10 @@ "node": ">=16.0.0" } }, - "packages/telegram-bot/node_modules/@jackdbd/utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@jackdbd/utils/-/utils-1.3.0.tgz", - "integrity": "sha512-r1In2Ww/x9H9OMCQxytVhS9euIjdwRLGozIZzgoPA6ooQs3KDZFc/Yxiod14vzP/cWs37XpIFEGhPfm6Q3aDSg==", - "dependencies": { - "wait-port": "^0.2.9" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "debug": ">=4.0.0" - } - }, - "packages/telegram-bot/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "packages/telegram-bot/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "packages/telegram-bot/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "packages/telegram-bot/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "packages/telegram-bot/node_modules/commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" - }, "packages/telegram-bot/node_modules/emoji-regex": { "version": "8.0.0", "license": "MIT" }, - "packages/telegram-bot/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "engines": { - "node": ">=0.8.0" - } - }, "packages/telegram-bot/node_modules/google-gax": { "version": "2.30.5", "license": "Apache-2.0", @@ -23748,14 +23619,6 @@ "node": ">=10" } }, - "packages/telegram-bot/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "engines": { - "node": ">=4" - } - }, "packages/telegram-bot/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "license": "MIT", @@ -23807,33 +23670,6 @@ "node": ">=8" } }, - "packages/telegram-bot/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "packages/telegram-bot/node_modules/wait-port": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/wait-port/-/wait-port-0.2.14.tgz", - "integrity": "sha512-kIzjWcr6ykl7WFbZd0TMae8xovwqcqbx6FM9l+7agOgUByhzdjfzZBPK2CPufldTOMxbUivss//Sh9MFawmPRQ==", - "dependencies": { - "chalk": "^2.4.2", - "commander": "^3.0.2", - "debug": "^4.1.1" - }, - "bin": { - "wait-port": "bin/wait-port.js" - }, - "engines": { - "node": ">=8" - } - }, "packages/telegram-bot/node_modules/yargs": { "version": "16.2.0", "license": "MIT", @@ -23852,7 +23688,7 @@ }, "packages/telegram-text-messages": { "name": "@jackdbd/telegram-text-messages", - "version": "1.2.0-canary.1", + "version": "1.2.0", "license": "MIT", "devDependencies": {}, "engines": { @@ -23861,7 +23697,7 @@ }, "packages/utils": { "name": "@jackdbd/utils", - "version": "1.4.0-canary.1", + "version": "1.4.0", "license": "MIT", "dependencies": { "wait-port": "^0.2.9" @@ -24155,20 +23991,6 @@ "node": ">=16.0.0" } }, - "packages/wasm-news/node_modules/@jackdbd/utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@jackdbd/utils/-/utils-1.3.0.tgz", - "integrity": "sha512-r1In2Ww/x9H9OMCQxytVhS9euIjdwRLGozIZzgoPA6ooQs3KDZFc/Yxiod14vzP/cWs37XpIFEGhPfm6Q3aDSg==", - "dependencies": { - "wait-port": "^0.2.9" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "debug": ">=4.0.0" - } - }, "packages/wasm-news/node_modules/@octokit/auth-token": { "version": "2.5.0", "license": "MIT", @@ -24270,17 +24092,6 @@ "@octokit/openapi-types": "^12.11.0" } }, - "packages/wasm-news/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, "packages/wasm-news/node_modules/axios": { "version": "0.21.4", "license": "MIT", @@ -24288,49 +24099,10 @@ "follow-redirects": "^1.14.0" } }, - "packages/wasm-news/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "packages/wasm-news/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "packages/wasm-news/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "packages/wasm-news/node_modules/commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" - }, "packages/wasm-news/node_modules/emoji-regex": { "version": "8.0.0", "license": "MIT" }, - "packages/wasm-news/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "engines": { - "node": ">=0.8.0" - } - }, "packages/wasm-news/node_modules/google-auth-library": { "version": "6.1.6", "license": "Apache-2.0", @@ -24404,14 +24176,6 @@ "node": ">=0.8.0" } }, - "packages/wasm-news/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "engines": { - "node": ">=4" - } - }, "packages/wasm-news/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "license": "MIT", @@ -24463,38 +24227,11 @@ "node": ">=8" } }, - "packages/wasm-news/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "packages/wasm-news/node_modules/twitter-api-v2": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/twitter-api-v2/-/twitter-api-v2-1.12.0.tgz", "integrity": "sha512-8Fv+sUYY0P1gloiBSgG1w/NSuGUIP32lDKMPVzIMX3jd4zDhiJFtCft41fKs+JqcD8m7s+4vkMO/XwyY2+NULQ==" }, - "packages/wasm-news/node_modules/wait-port": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/wait-port/-/wait-port-0.2.14.tgz", - "integrity": "sha512-kIzjWcr6ykl7WFbZd0TMae8xovwqcqbx6FM9l+7agOgUByhzdjfzZBPK2CPufldTOMxbUivss//Sh9MFawmPRQ==", - "dependencies": { - "chalk": "^2.4.2", - "commander": "^3.0.2", - "debug": "^4.1.1" - }, - "bin": { - "wait-port": "bin/wait-port.js" - }, - "engines": { - "node": ">=8" - } - }, "packages/wasm-news/node_modules/yargs": { "version": "16.2.0", "license": "MIT", @@ -24749,31 +24486,6 @@ "node": ">=16.0.0" } }, - "packages/webhooks/node_modules/@jackdbd/utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@jackdbd/utils/-/utils-1.3.0.tgz", - "integrity": "sha512-r1In2Ww/x9H9OMCQxytVhS9euIjdwRLGozIZzgoPA6ooQs3KDZFc/Yxiod14vzP/cWs37XpIFEGhPfm6Q3aDSg==", - "dependencies": { - "wait-port": "^0.2.9" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "debug": ">=4.0.0" - } - }, - "packages/webhooks/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, "packages/webhooks/node_modules/axios": { "version": "0.21.4", "license": "MIT", @@ -24781,49 +24493,10 @@ "follow-redirects": "^1.14.0" } }, - "packages/webhooks/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "packages/webhooks/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "packages/webhooks/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "packages/webhooks/node_modules/commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" - }, "packages/webhooks/node_modules/emoji-regex": { "version": "8.0.0", "license": "MIT" }, - "packages/webhooks/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "engines": { - "node": ">=0.8.0" - } - }, "packages/webhooks/node_modules/google-auth-library": { "version": "6.1.6", "license": "Apache-2.0", @@ -24897,14 +24570,6 @@ "node": ">=0.8.0" } }, - "packages/webhooks/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "engines": { - "node": ">=4" - } - }, "packages/webhooks/node_modules/ipaddr.js": { "version": "2.0.1", "license": "MIT", @@ -24963,33 +24628,6 @@ "node": ">=8" } }, - "packages/webhooks/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "packages/webhooks/node_modules/wait-port": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/wait-port/-/wait-port-0.2.14.tgz", - "integrity": "sha512-kIzjWcr6ykl7WFbZd0TMae8xovwqcqbx6FM9l+7agOgUByhzdjfzZBPK2CPufldTOMxbUivss//Sh9MFawmPRQ==", - "dependencies": { - "chalk": "^2.4.2", - "commander": "^3.0.2", - "debug": "^4.1.1" - }, - "bin": { - "wait-port": "bin/wait-port.js" - }, - "engines": { - "node": ">=8" - } - }, "packages/webhooks/node_modules/yargs": { "version": "16.2.0", "license": "MIT", @@ -26744,6 +26382,28 @@ "version": "file:packages/cloud-tasks-utils", "requires": {} }, + "@jackdbd/content-security-policy": { + "version": "file:packages/content-security-policy", + "requires": { + "debug": "^4.3.4", + "himalaya": "^1.1.0", + "joi": "^17.6.1" + }, + "dependencies": { + "joi": { + "version": "17.6.1", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.6.1.tgz", + "integrity": "sha512-Hl7/iBklIX345OCM1TiFSCZRVaAOLDGlWCp0Df2vWYgBgjkezaR7Kvm3joBciBHQjZj5sxXs859r6eqsRSlG8w==", + "requires": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.3", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + } + } + }, "@jackdbd/fattureincloud-client": { "version": "file:packages/fattureincloud-client", "requires": { @@ -26756,7 +26416,7 @@ "version": "file:packages/firestore-utils", "requires": { "@google-cloud/firestore": "^6.0.0", - "@jackdbd/utils": "1.4.0-canary.1", + "@jackdbd/utils": "1.4.0", "debug": "^4.3.4" } }, @@ -26808,80 +26468,6 @@ "@jackdbd/utils": ">=1.3.0", "debug": ">=4.0.0", "phin": "^3.6.1" - }, - "dependencies": { - "@jackdbd/utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@jackdbd/utils/-/utils-1.3.0.tgz", - "integrity": "sha512-r1In2Ww/x9H9OMCQxytVhS9euIjdwRLGozIZzgoPA6ooQs3KDZFc/Yxiod14vzP/cWs37XpIFEGhPfm6Q3aDSg==", - "requires": { - "wait-port": "^0.2.9" - } - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - }, - "wait-port": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/wait-port/-/wait-port-0.2.14.tgz", - "integrity": "sha512-kIzjWcr6ykl7WFbZd0TMae8xovwqcqbx6FM9l+7agOgUByhzdjfzZBPK2CPufldTOMxbUivss//Sh9MFawmPRQ==", - "requires": { - "chalk": "^2.4.2", - "commander": "^3.0.2", - "debug": "^4.1.1" - } - } } }, "@jackdbd/notifications": { @@ -27228,58 +26814,9 @@ "resolved": "https://registry.npmjs.org/@jackdbd/telegram-text-messages/-/telegram-text-messages-1.1.0.tgz", "integrity": "sha512-3a1Z0Xvyu6lsFmcqahVjmw3yFRZwvPBlUETsZyrcSZjnPVd0bc0zIDWv3aTmnbHbLPnpq5PD3LZSxR3I6JRWhA==" }, - "@jackdbd/utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@jackdbd/utils/-/utils-1.3.0.tgz", - "integrity": "sha512-r1In2Ww/x9H9OMCQxytVhS9euIjdwRLGozIZzgoPA6ooQs3KDZFc/Yxiod14vzP/cWs37XpIFEGhPfm6Q3aDSg==", - "requires": { - "wait-port": "^0.2.9" - } - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" - }, "emoji-regex": { "version": "8.0.0" }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" - }, "google-gax": { "version": "2.30.5", "requires": { @@ -27298,11 +26835,6 @@ "retry-request": "^4.0.0" } }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" - }, "is-fullwidth-code-point": { "version": "3.0.0" }, @@ -27340,24 +26872,6 @@ "strip-ansi": "^6.0.1" } }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - }, - "wait-port": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/wait-port/-/wait-port-0.2.14.tgz", - "integrity": "sha512-kIzjWcr6ykl7WFbZd0TMae8xovwqcqbx6FM9l+7agOgUByhzdjfzZBPK2CPufldTOMxbUivss//Sh9MFawmPRQ==", - "requires": { - "chalk": "^2.4.2", - "commander": "^3.0.2", - "debug": "^4.1.1" - } - }, "yargs": { "version": "16.2.0", "requires": { @@ -27582,14 +27096,6 @@ "resolved": "https://registry.npmjs.org/@jackdbd/telegram-text-messages/-/telegram-text-messages-1.1.0.tgz", "integrity": "sha512-3a1Z0Xvyu6lsFmcqahVjmw3yFRZwvPBlUETsZyrcSZjnPVd0bc0zIDWv3aTmnbHbLPnpq5PD3LZSxR3I6JRWhA==" }, - "@jackdbd/utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@jackdbd/utils/-/utils-1.3.0.tgz", - "integrity": "sha512-r1In2Ww/x9H9OMCQxytVhS9euIjdwRLGozIZzgoPA6ooQs3KDZFc/Yxiod14vzP/cWs37XpIFEGhPfm6Q3aDSg==", - "requires": { - "wait-port": "^0.2.9" - } - }, "@octokit/auth-token": { "version": "2.5.0", "requires": { @@ -27674,56 +27180,15 @@ "@octokit/openapi-types": "^12.11.0" } }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, "axios": { "version": "0.21.4", "requires": { "follow-redirects": "^1.14.0" } }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" - }, "emoji-regex": { "version": "8.0.0" }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" - }, "google-auth-library": { "version": "6.1.6", "requires": { @@ -27780,11 +27245,6 @@ "lodash": "^4.17.21" } }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" - }, "is-fullwidth-code-point": { "version": "3.0.0" }, @@ -27822,29 +27282,11 @@ "strip-ansi": "^6.0.1" } }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - }, "twitter-api-v2": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/twitter-api-v2/-/twitter-api-v2-1.12.0.tgz", "integrity": "sha512-8Fv+sUYY0P1gloiBSgG1w/NSuGUIP32lDKMPVzIMX3jd4zDhiJFtCft41fKs+JqcD8m7s+4vkMO/XwyY2+NULQ==" }, - "wait-port": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/wait-port/-/wait-port-0.2.14.tgz", - "integrity": "sha512-kIzjWcr6ykl7WFbZd0TMae8xovwqcqbx6FM9l+7agOgUByhzdjfzZBPK2CPufldTOMxbUivss//Sh9MFawmPRQ==", - "requires": { - "chalk": "^2.4.2", - "commander": "^3.0.2", - "debug": "^4.1.1" - } - }, "yargs": { "version": "16.2.0", "requires": { @@ -28036,64 +27478,15 @@ "resolved": "https://registry.npmjs.org/@jackdbd/telegram-text-messages/-/telegram-text-messages-1.1.0.tgz", "integrity": "sha512-3a1Z0Xvyu6lsFmcqahVjmw3yFRZwvPBlUETsZyrcSZjnPVd0bc0zIDWv3aTmnbHbLPnpq5PD3LZSxR3I6JRWhA==" }, - "@jackdbd/utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@jackdbd/utils/-/utils-1.3.0.tgz", - "integrity": "sha512-r1In2Ww/x9H9OMCQxytVhS9euIjdwRLGozIZzgoPA6ooQs3KDZFc/Yxiod14vzP/cWs37XpIFEGhPfm6Q3aDSg==", - "requires": { - "wait-port": "^0.2.9" - } - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, "axios": { "version": "0.21.4", "requires": { "follow-redirects": "^1.14.0" } }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" - }, "emoji-regex": { "version": "8.0.0" }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" - }, "google-auth-library": { "version": "6.1.6", "requires": { @@ -28150,11 +27543,6 @@ "lodash": "^4.17.21" } }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" - }, "ipaddr.js": { "version": "2.0.1" }, @@ -28195,24 +27583,6 @@ "strip-ansi": "^6.0.1" } }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - }, - "wait-port": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/wait-port/-/wait-port-0.2.14.tgz", - "integrity": "sha512-kIzjWcr6ykl7WFbZd0TMae8xovwqcqbx6FM9l+7agOgUByhzdjfzZBPK2CPufldTOMxbUivss//Sh9MFawmPRQ==", - "requires": { - "chalk": "^2.4.2", - "commander": "^3.0.2", - "debug": "^4.1.1" - } - }, "yargs": { "version": "16.2.0", "requires": { @@ -34278,6 +33648,11 @@ "integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==", "dev": true }, + "himalaya": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/himalaya/-/himalaya-1.1.0.tgz", + "integrity": "sha512-LLase1dHCRMel68/HZTFft0N0wti0epHr3nNY7ynpLbyZpmrKMQ8YIpiOV77TM97cNpC8Wb2n6f66IRggwdWPw==" + }, "hook-std": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hook-std/-/hook-std-2.0.0.tgz", diff --git a/packages/content-security-policy/.ae/content-security-policy.api.md b/packages/content-security-policy/.ae/content-security-policy.api.md new file mode 100644 index 00000000..7f72bb72 --- /dev/null +++ b/packages/content-security-policy/.ae/content-security-policy.api.md @@ -0,0 +1,62 @@ +## API Report File for "@jackdbd/content-security-policy" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +// @public (undocumented) +export interface Config { + // (undocumented) + directives: Directives; + // (undocumented) + patterns: string[]; +} + +// @public (undocumented) +export const cspDirectives: ({ directives, patterns }: Config) => Promise; + +// @public (undocumented) +export const cspHeader: ({ directives, patterns }: Config) => Promise; + +// @public (undocumented) +export const cspJSON: ({ directives, patterns }: Config) => Promise<{}>; + +// @public (undocumented) +export interface Directives { + // (undocumented) + [k: string]: string[]; +} + +// Warning: (ae-missing-release-tag) "recommended_policy" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export const recommended_policy: { + 'font-src': string[]; + 'frame-ancestors': string[]; + 'manifest-src': string[]; + 'object-src': string[]; + 'prefetch-src': string[]; + 'upgrade-insecure-requests': boolean; + 'base-uri': string[]; + 'connect-src': string[]; + 'default-src': string[]; + 'form-action': string[]; + 'img-src': string[]; + 'script-src': string[]; + 'style-src': string[]; +}; + +// Warning: (ae-missing-release-tag) "starter_policy" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export const starter_policy: { + 'base-uri': string[]; + 'connect-src': string[]; + 'default-src': string[]; + 'form-action': string[]; + 'img-src': string[]; + 'script-src': string[]; + 'style-src': string[]; +}; + +``` diff --git a/packages/content-security-policy/LICENSE b/packages/content-security-policy/LICENSE new file mode 100644 index 00000000..8eb086ee --- /dev/null +++ b/packages/content-security-policy/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Giacomo Debidda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/content-security-policy/README.md b/packages/content-security-policy/README.md new file mode 100644 index 00000000..0548ab34 --- /dev/null +++ b/packages/content-security-policy/README.md @@ -0,0 +1,26 @@ +# @jackdbd/content-security-policy + +[![npm version](https://badge.fury.io/js/@jackdbd%2Fcontent-security-policy.svg)](https://badge.fury.io/js/@jackdbd%2Fcontent-security-policy) +![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/@jackdbd%2Fcontent-security-policy) + +Description... + + + +
Table of Contents + +- [Installation](#installation) +- [API](#api) + + +
+ +## Installation + +```sh +npm install @jackdbd/content-security-policy +``` + +## API + +[API docs generated with TypeDoc](https://jackdbd.github.io/calderone/content-security-policy/) diff --git a/packages/content-security-policy/__tests__/constants.mjs b/packages/content-security-policy/__tests__/constants.mjs new file mode 100644 index 00000000..82e9d796 --- /dev/null +++ b/packages/content-security-policy/__tests__/constants.mjs @@ -0,0 +1,40 @@ +export const PATTERNS = ['../../assets/html-pages/**/*.html'] + +export const DIRECTIVES = { + 'base-uri': ['self'], + + 'connect-src': [ + 'self', + 'cloudflareinsights.com', + 'plausible.io', + 'res.cloudinary.com' + ], + + 'default-src': ['none'], + + 'font-src': ['self'], + + 'frame-src': [ + 'https://www.youtube.com/embed/', + 'https://www.youtube-nocookie.com/', + 'https://player.vimeo.com/video/' + ], + + 'img-src': [ + 'self', + 'github.com', + 'raw.githubusercontent.com', + 'res.cloudinary.com' + ], + + 'script-src-elem': [ + 'self', + 'https://plausible.io/js/plausible.js', + 'https://static.cloudflareinsights.com/beacon.min.js', + 'https://unpkg.com/htm/preact/standalone.module.js' + ], + + 'style-src-elem': ['self', 'sha256'], + + 'worker-src': ['self'] +} diff --git a/packages/content-security-policy/__tests__/csp-directives.test.mjs b/packages/content-security-policy/__tests__/csp-directives.test.mjs new file mode 100644 index 00000000..637a3d7a --- /dev/null +++ b/packages/content-security-policy/__tests__/csp-directives.test.mjs @@ -0,0 +1,39 @@ +import { cspDirectives, cspHeader, cspJSON } from '../lib/csp-directives.js' +import { DIRECTIVES, PATTERNS } from './constants.mjs' +import { isObject, isString } from '../lib/utils.js' + +describe('cspDirectives', () => { + it('is an array', async () => { + const arr = await cspDirectives({ + directives: DIRECTIVES, + patterns: PATTERNS + }) + + expect(arr).toBeDefined() + expect(arr.length).toBe(Object.keys(DIRECTIVES).length) + }) +}) + +describe('cspHeader', () => { + it('is a string', async () => { + const header = await cspHeader({ + directives: DIRECTIVES, + patterns: PATTERNS + }) + + expect(header).toBeDefined() + expect(isString(header)).toBeTruthy() + }) +}) + +describe('cspJSON', () => { + it('is a JS object', async () => { + const json = await cspJSON({ + directives: DIRECTIVES, + patterns: PATTERNS + }) + + expect(json).toBeDefined() + expect(isObject(json)).toBeTruthy() + }) +}) diff --git a/packages/content-security-policy/__tests__/errors.test.mjs b/packages/content-security-policy/__tests__/errors.test.mjs new file mode 100644 index 00000000..48de67b3 --- /dev/null +++ b/packages/content-security-policy/__tests__/errors.test.mjs @@ -0,0 +1,55 @@ +import Joi from 'joi' +import { validationErrorOrWarnings } from '../lib/errors.js' + +describe('validationErrorOrWarnings', () => { + it('is defined when the configuration is invalid', () => { + const message = 'this is a validation error' + const details = [{ path: [] }] + const original = {} + const error = new Joi.ValidationError(message, details, original) + + const result = validationErrorOrWarnings({ + error, + allowDeprecatedDirectives: false + }) + + expect(result.error).toBeDefined() + expect(result.error.message).toContain('invalid configuration') + }) + + it('is an error when the configuration is valid but it is used a deprecated CSP directive and allowDeprecatedDirectives is false', () => { + const deprecated_directive = 'block-all-mixed-content' + const message = 'this is a validation error' + const details = [{ path: ['foo', deprecated_directive] }] + const original = {} + + const { error, warnings } = validationErrorOrWarnings({ + error: new Joi.ValidationError(message, details, original), + allowDeprecatedDirectives: false + }) + + expect(error).toBeDefined() + expect(error.message).toContain('invalid configuration') + expect(error.message).toContain('deprecated directive') + expect(error.message).toContain(deprecated_directive) + expect(warnings.length).toBe(0) + }) + + it('is a warning when the configuration is valid but it is used a deprecated CSP directive and allowDeprecatedDirectives is true', () => { + const deprecated_directive = 'block-all-mixed-content' + const message = 'this is a validation error' + const details = [{ path: ['foo', deprecated_directive] }] + const original = {} + + const { error, warnings } = validationErrorOrWarnings({ + error: new Joi.ValidationError(message, details, original), + allowDeprecatedDirectives: true + }) + + expect(error).not.toBeDefined() + expect(warnings.length).toBe(1) + const warning = warnings[0] + expect(warning).toContain('deprecated') + expect(warning).toContain(deprecated_directive) + }) +}) diff --git a/packages/content-security-policy/__tests__/hash.test.mjs b/packages/content-security-policy/__tests__/hash.test.mjs new file mode 100644 index 00000000..c519c72c --- /dev/null +++ b/packages/content-security-policy/__tests__/hash.test.mjs @@ -0,0 +1,39 @@ +import { hashesStyleSrcElem } from '../lib/hash.js' + +describe('hashesStyleSrcElem', () => { + it('produces the expected hashes', async () => { + const patterns = ['../../assets/html-pages/**/*.html'] + + const hashes_256 = await hashesStyleSrcElem({ + algorithm: 'sha256', + patterns + }) + + const hashes_384 = await hashesStyleSrcElem({ + algorithm: 'sha384', + patterns + }) + + const hashes_512 = await hashesStyleSrcElem({ + algorithm: 'sha512', + patterns + }) + + expect(hashes_256.length).toBe(1) + expect(hashes_384.length).toBe(1) + expect(hashes_512.length).toBe(1) + + hashes_256.forEach((hash_256, i) => { + const hash_384 = hashes_384[i] + const hash_512 = hashes_512[i] + + expect(hash_384).not.toBe(hash_256) + expect(hash_512).not.toBe(hash_256) + expect(hash_512).not.toBe(hash_384) + + expect(hash_256.length).toBe(51) + expect(hash_384.length).toBe(71) + expect(hash_512.length).toBe(95) + }) + }) +}) diff --git a/packages/content-security-policy/__tests__/html-parser.test.mjs b/packages/content-security-policy/__tests__/html-parser.test.mjs new file mode 100644 index 00000000..ad0ee026 --- /dev/null +++ b/packages/content-security-policy/__tests__/html-parser.test.mjs @@ -0,0 +1,42 @@ +import fs from 'node:fs' +import path from 'node:path' +import { scriptTagsContents, styleTagsContents } from '../lib/html-parser.js' + +const HTML_DIR = path.resolve('..', '..', 'assets', 'html-pages') +// const HTML_DIR = path.join('assets', 'html-pages') +const html_filepath = path.join(HTML_DIR, 'index.html') + +// the of this HTML page contains 2 \ No newline at end of file diff --git a/docs/content-security-policy/functions/cspHeader.html b/docs/content-security-policy/functions/cspHeader.html index 6220def2..e1144fa6 100644 --- a/docs/content-security-policy/functions/cspHeader.html +++ b/docs/content-security-policy/functions/cspHeader.html @@ -24,7 +24,7 @@

Parameters

__namedParameters: Config

Returns Promise<string>

+
  • Defined in csp-directives.ts:107
  • +
  • cspJSON
  • +
  • validationErrorOrWarnings
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/content-security-policy/functions/cspJSON.html b/docs/content-security-policy/functions/cspJSON.html index d2a98974..db90c4aa 100644 --- a/docs/content-security-policy/functions/cspJSON.html +++ b/docs/content-security-policy/functions/cspJSON.html @@ -24,7 +24,7 @@

    Parameters

    __namedParameters: Config

    Returns Promise<{}>

    +
  • Defined in csp-directives.ts:119
  • +
  • cspJSON
  • +
  • validationErrorOrWarnings
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/content-security-policy/functions/validationErrorOrWarnings.html b/docs/content-security-policy/functions/validationErrorOrWarnings.html new file mode 100644 index 00000000..66598671 --- /dev/null +++ b/docs/content-security-policy/functions/validationErrorOrWarnings.html @@ -0,0 +1,61 @@ +validationErrorOrWarnings | @jackdbd/content-security-policy
    +
    + +
    +
    +
    +
    + +

    Function validationErrorOrWarnings

    +
    +
    +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/content-security-policy/index.html b/docs/content-security-policy/index.html index 83a0500a..1f04683e 100644 --- a/docs/content-security-policy/index.html +++ b/docs/content-security-policy/index.html @@ -64,11 +64,13 @@

    Config
  • Directives
  • +
  • ValidationErrorOrWarningsConfig
  • recommended_policy
  • starter_policy
  • cspDirectives
  • cspHeader
  • -
  • cspJSON
  • +
  • cspJSON
  • +
  • validationErrorOrWarnings
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/content-security-policy/interfaces/Config.html b/docs/content-security-policy/interfaces/Config.html index 51bedd63..4d64a8d9 100644 --- a/docs/content-security-policy/interfaces/Config.html +++ b/docs/content-security-policy/interfaces/Config.html @@ -18,7 +18,7 @@

    Hierarchy

    • Config
    +
  • Defined in csp-directives.ts:16
  • @@ -35,12 +35,12 @@

    Properties

    directives: Directives
    +
  • Defined in csp-directives.ts:17
  • patterns: string[]
    +
  • Defined in csp-directives.ts:18
  • +
  • cspJSON
  • +
  • validationErrorOrWarnings
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/content-security-policy/interfaces/ValidationErrorOrWarningsConfig.html b/docs/content-security-policy/interfaces/ValidationErrorOrWarningsConfig.html new file mode 100644 index 00000000..d75343d8 --- /dev/null +++ b/docs/content-security-policy/interfaces/ValidationErrorOrWarningsConfig.html @@ -0,0 +1,72 @@ +ValidationErrorOrWarningsConfig | @jackdbd/content-security-policy
    +
    + +
    +
    +
    +
    + +

    Interface ValidationErrorOrWarningsConfig

    +
    +

    Hierarchy

    +
      +
    • ValidationErrorOrWarningsConfig
    +
    +
    +
    + +
    +
    +

    Properties

    +
    +
    +

    Properties

    +
    + +
    allowDeprecatedDirectives: boolean
    +
    + +
    error: any
    +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/content-security-policy/modules.html b/docs/content-security-policy/modules.html index 99b31900..3a093215 100644 --- a/docs/content-security-policy/modules.html +++ b/docs/content-security-policy/modules.html @@ -20,6 +20,7 @@

    Index

    Interfaces

    Variables

    @@ -31,6 +32,7 @@

    Functions

    +
  • cspJSON
  • +
  • validationErrorOrWarnings
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/content-security-policy/variables/recommended_policy.html b/docs/content-security-policy/variables/recommended_policy.html index 68b8a266..94666c09 100644 --- a/docs/content-security-policy/variables/recommended_policy.html +++ b/docs/content-security-policy/variables/recommended_policy.html @@ -59,7 +59,7 @@
    style-src:
    upgrade-insecure-requests: boolean
    +
  • Defined in policies.ts:30
  • +
  • cspJSON
  • +
  • validationErrorOrWarnings
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/content-security-policy/variables/starter_policy.html b/docs/content-security-policy/variables/starter_policy.html index 6ff23928..a1ccefda 100644 --- a/docs/content-security-policy/variables/starter_policy.html +++ b/docs/content-security-policy/variables/starter_policy.html @@ -35,7 +35,7 @@
    script-src:
    style-src: string[]
    +
  • Defined in policies.ts:5
  • +
  • cspJSON
  • +
  • validationErrorOrWarnings
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/packages/content-security-policy/.ae/content-security-policy.api.md b/packages/content-security-policy/.ae/content-security-policy.api.md index 7f72bb72..fe4064ea 100644 --- a/packages/content-security-policy/.ae/content-security-policy.api.md +++ b/packages/content-security-policy/.ae/content-security-policy.api.md @@ -59,4 +59,21 @@ export const starter_policy: { 'style-src': string[]; }; +// @public (undocumented) +export const validationErrorOrWarnings: ({ allowDeprecatedDirectives, error }: ValidationErrorOrWarningsConfig) => { + warnings: string[]; + error?: undefined; +} | { + error: Error; + warnings: string[]; +}; + +// @public (undocumented) +export interface ValidationErrorOrWarningsConfig { + // (undocumented) + allowDeprecatedDirectives: boolean; + // (undocumented) + error: any; +} + ``` diff --git a/packages/content-security-policy/api-docs/content-security-policy.md b/packages/content-security-policy/api-docs/content-security-policy.md index 0cd6631c..52b3528c 100644 --- a/packages/content-security-policy/api-docs/content-security-policy.md +++ b/packages/content-security-policy/api-docs/content-security-policy.md @@ -12,6 +12,7 @@ Entry point for the documentation of content-security-policy. | --- | --- | | [Config](./content-security-policy.config.md) | | | [Directives](./content-security-policy.directives.md) | | +| [ValidationErrorOrWarningsConfig](./content-security-policy.validationerrororwarningsconfig.md) | | ## Variables @@ -22,4 +23,5 @@ Entry point for the documentation of content-security-policy. | [cspJSON](./content-security-policy.cspjson.md) | | | [recommended\_policy](./content-security-policy.recommended_policy.md) |

    Recommended policy for most sites.

    Differences with the standard policy are the following ones: - font-src is set to 'self', to allow self-hosted fonts - frame-ancestors is set to 'none' - manifest-src is set to 'self', to allow a self-hosted web application manifest,so the website can be installed as Progressive Web App. Learn more: https://developer.mozilla.org/en-US/docs/Web/Manifest - object-src is set to 'none' as recommended here: https://csp.withgoogle.com/docs/strict-csp.html - prefetch-src is set to 'self, to allow prefetching content hosted on this origin - upgrade-insecure-requests is set to true, even if I am not sure it's really necessary, since it does NOT replace HSTS. Learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests

    | | [starter\_policy](./content-security-policy.starter_policy.md) | This is the starter policy described here: https://content-security-policy.com/ | +| [validationErrorOrWarnings](./content-security-policy.validationerrororwarnings.md) | | diff --git a/packages/content-security-policy/api-docs/content-security-policy.validationerrororwarnings.md b/packages/content-security-policy/api-docs/content-security-policy.validationerrororwarnings.md new file mode 100644 index 00000000..3d797a05 --- /dev/null +++ b/packages/content-security-policy/api-docs/content-security-policy.validationerrororwarnings.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [@jackdbd/content-security-policy](./content-security-policy.md) > [validationErrorOrWarnings](./content-security-policy.validationerrororwarnings.md) + +## validationErrorOrWarnings variable + + +Signature: + +```typescript +validationErrorOrWarnings: ({ allowDeprecatedDirectives, error }: Config) => { + warnings: string[]; + error?: undefined; +} | { + error: Error; + warnings: string[]; +} +``` diff --git a/packages/content-security-policy/api-docs/content-security-policy.validationerrororwarningsconfig.allowdeprecateddirectives.md b/packages/content-security-policy/api-docs/content-security-policy.validationerrororwarningsconfig.allowdeprecateddirectives.md new file mode 100644 index 00000000..71b977ab --- /dev/null +++ b/packages/content-security-policy/api-docs/content-security-policy.validationerrororwarningsconfig.allowdeprecateddirectives.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [@jackdbd/content-security-policy](./content-security-policy.md) > [ValidationErrorOrWarningsConfig](./content-security-policy.validationerrororwarningsconfig.md) > [allowDeprecatedDirectives](./content-security-policy.validationerrororwarningsconfig.allowdeprecateddirectives.md) + +## ValidationErrorOrWarningsConfig.allowDeprecatedDirectives property + +Signature: + +```typescript +allowDeprecatedDirectives: boolean; +``` diff --git a/packages/content-security-policy/api-docs/content-security-policy.validationerrororwarningsconfig.error.md b/packages/content-security-policy/api-docs/content-security-policy.validationerrororwarningsconfig.error.md new file mode 100644 index 00000000..14503ece --- /dev/null +++ b/packages/content-security-policy/api-docs/content-security-policy.validationerrororwarningsconfig.error.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [@jackdbd/content-security-policy](./content-security-policy.md) > [ValidationErrorOrWarningsConfig](./content-security-policy.validationerrororwarningsconfig.md) > [error](./content-security-policy.validationerrororwarningsconfig.error.md) + +## ValidationErrorOrWarningsConfig.error property + +Signature: + +```typescript +error: any; +``` diff --git a/packages/content-security-policy/api-docs/content-security-policy.validationerrororwarningsconfig.md b/packages/content-security-policy/api-docs/content-security-policy.validationerrororwarningsconfig.md new file mode 100644 index 00000000..8fd707b4 --- /dev/null +++ b/packages/content-security-policy/api-docs/content-security-policy.validationerrororwarningsconfig.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [@jackdbd/content-security-policy](./content-security-policy.md) > [ValidationErrorOrWarningsConfig](./content-security-policy.validationerrororwarningsconfig.md) + +## ValidationErrorOrWarningsConfig interface + + +Signature: + +```typescript +export interface Config +``` + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [allowDeprecatedDirectives](./content-security-policy.validationerrororwarningsconfig.allowdeprecateddirectives.md) | | boolean | | +| [error](./content-security-policy.validationerrororwarningsconfig.error.md) | | any | | + diff --git a/packages/content-security-policy/package.json b/packages/content-security-policy/package.json index 36fcff9a..9709b790 100644 --- a/packages/content-security-policy/package.json +++ b/packages/content-security-policy/package.json @@ -29,10 +29,17 @@ "typings": "lib/index.d.ts", "exports": { ".": "./lib/index.js", + "./errors": "./lib/errors.js", + "./policies": "./lib/policies.js", + "./schemas": "./lib/schemas.js", "./package.json": "./package.json" }, "typesVersions": { - "*": {} + "*": { + "*": [ + "./lib/*.d.ts" + ] + } }, "files": [ "CHANGELOG.md", diff --git a/packages/content-security-policy/src/errors.ts b/packages/content-security-policy/src/errors.ts index 48b24a6d..e5bbc2ce 100644 --- a/packages/content-security-policy/src/errors.ts +++ b/packages/content-security-policy/src/errors.ts @@ -2,15 +2,15 @@ import { deprecatedDirectives } from './directives.js' import type { DeprecatedDirectiveKey } from './directives.js' /** - * @internal + * @public */ -interface Config { +export interface Config { allowDeprecatedDirectives: boolean error: any } /** - * @internal + * @public */ export const validationErrorOrWarnings = ({ allowDeprecatedDirectives, diff --git a/packages/content-security-policy/src/index.ts b/packages/content-security-policy/src/index.ts index 6d8c28fd..431949ee 100644 --- a/packages/content-security-policy/src/index.ts +++ b/packages/content-security-policy/src/index.ts @@ -7,3 +7,5 @@ export { starter_policy, recommended_policy } from './policies.js' export { cspDirectives, cspHeader, cspJSON } from './csp-directives.js' export type { Config } from './csp-directives.js' export type { Directives } from './directives.js' +export { validationErrorOrWarnings } from './errors.js' +export type { Config as ValidationErrorOrWarningsConfig } from './errors.js' diff --git a/packages/content-security-policy/src/utils.ts b/packages/content-security-policy/src/utils.ts index b5ab0bfb..2a8160da 100644 --- a/packages/content-security-policy/src/utils.ts +++ b/packages/content-security-policy/src/utils.ts @@ -13,37 +13,17 @@ export const isString = (item: any) => { return item && (typeof item === 'string' || item instanceof String) } -export const mergeDeep = (target: any, ...sources: any[]): any => { - if (!sources.length) { - return target - } - const source = sources.shift() - // debug(`merge SOURCE %O into TARGET %O`, source, target) - - if (isObject(target) && isObject(source)) { - for (const key in source) { - if (isObject(source[key])) { - if (!target[key]) - Object.assign(target, { - [key]: {} - }) - mergeDeep(target[key], source[key]) - } else { - Object.assign(target, { - [key]: source[key] - }) - } - } - } - - return mergeDeep(target, ...sources) -} - -// https://bobbyhadz.com/blog/javascript-get-difference-between-two-sets +/** + * https://bobbyhadz.com/blog/javascript-get-difference-between-two-sets + * @internal + */ export function diffBetweenSets(setA: Set, setB: Set) { return new Set([...setA].filter((elem) => !setB.has(elem))) } +/** + * @internal + */ export const stringReplacer = (s: string) => { if ( s === 'none' || @@ -62,6 +42,9 @@ export const stringReplacer = (s: string) => { } } +/** + * @internal + */ export const hashAlgorithmFromCspSourceValues = (arr: string[]) => { const algorithms = arr.filter( (s) => s === 'sha256' || s === 'sha384' || s === 'sha512' @@ -83,11 +66,17 @@ export const hashAlgorithmFromCspSourceValues = (arr: string[]) => { } } +/** + * @internal + */ interface ContentHashConfig { algorithm: string content: string } +/** + * @internal + */ export const contentHash = ({ algorithm, content }: ContentHashConfig) => { debug(`Compute ${algorithm}-hash from a string of length ${content.length}`) const hasher = crypto.createHash(algorithm) From 9d9b9ab40803196135eb3c91540fdfb9517ec0c8 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 28 Sep 2022 16:31:03 +0000 Subject: [PATCH 04/15] chore(content-security-policy): release v.1.0.0-canary.2 [skip ci] ## @jackdbd/content-security-policy [1.0.0-canary.2](https://github.com/jackdbd/calderone/compare/@jackdbd/content-security-policy@1.0.0-canary.1...@jackdbd/content-security-policy@1.0.0-canary.2) (2022-09-28) ### Bug Fixes * **content-security-policy:** add some exports that were missing ([2131f7a](https://github.com/jackdbd/calderone/commit/2131f7a21540b1b9c2ac319b1d0a5dac3c297982)) --- packages/content-security-policy/CHANGELOG.md | 7 +++++++ packages/content-security-policy/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/content-security-policy/CHANGELOG.md b/packages/content-security-policy/CHANGELOG.md index 73c4f4f5..ac7685d5 100644 --- a/packages/content-security-policy/CHANGELOG.md +++ b/packages/content-security-policy/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## @jackdbd/content-security-policy [1.0.0-canary.2](https://github.com/jackdbd/calderone/compare/@jackdbd/content-security-policy@1.0.0-canary.1...@jackdbd/content-security-policy@1.0.0-canary.2) (2022-09-28) + + +### Bug Fixes + +* **content-security-policy:** add some exports that were missing ([2131f7a](https://github.com/jackdbd/calderone/commit/2131f7a21540b1b9c2ac319b1d0a5dac3c297982)) + ## @jackdbd/content-security-policy 1.0.0-canary.1 (2022-09-28) diff --git a/packages/content-security-policy/package.json b/packages/content-security-policy/package.json index 9709b790..b52f11d2 100644 --- a/packages/content-security-policy/package.json +++ b/packages/content-security-policy/package.json @@ -1,6 +1,6 @@ { "name": "@jackdbd/content-security-policy", - "version": "1.0.0-canary.1", + "version": "1.0.0-canary.2", "description": "", "author": { "name": "Giacomo Debidda", From ca167677885855f0612175efcf2ee6edf7372d1e Mon Sep 17 00:00:00 2001 From: Giacomo Debidda Date: Wed, 28 Sep 2022 18:35:47 +0200 Subject: [PATCH 05/15] fix(content-security-policy): cleanup --- .../content-security-policy/src/schemas.ts | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/packages/content-security-policy/src/schemas.ts b/packages/content-security-policy/src/schemas.ts index 5daee95f..647a599f 100644 --- a/packages/content-security-policy/src/schemas.ts +++ b/packages/content-security-policy/src/schemas.ts @@ -72,10 +72,6 @@ export const csp_source_values = Joi.array() .unique() .unique(hashAlgorithmComparator) -const glob_pattern = Joi.string().min(1) - -const glob_patterns = Joi.array().items(glob_pattern).min(1) - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/report-to const groupname = Joi.string().min(1) @@ -106,16 +102,6 @@ const sandbox_value = Joi.string().valid( // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types const trusted_types_value = Joi.string().min(1) -export const defaultOptions = { - allowDeprecatedDirectives: false, - directives: {}, - globPatterns: ['/', '/*/'], - globPatternsDetach: [], - excludePatterns: [], - includePatterns: ['/**/**.html'], - reportOnly: false -} - export const directives = Joi.object({ 'base-uri': csp_source_values, 'child-src': csp_source_values, @@ -148,22 +134,3 @@ export const directives = Joi.object({ 'upgrade-insecure-requests': Joi.boolean(), 'worker-src': csp_source_values }) - -export const pluginOptions = Joi.object().keys({ - allowDeprecatedDirectives: Joi.boolean().default( - defaultOptions.allowDeprecatedDirectives - ), - - directives: directives.default(defaultOptions.directives), - - excludePatterns: glob_patterns.default(defaultOptions.excludePatterns), - - globPatterns: glob_patterns.default(defaultOptions.globPatterns), - - // https://developers.cloudflare.com/pages/platform/headers/#detach-a-header - globPatternsDetach: glob_patterns.default(defaultOptions.globPatternsDetach), - - includePatterns: glob_patterns.default(defaultOptions.includePatterns), - - reportOnly: Joi.boolean().default(defaultOptions.reportOnly) -}) From 8dc7aecb5ae7448539eed0a76c2a7725617f3748 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 28 Sep 2022 16:37:10 +0000 Subject: [PATCH 06/15] chore(content-security-policy): release v.1.0.0-canary.3 [skip ci] ## @jackdbd/content-security-policy [1.0.0-canary.3](https://github.com/jackdbd/calderone/compare/@jackdbd/content-security-policy@1.0.0-canary.2...@jackdbd/content-security-policy@1.0.0-canary.3) (2022-09-28) ### Bug Fixes * **content-security-policy:** cleanup ([ca16767](https://github.com/jackdbd/calderone/commit/ca167677885855f0612175efcf2ee6edf7372d1e)) --- packages/content-security-policy/CHANGELOG.md | 7 +++++++ packages/content-security-policy/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/content-security-policy/CHANGELOG.md b/packages/content-security-policy/CHANGELOG.md index ac7685d5..977c7950 100644 --- a/packages/content-security-policy/CHANGELOG.md +++ b/packages/content-security-policy/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## @jackdbd/content-security-policy [1.0.0-canary.3](https://github.com/jackdbd/calderone/compare/@jackdbd/content-security-policy@1.0.0-canary.2...@jackdbd/content-security-policy@1.0.0-canary.3) (2022-09-28) + + +### Bug Fixes + +* **content-security-policy:** cleanup ([ca16767](https://github.com/jackdbd/calderone/commit/ca167677885855f0612175efcf2ee6edf7372d1e)) + ## @jackdbd/content-security-policy [1.0.0-canary.2](https://github.com/jackdbd/calderone/compare/@jackdbd/content-security-policy@1.0.0-canary.1...@jackdbd/content-security-policy@1.0.0-canary.2) (2022-09-28) diff --git a/packages/content-security-policy/package.json b/packages/content-security-policy/package.json index b52f11d2..b41d59a6 100644 --- a/packages/content-security-policy/package.json +++ b/packages/content-security-policy/package.json @@ -1,6 +1,6 @@ { "name": "@jackdbd/content-security-policy", - "version": "1.0.0-canary.2", + "version": "1.0.0-canary.3", "description": "", "author": { "name": "Giacomo Debidda", From b1a40f630250d5d3d18bc2171d0875c357fe33e2 Mon Sep 17 00:00:00 2001 From: Giacomo Debidda Date: Thu, 29 Sep 2022 00:02:02 +0200 Subject: [PATCH 07/15] feat(content-security-policy): autogenerate hashes for inline script/style --- assets/html-pages/index.html | 16 +- .../functions/cspDirectives.html | 2 +- .../functions/cspHeader.html | 2 +- .../functions/cspJSON.html | 2 +- .../functions/validationErrorOrWarnings.html | 2 +- .../interfaces/Config.html | 6 +- .../interfaces/Directives.html | 2 +- .../ValidationErrorOrWarningsConfig.html | 6 +- .../variables/recommended_policy.html | 2 +- .../variables/starter_policy.html | 2 +- package-lock.json | 5 +- .../__tests__/constants.mjs | 6 + ...-parser.test.mjs => html-parsers.test.mjs} | 2 +- .../__tests__/source-values.test.mjs | 54 ++++- packages/content-security-policy/src/hash.ts | 37 ++- .../src/html-parser.ts | 103 -------- .../src/html-parsers.ts | 222 ++++++++++++++++++ .../src/source-values.ts | 44 +++- scripts/test.mjs | 1 - 19 files changed, 375 insertions(+), 141 deletions(-) rename packages/content-security-policy/__tests__/{html-parser.test.mjs => html-parsers.test.mjs} (98%) delete mode 100644 packages/content-security-policy/src/html-parser.ts create mode 100644 packages/content-security-policy/src/html-parsers.ts diff --git a/assets/html-pages/index.html b/assets/html-pages/index.html index 8b92ea80..6f73d987 100644 --- a/assets/html-pages/index.html +++ b/assets/html-pages/index.html @@ -64,6 +64,20 @@ - + \ No newline at end of file diff --git a/docs/content-security-policy/functions/cspDirectives.html b/docs/content-security-policy/functions/cspDirectives.html index 24f0a6a9..a653ccdf 100644 --- a/docs/content-security-policy/functions/cspDirectives.html +++ b/docs/content-security-policy/functions/cspDirectives.html @@ -24,7 +24,7 @@

    Parameters

    __namedParameters: Config

    Returns Promise<string[]>

    +
  • Defined in csp-directives.ts:24
  • +
  • Defined in csp-directives.ts:107
  • +
  • Defined in csp-directives.ts:119
  • +
  • Defined in errors.ts:15
  • +
  • Defined in policies.ts:30
  • +
  • Defined in policies.ts:5