Add security check (#7247)
* added Parse Server security option * added SecurityRouter * added Check class * added CheckGroup class * moved parameter validation to Utils * added CheckRunner class * added auto-run on server start * added custom security checks as Parse Server option * renamed script to check * reformat log output * added server config check * improved contributing guideline * improved contribution guide * added check security log * improved log format * added checks * fixed log fomat typo * added database checks * fixed database check * removed database auth check in initial version * improved contribution guide * added security check tests * fixed typo * improved wording guidelines * improved wording guidelines
This commit is contained in:
@@ -41,6 +41,8 @@ import { AggregateRouter } from './Routers/AggregateRouter';
|
||||
import { ParseServerRESTController } from './ParseServerRESTController';
|
||||
import * as controllers from './Controllers';
|
||||
import { ParseGraphQLServer } from './GraphQL/ParseGraphQLServer';
|
||||
import { SecurityRouter } from './Routers/SecurityRouter';
|
||||
import CheckRunner from './Security/CheckRunner';
|
||||
|
||||
// Mutate the Parse object to add the Cloud Code handlers
|
||||
addParseCloud();
|
||||
@@ -58,6 +60,7 @@ class ParseServer {
|
||||
appId = requiredParameter('You must provide an appId!'),
|
||||
masterKey = requiredParameter('You must provide a masterKey!'),
|
||||
cloud,
|
||||
security,
|
||||
javascriptKey,
|
||||
serverURL = requiredParameter('You must provide a serverURL!'),
|
||||
serverStartComplete,
|
||||
@@ -101,6 +104,10 @@ class ParseServer {
|
||||
throw "argument 'cloud' must either be a string or a function";
|
||||
}
|
||||
}
|
||||
|
||||
if (security && security.enableCheck && security.enableCheckLog) {
|
||||
new CheckRunner(options.security).run();
|
||||
}
|
||||
}
|
||||
|
||||
get app() {
|
||||
@@ -219,6 +226,7 @@ class ParseServer {
|
||||
new CloudCodeRouter(),
|
||||
new AudiencesRouter(),
|
||||
new AggregateRouter(),
|
||||
new SecurityRouter(),
|
||||
];
|
||||
|
||||
const routes = routers.reduce((memo, router) => {
|
||||
|
||||
Reference in New Issue
Block a user