emasser 1.0.3 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.env-example +2 -0
  3. data/.github/workflows/gh-pages.yml +4 -5
  4. data/.github/workflows/release.yml +9 -9
  5. data/Dockerfile +6 -4
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +23 -30
  8. data/README.md +87 -78
  9. data/docs/features.md +343 -207
  10. data/docs/images/emasser_architecture.jpg +0 -0
  11. data/emasser.gemspec +5 -3
  12. data/images/emasser_architecture.jpg +0 -0
  13. data/images/emasser_diagram-Page-3.jpg +0 -0
  14. data/lib/emasser/cli.rb +2 -2
  15. data/lib/emasser/configuration.rb +1 -0
  16. data/lib/emasser/constants.rb +11 -3
  17. data/lib/emasser/delete.rb +9 -7
  18. data/lib/emasser/get.rb +43 -48
  19. data/lib/emasser/help/cloudresource_post_mapper.md +62 -0
  20. data/lib/emasser/help/container_post_mapper.md +44 -0
  21. data/lib/emasser/output_converters.rb +101 -4
  22. data/lib/emasser/post.rb +231 -38
  23. data/lib/emasser/put.rb +23 -16
  24. data/lib/emasser/version.rb +1 -1
  25. metadata +19 -25
  26. data/.github/workflows/generate_docs.yml +0 -33
  27. data/docs/developers.md +0 -115
  28. data/docs/swagger/dist/favicon-16x16.png +0 -0
  29. data/docs/swagger/dist/favicon-32x32.png +0 -0
  30. data/docs/swagger/dist/oauth2-redirect.html +0 -75
  31. data/docs/swagger/dist/swagger-ui-bundle.js +0 -3
  32. data/docs/swagger/dist/swagger-ui-bundle.js.map +0 -1
  33. data/docs/swagger/dist/swagger-ui-es-bundle-core.js +0 -3
  34. data/docs/swagger/dist/swagger-ui-es-bundle-core.js.map +0 -1
  35. data/docs/swagger/dist/swagger-ui-es-bundle.js +0 -3
  36. data/docs/swagger/dist/swagger-ui-es-bundle.js.map +0 -1
  37. data/docs/swagger/dist/swagger-ui-standalone-preset.js +0 -3
  38. data/docs/swagger/dist/swagger-ui-standalone-preset.js.map +0 -1
  39. data/docs/swagger/dist/swagger-ui.css +0 -4
  40. data/docs/swagger/dist/swagger-ui.css.map +0 -1
  41. data/docs/swagger/dist/swagger-ui.js +0 -3
  42. data/docs/swagger/dist/swagger-ui.js.map +0 -1
  43. data/docs/swagger/index.html +0 -60
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emasser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amndeep Singh Mann
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: exe
14
14
  cert_chain: []
15
- date: 2022-01-14 00:00:00.000000000 Z
15
+ date: 2022-06-17 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -91,6 +91,9 @@ dependencies:
91
91
  - - "~>"
92
92
  - !ruby/object:Gem::Version
93
93
  version: '1.0'
94
+ - - "!="
95
+ - !ruby/object:Gem::Version
96
+ version: 1.0.3
94
97
  type: :runtime
95
98
  prerelease: false
96
99
  version_requirements: !ruby/object:Gem::Requirement
@@ -98,6 +101,9 @@ dependencies:
98
101
  - - "~>"
99
102
  - !ruby/object:Gem::Version
100
103
  version: '1.0'
104
+ - - "!="
105
+ - !ruby/object:Gem::Version
106
+ version: 1.0.3
101
107
  - !ruby/object:Gem::Dependency
102
108
  name: bundler
103
109
  requirement: !ruby/object:Gem::Requirement
@@ -238,10 +244,10 @@ dependencies:
238
244
  - - "~>"
239
245
  - !ruby/object:Gem::Version
240
246
  version: '0.5'
241
- description: emasser can be used as a gem or used from the command line to access
242
- eMASS via thei API.
247
+ description: emasser can be used as a gem or used from the command line (CL) to access
248
+ eMASS endpoints via their API.
243
249
  email:
244
- - saf@mitre.org
250
+ - saf@groups.mitre.org
245
251
  executables:
246
252
  - emasser
247
253
  extensions: []
@@ -252,7 +258,6 @@ files:
252
258
  - ".github/release-drafter.yml"
253
259
  - ".github/workflows/codeql-analysis.yml"
254
260
  - ".github/workflows/draft-release.yml"
255
- - ".github/workflows/generate_docs.yml"
256
261
  - ".github/workflows/gh-pages.yml"
257
262
  - ".github/workflows/push-to-docker-mail.yml"
258
263
  - ".github/workflows/push-to-docker.yml"
@@ -271,27 +276,13 @@ files:
271
276
  - README.md
272
277
  - Rakefile
273
278
  - _config.yml
274
- - docs/developers.md
275
279
  - docs/features.md
280
+ - docs/images/emasser_architecture.jpg
276
281
  - docs/redoc/index.html
277
- - docs/swagger/dist/favicon-16x16.png
278
- - docs/swagger/dist/favicon-32x32.png
279
- - docs/swagger/dist/oauth2-redirect.html
280
- - docs/swagger/dist/swagger-ui-bundle.js
281
- - docs/swagger/dist/swagger-ui-bundle.js.map
282
- - docs/swagger/dist/swagger-ui-es-bundle-core.js
283
- - docs/swagger/dist/swagger-ui-es-bundle-core.js.map
284
- - docs/swagger/dist/swagger-ui-es-bundle.js
285
- - docs/swagger/dist/swagger-ui-es-bundle.js.map
286
- - docs/swagger/dist/swagger-ui-standalone-preset.js
287
- - docs/swagger/dist/swagger-ui-standalone-preset.js.map
288
- - docs/swagger/dist/swagger-ui.css
289
- - docs/swagger/dist/swagger-ui.css.map
290
- - docs/swagger/dist/swagger-ui.js
291
- - docs/swagger/dist/swagger-ui.js.map
292
- - docs/swagger/index.html
293
282
  - emasser.gemspec
294
283
  - exe/emasser
284
+ - images/emasser_architecture.jpg
285
+ - images/emasser_diagram-Page-3.jpg
295
286
  - lib/emasser.rb
296
287
  - lib/emasser/cli.rb
297
288
  - lib/emasser/configuration.rb
@@ -305,7 +296,9 @@ files:
305
296
  - lib/emasser/help/artifacts_del_mapper.md
306
297
  - lib/emasser/help/artifacts_post_mapper.md
307
298
  - lib/emasser/help/artifacts_put_mapper.md
299
+ - lib/emasser/help/cloudresource_post_mapper.md
308
300
  - lib/emasser/help/cmmc_get_mapper.md
301
+ - lib/emasser/help/container_post_mapper.md
309
302
  - lib/emasser/help/controls_put_mapper.md
310
303
  - lib/emasser/help/milestone_del_mapper.md
311
304
  - lib/emasser/help/milestone_post_mapper.md
@@ -325,7 +318,8 @@ files:
325
318
  homepage: https://saf.mitre.org
326
319
  licenses:
327
320
  - Apache-2.0
328
- metadata: {}
321
+ metadata:
322
+ github_repo: ssh://github.com/mitre/emasser
329
323
  post_install_message:
330
324
  rdoc_options: []
331
325
  require_paths:
@@ -341,7 +335,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
341
335
  - !ruby/object:Gem::Version
342
336
  version: '0'
343
337
  requirements: []
344
- rubygems_version: 3.2.32
338
+ rubygems_version: 3.3.7
345
339
  signing_key:
346
340
  specification_version: 4
347
341
  summary: Provide an automated capability for invoving eMASS API endpoints
@@ -1,33 +0,0 @@
1
- name: generate-docs
2
-
3
- # Run on each push to main
4
- on:
5
- push:
6
- branches: [ main ]
7
-
8
- jobs:
9
- test_job:
10
- runs-on: ubuntu-latest
11
- name: Generate Document with redoc
12
- steps:
13
- - name: Checkout
14
- uses: actions/checkout@v2
15
-
16
- # use the public name of the action
17
- - name: redoc-cli test
18
- uses: seeebiii/redoc-cli-github-action@v9
19
- with:
20
- args: 'bundle emass_client/eMASSRestOpenApi.yaml -o docs/redoc/index.html'
21
-
22
- - name: check result
23
- run: |
24
- ls -al
25
- test -f docs/redoc/index.html || (echo "Fail to generate docs/redoc/index.html from previous step." && exit 1)
26
-
27
- - name: deploy
28
- uses: peaceiris/actions-gh-pages@v3
29
- with:
30
- github_token: ${{ secrets.GITHUB_TOKEN }}
31
- publish_dir: ./docs/redoc
32
- destination_dir: docs/redoc
33
- enable_jekyll: true
data/docs/developers.md DELETED
@@ -1,115 +0,0 @@
1
- # Developers Instructions
2
-
3
- The documentation provided here is an OpenAPI (v3.0.3) Specification compliant describing, producing, consuming, and visualizing the eMASS RESTful API web services (endpoints) as described in the eMASS REST API (v3.2) document, dated October 21, 2021.
4
-
5
- The API is documented in YAML and can be viewed utilizing Swagger Editor or Visual Studio Code (VSC) with swagger and yaml extensions.
6
-
7
- ### Viewing the API via Swagger
8
-
9
- There are online tool options for viewing and editing OpenAPI compliant RESTfull APIs like the eMASS API documentations. Some of these tools are Swagger Editor or SwaggerHub. <strong>We discourage the utilization of any online capability for editing a controlled unclassified API document</strong>.
10
-
11
- To install the Swagger Editor offline from its repository follow these [instructions](https://github.com/swagger-api/swagger-editor).
12
-
13
- ### Generate the API documentation (to view in a web browser-html)
14
- eMASS API documentation can be found [here](/docs/redoc/index.html)
15
-
16
- To generate the API documentation that can be viewable in a totally dependency-free (and nice looking) HTML use the `redoc-cli` command line tool.
17
-
18
-
19
- Install the tool via `npm`:
20
- ```bash
21
- npm install -g redoc-cli
22
- ```
23
- To generate the HTML document, use the following command:
24
- ```bash
25
- redoc-cli bundle -o ./output/eMASS.html eMASSRestOpenApi.yaml
26
- ```
27
-
28
- The command above assumes that the generated file is placed in a subfolder relative to the current folder called output, and that the eMASSRestApi.yaml is in the current working directory. The generated file is called eMASS.html and can be viewed in any web browser.
29
-
30
- ### Setting up Visual Studio Code
31
- Install these Extensions (Ctrl+Shift+X):
32
- * YAML ([link](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml))
33
- * Swagger Viewer ([link](https://marketplace.visualstudio.com/items?itemName=Arjun.swagger-viewer))
34
- * OpenAPI Swagger Editor ([link](https://marketplace.visualstudio.com/items?itemName=42Crunch.vscode-openapi))
35
- * Swagger Snippets ([link](https://marketplace.visualstudio.com/items?itemName=adisreyaj.swagger-snippets), optional)
36
-
37
- Open the eMASS Rest API file by selecting File -> Open Folder and select the folder containing the eMASSRestApi.yaml file. Open the file into the editor and select the "OpenApi: show preview using default render" (Ctrl+K V)
38
-
39
- Once the mock server is running, we can utilize the "Try it Out" on each of the API endpoints to test the API documentation with mock data.
40
-
41
- ### Using PRISM HTTP mock Server
42
- Install prism (if not installed) via npm:
43
- ``` npm
44
- npm install -g @stoplight/prism-cli
45
- ```
46
-
47
- Run the prism server on the localhost, use the -p parameter to set the port (using 4010)
48
- ``` node
49
- prism mock -p 4010 eMASSRestOpenApi.yaml
50
- ```
51
-
52
- To invoke the mock server interactive use the -d parameter (provides fake responses using x-faker)
53
- ``` node
54
- prism mock -d -p 4010 eMASSRestOpenAPI.yaml
55
- ```
56
- **Note:**
57
- * The Prism starting commands above assumes that the current path contains the eMASSRestAPI.yaml file
58
- * If using VSC, Prism restarts automatically when the yaml file is modified and saved
59
- * Use `npx` instead of `npm` to install packages locally, but still be able to run them as if they were global
60
-
61
- Now you can access the fake API endpoints utilizing either CURL or the Swagger Editor. The following curl command invokes the systems endpoint with a path parameter of policy=rmf:
62
- ``` node
63
- curl -X GET "http://localhost:4010/api/systems?policy=rmf" -H "accept: application/json" -H "api-key: f32516cc-57d3-43f5-9e16-8f86780a4cce" -H "user-uid: 1647389405"
64
- ```
65
- Note: The API expects the api-key and user-uid headers.
66
-
67
- ## Swagger Codegen
68
- ### Clone the source code
69
- Follow these instruction to generate the eMASS client API library (software development kit - SDK):
70
- ``` git
71
- git clone https://github.com/swagger-api/swagger-codegen
72
- cd swagger-codegen
73
- git checkout 3.0.0
74
- mvn clean package
75
- ```
76
- Alternatively, you can follow instruction listed in [Swagger Codegen](https://github.com/swagger-api/swagger-codegen/tree/3.0.0#getting-started). The eMASS API utilized the OpenAPI version 3.0 standards, ensure that the proper `Swagger Codegen` is utilized to generate the client SDK.
77
-
78
-
79
- ### Build the Client SDK
80
-
81
- NOTE: The current [handlebar templates](https://github.com/swagger-api/swagger-codegen/tree/3.0.0#modifying-the-client-library-format) do not provide a configuration variable where a keypassword can be defined containing the client certificate passphrase used by libcurl wrapper Typhoeus. For this reason, we have provided [updated templates](./swagger-codegen/ruby_template) that can be utilized in the interim until the necessary fixes are integrated into the [main repository](https://github.com/swagger-api/swagger-codegen/tree/3.0.0)
82
-
83
- After cloning the appropriate `Swagger Codegen` baseline (3.0.0) generate the SDK (make sure you are in the cloned directory, e.g; /path/to/codegen/swagger-codegen)
84
-
85
- To generate the client SDK with provided templates use:
86
- ``` node
87
- java -jar swagger-codegen-cli generate generate -i /path/to/yaml/eMASSRestOpenApi.yaml -l ruby -t emass_client/swagger-codegen/ruby_template -o /path/to/sdk/emass_api_client
88
- ```
89
-
90
-
91
- To generate without specifying the templates use:
92
- ``` node
93
- java -jar swagger-codegen-cli generate -i /path/to/yaml/eMASSRestOpenApi.yaml -l ruby -o /path/to/sdk/emass_api_client
94
- ```
95
- Note: The command listed above is for generating a ruby client SDK. Other languages are available, see instructions [here](https://github.com/swagger-api/swagger-codegen/tree/3.0.0#to-generate-a-sample-client-library)
96
-
97
- ## Ruby Client
98
- Information about the swagger generated ruby client SDK refer to the [ruby_client](./ruby_client) directory.
99
-
100
-
101
- ---
102
-
103
- NOTICE
104
-
105
- © 2020 The MITRE Corporation.
106
-
107
- Approved for Public Release; Distribution Unlimited. Case Number 18-3678.
108
- NOTICE
109
-
110
- MITRE hereby grants express written permission to use, reproduce, distribute, modify, and otherwise leverage this software to the extent permitted by the licensed terms provided in the LICENSE.md file included with this project.
111
- NOTICE
112
-
113
- This software was produced for the U. S. Government under Contract Number HHSM-500-2012-00008I, and is subject to Federal Acquisition Regulation Clause 52.227-14, Rights in Data-General.
114
-
115
- No other use other than that granted to the U. S. Government, or to those acting on behalf of the U. S. Government under that Clause is authorized without the express written permission of The MITRE Corporation. DISA STIGs are published by DISA, see: https://public.cyber.mil/privacy-security/
Binary file
Binary file
@@ -1,75 +0,0 @@
1
- <!doctype html>
2
- <html lang="en-US">
3
- <head>
4
- <title>Swagger UI: OAuth2 Redirect</title>
5
- </head>
6
- <body>
7
- <script>
8
- 'use strict';
9
- function run () {
10
- var oauth2 = window.opener.swaggerUIRedirectOauth2;
11
- var sentState = oauth2.state;
12
- var redirectUrl = oauth2.redirectUrl;
13
- var isValid, qp, arr;
14
-
15
- if (/code|token|error/.test(window.location.hash)) {
16
- qp = window.location.hash.substring(1);
17
- } else {
18
- qp = location.search.substring(1);
19
- }
20
-
21
- arr = qp.split("&");
22
- arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
23
- qp = qp ? JSON.parse('{' + arr.join() + '}',
24
- function (key, value) {
25
- return key === "" ? value : decodeURIComponent(value);
26
- }
27
- ) : {};
28
-
29
- isValid = qp.state === sentState;
30
-
31
- if ((
32
- oauth2.auth.schema.get("flow") === "accessCode" ||
33
- oauth2.auth.schema.get("flow") === "authorizationCode" ||
34
- oauth2.auth.schema.get("flow") === "authorization_code"
35
- ) && !oauth2.auth.code) {
36
- if (!isValid) {
37
- oauth2.errCb({
38
- authId: oauth2.auth.name,
39
- source: "auth",
40
- level: "warning",
41
- message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
42
- });
43
- }
44
-
45
- if (qp.code) {
46
- delete oauth2.state;
47
- oauth2.auth.code = qp.code;
48
- oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
49
- } else {
50
- let oauthErrorMsg;
51
- if (qp.error) {
52
- oauthErrorMsg = "["+qp.error+"]: " +
53
- (qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
54
- (qp.error_uri ? "More info: "+qp.error_uri : "");
55
- }
56
-
57
- oauth2.errCb({
58
- authId: oauth2.auth.name,
59
- source: "auth",
60
- level: "error",
61
- message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
62
- });
63
- }
64
- } else {
65
- oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
66
- }
67
- window.close();
68
- }
69
-
70
- window.addEventListener('DOMContentLoaded', function () {
71
- run();
72
- });
73
- </script>
74
- </body>
75
- </html>