Skip to content
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

feat: adds rudimentary script to import seantis risk excel. #5

Merged
merged 2 commits into from
May 31, 2024

Conversation

strfx
Copy link
Contributor

@strfx strfx commented Apr 30, 2024

Script to import our excel into RiskMatrix. Best used with new organizations to avoid conflicts.

Any idea how to handle conflicting risks?

Risks and assets (and therefore also assessments) are unique per organization, not catalog. Adding a risk from the excel that is already present in this organization will fail. Skipping them would result in an incomplete catalog. For now, I just abort the script.

misc:

  • intentionally not listed openpyxl as dependency; import script is meant to be used internally, install as required
  • added types-openpyxl to test requirements anyway to keep type checks

@Daverball
Copy link
Member

@strfx Why not just assume that when a risk already exists, that it's the same risk and update it based on the import, rather than always adding one? You could add a little helper function get_or_create_risk, like you already do for assets. Alternatively you could rename either the existing or new risk to get rid of the conflict.

@strfx
Copy link
Contributor Author

strfx commented May 2, 2024

@Daverball that makes sense, thanks! I had the concept of catalogs wrong -- I assumed one excel ≈ one catalog. Will go the update-if-exists route 👍

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 102 lines in your changes are missing coverage. Please review.

Project coverage is 68.22%. Comparing base (4af0879) to head (314abd9).

Files Patch % Lines
...rc/riskmatrix/scripts/seantis_import_risk_excel.py 0.00% 102 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #5      +/-   ##
==========================================
- Coverage   70.92%   68.22%   -2.71%     
==========================================
  Files          61       62       +1     
  Lines        2573     2675     +102     
==========================================
  Hits         1825     1825              
- Misses        748      850     +102     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@strfx strfx force-pushed the import-risk-excel branch from 314abd9 to b640b84 Compare May 2, 2024 08:09
@somehowchris somehowchris merged commit 82d689d into main May 31, 2024
3 checks passed
@somehowchris somehowchris deleted the import-risk-excel branch May 31, 2024 11:01
@somehowchris somehowchris restored the import-risk-excel branch June 11, 2024 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants