-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(RiskAcc-Eng): Clean RiskAcc-Eng mapping + Allow correct handling by API #12361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
I think the initial idea was that a Risk Acceptance could apply to more than just one engagement. For example accept the risk of a CVE that occurs in multiple branches. I think via the UI you cannot actually do this, but it might be possible via the API? |
API would not be broken; there is a checker correctly (see below). In fact, API needs to be fixed - you can create RiskAcc (via
I'm not strictly to one or another option. Both might make sense. It is the reason why I didn't continue with the implementation, but raised the question. Regarding breaking the current setup - I do not think so because we would just extend current abilities (but please correct me if I'm wrong). It might not be true about future use cases. But it is the reason why I'm asking about original intentions. |
f462a9d
to
96a904f
Compare
This pull request introduces potential risks in database migration and model relationships, including null reference scenarios, incomplete migration logic, unintended data deletion through CASCADE strategy, and changes to data relationships that could impact existing data tracking between Engagement and Risk_Acceptance models. 💭 Unconfirmed Findings (4)
All finding details can be found in the DryRun Security Dashboard. |
Hi @kiblik, thank you for pausing on this feature before continuing any further. Risk Exceptions are one of those features that is used a little differently by everyone. As Val pointed out, we don't want to break any current use cases, or point ourselves into a corner for future use cases. Minimizing changes to the risk exception object would be the best move we could make at this time |
Thank you @Maffooch. I will prepare the implementation, which will:
|
3e2f9df
to
9f3cf6d
Compare
ba53851
to
e4d0be7
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
e4d0be7
to
480165b
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
8755e4f
to
68a6482
Compare
1730b85
to
1b2358d
Compare
1b2358d
to
312c07c
Compare
f83fd48
to
4bf8bc4
Compare
4bf8bc4
to
ec21f6a
Compare
6a4097f
to
b61eca2
Compare
b61eca2
to
12930cb
Compare
Hi all, I am the author of the bug that triggered this discussion. @valentijnscholten - as for your question "it might be possible via the API?" I tried that, but I got an error that is not possible to have findings from different engagements under the same risk acceptance, so there is a validation somewhere. As for the general use case for Risk Acceptances. It is quite common for us to accept the risk for a certain CVE across the whole business. In our view, it should be possible to have a single Risk Acceptance comprising many findings across many engagements. I would like to think this is a very common requirement for many companies Because it is not possible to have a single Risk Acceptance across engagements, we had to implement workarounds. We created a script that creates one Risk Acceptance per finding. It could happen that we create more than 1k Risk Acceptances for a single CVE, this is not ideal, we may clog the DB at some point. |
I hope you are not the author of the bug, but only the author of the bug report 😄 You are writing at the best time. I almost finished this PR (only one validation statement and a fix of unittests are missing). I wrote it in a way that reflects current behaviour (allows mapping RiskAcc only to engagements), but correctly handled in case of API processing. On the other hand, I agree that if there is no specific use case (and I do not know it), I suppose it might be a much better idea to move RiskAcc from the Engagement level to the Product level. Cross-product level would not be the best because I'm not sure how we would handle permissions there (e.g., Can I see all RAs? Because if I want to add my findings to some pre-created RA, I need to be able to see it). @Maffooch, @valentijnscholten, @mtesauro, can I ask you for reconsideration? Change from the Engagement level to the Product level would not break any correct implementation; it would just open the door for a more flexible definition/handling. |
We also have this use case:
E.g. you track multiple versions of a product in different engagement (within the same product or multiple). Then a new CVE gets reported. You investigate and see that it has no effect to you. Therefor We would like to accept it for all installed Versions (so multiple engagements) as single Risk Acceptance since it has been evaluated together. Depending on the Application/System, this can affect many CVE (e.g. because it is not exposed). |
This PR is trying to fix "not the best" implementation of mapping between Engagements and RiskAcc.
Until now, it was set as
ManyToManyField
inEngagements
, and fromRiskAcc
, it was just using the first possible match. This implementation is eventually a one-to-many relation, which should be solved viaForeignKey
inRiskAcc
.