@maka/maka-cli 4.0.85 → 4.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/command.js +1 -1
- package/dist/commands/_index.js +1 -1
- package/dist/commands/aws/_index.js +1 -1
- package/dist/commands/aws/aws.command.js +1 -1
- package/dist/commands/aws/ci.sub.cmd.js +1 -1
- package/dist/commands/aws/ckp.sub.cmd.js +1 -1
- package/dist/commands/aws/csg.sub.cmd.js +1 -1
- package/dist/commands/aws/di.sub.cmd.js +1 -1
- package/dist/commands/aws/dks.sub.cmd.js +1 -1
- package/dist/commands/aws/rbi.sub.cmd.js +1 -1
- package/dist/commands/aws/sth.sub.cmd.js +1 -1
- package/dist/commands/aws/ti.sub.cmd.js +1 -1
- package/dist/commands/build/_index.js +1 -1
- package/dist/commands/build/build.js +1 -1
- package/dist/commands/build/docker.sub.cmd.js +1 -1
- package/dist/commands/create.js +1 -1
- package/dist/commands/debug.js +1 -1
- package/dist/commands/deploy.js +1 -1
- package/dist/commands/game/_index.js +1 -1
- package/dist/commands/game/battleship.sub.cmd.js +1 -1
- package/dist/commands/game/play.command.js +1 -1
- package/dist/commands/game/pong.sub.cmd.js +1 -1
- package/dist/commands/game/snake.sub.cmd.js +1 -1
- package/dist/commands/game/tetris.sub.cmd.js +1 -1
- package/dist/commands/generate.js +1 -1
- package/dist/commands/get/_index.js +1 -1
- package/dist/commands/get/get.command.js +1 -1
- package/dist/commands/get/global.sub.cmd.js +1 -1
- package/dist/commands/get/local.sub.cmd.js +1 -1
- package/dist/commands/help.js +1 -1
- package/dist/commands/install.js +1 -1
- package/dist/commands/jsdoc.js +1 -1
- package/dist/commands/login.js +1 -1
- package/dist/commands/logout.js +1 -1
- package/dist/commands/logs.js +1 -1
- package/dist/commands/maka.cmd.js +1 -1
- package/dist/commands/murder.js +1 -1
- package/dist/commands/reconfig.js +1 -1
- package/dist/commands/run.js +1 -1
- package/dist/commands/set/_index.js +1 -1
- package/dist/commands/set/global.sub.cmd.js +1 -1
- package/dist/commands/set/local.sub.cmd.js +1 -1
- package/dist/commands/set/set.command.js +1 -1
- package/dist/commands/ssh.js +1 -1
- package/dist/commands/ssl.js +1 -1
- package/dist/commands/test.js +1 -1
- package/dist/commands/version.js +1 -1
- package/dist/error.js +1 -1
- package/dist/generator.js +1 -1
- package/dist/generators/_index.js +1 -1
- package/dist/generators/api.js +1 -1
- package/dist/generators/collection.js +1 -1
- package/dist/generators/component.js +1 -1
- package/dist/generators/config.js +1 -1
- package/dist/generators/dbc.js +1 -1
- package/dist/generators/dockerfile.js +1 -1
- package/dist/generators/hook.js +1 -1
- package/dist/generators/kit.js +1 -1
- package/dist/generators/layout.js +1 -1
- package/dist/generators/maka.gen.js +1 -1
- package/dist/generators/methods.js +1 -1
- package/dist/generators/package.js +1 -1
- package/dist/generators/page.js +1 -1
- package/dist/generators/publish.js +1 -1
- package/dist/generators/route.js +1 -1
- package/dist/generators/scaffold.js +1 -1
- package/dist/generators/service.js +1 -1
- package/dist/maka.js +1 -1
- package/dist/templates/meteor/app/client/head.html +0 -11
- package/dist/templates/meteor/app/client/main.js +12 -0
- package/dist/templates/meteor/app/client/main.js.jsx +12 -0
- package/dist/templates/meteor/app/client/main.js.ts +12 -0
- package/dist/templates/meteor/app/client/main.js.tsx +12 -0
- package/dist/templates/meteor/app/server/helmet-csp.js +145 -0
- package/dist/templates/meteor/app/server/helmet-csp.js.jsx +145 -0
- package/dist/templates/meteor/app/server/helmet-csp.js.ts +145 -0
- package/dist/templates/meteor/app/server/helmet-csp.js.tsx +145 -0
- package/dist/templates/meteor/app/server/main.js +7 -2
- package/dist/templates/meteor/app/server/main.js.jsx +6 -1
- package/dist/templates/meteor/app/server/main.js.ts +6 -1
- package/dist/templates/meteor/app/server/main.js.tsx +5 -0
- package/dist/templates/meteor/config/settings.json +2 -1
- package/dist/tool.js +1 -1
- package/dist/tools/actions/actions.class.js +1 -1
- package/dist/tools/actions/actions.test.js +1 -1
- package/dist/tools/aws/aws.class.js +1 -1
- package/dist/tools/aws/aws.interfaces.js +1 -1
- package/dist/tools/docker/docker.class.js +1 -1
- package/dist/tools/docker/docker.interfaces.js +1 -1
- package/dist/tools/fsi/fsi.class.js +1 -1
- package/dist/tools/fsi/fsi.interfaces.js +1 -1
- package/dist/tools/https/https.class.js +1 -1
- package/dist/tools/https/https.interface.js +1 -1
- package/dist/tools/log/log.class.js +1 -1
- package/dist/tools/log/log.interfaces.js +1 -1
- package/dist/tools/spawn-async/spawn-async.class.js +1 -1
- package/dist/tools/spawn-async/spawn-async.interfaces.js +1 -1
- package/dist/tools/ssh/ssh.class.js +1 -1
- package/dist/tools/ssh/ssh.interfaces.js +1 -1
- package/dist/tools/ssl/ssl.class.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a66F=a66d;(function(a,b){const y=a66d,c=a();while(!![]){try{const d=parseInt(y(0xa8))/0x1+-parseInt(y(0xca))/0x2+parseInt(y(0xcd))/0x3*(parseInt(y(0xbf))/0x4)+parseInt(y(0x9b))/0x5*(parseInt(y(0xc5))/0x6)+parseInt(y(0xc4))/0x7+-parseInt(y(0xb8))/0x8+-parseInt(y(0xc2))/0x9;if(d===b)break;else c['push'](c['shift']());}catch(e){c['push'](c['shift']());}}}(a66c,0xdccfd));const a66b=(function(){let a=!![];return function(b,c){const d=a?function(){const z=a66d;if(c){if(z(0x8d)!==z(0x8d))c[z(0xb6)]=d;else{const f=c[z(0x92)](b,arguments);return c=null,f;}}}:function(){};return a=![],d;};}()),a66a=a66b(this,function(){const A=a66d;return a66a[A(0x8a)]()[A(0xa5)](A(0xce))['toString']()[A(0x9d)](a66a)[A(0xa5)]('(((.+)+)+)+$');});a66a();var __awaiter=this&&this['__awaiter']||function(a,b,c,d){function e(f){const B=a66d;if('EMAqA'===B(0xae)){const h=g?function(){if(h){const u=q['apply'](r,arguments);return s=null,u;}}:function(){};return l=![],h;}else return f instanceof c?f:new c(function(h){h(f);});}return new(c||(c=Promise))(function(f,g){const E=a66d;function h(k){const C=a66d;if(C(0xb3)!==C(0xb7))try{C(0x9e)!==C(0x91)?j(d[C(0x9a)](k)):b='ts';}catch(m){C(0x8f)!=='wpqdx'?h['done']?i(j[C(0x8b)]):k(l[C(0x8b)])[C(0xb9)](m,n):g(m);}else c(d);}function i(k){try{j(d['throw'](k));}catch(l){g(l);}}function j(k){const D=a66d;k[D(0xbc)]?f(k[D(0x8b)]):e(k[D(0x8b)])['then'](h,i);}j((d=d['apply'](a,b||[]))[E(0x9a)]());});};function a66d(a,b){const c=a66c();return a66d=function(d,e){d=d-0x87;let f=c[d];return f;},a66d(a,b);}import{camelCase,paramCase,pascalCase}from'change-case';import a66u from'../generators/maka.gen.js';import{Generator}from'../generator.js';import{Log}from'../tools/log/log.class.js';function a66c(){const I=['injectAtBeginningOfFile','services','2415174GxNgfF','(((.+)+)+)+$','service','error','throw','mongo','toString','value','template','gQFuG','WAwaU','wpqdx','logger','jWPiU','apply','/imports/startup/lib/services/logger-transports','winston\x20winston-transport\x20setimmediate','winston','maka\x20g:s\x20Logger\x20--type=logger','pRnsi','create','engines','next','187940tkHKOy','notice','constructor','kyeGK','(blank)','lib','fsi','collection','installNpmPackage','Service\x20Type','search','findGenerator','getProjectConfig','1581283jnCNke','service/logger/transports.js','withValue','AKslw','/imports/startup/lib/collections/logs','checkMeteorPackage','KEXbM','import\x20{\x20MongoTransport\x20}\x20from\x20\x27','resourceName','checkNpmPackage','imports','UfvNW','maka\x20{generate,\x20g}:{service}\x20<service-name>\x20--type=logger','pathFromApp','type','kbqnw','8444696QGTYDx','then','both','startup','done','options','tsx','4pDOcPE','list','Generate\x20a\x20service\x20to\x20run\x20within\x20your\x20meteor\x20application.','22997637oEpAtd','rewriteDestinationPathForType','6886257bsGWQJ','270czlljv','Winston\x20Logger','indexOf',',\x20you\x20must\x20provide\x20a\x20valid\x20type\x20as\x20an\x20argument.\x20\x20Usage:','serviceAnswer','1092454zTYzqr'];a66c=function(){return I;};return a66c();}import{Actions}from'../tools/actions/actions.class.js';Generator[a66F(0x98)]({'name':a66F(0xcf),'aliases':['svc'],'usage':a66F(0xb4),'description':a66F(0xc1),'examples':[a66F(0x96)]},function(a,b){return __awaiter(this,void 0x0,void 0x0,function*(){const G=a66d;try{const c=this[G(0xa1)][G(0xa7)]();this[G(0xa1)][G(0xaa)](c,()=>__awaiter(this,void 0x0,void 0x0,function*(){const H=G;if(H(0xab)===H(0xab)){const d=this[H(0xa1)][H(0xb5)]({}),f=paramCase(b[H(0xb0)]),g=paramCase(b['resourceName']);if(!b['type']){const k={'type':H(0xc0),'name':H(0xc9),'message':H(0xa4),'choices':[{'name':H(0xc6),'value':H(0x90)}]},{serviceAnswer:l}=yield Actions[H(0xbd)](k);if(l){if(H(0x8e)!=='mtUiE')b[H(0xb6)]=l;else try{i(j[H(0x88)](k));}catch(o){m(o);}}}const h={'name':pascalCase(b[H(0xb0)]),'fileName':f,'camelCase':camelCase(b['resourceName']),'type':b[H(0xb6)],'engine':c[H(0x99)]['js'],'noRename':!![]};let i='js';c[H(0x99)]['js']===H(0xbe)&&(i='ts');let j=[H(0x90)];if(j[H(0xc7)](h[H(0xb6)])<0x0){let n=h[H(0xb6)]?h[H(0xb6)]:H(0x9f);Log[H(0x87)]('Invalid\x20type\x20'+n+H(0xc8));return;}if(b['type']===H(0x90)){!this['fsi'][H(0xb1)](H(0x95))&&(Log['warn']('Verifying\x20npm\x20package\x20requirements:\x20winston\x20...'),yield this[H(0xa1)][H(0xa3)](H(0x94),{'cwd':d}));!this[H(0xa1)][H(0xad)](H(0x89))&&(Log[H(0x9c)]('Verifying\x20meteor\x20package\x20requirements:\x20mongo\x20...'),yield this['fsi']['installMeteorPackage'](H(0x89),{'cwd':d}));let o=this[H(0xa1)]['pathFromApp']({'pathParts':[H(0xb2),'startup','lib',H(0xcc),f+'.'+i]});this[H(0xa1)][H(0x8c)]({'srcPath':'service/logger/logger.js','destPath':o,'context':h,'config':c});const p=a66u[H(0xa6)](H(0xa2));p&&('pRnsi'!==H(0x97)?d(e[H(0x9a)](f)):yield p['invoke']([g],{'where':H(0xba),'appPathPrefix':'lib','dir':''}));let q=this['fsi'][H(0xc3)]({'pathParts':[o]});const r=this[H(0xa1)][H(0xc3)]({'pathParts':[H(0x93)]});this[H(0xa1)][H(0xcb)]({'filePath':q,'content':H(0xaf)+r+'\x27;'});let s=this['fsi'][H(0xb5)]({'pathParts':[H(0xb2),H(0xbb),H(0xa0),H(0xcc),'logger-transports.'+i]});this[H(0xa1)][H(0x8c)]({'srcPath':H(0xa9),'destPath':s,'context':h,'config':c});let t=this[H(0xa1)][H(0xc3)]({'pathParts':[s]});const u=this['fsi'][H(0xc3)]({'pathParts':[H(0xac)]});this[H(0xa1)][H(0xcb)]({'filePath':t,'content':'import\x20Logs\x20from\x20\x27'+u+'\x27;'});}}else{const x=d[H(0x92)](e,arguments);return f=null,x;}}));}catch(d){Log[G(0x87)](d);}});});
|
package/dist/maka.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node --experimental-modules --no-warnings --experimental-json-modules
|
|
2
|
-
const
|
|
2
|
+
const a67B=a67d;(function(a,b){const z=a67d,c=a();while(!![]){try{const d=-parseInt(z(0xd7))/0x1+-parseInt(z(0xc7))/0x2*(parseInt(z(0xd8))/0x3)+-parseInt(z(0xc8))/0x4*(parseInt(z(0xcc))/0x5)+parseInt(z(0xc2))/0x6*(-parseInt(z(0xbf))/0x7)+parseInt(z(0xd4))/0x8*(parseInt(z(0xd6))/0x9)+parseInt(z(0xce))/0xa+-parseInt(z(0xcb))/0xb*(-parseInt(z(0xd1))/0xc);if(d===b)break;else c['push'](c['shift']());}catch(e){c['push'](c['shift']());}}}(a67c,0xe8b94));const a67b=(function(){let a=!![];return function(b,c){const d=a?function(){if(c){const e=c['apply'](b,arguments);return c=null,e;}}:function(){};return a=![],d;};}()),a67a=a67b(this,function(){const A=a67d;return a67a[A(0xcd)]()[A(0xc1)](A(0xd0))[A(0xcd)]()['constructor'](a67a)[A(0xc1)](A(0xd0));});function a67d(a,b){const c=a67c();return a67d=function(d,e){d=d-0xbd;let f=c[d];return f;},a67d(a,b);}a67a();import a67u from'minimist';function a67c(){const C=['url','2pjBoeC','3088SeFgcg','env','argv','10276145elHtka','8705HuiJJi','toString','15127410xRubpF','--max-old-space-size=','(((.+)+)+)+$','24YBxoMC','MAKA_COMMAND_PATH','slice','8ZXajcj','totalmem','2921733dIjyRU','816580LjqyKZ','933174epGQAS','dirname','parse','982947byroyh','camelizeKeys','search','12tJedLW','floor','TOOL_NODE_FLAGS','run'];a67c=function(){return C;};return a67c();}import a67v from'os';import a67w from'path';import a67x from'humps';import a67y from'./commands/maka.cmd.js';import'./commands/_index.js';import'./generators/_index.js';import{fileURLToPath}from'url';const __filename=fileURLToPath(import.meta[a67B(0xc6)]),__dirname=a67w[a67B(0xbd)](__filename);global[a67B(0xd2)]=__dirname;let total_memory=a67v[a67B(0xd5)](),total_mem_in_kb=total_memory/0x400,total_mem_in_mb=total_mem_in_kb/0x400;total_mem_in_mb=Math[a67B(0xc3)](total_mem_in_mb),process[a67B(0xc9)][a67B(0xc4)]=a67B(0xcf)+total_mem_in_mb;const argv=a67u(process[a67B(0xca)][a67B(0xd3)](0x2)),args=argv['_'],deepCopyArgv=JSON[a67B(0xbe)](JSON['stringify'](argv));delete deepCopyArgv['_'];const opts=a67x[a67B(0xc0)](deepCopyArgv);a67y[a67B(0xc5)](args,opts);
|
|
@@ -11,15 +11,4 @@
|
|
|
11
11
|
<noscript>
|
|
12
12
|
Please enable JavaScript
|
|
13
13
|
</noscript>
|
|
14
|
-
<script type="text/javascript">
|
|
15
|
-
window.onbeforeunload = closingCode;
|
|
16
|
-
function closingCode(){
|
|
17
|
-
if (Meteor.settings.public.logoutOnClose === true && Meteor.logout) Meteor.logout();
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
// stop ios bounce and zoom
|
|
21
|
-
document.ontouchmove = event => {
|
|
22
|
-
event.preventDefault();
|
|
23
|
-
};
|
|
24
|
-
</script>
|
|
25
14
|
</head>
|
|
@@ -1 +1,13 @@
|
|
|
1
|
+
window.onbeforeunload = () => {
|
|
2
|
+
if (Meteor.settings.public.logoutOnClose === true && Meteor.logout) {
|
|
3
|
+
Meteor.logout();
|
|
4
|
+
}
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// stop ios bounce and zoom
|
|
9
|
+
document.ontouchmove = event => {
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
};
|
|
12
|
+
|
|
1
13
|
import '/imports/startup/client';
|
|
@@ -1 +1,13 @@
|
|
|
1
|
+
window.onbeforeunload = () => {
|
|
2
|
+
if (Meteor.settings.public.logoutOnClose === true && Meteor.logout) {
|
|
3
|
+
Meteor.logout();
|
|
4
|
+
}
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// stop ios bounce and zoom
|
|
9
|
+
document.ontouchmove = event => {
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
};
|
|
12
|
+
|
|
1
13
|
import '/imports/startup/client/index.jsx';
|
|
@@ -1 +1,13 @@
|
|
|
1
|
+
window.onbeforeunload = () => {
|
|
2
|
+
if (Meteor.settings.public.logoutOnClose === true && Meteor.logout) {
|
|
3
|
+
Meteor.logout();
|
|
4
|
+
}
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// stop ios bounce and zoom
|
|
9
|
+
document.ontouchmove = event => {
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
};
|
|
12
|
+
|
|
1
13
|
import '/imports/startup/client';
|
|
@@ -1 +1,13 @@
|
|
|
1
|
+
window.onbeforeunload = () => {
|
|
2
|
+
if (Meteor.settings.public.logoutOnClose === true && Meteor.logout) {
|
|
3
|
+
Meteor.logout();
|
|
4
|
+
}
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// stop ios bounce and zoom
|
|
9
|
+
document.ontouchmove = event => {
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
};
|
|
12
|
+
|
|
1
13
|
import '/imports/startup/client/index';
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Content Security Policy (CSP)
|
|
3
|
+
* https://guide.meteor.com/security.html#httpheaders
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/* global __meteor_runtime_config__ */
|
|
7
|
+
import { Meteor } from 'meteor/meteor'
|
|
8
|
+
import { WebApp } from 'meteor/webapp'
|
|
9
|
+
import { Autoupdate } from 'meteor/autoupdate'
|
|
10
|
+
import crypto from 'crypto'
|
|
11
|
+
|
|
12
|
+
const self = '\'self\''
|
|
13
|
+
const data = 'data:'
|
|
14
|
+
const unsafeEval = '\'unsafe-eval\''
|
|
15
|
+
const unsafeInline = '\'unsafe-inline\''
|
|
16
|
+
const allowedOrigins = Meteor.settings.extraAllowedOrigins;
|
|
17
|
+
|
|
18
|
+
// create the default connect source for our current domain in
|
|
19
|
+
// a multi-protocol compatible way (http/ws or https/wss)
|
|
20
|
+
const url = Meteor.absoluteUrl()
|
|
21
|
+
const domain = url.replace(/http(s)*:\/\//, '').replace(/\/$/, '')
|
|
22
|
+
const s = url.match(/(?!=http)s(?=:\/\/)/) ? 's' : ''
|
|
23
|
+
const usesHttps = s.length > 0
|
|
24
|
+
const connectSrc = [
|
|
25
|
+
self,
|
|
26
|
+
`http${s}://${domain}`,
|
|
27
|
+
`ws${s}://${domain}`
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
// Prepare runtime config for generating the sha256 hash
|
|
31
|
+
// It is important, that the hash meets exactly the hash of the
|
|
32
|
+
// script in the client bundle.
|
|
33
|
+
// Otherwise the app would not be able to start, since the runtimeConfigScript
|
|
34
|
+
// is rejected __meteor_runtime_config__ is not available, causing
|
|
35
|
+
// a cascade of follow-up errors.
|
|
36
|
+
const runtimeConfig = Object.assign(__meteor_runtime_config__, Autoupdate, {
|
|
37
|
+
// the following lines may depend on, whether you called Accounts.config
|
|
38
|
+
// and whether your Meteor app is a "newer" version
|
|
39
|
+
accountsConfigCalled: true,
|
|
40
|
+
isModern: true
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
// add client versions to __meteor_runtime_config__
|
|
44
|
+
Object.keys(WebApp.clientPrograms).forEach(arch => {
|
|
45
|
+
__meteor_runtime_config__.versions[arch] = {
|
|
46
|
+
version: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].version(),
|
|
47
|
+
versionRefreshable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionRefreshable(),
|
|
48
|
+
versionNonRefreshable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionNonRefreshable(),
|
|
49
|
+
// comment the following line if you use Meteor < 2.0
|
|
50
|
+
versionReplaceable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionReplaceable()
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const runtimeConfigScript = `__meteor_runtime_config__ = JSON.parse(decodeURIComponent("${encodeURIComponent(JSON.stringify(runtimeConfig))}"))`
|
|
55
|
+
const runtimeConfigHash = crypto.createHash('sha256').update(runtimeConfigScript).digest('base64')
|
|
56
|
+
|
|
57
|
+
const helmetOptions = {
|
|
58
|
+
contentSecurityPolicy: {
|
|
59
|
+
blockAllMixedContent: true,
|
|
60
|
+
directives: {
|
|
61
|
+
defaultSrc: [self],
|
|
62
|
+
scriptSrc: [
|
|
63
|
+
self,
|
|
64
|
+
// Remove / comment out unsafeEval if you do not use dynamic imports
|
|
65
|
+
// to tighten security. However, if you use dynamic imports this line
|
|
66
|
+
// must be kept in order to make them work.
|
|
67
|
+
unsafeEval,
|
|
68
|
+
`'sha256-${runtimeConfigHash}'`
|
|
69
|
+
],
|
|
70
|
+
childSrc: [self],
|
|
71
|
+
// If you have external apps, that should be allowed as sources for
|
|
72
|
+
// connections or images, your should add them here
|
|
73
|
+
// Call helmetOptions() without args if you have no external sources
|
|
74
|
+
// Note, that this is just an example and you may configure this to your needs
|
|
75
|
+
connectSrc: connectSrc.concat(allowedOrigins),
|
|
76
|
+
fontSrc: [self, data],
|
|
77
|
+
formAction: [self],
|
|
78
|
+
frameAncestors: [self],
|
|
79
|
+
frameSrc: ['*'],
|
|
80
|
+
// This is an example to show, that we can define to show images only
|
|
81
|
+
// from our self, browser data/blob and a defined set of hosts.
|
|
82
|
+
// Configure to your needs.
|
|
83
|
+
imgSrc: [self, data, 'blob:'].concat(allowedOrigins),
|
|
84
|
+
manifestSrc: [self],
|
|
85
|
+
mediaSrc: [self],
|
|
86
|
+
objectSrc: [self],
|
|
87
|
+
// these are just examples, configure to your needs, see
|
|
88
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox
|
|
89
|
+
sandbox: [
|
|
90
|
+
// allow-downloads-without-user-activation // experimental
|
|
91
|
+
'allow-forms',
|
|
92
|
+
'allow-modals',
|
|
93
|
+
// 'allow-orientation-lock',
|
|
94
|
+
// 'allow-pointer-lock',
|
|
95
|
+
// 'allow-popups',
|
|
96
|
+
// 'allow-popups-to-escape-sandbox',
|
|
97
|
+
// 'allow-presentation',
|
|
98
|
+
'allow-same-origin',
|
|
99
|
+
'allow-scripts',
|
|
100
|
+
// 'allow-storage-access-by-user-activation ', // experimental
|
|
101
|
+
// 'allow-top-navigation',
|
|
102
|
+
// 'allow-top-navigation-by-user-activation'
|
|
103
|
+
],
|
|
104
|
+
styleSrc: [self, unsafeInline],
|
|
105
|
+
workerSrc: [self, 'blob:']
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
// see the helmet documentation to get a better understanding of
|
|
109
|
+
// the following configurations and settings
|
|
110
|
+
strictTransportSecurity: {
|
|
111
|
+
maxAge: 15552000,
|
|
112
|
+
includeSubDomains: true,
|
|
113
|
+
preload: false
|
|
114
|
+
},
|
|
115
|
+
referrerPolicy: {
|
|
116
|
+
policy: 'no-referrer'
|
|
117
|
+
},
|
|
118
|
+
expectCt: {
|
|
119
|
+
enforce: true,
|
|
120
|
+
maxAge: 604800
|
|
121
|
+
},
|
|
122
|
+
frameguard: {
|
|
123
|
+
action: 'sameorigin'
|
|
124
|
+
},
|
|
125
|
+
dnsPrefetchControl: {
|
|
126
|
+
allow: false
|
|
127
|
+
},
|
|
128
|
+
permittedCrossDomainPolicies: {
|
|
129
|
+
permittedPolicies: 'none'
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// We assume, that we are working on a localhost when there is no https
|
|
134
|
+
// connection available.
|
|
135
|
+
// Run your project with --production flag to simulate script-src hashing
|
|
136
|
+
if (!usesHttps && Meteor.isDevelopment) {
|
|
137
|
+
delete helmetOptions.contentSecurityPolicy.blockAllMixedContent;
|
|
138
|
+
helmetOptions.contentSecurityPolicy.directives.scriptSrc = [
|
|
139
|
+
self,
|
|
140
|
+
unsafeEval,
|
|
141
|
+
unsafeInline,
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export default helmetOptions;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Content Security Policy (CSP)
|
|
3
|
+
* https://guide.meteor.com/security.html#httpheaders
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/* global __meteor_runtime_config__ */
|
|
7
|
+
import { Meteor } from 'meteor/meteor'
|
|
8
|
+
import { WebApp } from 'meteor/webapp'
|
|
9
|
+
import { Autoupdate } from 'meteor/autoupdate'
|
|
10
|
+
import crypto from 'crypto'
|
|
11
|
+
|
|
12
|
+
const self = '\'self\''
|
|
13
|
+
const data = 'data:'
|
|
14
|
+
const unsafeEval = '\'unsafe-eval\''
|
|
15
|
+
const unsafeInline = '\'unsafe-inline\''
|
|
16
|
+
const allowedOrigins = Meteor.settings.extraAllowedOrigins;
|
|
17
|
+
|
|
18
|
+
// create the default connect source for our current domain in
|
|
19
|
+
// a multi-protocol compatible way (http/ws or https/wss)
|
|
20
|
+
const url = Meteor.absoluteUrl()
|
|
21
|
+
const domain = url.replace(/http(s)*:\/\//, '').replace(/\/$/, '')
|
|
22
|
+
const s = url.match(/(?!=http)s(?=:\/\/)/) ? 's' : ''
|
|
23
|
+
const usesHttps = s.length > 0
|
|
24
|
+
const connectSrc = [
|
|
25
|
+
self,
|
|
26
|
+
`http${s}://${domain}`,
|
|
27
|
+
`ws${s}://${domain}`
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
// Prepare runtime config for generating the sha256 hash
|
|
31
|
+
// It is important, that the hash meets exactly the hash of the
|
|
32
|
+
// script in the client bundle.
|
|
33
|
+
// Otherwise the app would not be able to start, since the runtimeConfigScript
|
|
34
|
+
// is rejected __meteor_runtime_config__ is not available, causing
|
|
35
|
+
// a cascade of follow-up errors.
|
|
36
|
+
const runtimeConfig = Object.assign(__meteor_runtime_config__, Autoupdate, {
|
|
37
|
+
// the following lines may depend on, whether you called Accounts.config
|
|
38
|
+
// and whether your Meteor app is a "newer" version
|
|
39
|
+
accountsConfigCalled: true,
|
|
40
|
+
isModern: true
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
// add client versions to __meteor_runtime_config__
|
|
44
|
+
Object.keys(WebApp.clientPrograms).forEach(arch => {
|
|
45
|
+
__meteor_runtime_config__.versions[arch] = {
|
|
46
|
+
version: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].version(),
|
|
47
|
+
versionRefreshable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionRefreshable(),
|
|
48
|
+
versionNonRefreshable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionNonRefreshable(),
|
|
49
|
+
// comment the following line if you use Meteor < 2.0
|
|
50
|
+
versionReplaceable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionReplaceable()
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const runtimeConfigScript = `__meteor_runtime_config__ = JSON.parse(decodeURIComponent("${encodeURIComponent(JSON.stringify(runtimeConfig))}"))`
|
|
55
|
+
const runtimeConfigHash = crypto.createHash('sha256').update(runtimeConfigScript).digest('base64')
|
|
56
|
+
|
|
57
|
+
const helmetOptions = {
|
|
58
|
+
contentSecurityPolicy: {
|
|
59
|
+
blockAllMixedContent: true,
|
|
60
|
+
directives: {
|
|
61
|
+
defaultSrc: [self],
|
|
62
|
+
scriptSrc: [
|
|
63
|
+
self,
|
|
64
|
+
// Remove / comment out unsafeEval if you do not use dynamic imports
|
|
65
|
+
// to tighten security. However, if you use dynamic imports this line
|
|
66
|
+
// must be kept in order to make them work.
|
|
67
|
+
unsafeEval,
|
|
68
|
+
`'sha256-${runtimeConfigHash}'`
|
|
69
|
+
],
|
|
70
|
+
childSrc: [self],
|
|
71
|
+
// If you have external apps, that should be allowed as sources for
|
|
72
|
+
// connections or images, your should add them here
|
|
73
|
+
// Call helmetOptions() without args if you have no external sources
|
|
74
|
+
// Note, that this is just an example and you may configure this to your needs
|
|
75
|
+
connectSrc: connectSrc.concat(allowedOrigins),
|
|
76
|
+
fontSrc: [self, data],
|
|
77
|
+
formAction: [self],
|
|
78
|
+
frameAncestors: [self],
|
|
79
|
+
frameSrc: ['*'],
|
|
80
|
+
// This is an example to show, that we can define to show images only
|
|
81
|
+
// from our self, browser data/blob and a defined set of hosts.
|
|
82
|
+
// Configure to your needs.
|
|
83
|
+
imgSrc: [self, data, 'blob:'].concat(allowedOrigins),
|
|
84
|
+
manifestSrc: [self],
|
|
85
|
+
mediaSrc: [self],
|
|
86
|
+
objectSrc: [self],
|
|
87
|
+
// these are just examples, configure to your needs, see
|
|
88
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox
|
|
89
|
+
sandbox: [
|
|
90
|
+
// allow-downloads-without-user-activation // experimental
|
|
91
|
+
'allow-forms',
|
|
92
|
+
'allow-modals',
|
|
93
|
+
// 'allow-orientation-lock',
|
|
94
|
+
// 'allow-pointer-lock',
|
|
95
|
+
// 'allow-popups',
|
|
96
|
+
// 'allow-popups-to-escape-sandbox',
|
|
97
|
+
// 'allow-presentation',
|
|
98
|
+
'allow-same-origin',
|
|
99
|
+
'allow-scripts',
|
|
100
|
+
// 'allow-storage-access-by-user-activation ', // experimental
|
|
101
|
+
// 'allow-top-navigation',
|
|
102
|
+
// 'allow-top-navigation-by-user-activation'
|
|
103
|
+
],
|
|
104
|
+
styleSrc: [self, unsafeInline],
|
|
105
|
+
workerSrc: [self, 'blob:']
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
// see the helmet documentation to get a better understanding of
|
|
109
|
+
// the following configurations and settings
|
|
110
|
+
strictTransportSecurity: {
|
|
111
|
+
maxAge: 15552000,
|
|
112
|
+
includeSubDomains: true,
|
|
113
|
+
preload: false
|
|
114
|
+
},
|
|
115
|
+
referrerPolicy: {
|
|
116
|
+
policy: 'no-referrer'
|
|
117
|
+
},
|
|
118
|
+
expectCt: {
|
|
119
|
+
enforce: true,
|
|
120
|
+
maxAge: 604800
|
|
121
|
+
},
|
|
122
|
+
frameguard: {
|
|
123
|
+
action: 'sameorigin'
|
|
124
|
+
},
|
|
125
|
+
dnsPrefetchControl: {
|
|
126
|
+
allow: false
|
|
127
|
+
},
|
|
128
|
+
permittedCrossDomainPolicies: {
|
|
129
|
+
permittedPolicies: 'none'
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// We assume, that we are working on a localhost when there is no https
|
|
134
|
+
// connection available.
|
|
135
|
+
// Run your project with --production flag to simulate script-src hashing
|
|
136
|
+
if (!usesHttps && Meteor.isDevelopment) {
|
|
137
|
+
delete helmetOptions.contentSecurityPolicy.blockAllMixedContent;
|
|
138
|
+
helmetOptions.contentSecurityPolicy.directives.scriptSrc = [
|
|
139
|
+
self,
|
|
140
|
+
unsafeEval,
|
|
141
|
+
unsafeInline,
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export default helmetOptions;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Content Security Policy (CSP)
|
|
3
|
+
* https://guide.meteor.com/security.html#httpheaders
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/* global __meteor_runtime_config__ */
|
|
7
|
+
import { Meteor } from 'meteor/meteor'
|
|
8
|
+
import { WebApp } from 'meteor/webapp'
|
|
9
|
+
import { Autoupdate } from 'meteor/autoupdate'
|
|
10
|
+
import crypto from 'crypto'
|
|
11
|
+
|
|
12
|
+
const self = '\'self\''
|
|
13
|
+
const data = 'data:'
|
|
14
|
+
const unsafeEval = '\'unsafe-eval\''
|
|
15
|
+
const unsafeInline = '\'unsafe-inline\''
|
|
16
|
+
const allowedOrigins = Meteor.settings.extraAllowedOrigins;
|
|
17
|
+
|
|
18
|
+
// create the default connect source for our current domain in
|
|
19
|
+
// a multi-protocol compatible way (http/ws or https/wss)
|
|
20
|
+
const url = Meteor.absoluteUrl()
|
|
21
|
+
const domain = url.replace(/http(s)*:\/\//, '').replace(/\/$/, '')
|
|
22
|
+
const s = url.match(/(?!=http)s(?=:\/\/)/) ? 's' : ''
|
|
23
|
+
const usesHttps = s.length > 0
|
|
24
|
+
const connectSrc = [
|
|
25
|
+
self,
|
|
26
|
+
`http${s}://${domain}`,
|
|
27
|
+
`ws${s}://${domain}`
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
// Prepare runtime config for generating the sha256 hash
|
|
31
|
+
// It is important, that the hash meets exactly the hash of the
|
|
32
|
+
// script in the client bundle.
|
|
33
|
+
// Otherwise the app would not be able to start, since the runtimeConfigScript
|
|
34
|
+
// is rejected __meteor_runtime_config__ is not available, causing
|
|
35
|
+
// a cascade of follow-up errors.
|
|
36
|
+
const runtimeConfig = Object.assign(__meteor_runtime_config__, Autoupdate, {
|
|
37
|
+
// the following lines may depend on, whether you called Accounts.config
|
|
38
|
+
// and whether your Meteor app is a "newer" version
|
|
39
|
+
accountsConfigCalled: true,
|
|
40
|
+
isModern: true
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
// add client versions to __meteor_runtime_config__
|
|
44
|
+
Object.keys(WebApp.clientPrograms).forEach(arch => {
|
|
45
|
+
__meteor_runtime_config__.versions[arch] = {
|
|
46
|
+
version: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].version(),
|
|
47
|
+
versionRefreshable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionRefreshable(),
|
|
48
|
+
versionNonRefreshable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionNonRefreshable(),
|
|
49
|
+
// comment the following line if you use Meteor < 2.0
|
|
50
|
+
versionReplaceable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionReplaceable()
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const runtimeConfigScript = `__meteor_runtime_config__ = JSON.parse(decodeURIComponent("${encodeURIComponent(JSON.stringify(runtimeConfig))}"))`
|
|
55
|
+
const runtimeConfigHash = crypto.createHash('sha256').update(runtimeConfigScript).digest('base64')
|
|
56
|
+
|
|
57
|
+
const helmetOptions = {
|
|
58
|
+
contentSecurityPolicy: {
|
|
59
|
+
blockAllMixedContent: true,
|
|
60
|
+
directives: {
|
|
61
|
+
defaultSrc: [self],
|
|
62
|
+
scriptSrc: [
|
|
63
|
+
self,
|
|
64
|
+
// Remove / comment out unsafeEval if you do not use dynamic imports
|
|
65
|
+
// to tighten security. However, if you use dynamic imports this line
|
|
66
|
+
// must be kept in order to make them work.
|
|
67
|
+
unsafeEval,
|
|
68
|
+
`'sha256-${runtimeConfigHash}'`
|
|
69
|
+
],
|
|
70
|
+
childSrc: [self],
|
|
71
|
+
// If you have external apps, that should be allowed as sources for
|
|
72
|
+
// connections or images, your should add them here
|
|
73
|
+
// Call helmetOptions() without args if you have no external sources
|
|
74
|
+
// Note, that this is just an example and you may configure this to your needs
|
|
75
|
+
connectSrc: connectSrc.concat(allowedOrigins),
|
|
76
|
+
fontSrc: [self, data],
|
|
77
|
+
formAction: [self],
|
|
78
|
+
frameAncestors: [self],
|
|
79
|
+
frameSrc: ['*'],
|
|
80
|
+
// This is an example to show, that we can define to show images only
|
|
81
|
+
// from our self, browser data/blob and a defined set of hosts.
|
|
82
|
+
// Configure to your needs.
|
|
83
|
+
imgSrc: [self, data, 'blob:'].concat(allowedOrigins),
|
|
84
|
+
manifestSrc: [self],
|
|
85
|
+
mediaSrc: [self],
|
|
86
|
+
objectSrc: [self],
|
|
87
|
+
// these are just examples, configure to your needs, see
|
|
88
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox
|
|
89
|
+
sandbox: [
|
|
90
|
+
// allow-downloads-without-user-activation // experimental
|
|
91
|
+
'allow-forms',
|
|
92
|
+
'allow-modals',
|
|
93
|
+
// 'allow-orientation-lock',
|
|
94
|
+
// 'allow-pointer-lock',
|
|
95
|
+
// 'allow-popups',
|
|
96
|
+
// 'allow-popups-to-escape-sandbox',
|
|
97
|
+
// 'allow-presentation',
|
|
98
|
+
'allow-same-origin',
|
|
99
|
+
'allow-scripts',
|
|
100
|
+
// 'allow-storage-access-by-user-activation ', // experimental
|
|
101
|
+
// 'allow-top-navigation',
|
|
102
|
+
// 'allow-top-navigation-by-user-activation'
|
|
103
|
+
],
|
|
104
|
+
styleSrc: [self, unsafeInline],
|
|
105
|
+
workerSrc: [self, 'blob:']
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
// see the helmet documentation to get a better understanding of
|
|
109
|
+
// the following configurations and settings
|
|
110
|
+
strictTransportSecurity: {
|
|
111
|
+
maxAge: 15552000,
|
|
112
|
+
includeSubDomains: true,
|
|
113
|
+
preload: false
|
|
114
|
+
},
|
|
115
|
+
referrerPolicy: {
|
|
116
|
+
policy: 'no-referrer'
|
|
117
|
+
},
|
|
118
|
+
expectCt: {
|
|
119
|
+
enforce: true,
|
|
120
|
+
maxAge: 604800
|
|
121
|
+
},
|
|
122
|
+
frameguard: {
|
|
123
|
+
action: 'sameorigin'
|
|
124
|
+
},
|
|
125
|
+
dnsPrefetchControl: {
|
|
126
|
+
allow: false
|
|
127
|
+
},
|
|
128
|
+
permittedCrossDomainPolicies: {
|
|
129
|
+
permittedPolicies: 'none'
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// We assume, that we are working on a localhost when there is no https
|
|
134
|
+
// connection available.
|
|
135
|
+
// Run your project with --production flag to simulate script-src hashing
|
|
136
|
+
if (!usesHttps && Meteor.isDevelopment) {
|
|
137
|
+
delete helmetOptions.contentSecurityPolicy.blockAllMixedContent;
|
|
138
|
+
helmetOptions.contentSecurityPolicy.directives.scriptSrc = [
|
|
139
|
+
self,
|
|
140
|
+
unsafeEval,
|
|
141
|
+
unsafeInline,
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export default helmetOptions;
|