mitre / vulcan

A web application to streamline the development of STIGs from SRGs
https://mitre-vulcan-prod.herokuapp.com/
Other
60 stars 16 forks source link

Copy/Duplicate Component creates additional_answers in the source component if they exist #524

Closed rlakey closed 1 year ago

rlakey commented 1 year ago

When running a component copy or duplicate workflow if the source component has additional questions and answers defined on controls they are correctly carried over to the new component as new questions and answers but new answers are added to the original questions for the new rules.

This causes an issue when the source component is deleted the new component contains audit records that are referencing the old question/answer and review history will not load.

If include_association :additional_answers below is commented out of the rule model the operation happens as expected with no new answers added to the original questions.


  amoeba do
    # Using set review_requestor_id: nil does not work as expected, must use nullify
    nullify :review_requestor_id
    set locked: false

    include_association :additional_answers
  end```