Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eMASS V3.9 Specification Updates #1426

Merged
merged 10 commits into from
May 30, 2023
Merged

eMASS V3.9 Specification Updates #1426

merged 10 commits into from
May 30, 2023

Conversation

georgedias
Copy link
Contributor

@georgedias georgedias commented May 23, 2023

  • Make updates provided by eMASS specifications 3.5 to 3.9
  • Add additional endpoints provide by eMASS specifications 3.5 to 3.9

How to test

Checkout (gh pr checkout 1426) or clone (git clone -b emass_v3_9 [email protected]:mitre/saf.git) the PR

Install dependencies

> git install

Build the executables

> npm run prepack

Generate the .env variables

Run the configure command to generate a .env configuration file containing the necessary environmental variables.

For additional information on how too references Generating an eMASS Configuration file

The command to invoke the configure utility from the development environment is:

> node bin\run emasser configure (use -h for help)

You need to know the appropriate API and user key, certificates (key.pem and cert.pem), key cert password, dev env host url.

endpoints added (to test)

> node bin\run emasser get dashboards artifacts_summary -o 14
> node bin\run emasser get dashboards artifacts_details -o 14
> node bin\run emasser get dashboards sensor_hardware_summary -o 14
> node bin\run emasser get dashboards sensor_hardware_details -o 14
> node bin\run emasser get dashboards ports_protocols_summary -o 14
> node bin\run emasser get dashboards ports_protocols_summary -o 14
> node bin\run emasser get dashboards ports_protocols_details -o 14
> node bin\run emasser get dashboards fisma_inventory_crypto_summary -o 14
> node bin\run emasser get dashboards va_threat_risk_summary -o 14
> node bin\run emasser get dashboards va_threat_source_details -o 14
> node bin\run emasser get dashboards va_threat_architecture_details -o 14

Note Some endpoints don't return any data, but should return a 200 status

Test all emasser endpoints

To run all of the emasser unit tests (51) use this command:

> ts-mocha --timeout 8500 --forbid-only .\test\commands\emasser\* 

@mergify
Copy link
Contributor

mergify bot commented May 24, 2023

This pull request has a conflict. Could you fix it @georgedias?

@georgedias georgedias requested a review from em-c-rod May 25, 2023 03:50
package.json Outdated Show resolved Hide resolved
@@ -13,7 +13,7 @@ import {FlagOptions,
const endpoint = 'artifacts'

export default class EmasserGetArtifacts extends Command {
static usage = '<%= command.id %> [ARGUMENTS]';
static usage = '<%= command.id %> [ARGUMENT] \n \x1B[93m NOTE: see EXAMPLES for argument case format\x1B[0m';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which command makes this show up?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bin/run emasser get artifacts -h or --help

@@ -9,7 +9,7 @@ import {outputError} from '../../../utils/emasser/outputError'
import {FlagOptions, getFlagsForEndpoint} from '../../../utils/emasser/utilities'

export default class EmasserDeletePoams extends Command {
static usage = '<%= command.id %> [ARGUMENTS]';
static usage = '<%= command.id %> [options]';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between ARGUMENTS and options?

Copy link
Contributor Author

@georgedias georgedias May 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

options are actually the FLAGS, I contemplated what to put there.
Should we use [flag options] or [FLAG options] or simply [flags] or just [FLAGS] - what do you think?

this.log(this.formatCommand(command))
}

this.log('')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, what effect does this.log('') have?

}

protected log(...args: string[]): void {
stdout.write(util.format.apply(this, args) + '\n') // skipcq: JS-0357
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, does this.log('') effectively print a newline?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.log is what is outputting to the console. I had to implement the Streams class to add the additional logModify(), where the new display values are replaced.

@sonarcloud
Copy link

sonarcloud bot commented May 30, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
30.6% 30.6% Duplication

Copy link
Contributor

@em-c-rod em-c-rod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@em-c-rod em-c-rod merged commit 32a6ffc into main May 30, 2023
@em-c-rod em-c-rod deleted the emass_v3_9 branch May 30, 2023 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants