commit
d507e6f617
|
@ -28,3 +28,8 @@ repos:
|
|||
- id: detect-private-key
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- repo: https://github.com/eslint/eslint
|
||||
rev: v7.24.0
|
||||
hooks:
|
||||
- id: eslint
|
||||
args: ["monkey/monkey_island/cc/ui/src/", "--fix", "--max-warnings=0"]
|
||||
|
|
|
@ -71,7 +71,7 @@ script:
|
|||
- cd monkey_island/cc/ui
|
||||
- npm ci # See https://docs.npmjs.com/cli/ci.html
|
||||
- eslint ./src --quiet # Test for errors
|
||||
- JS_WARNINGS_AMOUNT_UPPER_LIMIT=7
|
||||
- JS_WARNINGS_AMOUNT_UPPER_LIMIT=0
|
||||
- eslint ./src --max-warnings $JS_WARNINGS_AMOUNT_UPPER_LIMIT # Test for max warnings
|
||||
|
||||
# Build documentation
|
||||
|
|
|
@ -23,3 +23,11 @@ This means setting up an environment with Linux 32/64-bit with Python installed
|
|||
The Monkey Island is a Python backend React frontend project. Similar to the agent, the backend's requirements are listed in the matching [`requirements.txt`](https://github.com/guardicore/monkey/blob/master/monkey/monkey_island/requirements.txt).
|
||||
|
||||
To setup a working front environment, run the instructions listed in the [`readme.txt`](https://github.com/guardicore/monkey/blob/master/monkey/monkey_island/readme.txt)
|
||||
|
||||
## Pre-commit
|
||||
|
||||
Pre-commit is a multi-language package manager for pre-commit hooks. It will run a set of checks when you attempt to commit. If your commit does not pass all checks, it will be reformatted and/or you'll be given a list of errors and warnings that need to be fixed before you can commit.
|
||||
|
||||
Our CI system runs the same checks when pull requests are submitted. This system may report that the build has failed if the pre-commit hooks have not been run or all issues have not been resolved.
|
||||
|
||||
To install and configure pre-commit, run `pip install --user pre-commit`. Next, go to the top level directory of this repository and run `pre-commit install`. Pre-commit will now run automatically whenever you `git commit`.
|
||||
|
|
|
@ -56,7 +56,7 @@ const getContents = (props) => {
|
|||
// update existing state, not run-over
|
||||
let prevRes = result;
|
||||
for (let key in result) {
|
||||
if (result.hasOwnProperty(key)) {
|
||||
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
||||
prevRes[key] = result[key];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ function RunOptions(props) {
|
|||
.then(res => {
|
||||
let commandServers = res.configuration.internal.island_server.command_servers;
|
||||
let ipAddresses = commandServers.map(ip => {
|
||||
return ip.split(":", 1);
|
||||
return ip.split(':', 1);
|
||||
});
|
||||
setIps(ipAddresses);
|
||||
setInitialized(true);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import React from 'react';
|
||||
import Graph from 'react-graph-vis';
|
||||
import Dimensions from 'react-dimensions'
|
||||
|
||||
class GraphWrapper extends React.Component {
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class ReportPageComponent extends AuthComponent {
|
|||
credentialTypes = {
|
||||
PASSWORD: 'password',
|
||||
HASH: 'hash',
|
||||
KEY: 'key',
|
||||
KEY: 'key'
|
||||
}
|
||||
|
||||
issueContentTypes = {
|
||||
|
@ -152,7 +152,7 @@ class ReportPageComponent extends AuthComponent {
|
|||
[this.issueContentTypes.TYPE]: this.issueTypes.DANGER
|
||||
},
|
||||
'zerologon_pass_restore_failed': {
|
||||
[this.issueContentTypes.OVERVIEW]: zerologonOverviewWithFailedPassResetWarning,
|
||||
[this.issueContentTypes.OVERVIEW]: zerologonOverviewWithFailedPassResetWarning
|
||||
},
|
||||
'island_cross_segment': {
|
||||
[this.issueContentTypes.OVERVIEW]: crossSegmentIssueOverview,
|
||||
|
@ -437,9 +437,9 @@ class ReportPageComponent extends AuthComponent {
|
|||
|
||||
isIssuePotentialSecurityIssue(issueName) {
|
||||
let issueDescriptor = this.IssueDescriptorEnum[issueName];
|
||||
return issueDescriptor.hasOwnProperty(this.issueContentTypes.TYPE) &&
|
||||
return Object.prototype.hasOwnProperty.call(issueDescriptor, this.issueContentTypes.TYPE) &&
|
||||
issueDescriptor[this.issueContentTypes.TYPE] === this.issueTypes.WARNING &&
|
||||
issueDescriptor.hasOwnProperty(this.issueContentTypes.OVERVIEW);
|
||||
Object.prototype.hasOwnProperty.call(issueDescriptor, this.issueContentTypes.OVERVIEW);
|
||||
}
|
||||
|
||||
getImmediateThreats() {
|
||||
|
@ -476,9 +476,9 @@ class ReportPageComponent extends AuthComponent {
|
|||
|
||||
isIssueImmediateThreat(issueName) {
|
||||
let issueDescriptor = this.IssueDescriptorEnum[issueName];
|
||||
return issueDescriptor.hasOwnProperty(this.issueContentTypes.TYPE) &&
|
||||
return Object.prototype.hasOwnProperty.call(issueDescriptor, this.issueContentTypes.TYPE) &&
|
||||
issueDescriptor[this.issueContentTypes.TYPE] === this.issueTypes.DANGER &&
|
||||
issueDescriptor.hasOwnProperty(this.issueContentTypes.OVERVIEW);
|
||||
Object.prototype.hasOwnProperty.call(issueDescriptor, this.issueContentTypes.OVERVIEW);
|
||||
}
|
||||
|
||||
getImmediateThreatsOverviews() {
|
||||
|
@ -597,8 +597,8 @@ class ReportPageComponent extends AuthComponent {
|
|||
generateIssue = (issue) => {
|
||||
let issueDescriptor = this.IssueDescriptorEnum[issue.type];
|
||||
|
||||
let reportFnc = (issue) => {};
|
||||
if (issue.hasOwnProperty('credential_type') && issue.credential_type !== null) {
|
||||
let reportFnc = {};
|
||||
if (Object.prototype.hasOwnProperty.call(issue, 'credential_type') && issue.credential_type !== null) {
|
||||
reportFnc = issueDescriptor[this.issueContentTypes.REPORT][issue.credential_type];
|
||||
} else {
|
||||
reportFnc = issueDescriptor[this.issueContentTypes.REPORT];
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
class IssueDescriptor {
|
||||
constructor(name, overviewComponent, reportComponent) {
|
||||
this.name = name;
|
||||
this.overviewComponent = overviewComponent;
|
||||
this.reportComponent = reportComponent;
|
||||
}
|
||||
}
|
|
@ -3,11 +3,11 @@ import CollapsibleWellComponent from '../CollapsibleWell';
|
|||
import {generateInfoBadges} from './utils';
|
||||
|
||||
export function sharedPasswordsIssueOverview() {
|
||||
return (<li key={"shared_passwords"}>Multiple users have the same password</li>)
|
||||
return (<li key={'shared_passwords'}>Multiple users have the same password</li>)
|
||||
}
|
||||
|
||||
export function sharedAdminsDomainIssueOverview() {
|
||||
return (<li key={"admin_domains"}>Shared local administrator account - Different machines have the same account as a local
|
||||
return (<li key={'admin_domains'}>Shared local administrator account - Different machines have the same account as a local
|
||||
administrator.</li>)
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ const columns = [
|
|||
columns: [
|
||||
{
|
||||
Header: 'Status', id: 'status',
|
||||
accessor: x => {
|
||||
accessor: function getAccessor (x) {
|
||||
return <StatusLabel status={x.status} size="3x" showText={false}/>;
|
||||
},
|
||||
maxWidth: MAX_WIDTH_STATUS_COLUMN
|
||||
|
@ -24,7 +24,7 @@ const columns = [
|
|||
{
|
||||
Header: 'Monkey Tests', id: 'tests',
|
||||
style: {'whiteSpace': 'unset'}, // This enables word wrap
|
||||
accessor: x => {
|
||||
accessor: function getAccessor (x) {
|
||||
return <TestsStatus tests={x.tests}/>;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue