GovReady / govready-q

An open source, self-service GRC tool to automate security assessments and compliance.
https://q.govready.com
Other
174 stars 55 forks source link

Importing OCAL 1.0.0 catalog causes Exception Type: KeyError at /controls/ #1735

Open gbrown-gis opened 2 years ago

gbrown-gis commented 2 years ago

Describe the bug as a Story After importing https://raw.githubusercontent.com/GSA/fedramp-automation/master/dist/content/baselines/rev4/json/FedRAMP_rev4_MODERATE-baseline-resolved-profile_catalog.json into GUI: Database Administration -> Catalog datas, going to "Control" tab results in "Exception Type: KeyError at /controls/"

To Reproduce Steps to reproduce the behavior:

  1. Go to (GUI) Database Administration -> Catalog datas
  2. Click on add to paste in catalog and baseline. Add https://raw.githubusercontent.com/GSA/fedramp-automation/master/dist/content/baselines/rev4/json/FedRAMP_rev4_MODERATE-baseline-resolved-profile_catalog.json to catalog. Baseline left null. Click "Save".
  3. Saved catalog shows up in list.
  4. Click on the upper right corner "visit site" that is next to the welcome user.
  5. Click on the "Controls" tab.
  6. See error page showing "Exception Type: KeyError at /controls/"

Expected behavior An imported catalog listed in the results

Screenshots 51d4a867-f9cd-4b2a-abdf-5fd844c6b755 Screen Shot 2021-12-31 at 3 20 43 PM 32c799df-39a7-463f-b256-49b4d320b7bc ad67b468-a447-4587-b2ca-f69774971bb4 Screen Shot 2021-12-31 at 3 32 12 PM Screen Shot 2021-12-31 at 3 33 17 PM

Desktop (please complete the following information):

Developer hints

9823f1db (HEAD -> main, origin/main, origin/HEAD, lib-fix) main@{0}: clone: from github.com:GovReady/govready-q.git

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/controls/

Django Version: 3.2.5
Python Version: 3.9.9

Error

Traceback (most recent call last):
File "/Users/XXXX/Library/Python/3.9/lib/python/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/Users/XXXX/Library/Python/3.9/lib/python/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/XXXX/Development/github/govready-q/controls/views.py", line 70, in catalogs
"catalogs": Catalogs(),
File "/Users/XXXX/Development/github/govready-q/controls/oscal.py", line 43, in init
self.index = self._build_index()
File "/Users/XXXX/Development/github/govready-q/controls/oscal.py", line 58, in build_index
{'id': catalog['id'], 'catalog_key': catalog_key, 'catalog_key_display': catalog_key.replace("", " "),

Exception Type: KeyError at /controls/
Exception Value: 'id'

Acceptance criteria

GIVEN I import a OSCAL 1.0.0 Catalog and compatible Baseline into database catalog such as https://raw.githubusercontent.com/GSA/fedramp-automation/master/dist/content/baselines/rev4/json/FedRAMP_rev4_MODERATE-baseline-resolved-profile_catalog.json WHEN I click on "Controls" THEN The imported catalog should appear.

Additional context Add any other context about the problem here.

Links referenced in issue

rylew1 commented 1 year ago

@gbrown-gis were you able to resolve this ?