Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Add support for storing evaluation artifacts #57

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions rpe/engines/opa.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,16 @@ def _opa_request(self, path, method='GET', data=None):

# Perform an evaluation on a given resource
def evaluate(self, resource):
resource_data = resource.get()

input = {
'input': resource.get(),
'input': resource_data,
}

evals = self._opa_request('rpe/evaluate', method='POST', data=input)

return [
Evaluation(engine=self, resource=resource, **ev)
Evaluation(engine=self, resource=resource, evaluation_artifact=resource_data, **ev)
for ev in evals
]

Expand Down
3 changes: 2 additions & 1 deletion rpe/policy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dataclasses import dataclass
from dataclasses import dataclass, field
from typing import List

from rpe.engines import Engine
Expand All @@ -20,6 +20,7 @@ class Evaluation:
compliant: bool
excluded: bool
remediable: bool
evaluation_artifact: dict = field(default_factory=dict) # Data used during evaluation

def remediate(self):
return self.engine.remediate(self.resource, self.policy_id)