render: don't stomp on meta dictionary

fixes a bug in bulk-process in which rules are evaluated multiple times
so meta cannot be updated in place.
This commit is contained in:
William Ballenthin
2021-06-15 11:44:02 -06:00
parent 6f1f928434
commit 1b4a087c4b

View File

@@ -5,6 +5,8 @@
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
import copy
import capa.rules
import capa.engine
import capa.render.utils
@@ -202,6 +204,9 @@ def convert_match_to_result_document(rules, capabilities, result):
def convert_meta_to_result_document(meta):
# make a copy so that we don't modify the given parameter
meta = copy.deepcopy(meta)
attacks = meta.get("att&ck", [])
meta["att&ck"] = [parse_canonical_attack(attack) for attack in attacks]
mbcs = meta.get("mbc", [])