diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8eab8ce..30f20c8 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -38,11 +38,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -53,7 +53,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -67,4 +67,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index fc32573..0ba5e73 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -11,7 +11,7 @@ jobs: name: Copy Markdown Files to gh_pages steps: - name: Checkout 🛎ī¸ - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build Deploment Folder 🔧 run: | diff --git a/.github/workflows/push-to-docker-mail.yml b/.github/workflows/push-to-docker-mail.yml index bce50e4..fd7af7e 100644 --- a/.github/workflows/push-to-docker-mail.yml +++ b/.github/workflows/push-to-docker-mail.yml @@ -10,17 +10,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Checkout the emasser Repository - uses: actions/checkout@v3 + - name: Checkout the eMASSer Repository + uses: actions/checkout@v4 - name: Build and push id: docker_build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: context: . file: Dockerfile diff --git a/.github/workflows/push-to-docker.yml b/.github/workflows/push-to-docker.yml index 67df2b7..6c843bd 100644 --- a/.github/workflows/push-to-docker.yml +++ b/.github/workflows/push-to-docker.yml @@ -9,9 +9,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -24,10 +24,10 @@ jobs: replace-with: '' flags: 'g' - name: Checkout the emasser Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build and push id: docker_build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: context: . file: Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9556d1b..427732b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Setup ruby uses: actions/setup-ruby@v1 - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - run: git fetch origin +refs/tags/*:refs/tags/* diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index f741f44..d15cce1 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -9,7 +9,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - run: git fetch origin +refs/tags/*:refs/tags/* diff --git a/.github/workflows/test-cli.yml b/.github/workflows/test-cli.yml index 95f7908..4ce12aa 100644 --- a/.github/workflows/test-cli.yml +++ b/.github/workflows/test-cli.yml @@ -19,7 +19,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: crazy-max/ghaction-chocolatey@v1 with: args: install curl -y diff --git a/CHANGELOG.md b/CHANGELOG.md index aaf5a4b..68caf9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,59 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] -- Harden the docker container (ex. non root user, etc). +## [3.12.0] Oct 11, 2023 +### Changes +- Implemented eMASS API V3.12 specifications (to include previous updates) + +## [3.10.0] Jun 27, 2023 +### Changes +- Implemented eMASS API 3.10 specifications +## [3.4.1] Oct 7, 2022 +### Changes +- Included the ability to register NPE credentials and obtain the Api key api-key + +## [3.4.0] Sep 22, 2022 +### Changes +- Implemented API specifications V3.4 +- Changed release version to match API specificationa + +## [1.0.6] Jun 17, 2022 +### Changes +- addMultiplePackages + +## [1.0.3] Jan 14, 2022 +### Changes +- UpdateVersionTags + +## [1.0.2] Jan 14, 2022 +### Changes +- updateCLI_Help + +## [1.0.1] Jan 3, 2022 +### Changes +- Rename swagger_client to emass_client and publish it to rubygems. + +## [1.0.0] - Dec 29, 2021 +### Changes +- addReleaseWorkflow @georgedias (#26) +- create test-cli workflow @georgedias (#25) +- Add cli tests @georgedias (#24) +- Add the stoplight prism mock server as a server selection @georgedias (#23) +- Update eMASSRestOpenApi.yaml @georgedias (#22) +- ci(Mergify): configuration update @camdenmoors (#21) +- fix_gh_pages @georgedias (#18) +- Fixed the removal of jekyll thene when updating the gh_pages @georgedias (#17) +- Add workflow to update markdown files in gh-pages @georgedias (#15) +- Udates to the emasser features documentation @georgedias (#13) +- corrected controls post/put requests @georgedias (#9) +- Added eMASS contact information to the README @georgedias (#8) +- Update eMASSOpenAPI specification, add redoc and swagger documentation @rbclark (#6) + +### Features + +- Initial workflow configuration @georgedias (#10) + ## [0.2.0] - 2020-12-14 ### Added - Scaffolding for the emasser project including such things as a Dockerfile, a .gitlab-ci.yml, some repository dependencies such as `standard` and `minitest`, and some gem dependencies such as `thor`. diff --git a/Gemfile.lock b/Gemfile.lock index d001676..7320435 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,18 +1,18 @@ PATH remote: . specs: - emasser (3.4.1) + emasser (3.12.0) activesupport (>= 6.1.4, < 7.1.0) colorize (~> 0.8.1) dotenv (~> 2.7.6) - emass_client (~> 3.10) + emass_client (~> 3.12) rubyzip (~> 2.3.2) thor (~> 1.1.0) GEM remote: https://rubygems.org/ specs: - activesupport (7.0.5) + activesupport (7.0.8) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -26,16 +26,16 @@ GEM concurrent-ruby (1.2.2) diff-lcs (1.5.0) dotenv (2.7.6) - emass_client (3.10.1) + emass_client (3.12.0) typhoeus (~> 1.0, >= 1.0.1) ethon (0.16.0) ffi (>= 1.15.0) - ffi (1.15.5) - ffi (1.15.5-x64-mingw32) + ffi (1.16.3) + ffi (1.16.3-x64-mingw32) i18n (1.14.1) concurrent-ruby (~> 1.0) json (2.6.3) - minitest (5.18.1) + minitest (5.20.0) parallel (1.23.0) parser (3.2.2.3) ast (~> 2.4.1) diff --git a/README.md b/README.md index 71d2209..eec6ec7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# emasser +# eMASSer ![GitHub Release Date](https://img.shields.io/github/release-date/mitre/emasser?label=Release%20Date&logo=github&color=blue) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/mitre/emasser?label=Release%20Version&logo=github) ![Gem](https://img.shields.io/gem/v/emasser?label=gem%20version&logo=ruby&logoColor=red) ![Docker Version](https://img.shields.io/docker/v/mitre/emasser?label=docker%20version&logo=docker&sort=semver) @@ -9,29 +9,29 @@ ## About -`emasser` is a Command Line Interface (CLI) that aims to automate routine business use-cases and provide utility surrounding the Enterprise Mission Assurance Support Service (eMASS) by leveraging its Representational State Transfer (REST) Application Programming Interface (API). +`eMASSer` is a Command Line Interface (CLI) that aims to automate routine business use-cases and provide utility surrounding the Enterprise Mission Assurance Support Service (eMASS) by leveraging its Representational State Transfer (REST) [Application Programming Interface (API)](https://mitre.github.io/emass_client/docs/eMASS_API_Documentation.pdf). -***NOTE***: The `emasser` CLI utilizes the [emass_client](https://github.com/mitre/emass_client) RubyGem executable package to access the eMASS API endpoints. +***NOTE***: The `eMASSer` CLI utilizes the [emass_client](https://github.com/mitre/emass_client) RubyGem executable package to access the eMASS API endpoints. --- ## Documentation For detail content information about the `eMASS` API references the [**eMASS API Specification**](https://mitre.github.io/emass_client/docs/redoc/) page. -For detail features provided by the `emasser` CLI references the [**emasser CLI Features**](docs/features.md) page. +For detail features provided by the `eMASSer` CLI references the [**eMASSer CLI Features**](docs/features.md) page. -The `emasser` CLI [**Architecture**](#emasser-cli-architecture) depicts the `emasser` structure, and provides an explanation of how it behaves. +The `eMASSer` CLI [**Architecture**](#emasser-cli-architecture) depicts the structure, and provides an explanation of CLI behaviors. --- ## Installation Options -`emasser` is a Ruby CLI distributed via GitHub (this repository), [RubyGems](https://rubygems.org/gems/emass_client/versions/), or [Docker](https://hub.docker.com/r/mitre/emasser/tags). +`eMASSer` is a Ruby CLI distributed via GitHub (this repository), [RubyGems](https://rubygems.org/gems/emass_client/versions/), or [Docker](https://hub.docker.com/r/mitre/emasser/tags). ### Installation Dependencies * git * Ruby version 2.7 or greater -### Runtime Dependencies - * Ruby version 2.7 or greater. +### Runtime Major Dependencies + * Ruby version 2.7 or greater * `rubyzip (latest version)` * `emass_client (latest version)` * On Windows the `cURL` binary is required (libcurl.dll). To install cURL: @@ -41,6 +41,7 @@ The `emasser` CLI [**Architecture**](#emasser-cli-architecture) depicts the `ema - Extract the file into the Ruby installation /bin directory - Rename the file to `libcurl.dll` if it has the `_x64` suffix - Install [cURL for windows](https://community.chocolatey.org/packages/curl) and add the installation directory to the PATH. + * See the `emasser.gemspec` file for all other dependencies ## Install via GitHub @@ -49,7 +50,7 @@ The `emasser` CLI [**Architecture**](#emasser-cli-architecture) depicts the `ema git clone emasser cd emasser ``` -- Build the emasser gem* +- Build the eMASSer gem* ```bash gem build *.gemspec gem install *.gem @@ -81,7 +82,7 @@ bundle exec exe/emasser [command] ***Note:** See [Setting Environment Variables Configuration](https://github.com/mitre/emasser/wiki/Editing-Environment-Variables-Configuration) for detailed information on required and optional variables. ## Using Docker -Ensure that docker engine is running and start the emasser Docker Container. +Ensure that docker engine is running and start the eMASSer Docker Container. ### Install - On Linux or Mac: ``` @@ -109,7 +110,7 @@ Ensure that docker engine is running and start the emasser Docker Container. ``` - See [Editing Environment Variables Configuration](https://github.com/mitre/emasser/wiki/Editing-Environment-Variables-Configuration) -### Run emasser API client commands +### Run eMASSer API client commands - To list all available GET, POST, PUT, or DELETE commands use: ``` docker run --rm -v $PWD/path-to-secrets:/data mitre/emasser:latest get help @@ -132,7 +133,7 @@ Ensure that docker engine is running and start the emasser Docker Container. --- ## Roadmap -The `emasser` implements all endpoints provided by the `eMASS` API, there is, all of the functions available from the `eMASS GUI` that are exposed by the API. If additional functions are useful (accessible via the CLI), please submit a request to [eMass Tier III Support](mailto:disa.meade.id.mbx.emass-tier-iii-support@mail.mil) for possible inclusion into the API. +The `eMASSer` implements all endpoints provided by the `eMASS` API, there is, all of the functions available from the `eMASS GUI` that are exposed by the API. If additional functions are useful (accessible via the CLI), please submit a request to [eMass Tier III Support](mailto:disa.meade.id.mbx.emass-tier-iii-support@mail.mil) for possible inclusion into the API. The Road Map seeks to add any useful features that facilitates organization that utilizes `eMASS` instances and have a need to automate their cybersecurity management process. @@ -147,13 +148,13 @@ Some proposed capabilities (looking for a sponsor) are: ## Design ### Interactions with eMASS API -The `emasser` CLI leverages the [emass_client](https://github.com/mitre/emass_client), which provides a REST API client developed by MITRE based on the [OpenAPI V3](https://www.openapis.org/) standards for the official [eMASS API specification](https://mitre.github.io/emass_client/docs/redoc). This design enables REST API clients to be generated in [any supported programming language](https://openapi-generator.tech/docs/generators/). The design enables the `emass_client` to be generated independently of the emasser CLI. Currently, a Ruby and a Typescript eMASS client API are provided. The TypeScript client is used with the [Security Automation Framework CLI (SAF) CLI](https://github.com/mitre/saf). +The `eMASSer` CLI leverages the [emass_client](https://github.com/mitre/emass_client), which provides a REST API client developed by MITRE based on the [OpenAPI V3](https://www.openapis.org/) standards for the official [eMASS API specification](https://mitre.github.io/emass_client/docs/redoc). This design enables REST API clients to be generated in [any supported programming language](https://openapi-generator.tech/docs/generators/). The design enables the `emass_client` to be generated independently of the eMASSer CLI. Currently, a Ruby and a Typescript eMASS client API are provided. The TypeScript client is used with the [Security Automation Framework CLI (SAF) CLI](https://github.com/mitre/saf). ### Business Logic -Because interactions with the API are handled by a dependency, the bulk of `emasser` business logic is for accepting user input/output, reading data from eMASS or from input, transforming data, and routing data to the appropriate eMASS API endpoint. This business logic is organized into Ruby Classes and Modules based on the command or subcommand requested by the user. +Because interactions with the API are handled by a dependency, the bulk of `eMASSer` business logic is for accepting user input/output, reading data from eMASS or from input, transforming data, and routing data to the appropriate eMASS API endpoint. This business logic is organized into Ruby Classes and Modules based on the command or subcommand requested by the user. -## Emasser CLI Architecture -The `emasser` CLI makes use of the `emass_client` ruby gem to communicate with an `eMASS` instance via the `eMASS API` as depicted in the diagram below: +## eMASSer CLI Architecture +The `eMASSer` CLI makes use of the `emass_client` ruby gem to communicate with an `eMASS` instance via the `eMASS API` as depicted in the diagram below:
emasser CLI Architecture diff --git a/docs/features.md b/docs/features.md index b035033..c5c6415 100644 --- a/docs/features.md +++ b/docs/features.md @@ -1,14 +1,14 @@ -# emasser CLI Features +# eMASSer CLI Features ## Environment Variables -To facilitate setting the required environment variables the `emasser `CLI utilized the zero-dependency module to load these variables from a `.env` file. +To facilitate setting the required environment variables the `eMASSer `CLI utilized the zero-dependency module to load these variables from a `.env` file. ### Configuring the `.env` File An `.env-example` file is provided with the required and optional fields. Modify the `.env_example` as necessary and save it as a `.env` file. -Place the file on the path where the `emasser` command is executed. +Place the file on the path where the `eMASSer` command is executed. ### Required and Optional Environment Variables The following environment variables are required: @@ -25,7 +25,7 @@ The following environment variables are optional*: * EMASSER_VERIFY_SSL_HOST=`` * EMASSER_DEBUGGING=`` * EMASSER_CLI_DISPLAY_NULL=`` -* EMASSER_POCH_TO_DATETIME=`` +* EMASSER_EPOCH_TO_DATETIME=`` \* If not provided defaults are used @@ -34,70 +34,143 @@ The proper format to set these variables in the `.env` files is as follows: export [VARIABLE_NAME]='value' ``` ***NOTE*** -`emasser` requires authentication to an eMASS instance as well as authorization to use the eMASS API. This authentication and authorization is **not** a function of `emasser` and needs to be accomplished with the eMASS instances owner organization. Further information about eMASS credential requirements refer to [Defense Counterintelligence and Security Agency](https://www.dcsa.mil/is/emass/) about eMASS access. +`eMASSer` requires authentication to an eMASS instance as well as authorization to use the eMASS API. This authentication and authorization is **not** a function of `eMASSer` and needs to be accomplished with the eMASS instances owner organization. Further information about eMASS credential requirements refer to [Defense Counterintelligence and Security Agency](https://www.dcsa.mil/is/emass/) about eMASS access. --- -## Common emasser Endpoint Requests Information +## Common eMASSer Endpoint Requests Information - To invoke any boolean parameters use --parameterName for TRUE and --no-parameterName for FALSE - - The eMASS API provides the capability of updating multiple entries within several endpoints, however the `emasser` CLI, in some cases only supports updating one entry at the time. - -## Invoking emasser CLI Commands - -The CLI invoke commands listed in this document shows them when executing from the source code (after a pull from GitHub). Please reference the [`emasser` README](https://mitre.github.io/emasser/) on how to invoke the CLI using other available executables (gem or docker). - -## API Endpoints Provided - -### GET -* [/api](#get-test-connection) -* [/api/system](#get-system) -* [/api/systems](#get-systems) -* [/api/systems/{systemId}](#get-system) -* [/api/system-roles](#get-roles) -* [/api/system-roles/{roleCategory}](#get-roles) -* [/api/systems/{systemId}/controls](#get-controls) -* [/api/systems/{systemId}/test-results](#get-testresults) -* [/api/systems/{systemId}/poams](#get-poams) -* [/api/systems/{systemId}/poams/{poamId}](#get-poams) -* [/api/systems/{systemId}/poams/{poamId}/milestones](#get-milestones) -* [/api/systems/{systemId}/poams/{poamId}/milestones/{milestoneId})](#get-milestones) -* [/api/systems/{systemId}/artifacts](#get-artifacts) -* [/api/systems/{systemId}/artifacts-export](#get-artifacts) -* [/api/systems/{systemId}/approval/cac](#get-cac) -* [/api/systems/{systemId}/approval/pac](#get-pac) -* [/api/cmmc-assessments](#get-cmmc) -* [/api/workflow-definitions](#get-workflow_definitions) -* [/api/systems/{systemId}/workflow-instances](#get-workflow_instances) -* [/api/dashboards/system-status-details](#get-dashboards) -* [/api/dashboards/system-control-compliance-summary](#get-dashboards) -* [/api/dashboards/system-security-controls-details](#get-dashboards) -* [/api/dashboards/system-assessment-procedures-details](#get-dashboards) -* [/api/dashboards/system-poam-summary](#get-dashboards) -* [/api/dashboards/system-poam-details](#get-dashboards) -* [/api/dashboards/system-artifacts-summary](#get-dashboards) -* [/api/dashboards/system-artifacts-details](#get-dashboards) -* [/api/dashboards/system-hardware-summary](#get-dashboards) -* [/api/dashboards/system-hardware-details](#get-dashboards) -* [/api/dashboards/system-sensor-hardware-summary](#get-dashboards) -* [/api/dashboards/system-sensor-hardware-details](#get-dashboards) -* [/api/dashboards/system-software-summary](#get-dashboards) -* [/api/dashboards/system-software-details](#get-dashboards) -* [/api/dashboards/system-ports-protocols-summary](#get-dashboards) -* [/api/dashboards/system-ports-protocols-details](#get-dashboards) -* [/api/dashboards/system-conmon-integration-status-summary](#get-dashboards) -* [/api/dashboards/system-associations-details](#get-dashboards) -* [/api/dashboards/user-system-assignments-details](#get-dashboards) -* [/api/dashboards/system-privacy-summary](#get-dashboards) -* [/api/dashboards/va-omb-fisma-saop-summary](#get-dashboards) -* [/api/dashboards/va-system-aa-summary](#get-dashboards) -* [/api/dashboards/va-system-a2-summary](#get-dashboards) -* [/api/dashboards/va-system-pl-109-reporting-summary](#get-dashboards) -* [/api/dashboards/va-system-fisma-inventory-summary](#get-dashboards) -* [/api/dashboards/va-system-fisma-inventory-crypto-summary](#get-dashboards) -* [/api/dashboards/va-system-threat-risks-summary](#get-dashboards) -* [/api/dashboards/va-system-threat-sources-details](#get-dashboards) -* [/api/dashboards/va-system-threat-architecture-details](#get-dashboards) + - The eMASS API provides the capability of updating multiple entries within several endpoints, however the `eMASSer` CLI, in some cases only supports updating one entry at the time. + +## Invoking eMASSer CLI Commands + +The CLI invoke commands listed in this document shows them when executing from the source code (after a pull from GitHub). Please reference the [`eMASSer` README](https://mitre.github.io/emasser/) on how to invoke the CLI using other available executables (gem or docker). + +## GET Endpoints +#### Test Connection + * [/api](#get-test-connection) + +#### System Endpoints + * [/api/system](#get-system) + * [/api/systems](#get-systems) + * [/api/systems/{systemId}](#get-system) + +#### System Roles Endpoints + * [/api/system-roles](#get-roles) + * [/api/system-roles/{roleCategory}](#get-roles) + +#### Controls Endpoint + * [/api/systems/{systemId}/controls](#get-controls) + +#### Test Results Endpoint + * [/api/systems/{systemId}/test-results](#get-test_results) + +#### POA&Ms Endpoints + * [/api/systems/{systemId}/poams](#get-poams) + * [/api/systems/{systemId}/poams/{poamId}](#get-poams) + +#### Milestones Endpoints + * [/api/systems/{systemId}/poams/{poamId}/milestones](#get-milestones) + * [/api/systems/{systemId}/poams/{poamId}/milestones/{milestoneId})](#get-milestones) + +#### Artifacts Endpoints + * [/api/systems/{systemId}/artifacts](#get-artifacts) + * [/api/systems/{systemId}/artifacts-export](#get-artifacts) + +#### CAC Endpoint + * [/api/systems/{systemId}/approval/cac](#get-cac) + +#### PAC Endpoint + * [/api/systems/{systemId}/approval/pac](#get-pac) + +#### CMMC Assessment Endpoint + * [/api/cmmc-assessments](#get-cmmc) + +#### Workflow Definition Endpoint + * [/api/workflow-definitions](#get-workflow_definitions) + +#### Workflow Instances Endpoint + * [/api/systems/{systemId}/workflow-instances](#get-workflow_instances) + +### [Dashboards](#get-dashboards) + +#### System Status Dashboard + * [/api/dashboards/system-status-details](#system-status-endpoint) + +#### Enterprise Terms Conditions Dashboard + * [/api/dashboards/system-terms-conditions-summary](#system-terms-conditions-endpoints) + * [/api/dashboards/system-terms-conditions-details](#system-terms-conditions-endpoints) + +### Enterprise Security Controls Dashboard + * [/api/dashboards/system-control-compliance-summary](#enterprise-security-controls-endpoints) + * [/api/dashboards/system-security-controls-details](#enterprise-security-controls-endpoints) + * [/api/dashboards/system-assessment-procedures-details](#enterprise-security-controls-endpoints) + +### Enterprise POA&M Dashboard + * [/api/dashboards/system-poam-summary](#enterprise-poam-endpoints) + * [/api/dashboards/system-poam-details](#enterprise-poam-endpoints) + +### Enterprise Artifacts Dashboard + * [/api/dashboards/system-artifacts-summary](#enterprise-artifacts-endpoints) + * [/api/dashboards/system-artifacts-details](#enterprise-artifacts-endpoints) + +### Hardware Baseline Dashboard + * [/api/dashboards/system-hardware-summary](#hardware-baseline-endpoints) + * [/api/dashboards/system-hardware-details](#hardware-baseline-endpoints) + +### Enterprise Sensor-based Hardware Resources Dashboard + * [/api/dashboards/system-sensor-hardware-summary](#enterprise-sensor-based-hardware-resources-endpoints) + * [/api/dashboards/system-sensor-hardware-details](#enterprise-sensor-based-hardware-resources-endpoints) + +### Software Baseline Dashboard + * [/api/dashboards/system-software-summary](#software-baseline-endpoints) + * [/api/dashboards/system-software-details](#software-baseline-endpoints) + +### Enterprise Sensor-based Software Resources Dashboard + * [/api/dashboards/system-sensor-software-summary](#enterprise-sensor-based-software-resources-endpoints) + * [/api/dashboards/system-sensor-software-details](#enterprise-sensor-based-software-resources-endpoints) + * [/api/dashboards/system-sensor-software-counts](#enterprise-sensor-based-software-resources-endpoints) + +### Enterprise Vulnerability Dashboard + * [/api/dashboards/system-vulnerability-summary](#enterprise-vulnerability-endpoints) + * [/api/dashboards/system-device-findings-summary](#enterprise-vulnerability-endpoints) + * [/api/dashboards/system-device-findings-details](#enterprise-vulnerability-endpoints) + +### Ports and Protocols Dashboard + * [/api/dashboards/system-ports-protocols-summary](#ports-and-protocols-endpoints) + * [/api/dashboards/system-ports-protocols-details](#ports-and-protocols-endpoints) + +### System CONMON Integration Status Dashboard + * [/api/dashboards/system-conmon-integration-status-summary](#system-conmon-integration-status-endpoint) + +### System Associations Dashboard + * [/api/dashboards/system-associations-details](#system-associations-endpoint) + +### Users Dashboard + * [/api/dashboards/user-system-assignments-details](#users-endpoint) + +### Privacy Compliance Dashboard + * [/api/dashboards/system-privacy-summary](#privacy-compliance-endpoints) + * [/api/dashboards/va-omb-fisma-saop-summary](#privacy-compliance-endpoints) + +### System A&A Summary Dashboard + * [/api/dashboards/va-system-aa-summary](#system-aa-summary-endpoint) + +### System A2.0 Summary Dashboard + * [/api/dashboards/va-system-a2-summary](#system-a20-summary-endpoint) + +### System P.L. 109 Reporting Summary Dashboard + * [/api/dashboards/va-system-pl-109-reporting-summary](#system-pl-109-reporting-summary-endpoint) + +### FISMA Inventory Summary Dashboard + * [/api/dashboards/va-system-fisma-inventory-summary](#fisma-inventory-summary-endpoints) + * [/api/dashboards/va-system-fisma-inventory-crypto-summary](#fisma-inventory-summary-endpoints) + +### Threat Risks Dashboard + * [/api/dashboards/va-system-threat-risks-summary](#threat-risks-endpoints) + * [/api/dashboards/va-system-threat-sources-details](#threat-risks-endpoints) + * [/api/dashboards/va-system-threat-architecture-details](#threat-risks-endpoints) -### POST +## POST Endpoints * [/api/systems/{systemId}/test-results](#post-test_results) * [/api/systems/{systemId}/poam](#post-poams) * [/api/systems/{systemId}/poam/{poamId}/milestones](#post-milestones) @@ -108,18 +181,20 @@ The CLI invoke commands listed in this document shows them when executing from t * [/api/systems/{systemId}/cloud-resource-results](#post-cloud_resource) * [/api/systems/{systemId}/container-scan-results](#post-container) -### PUT +## PUT Endpoints * [/api/systems/{systemId}/controls](#put-controls) * [/api/systems/{systemId}/poams](#put-poams) * [/api/systems/{systemId}/poams/{poamId}/milestones](#put-milestones) * [/api/systems/{systemId}/artifacts](#put-artifacts) -### DELETE +## DELETE Endpoints * [/api/systems/{systemId}/poams](#delete-poams) * [/api/systems/{systemId}/poams/{poamId}/milestones](#delete-milestones) * [/api/systems/{systemId}/artifacts](#delete-artifacts) +* [/api/systems/{systemId}/cloud-resource-results](#delete-cloud-resource) +* [/api/systems/{systemId}/container-scan-results](#delete-container) -## Endpoints CLI help +# Endpoints CLI help Each CLI endpoint command has several layers of help. - Using `help` after a `get, put, post, or delete` command lists all available endpoint calls. The following command would list all available `GET` endpoints commands. @@ -148,20 +223,21 @@ Each CLI endpoint command has several layers of help. ```bash $ bundle exec exe/emasser get help artifacts commands: - emasser get artifacts export --filename=FILENAME --systemId=N # Get artifa... - emasser get artifacts forSystem --systemId=N # Get all sy... - emasser get artifacts help [COMMAND] # Describe s... + emasser get artifacts export -f, --filename=FILENAME -s, --systemId=N # Get artifa... + emasser get artifacts forSystem -s, --systemId=N # Get all sy... + emasser get artifacts help [COMMAND] # Describe s... ``` - Using `help` after any command lists all available options. The following command would list all available options for the `get artifacts export` endpoint command. ```bash $ bundle exec exe/emasser get artifacts help export Usage: - emasser get artifacts export --filename=FILENAME --systemId=N + emasser get artifacts export -f, --filename=FILENAME -s, --systemId=N Options: - --systemId=N # A numeric value representing the system identification - --filename=FILENAME # The artifact file name - [--compress], [--no-compress] # BOOLEAN - true or false. + -s, --systemId=N # A numeric value representing the system identification + -f, --filename=FILENAME # The artifact file name + -C, [--compress], [--no-compress] # BOOLEAN - true or false. + -o, [--printToStdout=PRINTTOSTDOUT] # Output file content to terminal - not valid for zip files ``` **The same format is applicable for POST, PUT and DELETE requests as well, however there may be additional help content** @@ -177,7 +253,7 @@ The Test Connection endpoint provides the ability to verify connection to the we A return of success from the call indicates that the CLI can reach the configure server URL. References [Required Environment Variables](#required-environment-variables) for the necessary environment variables. -[top](#api-endpoints-provided) +[top](#test-connection) ### ```get system``` @@ -210,16 +286,16 @@ Retrieves the system content for provided identification (ID) number. To invoke |parameter | type or values | |-------------|:----------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | - Optional parameters are: |parameter | type or values | |------------------------|:----------------------------------------| - |--includePackage |BOOLEAN - true or false | - |--policy |Possible values: diacap, rmf, reporting | + |-I, --includePackage |BOOLEAN - true or false | + |-p, --policy |Possible values: diacap, rmf, reporting | -[top](#api-endpoints-provided) +[top](#system-endpoints) ### ```get systems``` @@ -234,17 +310,17 @@ To retrieve controls use the following command: |parameter | type or values | |------------------------|:----------------------------------------------------------------------------| - |--coamsId |Cyber Operational Attributes Management System (COAMS) string Id | - |--ditprId |DoD Information Technology (IT) Portfolio Repository (DITPR) string id | - |--includeDecommissioned |BOOLEAN - true or false | - |--includeDitprMetrics |BOOLEAN - true or false | - |--includePackage |BOOLEAN - true or false | - |--policy |Possible values: diacap, rmf, reporting | - |--registrationType |Possible values: assessAndAuthorize, assessOnly, guest, regular, functional, | - | | cloudServiceProvider, commonControlProvider | - |--reportsForScorecard |BOOLEAN - true or false | + |-c, --coamsId |Cyber Operational Attributes Management System (COAMS) string Id | + |-t, --ditprId |DoD Information Technology (IT) Portfolio Repository (DITPR) string id | + |-r, --registrationType |Possible values: assessAndAuthorize, assessOnly, guest, regular, functional, | + | | cloudServiceProvider, commonControlProvider | + |-I, --includeDecommissioned |BOOLEAN - true or false | + |-M, --includeDitprMetrics |BOOLEAN - true or false | + |-P, --includePackage |BOOLEAN - true or false | + |-p, --policy |Possible values: diacap, rmf, reporting | + |_S, --reportsForScorecard |BOOLEAN - true or false | -[top](#api-endpoints-provided) +[top](#system-endpoints) ### ```get roles``` ---- @@ -255,138 +331,140 @@ There are two get endpoints for system roles: ``` - byCategory - Retrieves roles based on the following required parameter: ```` - $ bundle exec exe/emasser get roles byCategory --roleCategory=ROLECATEGORY --role=ROLE + $ bundle exec exe/emasser get roles byCategory -c, --roleCategory=ROLECATEGORY -r, --role=ROLE ```` - required parameters are: |parameter | type or values | |:---------------|:------------------------------------------| - |--roleCategory |Possible values: PAC, CAC, Other | - |--role |Possible values: AO, Auditor, Artifact Manager, C&A Team, IAO, ISSO, PM/IAM, SCA, User Rep (View Only), Validator (IV&V)| + |-c, --roleCategory |Possible values: PAC, CAC, Other | + |-r, --role |Possible values: AO, Auditor, Artifact Manager, C&A Team, IAO, ISSO, PM/IAM, SCA, User Rep (View Only), Validator (IV&V)| - optional parameter are: |parameter | type or values | |------------------------|:----------------------------------------| - |--policy |Possible values: diacap, rmf, reporting | - |--includeDecommissioned |BOOLEAN - true or false | + |-p, --policy |Possible values: diacap, rmf, reporting | + -[top](#api-endpoints-provided) +[top](#system-roles-endpoints) ### ```get controls``` ---- To retrieve controls use the following command: - $ bundle exec exe/emasser get controls forSystem --systemId=SYSTEMID + $ bundle exec exe/emasser get controls forSystem -s, --systemId=SYSTEMID - required parameter is: |parameter | type or values | |-------------|:----------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | - optional parameter is: - |parameter | type or values | - |-------------|:------------------------------------------| - |--acronyms |The system acronym(s) e.g "AC-1, AC-2" - if not provided all controls for systemId are returned | + |parameter | type or values | + |---------------|:------------------------------------------| + |-a, --acronyms |The system acronym(s) e.g "AC-1, AC-2" - if not provided all controls for systemId are returned | -[top](#api-endpoints-provided) +[top](#controls-endpoint) ### ```get test_results``` ---- To retrieve test results use the following command: - $ bundle exec exe/emasser get test_results forSystem --systemId=SYSTEMID + $ bundle exec exe/emasser get test_results forSystem -s, --systemId=SYSTEMID - required parameter is: |parameter | type or values | |-------------|:----------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | - optional parameters are: |parameter | type or values | |-------------------|:------------------------------------------| - |--controlAcronyms |String - The system acronym(s) e.g "AC-1, AC-2" | - |--ccis |String - The system CCIS string numerical value | - |--latestOnly |BOOLEAN - true or false| + |-a, --controlAcronyms |String - The system acronym(s) e.g "AC-1, AC-2" | + |-p, --assessmentProcedures|String - The system Security Control Assessment Procedure e.g "AC-1.1,AC-1.2"| + |-c, --ccis |String - The system CCIS string numerical value | + |-L, --latestOnly |BOOLEAN - true or false| -[top](#api-endpoints-provided) +[top](#test-results-endpoint) ### ```get poams``` ---- There are two get endpoints for system poams: - forSystem - Retrieves all poams for specified system ID ```` - $ bundle exec exe/emasser get poams forSystem --systemId=SYSTEMID + $ bundle exec exe/emasser get poams forSystem -s, --systemId=SYSTEMID ```` - required parameter is: |parameter | type or values | |-------------|:----------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | - optional parameters are: |parameter | type or values | |-------------------------------|:----------------------------------------------| - |--scheduledCompletionDateStart |Date - Unix time format (e.g. 1499644800) | - |--scheduledCompletionDateEnd |Date - Unix time format (e.g. 1499990400) | - |--controlAcronyms |String - The system acronym(s) e.g "AC-1, AC-2"| - |--ccis |String - The system CCIS string numerical value| - |--systemOnly |BOOLEAN - true or false| + |-d, --scheduledCompletionDateStart |Date - Unix time format (e.g. 1499644800) | + |-e, --scheduledCompletionDateEnd |Date - Unix time format (e.g. 1499990400) | + |-a, --controlAcronyms |String - The system acronym(s) e.g "AC-1, AC-2"| + |-p, --assessmentProcedures |String - The system Security Control Assessment Procedure e.g "AC-1.1,AC-1.2"| + |-c, --ccis |String - The system CCIS string numerical value| + |-Y, --systemOnly |BOOLEAN - true or false| - byPoamId - Retrieves all poams for specified system and poam ID ```` - $ bundle exec exe/emasser get poams byPoamId --systemId=SYSTEMID --poamId=POAMID + $ bundle exec exe/emasser get poams byPoamId -s, --systemId=SYSTEMID -p, --poamId=POAMID ```` - required parameters are: |parameter | type or values | |-------------|:----------------------------------| - |--systemId |Integer - Unique system identifier | - |--poamId |Integer - Unique poam identifier | + |-s, --systemId |Integer - Unique system identifier | + |-p, --poamId |Integer - Unique poam identifier | -[top](#api-endpoints-provided) +[top](#poams-endpoints) ### ```get milestones``` ---- There are two get endpoints for system milestones: - byPoamId - Retrieves milestone(s) for specified system and poam ID ```` - $ bundle exec exe/emasser get milestones byPoamId --systemId=SYSTEMID --poamId=POAMID + $ bundle exec exe/emasser get milestones byPoamId -s, --systemId=SYSTEMID -p, --poamId=POAMID ```` - required parameters are: |parameter | type or values | |-------------|:----------------------------------| - |--systemId |Integer - Unique system identifier | - |--poamId |Integer - Unique poam identifier | + |-s, --systemId |Integer - Unique system identifier | + |-p, --poamId |Integer - Unique poam identifier | - optional parameters are: |parameter | type or values | |-------------------------------|:----------------------------------------------| - |--scheduledCompletionDateStart |Date - Unix time format (e.g. 1499644800) | - |--scheduledCompletionDateEnd |Date - Unix time format (e.g. 1499990400) | + |-d, --scheduledCompletionDateStart |Date - Unix time format (e.g. 1499644800) | + |-e, --scheduledCompletionDateEnd |Date - Unix time format (e.g. 1499990400) | - byMilestoneId, Retrieve milestone(s) for specified system, poam, and milestone ID" ```` - $ bundle exec exe/emasser get poams byMilestoneId --systemId=SYSTEMID --poamId=POAMID --milestoneId=MILESTONEID + $ bundle exec exe/emasser get poams byMilestoneId -s, --systemId=SYSTEMID -p, --poamId=POAMID -m, --milestoneId=MILESTONEID ```` - required parameters are: |parameter | type or values | |--------------|:-------------------------------------| - |--systemId |Integer - Unique system identifier | - |--poamId |Integer - Unique poam identifier | - |--milestoneId |Integer - Unique milestone identifier | + |-s, --systemId |Integer - Unique system identifier | + |-p, --poamId |Integer - Unique poam identifier | + |-m, --milestoneId |Integer - Unique milestone identifier | -[top](#api-endpoints-provided) +[top](#milestones-endpoints) ### ```get artifacts``` ---- @@ -394,91 +472,93 @@ There are two get endpoints that provides the ability to view existing `Artifact - forSystem - Retrieves one or many artifacts in a system specified system ID ```` - $ bundle exec exe/emasser get artifacts forSystem --systemId=SYSTEMID + $ bundle exec exe/emasser get artifacts forSystem -s, --systemId=SYSTEMID ```` - required parameter is: |parameter | type or values | |-------------|:----------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | - optional parameters are: - |parameter | type or values | - |-------------------------------|:----------------------------------------------| - |--filename |The artifact file name | - |--controlAcronyms |String - The system acronym(s) e.g "AC-1, AC-2"| - |--ccis |String - The system CCIS string numerical value| - |--systemOnly |BOOLEAN - true or false| + |parameter | type or values | + |---------------------------|:----------------------------------------------| + |-f, --filename |The artifact file name | + |-a, --controlAcronyms |String - The system acronym(s) e.g "AC-1, AC-2"| + |-p, --assessmentProcedures |String - The system Security Control Assessment Procedure e.g "AC-1.1,AC-1.2"| + |-c, --ccis |String - The system CCIS string numerical value| + |-Y, --systemOnly |BOOLEAN - true or false| - export - Retrieves the file artifacts (if compress is true the file binary contents are returned, otherwise the file textual contents are returned.) ```` - $ bundle exec exe/emasser get artifacts export --systemId=SYSTEMID + $ bundle exec exe/emasser get artifacts export -s, --systemId=SYSTEMID ```` - required parameters are: |parameter | type or values | |-------------|:----------------------------------| - |--systemId |Integer - Unique system identifier | - |--filename |The artifact file name | + |-s, --systemId |Integer - Unique system identifier | + |-f, --filename |The artifact file name | - optional parameter is: |parameter | type or values | |-------------|:----------------------------------| - |--compress |BOOLEAN - true or false. | + |-C, --compress |BOOLEAN - true or false. | + |-o, --printToStdout |BOOLEAN - true or false - Output file content to terminal - not valid for zip files| -[top](#api-endpoints-provided) +[top](#artifacts-endpoints) ### ```get cac``` ---- To view one or many Control Approval Chain (CAC) in a system specified system ID use the following command: ``` - $ bundle exec exe/emasser get cac controls --systemId=SYSTEMID + $ bundle exec exe/emasser get cac controls -s, --systemId=SYSTEMID ``` - required parameter is: |parameter | type or values | |-------------|:----------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | - optional parameter is: - |parameter | type or values | - |-------------------------------|:----------------------------------------------| - |--controlAcronyms |String - The system acronym(s) e.g "AC-1, AC-2"| + |parameter | type or values | + |----------------------|:----------------------------------------------| + |-a, --controlAcronyms |String - The system acronym(s) e.g "AC-1, AC-2"| -[top](#api-endpoints-provided) +[top](#cac-endpoint) ### ```get pac``` ---- To view one or many Package Approval Chain (PAC) in a system specified system ID use the following command: ```` - $ bundle exec exe/emasser get pac package --systemId=SYSTEMID + $ bundle exec exe/emasser get pac package -s, --systemId=SYSTEMID ```` - required parameter is: |parameter | type or values | |-------------|:----------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | -[top](#api-endpoints-provided) +[top](#pac-endpoint) ### ```get cmmc``` ---- To view Cybersecurity Maturity Model Certification (CMMC) Assessments use the following command: - $ bundle exec exe/emasser get workflow_definitions forSite --sinceDate=SINCEDATE + $ bundle exec exe/emasser get cmmc assessments -d, --sinceDate=SINCEDATE - Required parameter is: |parameter | type or values | |----------------|:--------------------------------------| - |--sinceDate |Date - The CMMC date. Unix date format | + |-d, --sinceDate |Date - The CMMC date. Unix date format | -[top](#api-endpoints-provided) +[top](#cmmc-assessment-endpoint) ### ```get workflow_definitions``` ---- @@ -490,11 +570,11 @@ To view Workflow Definitions use the following command: |parameter | type or values | |---------------------|:----------------------------------------------------------------------------| - |--includeInactive |BOOLEAN - true or false | - |--registrationType |Possible values: assessAndAuthorize, assessOnly, guest, regular, functional, | - | | cloudServiceProvider, commonControlProvider | + |-I, --includeInactive |BOOLEAN - true or false | + |-r, --registrationType |Possible values: assessAndAuthorize, assessOnly, guest, regular, functional, | + | | cloudServiceProvider, commonControlProvider | -[top](#api-endpoints-provided) +[top](#workflow-definition-endpoint) ### ```get workflow_instances``` ---- @@ -507,22 +587,23 @@ There are two get endpoints to view workflow instances: |parameter | type or values | |-------------------|:---------------------------------------------------| - |--includeComments |BOOLEAN - true or false | - |--pageIndex |Integer - The page number to query | - |--sinceDate |Date - The Workflow Instance date. Unix date format | - |--status |Possible values: active, inactive, all | + |-C, --includeComments |BOOLEAN - true or false | + |-D, --includeDecommissionSystems |BOOLEAN - true or false. | + |-p, --pageIndex |Integer - The page number to query | + |-d, --sinceDate |Date - The Workflow Instance date. Unix date format | + |-s, --status |Possible values: active, inactive, all | - - byWorkflowInstanceId + - byInstanceId ``` - $ bundle exec exe/emasser get workflow_instances byWorkflowInstanceId --workflowInstanceId=WORKFLOWID + $ bundle exec exe/emasser get workflow_instances byInstanceId --workflowInstanceId=WORKFLOWID ``` - required parameter is: |parameter | type or values | |---------------------|:---------------------------------------------| - |--workflowInstanceId |Integer - Unique workflow instance identifier | + |-w, --workflowInstanceId |Integer - Unique workflow instance identifier | -[top](#api-endpoints-provided) +[top](#workflow-instances-endpoint) ### ```get dashboards``` ---- @@ -533,21 +614,34 @@ All endpoint calls utilize the same parameter values, they are: |parameter | type or values | |--------------|:------------------------------------------------| - |--orgId |Integer - The organization identification number | + |-o, --orgId |Integer - The organization identification number | - Optional flags (parameters) are: |parameter | type or values | |-------------------|:--------------------------------------------------------------| - |--excludeInherited |BOOLEAN - If no value is specified, includes inherited data | - |--pageIndex |Integer - The index of the starting page (default first page 0)| - |--pageSize |Integer - The number of entries per page (default 20000) | + |-I, --excludeInherited |BOOLEAN - If no value is specified, includes inherited data | + |-i, --pageIndex |Integer - The index of the starting page (default first page 0)| + |-s, --pageSize |Integer - The number of entries per page (default 20000) | +[top](#dashboards) -Available commands are: +#### System Status Endpoint - Get systems status detail dashboard information ``` $ bundle exec exe/emasser get dashboards status_details [-o, --orgId] [options] ``` + [top](#system-status-dashboard) +#### System Terms Conditions Endpoints + - Get system terms/conditions summary dashboard information + ``` + $ bundle exec exe/emasser get dashboards terms_conditions_summary [-o, --orgId] [options] + ``` + - Get system terms/conditions details dashboard information + ``` + $ bundle exec exe/emasser get dashboards terms_conditions_detail [-o, --orgId] [options] + ``` + [top](#enterprise-terms-conditions-dashboard) +### Enterprise Security Controls Endpoints - Get systems control compliance summary dashboard information ``` $ bundle exec exe/emasser get dashboards control_compliance_summary [-o, --orgId] [options] @@ -560,6 +654,9 @@ Available commands are: ``` $ bundle exec exe/emasser get dashboards assessment_procedures_details [-o, --orgId] [options] ``` + [top](#enterprise-security-controls-dashboard) +### Enterprise POA&M Endpoints + - Get systems POA&Ms summary dashboard information ``` $ bundle exec exe/emasser get dashboards poam_summary [-o, --orgId] [options] @@ -568,6 +665,8 @@ Available commands are: ``` $ bundle exec exe/emasser get dashboards poam_details [-o, --orgId] [options] ``` + [top](#enterprise-poam-dashboard) +### Enterprise Artifacts Endpoints - Get artifacts summary dashboard information ``` $ bundle exec exe/emasser get dashboards artifacts_summary [-o, --orgId] [options] @@ -576,6 +675,8 @@ Available commands are: ``` $ bundle exec exe/emasser get dashboards artifacts_details [-o, --orgId] [options] ``` + [top](#enterprise-artifacts-dashboard) +### Hardware Baseline Endpoints - Get system hardware summary dashboard information ``` $ bundle exec exe/emasser get dashboards hardware_summary [-o, --orgId] [options] @@ -584,6 +685,8 @@ Available commands are: ``` $ bundle exec exe/emasser get dashboards hardware_details [-o, --orgId] [options] ``` + [top](#hardware-baseline-dashboard) +### Enterprise Sensor-based Hardware Resources Endpoints - Get sensor hardware summary dashboard information ``` $ bundle exec exe/emasser get dashboards sensor_hardware_summary [-o, --orgId] [options] @@ -592,6 +695,8 @@ Available commands are: ``` $ bundle exec exe/emasser get dashboards sensor_hardware_details [-o, --orgId] [options] ``` + [top](#enterprise-sensor-based-hardware-resources-dashboard) +### Software Baseline Endpoints - Get software baseline summary dashboard information ``` $ bundle exec exe/emasser get dashboards software_summary [-o, --orgId] [options] @@ -600,6 +705,37 @@ Available commands are: ``` $ bundle exec exe/emasser get dashboards software_details [-o, --orgId] [options] ``` + [top](#software-baseline-dashboard) + +### Enterprise Sensor-based Software Resources Endpoints + - Get sensor based software resources summary dashboard information + ``` + $ bundle exec exe/emasser get dashboards sensor_software_summary [-o, --orgId] [options] + ``` + - Get sensor based software resources details dashboard information + ``` + $ bundle exec exe/emasser get dashboards sensor_software_details [-o, --orgId] [options] + ``` + - Get sensor based software resources counts dashboard information + ``` + $ bundle exec exe/emasser get dashboards sensor_software_counts [-o, --orgId] [options] + ``` + [top](#enterprise-sensor-based-software-resources-dashboard) +### Enterprise Vulnerability Endpoints + - Get vulnerability summary dashboard information + ``` + $ bundle exec exe/emasser get dashboards vulnerability_summary [-o, --orgId] [options] + ``` + - Get device findings summary dashboard information + ``` + $ bundle exec exe/emasser get dashboards device_findings_summary [-o, --orgId] [options] + ``` + - Get device findings details dashboard information + ``` + $ bundle exec exe/emasser get dashboards device_findings_details [-o, --orgId] [options] + ``` + [top](#enterprise-vulnerability-dashboard) +### Ports and Protocols Endpoints - Get ports and protocols summary dashboard information ``` $ bundle exec exe/emasser get dashboards ports_protocols_summary [-o, --orgId] [options] @@ -608,18 +744,27 @@ Available commands are: ``` $ bundle exec exe/emasser get dashboards ports_protocols_details [-o, --orgId] [options] ``` + [top](#ports-and-protocols-dashboard) + +### System CONMON Integration Status Endpoint - Get CONMON integration status summary dashboard information ``` $ bundle exec exe/emasser get dashboards integration_status_summary [-o, --orgId] [options] ``` + [top](#system-conmon-integration-status-dashboard) +### System Associations Endpoint - Get system associations details dashboard information ``` $ bundle exec exe/emasser get dashboards associations_details [-o, --orgId] [options] ``` + [top](#system-associations-dashboard) +### Users Endpoint - Get user system assignments details dashboard information ``` $ bundle exec exe/emasser get dashboards assignments_details [-o, --orgId] [options] ``` + [top](#users-dashboard) +### Privacy Compliance Endpoints - Get user system privacy summary dashboard information ``` $ bundle exec exe/emasser get dashboards privacy_summary [-o, --orgId] [options] @@ -628,18 +773,26 @@ Available commands are: ``` $ bundle exec exe/emasser get dashboards fisma_saop_summary [-o, --orgId] [options] ``` + [top](#privacy-compliance-dashboard) +### System A&A Summary Endpoint - Get VA system A&A summary dashboard information ``` $ bundle exec exe/emasser get dashboards va_aa_summary [-o, --orgId] [options] ``` + [top](#system-aa-summary-dashboard) +### System A2.0 Summary Endpoint - Get VA system A2.0 summary dashboard information ``` $ bundle exec exe/emasser get dashboards va_a2_summary [-o, --orgId] [options] ``` + [top](#system-a20-summary-dashboard) +### System P.L. 109 Reporting Summary Endpoint - Get VA System P.L. 109 reporting summary dashboard information ``` $ bundle exec exe/emasser get dashboards va_pl_109_summary [-o, --orgId] [options] ``` + [top](#system-pl-109-reporting-summary-dashboard) +### FISMA Inventory Summary Endpoints - Get VA system FISMA inventory summary dashboard information ``` $ bundle exec exe/emasser get dashboards fisma_inventory_summary [-o, --orgId] [options] @@ -648,6 +801,8 @@ Available commands are: ``` $ bundle exec exe/emasser get dashboards fisma_inventory_crypto_summary [-o, --orgId] [options] ``` + [top](#fisma-inventory-summary-dashboard) +### Threat Risks Endpoints - Get VA threat risk summary dashboard information ``` $ bundle exec exe/emasser get dashboards va_threat_risk_summary [-o, --orgId] [options] @@ -660,7 +815,7 @@ Available commands are: ``` $ bundle exec exe/emasser get dashboards va_threat_architecture_details [-o, --orgId] [options] ``` -[top](#api-endpoints-provided) + [top](#threat-risks-dashboard) ## Usage - POST @@ -684,7 +839,7 @@ Test Result add (POST) endpoint API business rules. To add (POST) test results use the following command: ```` - $ bundle exec exe/emasser post test_results add --systemId [value] --cci [value] --testedBy [value] --testDate [value] --description [value] --complianceStatus [value] + $ bundle exec exe/emasser post test_results add -s, --systemId [value] --cci [value] --testedBy [value] --testDate [value] --description [value] --complianceStatus [value] ```` Note: If no POA&Ms or AP exist for the control (system), you will get this response: "You have entered a Non-Compliant Test Result. You must create a POA&M Item for this Control and/or AP if one does not already exist." @@ -693,7 +848,7 @@ Note: If no POA&Ms or AP exist for the control (system), you will get this respo |parameter | type or values | |-------------------|:------------------------------------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | |--cci |String - CCI associated with the test result. e.g "00221" | |--testedBy |String - Last Name, First Name. 100 Characters. | |--testDate |Date - Unix time format (e.g. 1499990400) | @@ -705,7 +860,7 @@ For information at the command line use: ``` $ bundle exec exe/emasser post test_results help add ``` -[top](#post) +[top](#post-endpoints) ### ``post poams`` --- @@ -765,7 +920,7 @@ The following POA&M parameters/fields have the following character limitations: To add (POST) POA&Ms use the following command: ``` -$ bundle exec exe/emasser post poams add --systemId [value] --status [value] --vulnerabilityDescription [value] --sourceIdentVuln [value] --pocOrganization [value] --resources [value] +$ bundle exec exe/emasser post poams add -s, --systemId [value] --status [value] --vulnerabilityDescription [value] --sourceIdentVuln [value] --pocOrganization [value] --resources [value] ``` **Notes:** - The above listed parameters/fields are the minimal required. @@ -782,7 +937,7 @@ Client API parameters/fields (required, conditional, and optional). |parameter | type or values | |---------------------------|:---------------------------------------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | |--status |Possible Values: Ongoing,Risk Accepted,Completed,Not Applicable | |--vulnerabilityDescription |String - Vulnerability description for the POA&M Item | |--sourceIdentVuln |String - Include Source Identifying Vulnerability text | @@ -834,21 +989,21 @@ For information at the command line use: ``` $ bundle exec exe/emasser post poams help add ``` -[top](#post) +[top](#post-endpoints) ### ``post milestones`` --- To add (POST) milestones in a system for one or more POA&M items use the following command: ```` - $ bundle exec exe/emasser post milestones add --systemId [value] --poamId [value] --description [value] --scheduledCompletionDate [value] + $ bundle exec exe/emasser post milestones add -s, --systemId [value] -p, --poamId [value] --description [value] --scheduledCompletionDate [value] ```` - required parameter are: |parameter | type or values | |---------------------------|:----------------------------------------------------| - |--systemId |Integer - Unique system identifier | - |--poamId |Integer - Unique item identifier | + |-s, --systemId |Integer - Unique system identifier | + |-p, --poamId |Integer - Unique item identifier | |--description |String - Milestone item description. 2000 Characters | |--scheduledCompletionDate |Date - Schedule completion date. Unix date format | @@ -858,7 +1013,7 @@ For information at the command line use: ``` $ bundle exec exe/emasser post milestones help add ``` -[top](#post) +[top](#post-endpoints) ### ``post artifacts`` --- @@ -887,14 +1042,14 @@ Business Rules: To add (POST) artifacts use the following command: ``` -$ bundle exec exe/emasser post artifacts upload --systemId [value] [--isTemplate or --no-isTemplate] --type [value] --category [value] --files [value...value] +$ bundle exec exe/emasser post artifacts upload -s, --systemId [value] [--isTemplate or --no-isTemplate] --type [value] --category [value] --files [value...value] ``` - required parameter are: |parameter | type or values | |----------------|:----------------------------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | |--isTemplate |Boolean - Indicates whether an artifact is a template| |--type |Possible Values: Procedure, Diagram, Policy, Labor, Document, Image, Other, Scan Result, Auditor Report| |--category |Possible Values: Implementation Guidance, Evidence | @@ -906,7 +1061,7 @@ $ bundle exec exe/emasser post artifacts upload --systemId [value] [--isTemplate |-------------------------|:------------------------------------------------------| |--description |String - Artifact description. 2000 Characters | |--refPageNumber |String - Artifact reference page number. 50 Characters | - |--ccis |String - CCIs associated with artifact | + |-c, --ccis |String - CCIs associated with artifact | |--controls |String - Control acronym associated with the artifact. NIST SP 800-53 Revision 4 defined| |--artifactExpirationDate |Date - Date Artifact expires and requires review. In Unix Date Format| |--lastReviewedDate |Date - Date Artifact was last reviewed. In Unix Date Format | @@ -917,7 +1072,7 @@ For information at the command line use: ``` $ bundle exec exe/emasser post artifacts help upload ``` -[top](#post) +[top](#post-endpoints) ### ``post cac`` ---- @@ -929,13 +1084,13 @@ Business Rule To add (POST) test CAC use the following command: ```` - $ bundle exec exe/emasser post pac add --systemId [value] --controlAcronym [value] --comments [value] + $ bundle exec exe/emasser post pac add -s, --systemId [value] --controlAcronym [value] --comments [value] ```` - required parameter are: |parameter | type or values | |-------------------|:------------------------------------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | |--controlAcronym |String - Control acronym associated with the POA&M Item. NIST SP 800-53 Revision 4 defined | - conditional parameter is: @@ -949,7 +1104,7 @@ For information at the command line use: ``` $ bundle exec exe/emasser post cac help add ``` -[top](#post) +[top](#post-endpoints) ### ``post pac`` ---- @@ -958,13 +1113,13 @@ Submit control to second role of CAC To add (POST) test PAC use the following command: ```` - $ bundle exec exe/emasser post pac add --systemId [value] --workflow [value] --name [value] --comments [value] + $ bundle exec exe/emasser post pac add -s, --systemId [value] --workflow [value] --name [value] --comments [value] ```` - required parameter are: |parameter | type or values | |--------------|:--------------------------------------------------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | |--workflow |Possible Values: Assess and Authorize, Assess Only, Security Plan Approval | |--name |String - Package name. 100 Characters | |--comments |String - Comments submitted upon initiation of the indicated workflow, 4,000 character| @@ -974,20 +1129,20 @@ For information at the command line use: ``` $ bundle exec exe/emasser post pac help add ``` -[top](#post) +[top](#post-endpoints) ### ``post static_code_scan`` ---- To add (POST) static code scans use the following command: ```` - $ bundle exec exe/emasser post scan_findings add --systemId [value] --applicationName [value] --version [value] --codeCheckName [value] --scanDate [value] --cweId [value] + $ bundle exec exe/emasser post scan_findings add -s, --systemId [value] --applicationName [value] --version [value] --codeCheckName [value] --scanDate [value] --cweId [value] ```` - required parameter are: |parameter | type or values | |-------------------|:-----------------------------------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | |--applicationName |String - Name of the software application that was assessed | |--version |String - The version of the application | |--codeCheckName |Strings - Name of the software vulnerability or weakness | @@ -1006,13 +1161,13 @@ To add (POST) static code scans use the following command: To clear (POST) static code scans use the following command: ```` - $ bundle exec exe/emasser post scan_findings clear --systemId [value] --applicationName [value] --version [value] --clearFindings + $ bundle exec exe/emasser post scan_findings clear -s, --systemId [value] --applicationName [value] --version [value] --clearFindings ```` - required parameter are: |parameter | type or values | |-------------------|:-----------------------------------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | |--applicationName |String - Name of the software application that was assessed | |--clearFindings* |Boolean - To clear an application's findings set it to true | @@ -1023,7 +1178,7 @@ For information at the command line use: ``` $ bundle exec exe/emasser post scan_findings help add ``` -[top](#post) +[top](#post-endpoints) ### ```post cloud_resource``` --- @@ -1051,13 +1206,13 @@ The following Cloud Resource parameters/fields have the following character limi To add a cloud resource and their scan results in the assets module for a system use the following command: ```` - $ bundle exec exe/emasser post cloud_resource add --systemId [value] --provider [value] --resourceId [value] --resourceName [value] --resourceType [value] --cspPolicyDefinitionId [value] --isCompliant or --is-not-Compliant --policyDefinitionTitle [value] --test [value] + $ bundle exec exe/emasser post cloud_resource add -s, --systemId [value] --provider [value] --resourceId [value] --resourceName [value] --resourceType [value] --cspPolicyDefinitionId [value] --isCompliant or --is-not-Compliant --policyDefinitionTitle [value] --test [value] ```` - required parameter are: |parameter | type or values | |------------------------|:--------------------------------------------------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | |--provider |string - Cloud service provider name | |--resourceId |String - Unique identifier/resource namespace for policy compliance result | |--resourceName |String - Friendly name of Cloud resource | @@ -1092,7 +1247,7 @@ For information at the command line use: $ bundle exec exe/emasser post cloud_resource help add ``` -[top](#post) +[top](#post-endpoints) ### ```post container``` @@ -1113,7 +1268,7 @@ The following Container parameters/fields have the following character limitatio To add containers and their scan results in the assets module for a system use the following command: ```` - $ bundle exec ruby exe/emasser post container add --systemId [value] --containerId [value] --containerName [value] --time [value] --benchmark [value] --lastSeen [value] --ruleId [value] --status [value] + $ bundle exec ruby exe/emasser post container add -s, --systemId [value] --containerId [value] --containerName [value] --time [value] --benchmark [value] --lastSeen [value] --ruleId [value] --status [value] ```` @@ -1121,7 +1276,7 @@ To add containers and their scan results in the assets module for a system use t |parameter | type or values | |------------------------|:--------------------------------------------------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | |--containerId |String - Unique identifier of the container | |--containerName |String - Friendly name of the container | |--time |Date - Datetime of scan/result. Unix date format | @@ -1151,7 +1306,7 @@ For information at the command line use: ``` $ bundle exec exe/emasser post container help add ``` -[top](#post) +[top](#post-endpoints) ## Usage - PUT @@ -1196,7 +1351,7 @@ Updating (PUT) a Control can be accomplished by invoking the following command: |parameter | type or values | |--------------------------|:-------------------------------------------------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | |--acronym |String - The system acronym(s) e.g "AC-1, AC-2" | |--responsibleEntities |String - Description of the responsible entities for the Security Control | |--controlDesignation |Possible values: Common, System-Specific, or Hybrid | @@ -1235,7 +1390,7 @@ For information at the command line use: ``` $ bundle exec exe/emasser put controls help update ``` -[top](#put) +[top](#put-emdpoints) ### ``put poams`` @@ -1316,7 +1471,7 @@ Updating (PUT) a POA&M can be accomplished by invoking the following command: |parameter | type or values | |---------------------------|:---------------------------------------------------------------| - |--systemId |Integer - Unique system identifier | + |-s, --systemId |Integer - Unique system identifier | |--displayPoamId |Integer - Globally unique identifier for individual POA&M Items | |--status |Possible Values: Ongoing,Risk Accepted,Completed,Not Applicable | |--vulnerabilityDescription |String - Vulnerability description for the POA&M Item | @@ -1370,7 +1525,7 @@ For information at the command line use: ``` $ bundle exec exe/emasser put poams help update ``` -[top](#put) +[top](#put-endpoints) ### ``put milestones`` @@ -1385,9 +1540,9 @@ To add (POST) milestones in a system for one or more POA&M items use the followi |parameter | type or values | |---------------------------|:----------------------------------------------------| - |--systemId |Integer - Unique system identifier | - |--poamId |Integer - Unique poam identifier | - |--milestoneId |Integer - Unique milestone identifier | + |-s, --systemId |Integer - Unique system identifier | + |-p, --poamId |Integer - Unique poam identifier | + |-m, --milestoneId |Integer - Unique milestone identifier | |--description |String - Milestone item description. 2000 Characters | |--scheduledCompletionDate |Date - Schedule completion date. Unix date format | @@ -1397,7 +1552,7 @@ For information at the command line use: ``` $ bundle exec exe/emasser put milestones help update ``` -[top](#put) +[top](#put-endpoints) ### ``put artifacts`` @@ -1426,8 +1581,8 @@ To add (POST) milestones in a system for one or more POA&M items use the followi |parameter | type or values | |----------------|:----------------------------------------------------| - |--systemId |Integer - Unique system identifier | - |--filename |String - File name should match exactly one file within the provided zip file| + |-s, --systemId |Integer - Unique system identifier | + |-f, --filename |String - File name should match exactly one file within the provided zip file| | |Binary - Application/zip file. Max 30MB per artifact | |--isTemplate |Boolean - Indicates whether an artifact is a template| |--type* |Possible Values: Procedure, Diagram, Policy, Labor, Document, Image, Other, Scan Result, Auditor Report| @@ -1441,7 +1596,7 @@ To add (POST) milestones in a system for one or more POA&M items use the followi |-------------------------|:------------------------------------------------------| |--description |String - Artifact description. 2000 Characters | |--refPageNumber |String - Artifact reference page number. 50 Characters | - |--ccis |String - CCIs associated with artifact | + |-c, --ccis |String - CCIs associated with artifact | |--controls |String - Control acronym associated with the artifact. NIST SP 800-53 Revision 4 defined| |--artifactExpirationDate |Date - Date Artifact expires and requires review. In Unix Date Format| |--lastReviewedDate |Date - Date Artifact was last reviewed. In Unix Date Format | @@ -1452,7 +1607,7 @@ For information at the command line use: ``` $ bundle exec exe/emasser put artifacts help update ``` -[top](#put) +[top](#put-endpoints) ## Usage - DELETE @@ -1463,9 +1618,9 @@ Remove one or many poa&m items in a system To remove (DELETE) one or more POA&M items use the following command: ``` -bundle exec exe/emasser delete poams remove --systemId [value] --poamId [value] +bundle exec exe/emasser delete poams remove -s, --systemId [value] -p, --poamId [value] ``` -[top](#delete) +[top](#delete-endpoints) ### ``delete milestones`` @@ -1480,9 +1635,9 @@ The last milestone can not be deleted, at-least on must exist. To remove (DELETE) one or more Milestones in a system use the following command: ``` -bundle exec exe/emasser delete milestones remove--systemId [value] --poamId [value] --milestoneId [value] +bundle exec exe/emasser delete milestones remove -s, --systemId [value] -p, --poamId [value] -m, --milestoneId [value] ``` -[top](#delete) +[top](#delete-endpoints) ### ``delete artifacts`` @@ -1493,10 +1648,30 @@ Provide single file or a space/comma delimited list of file names to be removed To remove (DELETE) one or more Artifacts from a system use the following command: ``` -bundle exec exe/emasser delete artifacts remove --systemId [value] --files [value] +bundle exec exe/emasser delete artifacts remove -s, --systemId [value] -f, --files [value] or -bundle exec exe/emasser delete artifacts remove --systemId [value] --files [value value...] +bundle exec exe/emasser delete artifacts remove -s, --systemId [value] -f, --files [value value...] or -bundle exec exe/emasser delete artifacts remove --systemId [value] --files [value, value...] +bundle exec exe/emasser delete artifacts remove -s, --systemId [value] -f, --files [value, value...] +``` +[top](#delete-endpoints) + +### ``delete cloud resource`` +--- +Delete one or many Cloud Resources and their scan results in the assets module for a system + +To remove (DELETE) one or many cloud resources in a system use the following command: +``` +bundle exec exe/emasser delete cloud_resource remove -c, --resourceId [value] -s, --systemId [value] +``` +[top](#delete-endpoints) + +### ``delete container`` +--- +Delete one or many containers scan results in the assets module for a system + +To remove (DELETE) one or many containers in a system use the following command: +``` +bundle exec exe/emasser delete container remove -c, --containerId [value] -s, --systemId [value] ``` -[top](#delete) \ No newline at end of file +[top](#delete-endpoints) \ No newline at end of file diff --git a/emasser.gemspec b/emasser.gemspec index 23a282b..19b7610 100644 --- a/emasser.gemspec +++ b/emasser.gemspec @@ -29,7 +29,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency 'dotenv', '~> 2.7.6' spec.add_runtime_dependency 'rubyzip', '~> 2.3.2' spec.add_runtime_dependency 'thor', '~> 1.1.0' - spec.add_runtime_dependency 'emass_client', '~> 3.10' + spec.add_runtime_dependency 'emass_client', '~> 3.12' spec.add_development_dependency 'bundler', '~> 2.3' spec.add_development_dependency 'bundler-audit', '~> 0.7' diff --git a/lib/emasser/configuration.rb b/lib/emasser/configuration.rb index f62b81b..a1b349f 100644 --- a/lib/emasser/configuration.rb +++ b/lib/emasser/configuration.rb @@ -9,7 +9,7 @@ def self.raise_unless_present(env) ENV.fetch(env) { raise Emasser::ConfigurationMissingError.new(env) } rescue Emasser::ConfigurationMissingError => e if (ARGV[0].to_s.include? '-v') || (ARGV[0].to_s.include? '-V') - puts "emasser version: #{Emasser::VERSION}".green + puts "eMASSer version: #{Emasser::VERSION}".green else puts "\n", e.message.red puts 'Create a .env file containing required variables, place it in the root directory where the emasser command is executed'.yellow @@ -17,10 +17,10 @@ def self.raise_unless_present(env) puts ' export EMASSER_API_KEY='.green puts ' export EMASSER_USER_UID='.green puts ' export EMASSER_HOST_URL='.green - puts ' export EMASSER_KEY_FILE_PATH='.green - puts ' export EMASSER_CERT_FILE_PATH='.green + puts ' export EMASSER_KEY_FILE_PATH='.green + puts ' export EMASSER_CERT_FILE_PATH='.green puts ' export EMASSER_KEY_FILE_PASSWORD='.green, "\n" - puts 'See emasser environment variables requirements in emasser CLI Features for more information (https://mitre.github.io/emasser/docs/features.html).', "\n" + puts 'See eMASSer environment variables requirements in eMASSer CLI Features for more information (https://mitre.github.io/emasser/docs/features.html).', "\n" end exit end diff --git a/lib/emasser/constants.rb b/lib/emasser/constants.rb index 736d139..76f3af3 100644 --- a/lib/emasser/constants.rb +++ b/lib/emasser/constants.rb @@ -19,8 +19,4 @@ module Emasser GET_WORKFLOWINSTANCES_RETURN_TYPE = { debug_return_type: 'Object' }.freeze - - DEL_MILESTONES_RETURN_TYPE = { - debug_return_type: 'Object' - }.freeze end diff --git a/lib/emasser/delete.rb b/lib/emasser/delete.rb index b93160d..0f3d423 100644 --- a/lib/emasser/delete.rb +++ b/lib/emasser/delete.rb @@ -51,11 +51,11 @@ def self.exit_on_failure? long_desc Help.text(:poam_del_mapper) # Required parameters/fields - option :systemId, type: :numeric, required: true, desc: 'A numeric value representing the system identification' - option :poamId, type: :numeric, required: true, desc: 'A numeric value representing the poam identification' + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' + option :poamId, aliases: '-p', type: :numeric, required: true, desc: 'A numeric value representing the poam identification' def remove - body = EmassClient::PoamGet.new + body = EmassClient::PoamRequestDeleteBodyInner.new body.poam_id = options[:poamId] body_array = Array.new(1, body) @@ -80,26 +80,24 @@ def self.exit_on_failure? long_desc Help.text(:milestone_del_mapper) # Required parameters/fields - option :systemId, type: :numeric, required: true, + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' - option :poamId, type: :numeric, required: true, + option :poamId, aliases: '-p', type: :numeric, required: true, desc: 'A numeric value representing the poam identification' - option :milestoneId, type: :numeric, required: true, + option :milestoneId, aliases: '-m', type: :numeric, required: true, desc: 'A numeric value representing the milestone identification' def remove - body = EmassClient::MilestonesGet.new + body = EmassClient::MilestonesRequestDeleteBodyInner.new body.milestone_id = options[:milestoneId] body_array = Array.new(1, body) - # Getting an empty return when utilizing the default return type - using 'Object' as return type - opts = Emasser::DEL_MILESTONES_RETURN_TYPE - - result = EmassClient::MilestonesApi.new.delete_milestone(options[:systemId], options[:poamId], body_array, opts) + result = EmassClient::MilestonesApi.new.delete_milestone(options[:systemId], options[:poamId], body_array) + # The server returns an empty object upon successfully deleting a milestone. puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling MilestonesApi->delete_milestone'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end @@ -113,11 +111,11 @@ def self.exit_on_failure? end desc 'remove', 'Delete one or many artifacts in a system' - long_desc Help.text(:artifact_del_mapper) + long_desc Help.text(:artifacts_del_mapper) # Required parameters/fields - option :systemId, type: :numeric, required: true, desc: 'A numeric value representing the system identification' - option :files, type: :array, required: true, desc: 'Artifact file(s) to remove from the given system' + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' + option :files, aliases: '-f', type: :array, required: true, desc: 'Artifact file(s) to remove from the given system' def remove body_array = [] @@ -127,7 +125,7 @@ def remove body_array << obj end - result = EmassClient::ArtifactsApi.new.delete_artifact(options[:systemId], body_array) + result = EmassClient::ArtifactsApi.new.delete_artifact(body_array, options[:systemId]) puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling ArtifactsApi->delete_artifact'.red @@ -135,6 +133,64 @@ def remove end end + # The Cloud Resource Results endpoint provides the ability to remove + # cloud resources and their scan results in the assets module for a system. + # + # Endpoint: + # /api/systems/{systemId}/cloud-resource-results - Remove one or many cloud resources in a system + class CloudResource < SubCommandBase + def self.exit_on_failure? + true + end + + desc 'remove', 'Delete one or many Cloud Resources and their scan results in the assets module for a system' + + # Required parameters/fields + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' + option :resourceId, aliases: '-c', type: :string, required: true, desc: 'Unique identifier/resource namespace for policy compliance result' + + def remove + body = EmassClient::CloudResourcesDeleteBodyInner.new + body.resource_id = options[:resourceId] + body_array = Array.new(1, body) + + result = EmassClient::CloudResourceResultsApi.new.delete_cloud_resources(options[:systemId], body_array) + puts to_output_hash(result).green + rescue EmassClient::ApiError => e + puts 'Exception when calling MilestonesApi->delete_cloud_resources'.red + puts to_output_hash(e) + end + end + + # The Container Scan Results endpoint provides the ability to remove + # containers and their scan results in the assets module for a system. + # + # Endpoint: + # /api/systems/{systemId}/container-scan-results - Remove one or many containers in a system + class Container < SubCommandBase + def self.exit_on_failure? + true + end + + desc 'remove', 'Delete one or many containers scan results in the assets module for a system' + + # Required parameters/fields + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' + option :containerId, aliases: '-c', type: :string, required: true, desc: 'Unique identifier of the container' + + def remove + body = EmassClient::ContainerResourcesDeleteBodyInner.new + body.containerId = options[:containerId] + body_array = Array.new(1, body) + + result = EmassClient::ContainerScanResultsApi.new.delete_container_sans(options[:systemId], body_array) + puts to_output_hash(result).green + rescue EmassClient::ApiError => e + puts 'Exception when calling MilestonesApi->delete_cloud_resources'.red + puts to_output_hash(e) + end + end + class Delete < SubCommandBase desc 'poams', 'Delete Plan of Action and Milestones (POA&M) items for a system' subcommand 'poams', Poams @@ -144,5 +200,11 @@ class Delete < SubCommandBase desc 'artifacts', 'Delete system Artifacts' subcommand 'artifacts', Artifacts + + desc 'cloud_resource', 'Delete cloud resource and their scan results' + subcommand 'cloud_resource', CloudResource + + desc 'container', 'Delete container and their scan results' + subcommand 'container', Container end end diff --git a/lib/emasser/get.rb b/lib/emasser/get.rb index b5aa59d..aa2b906 100644 --- a/lib/emasser/get.rb +++ b/lib/emasser/get.rb @@ -44,7 +44,7 @@ def connection puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling TestApi->test_connection'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end @@ -58,12 +58,13 @@ def self.exit_on_failure? true end - desc 'id [--system_name [SYSTEM_NAME]] [--system_owner [SYSTEM_OWNER]]', + desc 'id [--system-name [SYSTEM_NAME]] [--system-owner [SYSTEM_OWNER]]', 'Attempts to provide system ID of a system with name [NAME] and owner [SYSTEM_OWNER]' + # desc 'id', 'Get a system ID given "name" or "owner"' # Required parameters/fields - option :system_name - option :system_owner + option :system_name, aliases: '-n' + option :system_owner, aliases: '-o' def id if options[:system_name].nil? && options[:system_owner].nil? @@ -72,35 +73,45 @@ def id end begin - results = EmassClient::SystemsApi.new.get_systems - results = filter_systems(results, options[:system_name], options[:system_owner]) - results.each { |result| puts "#{result[:systemId]} - #{result[:systemOwner]} - #{result[:name]}" } + results = EmassClient::SystemsApi.new.get_systems.data + # Convert the Ruby Object (results) to a Hash (hash) and save each hash to an Array (hash_array) + hash_array = [] + results.each do |element| + hash = {} + # instance_variables returns an array of object’s instance variables + # instance_variable_get returns the value of the instance variable, given the variable name + element.instance_variables.each do |v| + hash[v.to_s.delete('@')] = element.instance_variable_get(v) + end + hash_array.push(hash) + end + # Filter the hash array based on provided options + results = filter_systems(hash_array, options[:system_name], options[:system_owner]) + # Output the filtered results + results.each { |result| puts "#{result['system_id']} - #{result['owning_organization']} - #{result['name']}" } rescue EmassClient::ApiError => e puts 'Exception when calling SystemsApi->get_systems' - puts to_output_hash(e).yellow + puts to_output_hash(e) end end - # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity no_commands do def filter_systems(results, system_name = nil, system_owner = nil) - results = results.to_body if results.respond_to?(:to_body) if system_owner.nil? - results[:data].filter { |result| result[:name].eql?(system_name) } + results.filter { |result| result['name'].eql?(system_name) } elsif system_name.nil? - results[:data].filter { |result| result[:systemOwner].eql?(system_owner) } + results.filter { |result| result['owning_organization'].eql?(system_owner) } else - results[:data].filter { |result| result[:name].eql?(system_name) && result[:systemOwner].eql?(system_owner) } + results.filter { |result| result['name'].eql?(system_name) && result['owning_organization'].eql?(system_owner) } end end end - # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity desc 'byId [options]', 'Retrieve a system - filtered by [options] params' - option :systemId, type: :numeric, required: true, + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' - option :includePackage, type: :boolean, required: false, desc: 'BOOLEAN - true or false.' - option :policy, type: :string, required: false, enum: %w[diacap rmf reporting] + option :includePackage, aliases: '-I', type: :boolean, required: false, desc: 'BOOLEAN - true or false.' + option :policy, aliases: '-p', type: :string, required: false, enum: %w[diacap rmf reporting] def byId optional_options_keys = optional_options(@_initializer).keys @@ -112,8 +123,8 @@ def byId result = EmassClient::SystemsApi.new.get_system(options[:systemId], optional_options) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling SystemsApi->get_system'.red - puts to_output_hash(e).yellow + puts 'Exception when calling SystemsApi->get_systems'.red + puts to_output_hash(e) end end end @@ -125,19 +136,19 @@ def self.exit_on_failure? desc 'all [options]', 'Retrieves all available system(s) - filtered by [options] params' # Optional parameters/fields - option :registrationType, + option :registrationType, aliases: '-r', type: :string, required: false, enum: %w[assessAndAuthorize assessOnly guest regular functional cloudServiceProvider commonControlProvider] - option :ditprId, type: :string, required: false, + option :ditprId, aliases: '-t', type: :string, required: false, desc: 'DoD Information Technology (IT) Portfolio Repository (DITPR) string Id' - option :coamsId, type: :string, required: false, + option :coamsId, aliases: '-c', type: :string, required: false, desc: 'Cyber Operational Attributes Management System (COAMS) string Id' - option :policy, type: :string, required: false, enum: %w[diacap rmf reporting] + option :policy, aliases: '-p', type: :string, required: false, enum: %w[diacap rmf reporting] - option :includePackage, type: :boolean, required: false, desc: 'BOOLEAN - true or false.' - option :includeDitprMetrics, type: :boolean, required: false, desc: 'BOOLEAN - true or false.' - option :includeDecommissioned, type: :boolean, required: false, desc: 'BOOLEAN - true or false.' - option :reportsForScorecard, type: :boolean, required: false, desc: 'BOOLEAN - true or false.' + option :includePackage, aliases: '-I', type: :boolean, required: false, desc: 'BOOLEAN - true or false.' + option :includeDitprMetrics, aliases: '-M', type: :boolean, required: false, desc: 'BOOLEAN - true or false.' + option :includeDecommissioned, aliases: '-D', type: :boolean, required: false, desc: 'BOOLEAN - true or false.' + option :reportsForScorecard, aliases: '-S', type: :boolean, required: false, desc: 'BOOLEAN - true or false.' def all optional_options_keys = optional_options(@_initializer).keys @@ -150,7 +161,7 @@ def all puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling SystemsApi->get_systems'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end end @@ -176,18 +187,17 @@ def all puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling SystemRolesApi->get_system_roles'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end desc 'byCategory [options]', 'Retrieves role(s) - filtered by [options] params' # Required parameters/fields - option :roleCategory, type: :string, required: true, enum: %w[PAC CAC Other] - option :role, type: :string, required: true, - enum: ['AO', 'Auditor', 'Artifact Manager', 'C&A Team', 'IAO', - 'ISSO', 'PM/IAM', 'SCA', 'User Rep', 'Validator'] + option :roleCategory, aliases: '-c', type: :string, required: true, enum: %w[PAC CAC Other] + option :role, aliases: '-r', type: :string, required: true, + desc: 'Accepts single value from options available at base system-roles endpoint e.g., SCA.' + # Optional parameters/fields - option :policy, type: :string, required: false, default: 'rmf', enum: %w[diacap rmf reporting] - option :includeDecommissioned, type: :boolean, required: false, desc: 'BOOLEAN - true or false.' + option :policy, aliases: '-p', type: :string, required: false, enum: %w[diacap rmf reporting] def byCategory optional_options_keys = optional_options(@_initializer).keys @@ -199,7 +209,7 @@ def byCategory puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling SystemRolesApi->get_system_by_role_category_id'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end end @@ -216,11 +226,11 @@ def self.exit_on_failure? desc 'forSystem', 'Get control information in a system for one or many controls (acronym)' # Required parameters/fields - option :systemId, type: :numeric, required: true, + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' # Optional parameters/fields - option :acronyms, type: :string, required: false, - desc: 'The system acronym(s) e.g "AC-1, AC-2" - if not provided all controls for systemId are returned' + option :acronyms, aliases: '-a', type: :string, required: false, + desc: 'The system acronym(s) e.g "AC-1, AC-2" - if not provided all controls for systemId are returned' def forSystem optional_options_keys = optional_options(@_initializer).keys @@ -231,7 +241,7 @@ def forSystem puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling ControlsApi->get_system_controls'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end end @@ -248,12 +258,14 @@ def self.exit_on_failure? desc 'forSystem', 'Get one or many test results in a system' # Required parameters/fields - option :systemId, type: :numeric, required: true, + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' # Optional parameters/fields - option :controlAcronyms, type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1, AC-2"' - option :ccis, type: :string, required: false, desc: 'The system CCIS string numerical value' - option :latestOnly, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.' + option :controlAcronyms, aliases: '-a', type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1, AC-2"' + option :assessmentProcedures, aliases: '-p', type: :string, required: false, + desc: 'The system Security Control Assessment Procedure e.g "AC-1.1,AC-1.2"' + option :ccis, aliases: '-c', type: :string, required: false, desc: 'The system CCIS string numerical value' + option :latestOnly, aliases: '-L', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.' def forSystem optional_options_keys = optional_options(@_initializer).keys @@ -264,7 +276,7 @@ def forSystem puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling TestResultsApi->get_system_test_results'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end end @@ -283,16 +295,18 @@ def self.exit_on_failure? # BY SYSTEM ID ------------------------------------------------------------------ desc 'forSystem', 'Get one or many POA&M items in a system' # Required parameters/fields - option :systemId, type: :numeric, required: true, + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' # Optional parameters/fields - option :scheduledCompletionDateStart, type: :numeric, required: false, + option :scheduledCompletionDateStart, aliases: '-d', type: :numeric, required: false, desc: 'The schedule completion start date - Unix time format.' - option :scheduledCompletionDateEnd, type: :numeric, required: false, + option :scheduledCompletionDateEnd, aliases: '-e', type: :numeric, required: false, desc: 'The scheduled completion end date - Unix time format.' - option :controlAcronyms, type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1" or "AC-1, AC-2"' - option :ccis, type: :string, required: false, desc: 'The system CCIS string numerical value e.g "000123" or "000123,000069"' - option :systemOnly, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.' + option :controlAcronyms, aliases: '-a', type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1, AC-2"' + option :assessmentProcedures, aliases: '-p', type: :string, required: false, + desc: 'The system Security Control Assessment Procedure e.g "AC-1.1,AC-1.2"' + option :ccis, aliases: '-c', type: :string, required: false, desc: 'The system CCIS string numerical value' + option :systemOnly, aliases: '-Y', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.' def forSystem optional_options_keys = optional_options(@_initializer).keys @@ -303,16 +317,16 @@ def forSystem puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling POAMApi->get_system_poams'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end # BY POAM ID -------------------------------------------------------------- desc 'byPoamId', 'Get POA&M item for given systemId and poamId' # Required parameters/fields - option :systemId, type: :numeric, required: true, + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' - option :poamId, type: :numeric, required: true, + option :poamId, aliases: '-p', type: :numeric, required: true, desc: 'A numeric value representing the poam identification' def byPoamId @@ -320,7 +334,7 @@ def byPoamId puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling POAMApi->get_system_poams_by_poam_id'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end @@ -336,14 +350,14 @@ def self.exit_on_failure? # MILSTONES by SYSTEM and POAM ID ----------------------------------------- desc 'byPoamId', 'Get milestone(s) for given specified system and poam' # Required parameters/fields - option :systemId, type: :numeric, required: true, + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' - option :poamId, type: :numeric, required: true, + option :poamId, aliases: '-p', type: :numeric, required: true, desc: 'A numeric value representing the poam identification' # Optional parameters/fields - option :scheduledCompletionDateStart, type: :numeric, required: false, + option :scheduledCompletionDateStart, aliases: '-d', type: :numeric, required: false, desc: 'The schedule completion start date - Unix time format.' - option :scheduledCompletionDateEnd, type: :numeric, required: false, + option :scheduledCompletionDateEnd, aliases: '-e', type: :numeric, required: false, desc: 'The scheduled completion end date - Unix time format.' def byPoamId @@ -357,18 +371,18 @@ def byPoamId puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling MilestonesApi->get_system_milestones_by_poam_id'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end # MILSTONES by SYSTEM, POAM, and MILESTONE ID ----------------------------------------- desc 'byMilestoneId', 'Get milestone(s) for given specified system, poam, and milestone Id' # Required parameters/fields - option :systemId, type: :numeric, required: true, + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' - option :poamId, type: :numeric, required: true, + option :poamId, aliases: '-p', type: :numeric, required: true, desc: 'A numeric value representing the poam identification' - option :milestoneId, type: :numeric, required: true, + option :milestoneId, aliases: '-m', type: :numeric, required: true, desc: 'A numeric value representing the milestone identification' def byMilestoneId @@ -378,7 +392,7 @@ def byMilestoneId puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling MilestonesApi->get_system_milestones_by_poam_id_and_milestone_id'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end @@ -396,13 +410,15 @@ def self.exit_on_failure? desc 'forSystem', 'Get all system artifacts for a system Id' # Required parameters/fields - option :systemId, type: :numeric, required: true, + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' # Optional parameters/fields - option :filename, type: :string, required: false, desc: 'The artifact file name' - option :controlAcronyms, type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1, AC-2"' - option :ccis, type: :string, required: false, desc: 'The system CCIS string numerical value' - option :systemOnly, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.' + option :filename, aliases: '-f', type: :string, required: false, desc: 'The artifact file name' + option :controlAcronyms, aliases: '-a', type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1, AC-2"' + option :assessmentProcedures, aliases: '-p', type: :string, required: false, + desc: 'The system Security Control Assessment Procedure e.g "AC-1.1,AC-1.2"' + option :ccis, aliases: '-c', type: :string, required: false, desc: 'The system CCIS string numerical value' + option :systemOnly, aliases: '-Y', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.' def forSystem optional_options_keys = optional_options(@_initializer).keys @@ -415,42 +431,61 @@ def forSystem puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling ArtifactsApi->get_system_artifacts'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end desc 'export', 'Get artifact binary file associated with given filename' # Required parameters/fields - option :systemId, type: :numeric, required: true, + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' - option :filename, type: :string, required: true, desc: 'The artifact file name' - option :compress, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.' + option :filename, aliases: '-f', type: :string, required: true, desc: 'The artifact file name' + option :compress, aliases: '-C', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.' + option :printToStdout, aliases: '-o', required: false, desc: 'Output file content to terminal - not valid for zip files' # NOTE: compress is a required parameter, however Thor does not allow a boolean type to be required because it # automatically creates a --no-compress option, which is confusing in the help output: # [--compress], [--no-compress] # BOOLEAN - true or false. + # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def export optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - optional_options.merge!(Emasser::GET_ARTIFACTS_RETURN_TYPE) + if options[:printToStdout] + optional_options.merge!(Emasser::GET_ARTIFACTS_RETURN_TYPE) + if options[:compress] + puts 'Output to stdout - compress'.yellow + else + puts 'Output to stdout - plain text'.yellow + end + else + puts 'Output to temp directory'.yellow + end result = EmassClient::ArtifactsExportApi.new.get_system_artifacts_export( options[:systemId], options[:filename], optional_options ) - if options[:compress] - pp result - else - begin - puts JSON.pretty_generate(JSON.parse(result)).green - rescue StandardError - puts result.red + + unless File.extname(options[:filename]).eql? '.zip' + # rubocop:disable Style/SoleNestedConditional, Metrics/BlockNesting + if options[:printToStdout] + if options[:compress] + puts result.green + else + begin + puts JSON.pretty_generate(JSON.parse(result)).green + rescue StandardError + puts result.red + end + end end end + # rubocop:enable Style/SoleNestedConditional, Metrics/BlockNesting rescue EmassClient::ApiError => e puts 'Exception when calling ArtifactsApi->get_system_artifacts_export'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end + # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity # The Control Approval Chain (CAC) endpoints provide the ability to view the status of # Security Controls and submit them to the second stage in the Control Approval Chain @@ -467,11 +502,11 @@ def self.exit_on_failure? desc 'controls', 'Get location of one or many controls in CAC' # Required parameters/fields - option :systemId, type: :numeric, required: true, + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' # Optional parameters/fields - option :controlAcronyms, type: :string, required: false, - desc: 'The system acronym(s) e.g "AC-1, AC-2" - if not provided all CACs for systemId are returned' + option :controlAcronyms, aliases: '-a', type: :string, required: false, + desc: 'The system acronym(s) e.g "AC-1, AC-2" - if not provided all CACs for systemId are returned' def controls optional_options_keys = optional_options(@_initializer).keys @@ -483,7 +518,7 @@ def controls puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling ApprovalChainApi->get_system_cac'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end end @@ -505,7 +540,7 @@ def self.exit_on_failure? desc 'package', 'Get location of system package in PAC' # Required parameters/fields - option :systemId, type: :numeric, required: true, + option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification' def package @@ -514,7 +549,7 @@ def package puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling ApprovalChainApi->get_system_'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end @@ -532,14 +567,14 @@ def self.exit_on_failure? long_desc Help.text(:cmmc_get_mapper) # Required parameters/fields - option :sinceDate, type: :string, required: true, desc: 'The CMMC date. Unix date format' + option :sinceDate, aliases: '-d', type: :string, required: true, desc: 'The CMMC date. Unix date format' def assessments result = EmassClient::CMMCAssessmentsApi.new.get_cmmc_assessments(options[:sinceDate]) puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling ApprovalChainApi->get_cmmc_assessments'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end @@ -556,8 +591,8 @@ def self.exit_on_failure? desc 'forSite', 'Get location of system package in PAC' # Optional parameters/fields - option :includeInactive, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.' - option :registrationType, + option :includeInactive, aliases: '-I', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.' + option :registrationType, aliases: '-r', type: :string, required: false, enum: %w[assessAndAuthorize assessOnly guest regular functional cloudServiceProvider commonControlProvider] @@ -569,7 +604,7 @@ def forSite puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling ApprovalChainApi->get_workflow_definitions'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end @@ -577,20 +612,20 @@ def forSite # active and historical workflows for a system. # # Endpoints: - # /api/workflows/instances - Get workflow instances in a site - # /api/workflows/instances/{workflowInstanceId} - Get workflow instance by ID + # /api/systems/{systemId}/workflow-instances - Get workflow instances in a system + # /api/systems/{systemId}/workflow-instances/{workflowInstanceId} - Get workflow instance by ID in a system class WorkflowInstances < SubCommandBase def self.exit_on_failure? true end - desc 'all', 'Get workflow instances in a site' - + desc 'all', 'Get detailed information for all active and historical workflows' # Optional parameters/fields - option :includeComments, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.' - option :pageIndex, type: :numeric, required: false, desc: 'The page number to be returned' - option :sinceDate, type: :string, required: false, desc: 'The workflow instance date. Unix date format' - option :status, type: :string, required: false, enum: %w[active inactive all] + option :includeComments, aliases: '-C', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.' + option :includeDecommissionSystems, aliases: '-D', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.' + option :pageIndex, aliases: '-p', type: :numeric, required: false, desc: 'The page number to be returned' + option :sinceDate, aliases: '-d', type: :string, required: false, desc: 'The workflow instance date. Unix date format' + option :status, aliases: '-s', type: :string, required: false, enum: %w[active inactive all] def all optional_options_keys = optional_options(@_initializer).keys @@ -600,24 +635,25 @@ def all puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling ApprovalChainApi->get_system_workflow_instances'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end # Workflow by workflowInstanceId --------------------------------------------------------- - desc 'byInstanceId', 'Get workflow instance by ID' + desc 'byInstanceId', 'Get workflow instance by ID in a system' # Required parameters/fields - option :workflowInstanceId, type: :numeric, required: true, + option :workflowInstanceId, aliases: '-w', type: :numeric, required: true, desc: 'A numeric value representing the workflowInstance identification' def byInstanceId - opts = Emasser::GET_WORKFLOWINSTANCES_RETURN_TYPE - result = EmassClient::WorkflowInstancesApi.new - .get_system_workflow_instances_by_workflow_instance_id(options[:workflowInstanceId], opts) + # opts = Emasser::GET_WORKFLOWINSTANCES_RETURN_TYPE + + result = EmassClient::WorkflowInstancesApi + .new.get_system_workflow_instances_by_workflow_instance_id(options[:workflowInstanceId]) puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling ApprovalChainApi->get_system_workflow_instances_by_workflow_instance_id'.red - puts to_output_hash(e).yellow + puts to_output_hash(e) end end @@ -626,36 +662,84 @@ def byInstanceId # Each dashboard dataset available from the API is automatically updated with the current # configuration of the dashboard and the instance of eMASS as the dashboard changes. # - # Endpoints: - # /api/dashboards/system-status-details - Get systems status detail dashboard information - # /api/dashboards/system-control-compliance-summary - Get systems control compliance summary dashboard information - # /api/dashboards/system-security-controls-details - Get systems security control details dashboard information - # /api/dashboards/system-assessment-procedures-details - Get systems assessement procdures details dashboard information - # /api/dashboards/system-poam-summary - Get systems POA&Ms summary dashboard information - # /api/dashboards/system-poam-details - Get system POA&Ms details dashboard information - # /api/dashboards/system-artifacts-summary - Get system Artifacts summary information. - # /api/dashboards/system-artifacts-details - Get system Artifacts details information. - # /api/dashboards/system-hardware-summary - Get system hardware summary dashboard information - # /api/dashboards/system-hardware-details - Get system hardware details dashboard information - # /api/dashboards/system-sensor-hardware-summary - Get system sensor hardware summary dashboard information - # /api/dashboards/system-sensor-hardware-details - Get system sensor hardware details dashboard information - # /api/dashboards/system-software-summary - Get system software summary dashboard information - # /api/dashboards/system-software-details - Get system ssoftware details dashboard information - # /api/dashboards/system-ports-protocols-summary - Get system ports and protocols summary dashboard information - # /api/dashboards/system-ports-protocols-details - Get system ports and protocols details dashboard information - # /api/dashboards/system-conmon-integration-status-summary - Get system conmon integration status summary dashboard information - # /api/dashboards/system-associations-details - Get system associations details dashboard information - # /api/dashboards/user-system-assignments-details - Get user system assignments details dashboard information - # /api/dashboards/system-privacy-summary - Get user system privacy summary dashboard information - # /api/dashboards/va-omb-fisma-saop-summary - Get VA OMB-FISMA SAOP summary dashboard information - # /api/dashboards/va-system-aa-summary - Get VA system A&A summary dashboard information - # /api/dashboards/va-system-a2-summary - Get VA system A2.0 summary dashboard information + # Endpoints: (37) + # --------------------------------------------------------------------------- + # System Status Dashboard + # /api/dashboards/system-status-details - Get systems status detail + # --------------------------------------------------------------------------- + # Enterprise Security Controls Dashboard + # /api/dashboards/system-control-compliance-summary - Get systems control compliance summary + # /api/dashboards/system-security-controls-details - Get systems security control details + # /api/dashboards/system-assessment-procedures-details - Get systems assessement procdures details + # --------------------------------------------------------------------------- + # Enterprise Terms Conditions Dashboards + # /api/dashboards/system-terms-conditions-summary - Get systems terms conditions summary + # /api/dashboards/system-terms-conditions-details - Get systems terms conditions details + # --------------------------------------------------------------------------- + # Enterprise POA&M Dashboards + # /api/dashboards/system-poam-summary - Get systems POA&Ms summary + # /api/dashboards/system-poam-details - Get system POA&Ms details + # --------------------------------------------------------------------------- + # Enterprise Artifacts Dashboards + # /api/dashboards/system-artifacts-summary - Get system Artifacts summary + # /api/dashboards/system-artifacts-details - Get system Artifacts details + # --------------------------------------------------------------------------- + # Hardware Baseline Dashboards + # /api/dashboards/system-hardware-summary - Get system hardware summary + # /api/dashboards/system-hardware-details - Get system hardware details + # --------------------------------------------------------------------------- + # Enterprise Sensor-based Hardware Resources Dashboards + # /api/dashboards/system-sensor-hardware-summary - Get system sensor hardware summary + # /api/dashboards/system-sensor-hardware-details - Get system sensor hardware details + # --------------------------------------------------------------------------- + # Software Baseline Dashboards + # /api/dashboards/system-software-summary - Get system software summary + # /api/dashboards/system-software-details - Get system ssoftware details + # --------------------------------------------------------------------------- + # Enterprise Sensor-based Software Resources Dashboards + # /api/dashboards/system-sensor-software-summary - Get system sensor software summary + # /api/dashboards/system-sensor-software-details - Get system sensor software details + # /api/dashboards/system-sensor-software-counts - Get system sensor software counts + # --------------------------------------------------------------------------- + # Enterprise Vulnerability Dashboards + # /api/dashboards/system-vulnerability-summary - Get system vulnerability summary + # /api/dashboards/system-device-findings-summary - Get system device findings summary + # /api/dashboards/system-device-findings-details - Get system device findings details + # --------------------------------------------------------------------------- + # Ports and Protocols Dashboards + # /api/dashboards/system-ports-protocols-summary - Get system ports and protocols summary + # /api/dashboards/system-ports-protocols-details - Get system ports and protocols details + #---------------------------------------------------------------------------- + # System CONMON Integration Status Dashboard + # /api/dashboards/system-conmon-integration-status-summary - Get system conmon integration status summary + #---------------------------------------------------------------------------- + # System Associations Dashboard + # /api/dashboards/system-associations-details - Get system associations details + #---------------------------------------------------------------------------- + # Users Dashboard + # /api/dashboards/user-system-assignments-details - Get user system assignments details + #---------------------------------------------------------------------------- + # Privacy Compliance Dashboards + # /api/dashboards/system-privacy-summary - Get user system privacy summary + # /api/dashboards/va-omb-fisma-saop-summary - Get VA OMB-FISMA SAOP summary + #---------------------------------------------------------------------------- + # System A&A Summary Dashboard + # /api/dashboards/va-system-aa-summary - Get VA system A&A summary + #---------------------------------------------------------------------------- + # System A2.0 Summary Dashboard + # /api/dashboards/va-system-a2-summary - Get VA system A2.0 summary + #---------------------------------------------------------------------------- + # System P.L. 109 Reporting Summary Dashboard # /api/dashboards/va-system-pl-109-reporting-summary - Get workflow instance by ID in a system - # /api/dashboards/va-system-fisma-inventory-summary - Get VA system FISMA inventory summary dashboard information - # /api/dashboards/va-system-fisma-inventory-crypto-summary - Get VA system FISMA inventory crypto summary dashboard information - # /api/dashboards/va-system-threat-risks-summary - Get VA System Threat Risks Summary dashboard information - # /api/dashboards/va-system-threat-sources-details - Get VA System Threat Sources Details dashboard information - # /api/dashboards/va-system-threat-architecture-details - Get VA System Threat Architecture Details dashboard information + #---------------------------------------------------------------------------- + # FISMA Inventory Summary Dashboards + # /api/dashboards/va-system-fisma-inventory-summary - Get VA system FISMA inventory summary + # /api/dashboards/va-system-fisma-inventory-crypto-summary - Get VA system FISMA inventory crypto summary + #---------------------------------------------------------------------------- + # Threat Risks Dashboards + # /api/dashboards/va-system-threat-risks-summary - Get VA System Threat Risks Summary + # /api/dashboards/va-system-threat-sources-details - Get VA System Threat Sources Details + # /api/dashboards/va-system-threat-architecture-details - Get VA System Threat Architecture Details class Dashboards < SubCommandBase def self.exit_on_failure? @@ -663,16 +747,13 @@ def self.exit_on_failure? end # Required parameters/fields - class_option :orgId, aliases: '-o', type: :numeric, + class_option :orgId, aliases: '-o', type: :numeric, required: true, desc: 'A numeric value representing the system identification' # Optional parameters/fields - class_option :excludeinherited, aliases: '-I', type: :boolean, required: false, default: false, - desc: 'BOOLEAN - true or false, default false.' - class_option :pageIndex, aliases: '-i', type: :numeric, required: false, - desc: 'The page number to be returned, if not specified starts at page 0' - class_option :pageSize, aliases: '-s', type: :numeric, required: false, - desc: 'The total entries per page, default is 20,000' + class_option :excludeinherited, aliases: '-I', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false, default false.' + class_option :pageIndex, aliases: '-i', type: :numeric, required: false, desc: 'The page number to be returned, if not specified starts at page 0' + class_option :pageSize, aliases: '-s', type: :numeric, required: false, desc: 'The total entries per page, default is 20,000' #-------------------------------------------------------------------------- # System Status Dashboard @@ -682,44 +763,76 @@ def status_details optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_status_details( + result = EmassClient::SystemStatusDashboardApi.new.get_system_status_details( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_status_details'.red + puts 'Exception when calling SystemStatusDashboardApi->get_system_status_details'.red + puts to_output_hash(e) + end + + #---------------------------------------------------------------------------- + # Enterprise Terms Conditions Dashboards + # /api/dashboards/system-terms-conditions-summary + desc 'terms_conditions_summary', 'Get systems terms conditions summary dashboard information' + def terms_conditions_summary + optional_options_keys = optional_options(@_initializer).keys + optional_options = to_input_hash(optional_options_keys, options) + + result = EmassClient::EnterpriseTermsConditionsDashboardsApi.new.get_system_terms_conditions_summary( + options[:orgId], optional_options + ) + puts to_output_hash(result).green + rescue EmassClient::ApiError => e + puts 'Exception when calling EnterpriseTermsConditionsDashboardsApi->get_system_terms_conditions_summary'.red + puts to_output_hash(e) + end + + # /api/dashboards/system-terms-conditions-details + desc 'terms_conditions_detail', 'Get systems terms conditions details dashboard information' + def terms_conditions_details + optional_options_keys = optional_options(@_initializer).keys + optional_options = to_input_hash(optional_options_keys, options) + + result = EmassClient::EnterpriseTermsConditionsDashboardsApi.new.get_system_terms_conditions_details( + options[:orgId], optional_options + ) + puts to_output_hash(result).green + rescue EmassClient::ApiError => e + puts 'Exception when calling EnterpriseTermsConditionsDashboardsApi->get_system_terms_conditions_details'.red puts to_output_hash(e) end #-------------------------------------------------------------------------- - # Enterprise Security Controls Dashboard + # Enterprise Security Controls Dashboards # /api/dashboards/system-control-compliance-summary desc 'control_compliance_summary', 'Get systems control compliance summary dashboard information' def control_compliance_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_control_compliance_summary( + result = EmassClient::EnterpriseSecurityControlsDashboardsApi.new.get_system_control_compliance_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_control_compliance_summary'.red + puts 'Exception when calling EnterpriseSecurityControlsDashboardsApi->get_system_control_compliance_summary'.red puts to_output_hash(e) end # /api/dashboards/system-security-controls-details desc 'security_control_details', 'Get systems security control details dashboard information' - def security_control_details + def security_controls_details optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_security_control_details( + result = EmassClient::EnterpriseSecurityControlsDashboardsApi.new.get_system_security_control_details( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_security_control_details'.red + puts 'Exception when calling EnterpriseSecurityControlsDashboardsApi->get_system_security_control_details'.red puts to_output_hash(e) end @@ -729,12 +842,12 @@ def assessment_procedures_details optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_assessment_procedures_details( + result = EmassClient::EnterpriseSecurityControlsDashboardsApi.new.get_system_assessment_procedures_details( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_assessment_procedures_details'.red + puts 'Exception when calling EnterpriseSecurityControlsDashboardsApi->get_system_assessment_procedures_details'.red puts to_output_hash(e) end @@ -746,12 +859,12 @@ def poam_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_poam_summary( + result = EmassClient::EnterprisePOAMDashboardsApi.new.get_system_poam_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_poam_summary'.red + puts 'Exception when calling EnterprisePOAMDashboardsApi->get_system_poam_summary'.red puts to_output_hash(e) end @@ -761,12 +874,12 @@ def poam_details optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_poam_details( + result = EmassClient::EnterprisePOAMDashboardsApi.new.get_system_poam_details( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_poam_details'.red + puts 'Exception when calling EnterprisePOAMDashboardsApi->get_system_poam_details'.red puts to_output_hash(e) end @@ -778,12 +891,12 @@ def artifacts_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_artifacts_summary( + result = EmassClient::EnterpriseArtifactsDashboardsApi.new.get_system_artifacts_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_artifacts_summary'.red + puts 'Exception when calling EnterpriseArtifactsDashboardsApi->get_system_artifacts_summary'.red puts to_output_hash(e) end @@ -793,12 +906,12 @@ def artifacts_details optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_artifacts_details( + result = EmassClient::EnterpriseArtifactsDashboardsApi.new.get_system_artifacts_details( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_artifacts_details'.red + puts 'Exception when calling EnterpriseArtifactsDashboardsApi->get_system_artifacts_details'.red puts to_output_hash(e) end @@ -810,12 +923,12 @@ def hardware_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_hardware_summary( + result = EmassClient::HardwareBaselineDashboardsApi.new.get_system_hardware_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_hardware_summary'.red + puts 'Exception when calling HardwareBaselineDashboardsApi->get_system_hardware_summary'.red puts to_output_hash(e) end @@ -825,12 +938,12 @@ def hardware_details optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_hardware_details( + result = EmassClient::HardwareBaselineDashboardsApi.new.get_system_hardware_details( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_hardware_details'.red + puts 'Exception when calling HardwareBaselineDashboardsApi->get_system_hardware_details'.red puts to_output_hash(e) end @@ -842,12 +955,12 @@ def sensor_hardware_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_sensor_hardware_summary( + result = EmassClient::EnterpriseSensorBasedHardwareResourcesDashboardsApi.new.get_system_sensor_hardware_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_sensor_hardware_summary'.red + puts 'Exception when calling EnterpriseSensorBasedHardwareResourcesDashboardsApi->get_system_sensor_hardware_summary'.red puts to_output_hash(e) end @@ -857,12 +970,12 @@ def sensor_hardware_details optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_sensor_hardware_details( + result = EmassClient::EnterpriseSensorBasedHardwareResourcesDashboardsApi.new.get_system_sensor_hardware_details( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_sensor_hardware_details'.red + puts 'Exception when calling EnterpriseSensorBasedHardwareResourcesDashboardsApi->get_system_sensor_hardware_details'.red puts to_output_hash(e) end @@ -874,12 +987,12 @@ def software_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_software_summary( + result = EmassClient::SoftwareBaselineDashboardsApi.new.get_system_software_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_software_summary'.red + puts 'Exception when calling SoftwareBaselineDashboardsApi->get_system_software_summary'.red puts to_output_hash(e) end @@ -889,29 +1002,123 @@ def software_details optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_software_details( + result = EmassClient::SoftwareBaselineDashboardsApi.new.get_system_software_details( + options[:orgId], optional_options + ) + puts to_output_hash(result).green + rescue EmassClient::ApiError => e + puts 'Exception when calling SoftwareBaselineDashboardsApi->get_system_software_details'.red + puts to_output_hash(e) + end + + #-------------------------------------------------------------------------- + # Enterprise Sensor-based Software Resources Dashboards + # /api/dashboards/system-sensor-software-summary + desc 'sensor_software_summary', 'Get system sensor software summary dashboard information' + def sensor_software_summary + optional_options_keys = optional_options(@_initializer).keys + optional_options = to_input_hash(optional_options_keys, options) + + result = EmassClient::EnterpriseSensorBasedSoftwareResourcesDashboardsApi.new.get_system_sensor_software_summary( + options[:orgId], optional_options + ) + puts to_output_hash(result).green + rescue EmassClient::ApiError => e + puts 'Exception when calling EnterpriseSensorBasedSoftwareResourcesDashboardsApi->get_system_sensor_software_summary'.red + puts to_output_hash(e) + end + + # /api/dashboards/system-sensor-software-details + desc 'sensor_software_details', 'Get system sensor software details dashboard information' + def sensor_software_details + optional_options_keys = optional_options(@_initializer).keys + optional_options = to_input_hash(optional_options_keys, options) + + result = EmassClient::EnterpriseSensorBasedSoftwareResourcesDashboardsApi.new.get_system_sensor_software_details( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_software_details'.red + puts 'Exception when calling EnterpriseSensorBasedSoftwareResourcesDashboardsApi->get_system_sensor_software_details'.red + puts to_output_hash(e) + end + + # /api/dashboards/system-sensor-software-counts + desc 'sensor_software_counts', 'Get system sensor software counts dashboard information' + def sensor_software_counts + optional_options_keys = optional_options(@_initializer).keys + optional_options = to_input_hash(optional_options_keys, options) + + result = EmassClient::EnterpriseSensorBasedSoftwareResourcesDashboardsApi.new.get_system_sensor_software_counts( + options[:orgId], optional_options + ) + puts to_output_hash(result).green + rescue EmassClient::ApiError => e + puts 'Exception when calling EnterpriseSensorBasedSoftwareResourcesDashboardsApi->get_system_sensor_software_counts'.red puts to_output_hash(e) end #-------------------------------------------------------------------------- - # Ports and Protocols Dashboard + # Enterprise Vulnerability Dashboards + # /api/dashboards/system-vulnerability-summary + desc 'vulnerability_summary', 'Get system vulnerability summary dashboard information' + def vulnerability_summary + optional_options_keys = optional_options(@_initializer).keys + optional_options = to_input_hash(optional_options_keys, options) + + result = EmassClient::EnterpriseVulnerabilityDashboardsApi.new.get_system_vulnerability_summary( + options[:orgId], optional_options + ) + puts to_output_hash(result).green + rescue EmassClient::ApiError => e + puts 'Exception when calling EnterpriseVulnerabilityDashboardsApi->get_system_vulnerability_summary'.red + puts to_output_hash(e) + end + + # /api/dashboards/system-device-findings-summary + desc 'device_findings_summary', 'Get system device findings summary dashboard information' + def device_findings_summary + optional_options_keys = optional_options(@_initializer).keys + optional_options = to_input_hash(optional_options_keys, options) + + result = EmassClient::EnterpriseVulnerabilityDashboardsApi.new.get_system_device_findings_summary( + options[:orgId], optional_options + ) + puts to_output_hash(result).green + rescue EmassClient::ApiError => e + puts 'Exception when calling EnterpriseVulnerabilityDashboardsApi->get_system_device_findings_summary'.red + puts to_output_hash(e) + end + + # /api/dashboards/system-device-findings-details + desc 'device_findings_details', 'Get system device findings details dashboard information' + def device_findings_details + optional_options_keys = optional_options(@_initializer).keys + optional_options = to_input_hash(optional_options_keys, options) + + result = EmassClient::EnterpriseVulnerabilityDashboardsApi.new.get_system_device_findings_details( + options[:orgId], optional_options + ) + puts to_output_hash(result).green + rescue EmassClient::ApiError => e + puts 'Exception when calling EnterpriseVulnerabilityDashboardsApi->get_system_device_findings_details'.red + puts to_output_hash(e) + end + + #-------------------------------------------------------------------------- + # Ports and Protocols Dashboards # /api/dashboards/system-ports-protocols-summary desc 'ports_protocols_summary', 'Get system ports & portocols summary dashboard information' def ports_protocols_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_ports_protocols_summary( + result = EmassClient::PortsAndProtocolsDashboardsApi.new.get_system_ports_protocols_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_ports_protocols_summary'.red + puts 'Exception when calling PortsAndProtocolsDashboardsApi->get_system_ports_protocols_summary'.red puts to_output_hash(e) end @@ -921,29 +1128,29 @@ def ports_protocols_details optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_ports_protocols_details( + result = EmassClient::PortsAndProtocolsDashboardsApi.new.get_system_ports_protocols_details( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_ports_protocols_details'.red + puts 'Exception when calling PortsAndProtocolsDashboardsApi->get_system_ports_protocols_details'.red puts to_output_hash(e) end #-------------------------------------------------------------------------- # System CONMON Integration Status Dashboard # /api/dashboards/system-conmon-integration-status-summary - desc 'common_integration_status_summary', 'Get system conmon integration status summary dashboard information' - def common_integration_status_summary + desc 'integration_status_summary', 'Get system conmon integration status summary dashboard information' + def integration_status_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_common_integration_status_summary( + result = EmassClient::SystemCONMONIntegrationStatusDashboardApi.new.get_system_common_integration_status_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_common_integration_status_summary'.red + puts 'Exception when calling SystemCONMONIntegrationStatusDashboardApi->get_system_common_integration_status_summary'.red puts to_output_hash(e) end @@ -955,12 +1162,12 @@ def associations_details optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_associations_details( + result = EmassClient::SystemAssociationsDashboardApi.new.get_system_associations_details( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_associations_details'.red + puts 'Exception when calling SystemAssociationsDashboardApi->get_system_associations_details'.red puts to_output_hash(e) end @@ -972,12 +1179,12 @@ def assignments_details optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_user_system_assignments_details( + result = EmassClient::UsersDashboardApi.new.get_user_system_assignments_details( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_user_system_assignments_details'.red + puts 'Exception when calling UsersDashboardApi->get_user_system_assignments_details'.red puts to_output_hash(e) end @@ -989,12 +1196,12 @@ def privacy_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_system_privacy_summary( + result = EmassClient::PrivacyComplianceDashboardsApi.new.get_system_privacy_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_system_privacy_summary'.red + puts 'Exception when calling PrivacyComplianceDashboardsApi->get_system_privacy_summary'.red puts to_output_hash(e) end @@ -1004,12 +1211,12 @@ def fisma_saop_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_va_omb_fsma_saop_summary( + result = EmassClient::PrivacyComplianceDashboardsApi.new.get_va_omb_fsma_saop_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_va_omb_fsma_saop_summary'.red + puts 'Exception when calling PrivacyComplianceDashboardsApi->get_va_omb_fsma_saop_summary'.red puts to_output_hash(e).yellow end @@ -1021,12 +1228,12 @@ def va_aa_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_va_system_aa_summary( + result = EmassClient::SystemAASummaryDashboardApi.new.get_va_system_aa_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_va_system_aa_summary'.red + puts 'Exception when calling SystemAASummaryDashboardApi->get_va_system_aa_summary'.red puts to_output_hash(e).yellow end @@ -1038,12 +1245,12 @@ def va_a2_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_va_system_a2_summary( + result = EmassClient::SystemA20SummaryDashboardApi.new.get_va_system_a2_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_va_system_a2_summary'.red + puts 'Exception when calling SystemA20SummaryDashboardApi->get_va_system_a2_summary'.red puts to_output_hash(e).yellow end @@ -1052,15 +1259,15 @@ def va_a2_summary # /api/dashboards/va-system-pl-109-reporting-summary desc 'va_pl_109_summary', 'Get VA System P.L. 109 reporting summary dashboard information' def va_pl_109_summary - optional_options = options.clone - optional_options.delete('orgId') + optional_options_keys = optional_options(@_initializer).keys + optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_va_system_pl109_reporting_summary( + result = EmassClient::SystemPL109ReportingSummaryDashboardApi.new.get_va_system_pl109_reporting_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_va_system_pl109_reporting_summary'.red + puts 'Exception when calling SystemPL109ReportingSummaryDashboardApi->get_va_system_pl109_reporting_summary'.red puts to_output_hash(e).yellow end @@ -1072,12 +1279,12 @@ def fisma_inventory_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_va_system_fisma_invetory_summary( + result = EmassClient::FISMAInventorySummaryDashboardsApi.new.get_va_system_fisma_invetory_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_va_system_fisma_invetory_summary'.red + puts 'Exception when calling FISMAInventorySummaryDashboardsApi->get_va_system_fisma_invetory_summary'.red puts to_output_hash(e).yellow end @@ -1087,12 +1294,12 @@ def fisma_inventory_crypto_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_va_system_fisma_invetory_crypto_summary( + result = EmassClient::FISMAInventorySummaryDashboardsApi.new.get_va_system_fisma_invetory_crypto_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_va_system_fisma_invetory_crypto_summary'.red + puts 'Exception when calling FISMAInventorySummaryDashboardsApi->get_va_system_fisma_invetory_crypto_summary'.red puts to_output_hash(e).yellow end @@ -1104,12 +1311,12 @@ def threat_risk_summary optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_va_system_threat_risk_summary( + result = EmassClient::ThreatRisksDashboardsApi.new.get_va_system_threat_risk_summary( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_va_system_threat_risk_summary'.red + puts 'Exception when calling ThreatRisksDashboardsApi->get_va_system_threat_risk_summary'.red puts to_output_hash(e).yellow end @@ -1119,12 +1326,12 @@ def threat_risk_details optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_va_system_threat_source_details( + result = EmassClient::ThreatRisksDashboardsApi.new.get_va_system_threat_source_details( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_va_system_threat_source_details'.red + puts 'Exception when calling ThreatRisksDashboardsApi->get_va_system_threat_source_details'.red puts to_output_hash(e).yellow end @@ -1134,12 +1341,12 @@ def threat_architecture_details optional_options_keys = optional_options(@_initializer).keys optional_options = to_input_hash(optional_options_keys, options) - result = EmassClient::DashboardsApi.new.get_va_system_threat_architecture_details( + result = EmassClient::ThreatRisksDashboardsApi.new.get_va_system_threat_architecture_details( options[:orgId], optional_options ) puts to_output_hash(result).green rescue EmassClient::ApiError => e - puts 'Exception when calling DashboardsApi->get_va_system_threat_architecture_details'.red + puts 'Exception when calling ThreatRisksDashboardsApi->get_va_system_threat_architecture_details'.red puts to_output_hash(e).yellow end end diff --git a/lib/emasser/help/artifacts_del_mapper.md b/lib/emasser/help/artifacts_del_mapper.md index 9f929d8..8b77d82 100644 --- a/lib/emasser/help/artifacts_del_mapper.md +++ b/lib/emasser/help/artifacts_del_mapper.md @@ -4,6 +4,6 @@ Provide single file or a space/comma delimited list of file names to be removed Example: -bundle exec exe/emasser delete artifacts remove --systemId [value] --files [value] +bundle exec exe/emasser delete artifacts remove -s, --systemId [value] -f, --files [value] or -bundle exec exe/emasser delete artifacts remove --systemId [value] --files [value ... value] +bundle exec exe/emasser delete artifacts remove -s, --systemId [value] -f, --files [value ... value] diff --git a/lib/emasser/help/milestone_del_mapper.md b/lib/emasser/help/milestone_del_mapper.md index 8142870..dfeb80d 100644 --- a/lib/emasser/help/milestone_del_mapper.md +++ b/lib/emasser/help/milestone_del_mapper.md @@ -8,4 +8,4 @@ The last milestone can not be deleted, at-least on must exist. Example: -bundle exec exe/emasser delete milestones remove--systemId [value] --poamId [value] --milestoneId [value] +bundle exec exe/emasser delete milestones remove -s, --systemId [value] -p, --poamId [value] -m, --milestoneId [value] \ No newline at end of file diff --git a/lib/emasser/help/poam_del_mapper.md b/lib/emasser/help/poam_del_mapper.md index 96df0b0..ac738a4 100644 --- a/lib/emasser/help/poam_del_mapper.md +++ b/lib/emasser/help/poam_del_mapper.md @@ -2,4 +2,4 @@ Remove one or many poa&m items in a system Example: -bundle exec exe/emasser delete poams remove --systemId [value] --poamId [value] +bundle exec exe/emasser delete poams remove -s, --systemId [value] -p, --poamId [value] diff --git a/lib/emasser/output_converters.rb b/lib/emasser/output_converters.rb index 9d4ec4c..bc17e08 100644 --- a/lib/emasser/output_converters.rb +++ b/lib/emasser/output_converters.rb @@ -79,7 +79,9 @@ def to_output_hash(obj) # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Style/TernaryParentheses # rubocop:enable Style/IfWithBooleanLiteralBranches, Style/RescueStandardError, Metrics/BlockNesting + # rubocop:disable Style/RedundantReturn # rubocop:disable Style/IdenticalConditionalBranches + # rubocop:disable Metrics/BlockNesting, Style/RescueStandardError # rubocop:disable Performance/RedundantMatch, Performance/RegexpMatch # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def change_to_datetime(obj) @@ -98,18 +100,26 @@ def change_to_datetime(obj) obj_entry[key] = hash_array data_obj.merge!(obj_entry) else + date_value = value if /(DATE|TIMESTAMP|LASTSEEN|TIME|ATD)/.match(key.to_s.upcase) - value = value.nil? ? value : Time.at(value.to_i) + begin + date_value = Integer(value) + if date_value > 100000000 + date_value = value.nil? ? value : Time.at(date_value) + end + rescue + date_value + end end - obj_entry[key] = value + obj_entry[key] = date_value data_obj.merge!(obj_entry) end end - # rubocop:disable Style/RedundantReturn return data_obj - # rubocop:enable Style/RedundantReturn end + # rubocop:enable Style/RedundantReturn # rubocop:enable Style/IdenticalConditionalBranches + # rubocop:enable Metrics/BlockNesting, Style/RescueStandardError # rubocop:enable Performance/RedundantMatch, Performance/RegexpMatch # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity end diff --git a/lib/emasser/version.rb b/lib/emasser/version.rb index e82aa47..4681aaf 100644 --- a/lib/emasser/version.rb +++ b/lib/emasser/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Emasser - VERSION = '3.10.0' + VERSION = '3.12.0' end diff --git a/spec/test_delete_cli_spec.rb b/spec/test_delete_cli_spec.rb index 4a8bc85..5aab314 100644 --- a/spec/test_delete_cli_spec.rb +++ b/spec/test_delete_cli_spec.rb @@ -41,3 +41,6 @@ end end end + +# To run use +# rspec spec\test_delete_cli_spec.rb --format documentation diff --git a/spec/test_post_cli_spec.rb b/spec/test_post_cli_spec.rb index 06f2faf..047aeac 100644 --- a/spec/test_post_cli_spec.rb +++ b/spec/test_post_cli_spec.rb @@ -115,3 +115,6 @@ end end end + +# to run use: +# rspec spec\test_post_cli_spec.rb --format documentation diff --git a/spec/test_put_cli_spec.rb b/spec/test_put_cli_spec.rb index 9c75837..b152b6c 100644 --- a/spec/test_put_cli_spec.rb +++ b/spec/test_put_cli_spec.rb @@ -53,3 +53,6 @@ end end end + +# to run use: +# rspec spec\test_put_cli_spec.rb --format documentation