Comments (2)
Hey @mlinton, glad you're enjoying Writehat!
As I'm sure you've discovered, the process for adding new finding types is a bit involved. We didn't have multiple finding types in mind when we first wrote this part, so it's sorely in need of a refactor. Generally, you can look for occurrences of 'CVSS' or 'DREAD' and mirror what they're doing, but the outline below should give you a rough roadmap.
We split findings into DatabaseFinding
(those that are stored as templates in the findings database) and EngagementFinding
(those that are specific to an engagement). For each finding type, the fields in DatabaseFinding
are a subset of those in EngagementFinding
- specifically, those that don't contain customer-specific information.
- Create templates (
htmlTemplate
,abridgedTemplate
, andsummaryTemplate
) intemplates/componentTemplates/
- Add a Model class to
lib/finding.py
that extends `BaseDatabaseFinding- Define
formClass
and set a uniquescoringType
- Specify the new type's HTML templates (
htmlTemplate
,abridgedTemplate
, andsummaryTemplate
).summaryTemplate
should be reusable but the other two are type-specific. - Implement properties for
score
andseverity
- Add your new class to
BaseDatabaseFinding::get_child()
- Define
- Add three Form classes to
lib/findingForm.py
FooForm
, extendingFindingForm
FooDatabaseFindingForm
, extendingFooForm
FooEngagementFindingForm
, extendingFooForm
andEngagementFindingForm
- Add a class to
lib/findingGroup.py
extendingBaseFindingGroup
- Update
views.py
:- Implement
findingFooNew()
andvalidationFoo()
views - Add the new scoring type to the filtering logic wherever you see CVSS or DREAD:
findingCreate()
engagementFgroupCreate()
engagementFgroupList()
engagementFindingDelete()
engagementFindingExport()
engagementFindingExcel()
- Implement
- Add your
findingFooNew()
andvalidationFoo()
views tourls.py
- Update Javascript
- Add logic to
static/js/findingEdit.js
to update the score badge - Add a default finding prefix to
static/js/engagementEdit.js
- Add the new scoring type to
$('#fgroupAdd').click()
instatic/js/engagementEdit.js
- Add logic to
- Update stylesheets
- Replicate what the CVSS and DREAD classes are doing in
static/css/colors.css
- Add whatever styles you need to
static/css/component/FindingsList.css
; these will probably be implementation-specific
- Replicate what the CVSS and DREAD classes are doing in
- Update templates
- Add a link to
/findings/foo/new
totemplates/pages/findings.html
- Add a link to
- Update base component
- Add a filter to
Component::iconColorDynamic()
incomponents/FindingsList.py
- Add a filter to
- Miscellaneous
- Add a sheet for the new finding type to
lib/excel.py
- Update
templates/pages/findingGroupStatus.html
andstatic/css/findingGroupStatus.css
(I'm so sorry for this one)
- Add a sheet for the new finding type to
There are a few other files that need to be updated, but should be able to replicate what's being done with the existing finding types. lib/dbExport.py
, lib/dbImport.py
, and lib/resolve.py
come to mind, but there may be others.
Let us know if you run into any issues; we're happy to help out.
from writehat.
Hey thanks for the info, I'll take a crack and put a pull request in with my progress once I have a chance. The refactor that you talk about is probably the best approach, as I can image there would be more people looking to add different types of findings.
Thanks again!
from writehat.
Related Issues (20)
- There should be a simple way to script report writing. HOT 1
- How to export a report in Markdown?
- How to export a report in docx? HOT 1
- Finding Group Search non-functional
- Not able to Deploy HOT 2
- Maintenance of this repository HOT 4
- NGinx "13: permission denied" messages HOT 6
- Add Log interface for reports
- Server Error (500) - Component modification HOT 5
- Feature request: vulnerability review status
- Page Template header/footer markdown image does not render correctly HOT 1
- Engagement clone options
- PDF report generation only works once HOT 2
- Code block running into next page ruins formatting HOT 2
- Generating PDF Error 500 Error HOT 3
- Unable to add "Finding Group"; no options available from drop down menu. HOT 3
- Inconsistent spacing in HTML and PDF formats for Findings.
- Add access controls
- Bug: Additional meta tags HOT 1
- GitHub wiki HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from writehat.