mitre / heimdall-mongo

A Mongo-based version of Heimdall (Deprecated)
Other
11 stars 1 forks source link

Error uploading json with descriptions field #75

Open Bialogs opened 5 years ago

Bialogs commented 5 years ago

The InSpec output that our tests are generating has this additional "descriptions": field that is not included in the control.rb model.

"controls": [
        {
          "id": "V-13613",
          "title": "The Web site software ...",
          "desc": "The IAVM process ...",
          "descriptions": [
            {
              "label": "default",
              "data": "The IAVM process ..."
            }
          ],
          "impact": 0.5,
          "etc": "etc ..."
       }]

When uploading an evaluation that includes this field, the following error is thrown:

Attempted to set a value for 'descriptions' which is not allowed on the model Control.
summary:
  Without including Mongoid::Attributes::Dynamic in your model and the attribute does not already 
  exist in the attributes hash, attempting to call Control#descriptions= for it is not allowed. This is also
 triggered by passing the attribute to any method that accepts an attributes hash, and is raised instead 
  of getting a NoMethodError.
resolution:
  You can include Mongoid::Attributes::Dynamic if you expect to be writing values for undefined fields often.

Is this a problem with our InSpec output? How can I correct that? If not, I have a fix ready to go that adds the following to control.rb and lets me upload my evaluation without a problem.

  field :descriptions, type: Array, default: []
aaronlippold commented 5 years ago

This is related to the new InSpec 3.x data structures.

72

We need to update vulcan, heimdall and heimdall-lite to support these additional features

aaronlippold commented 5 years ago

I actually want a couple things out of that PR for both Heimdall and Heimdall-Lite and Vulcan and the _tools.

( please create an issues on each project for this - and create a PR or PRs to cover the 6 elements )

72

Bialogs commented 5 years ago

@aaronlippold For what its worth, this data set works as-is on the version of heimdall-lite we have been using