-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Steps to add a new source | ||
|
||
## New Feeder | ||
|
||
1. Create a new feeder in `vulnerabilitylookup/feeders/`. A generic feeder needs to | ||
inherit from `AbstractFeeder`, but if it is a CSAF provider, use `CSAFGeneric` instead. | ||
|
||
Example: `vulnerabilitylookup/feeders/my_feeder.py` | ||
|
||
2. Create a config file for the logger in `vulnerabilitylookup/config/` with the name `<feedname>_logging.json` | ||
|
||
Example: `vulnerabilitylookup/config/my_feeder_logging.json` | ||
|
||
3. Create the script that will run regularly to fetch the data in `bin/`. | ||
|
||
Example: `bin/my_feeder.py` | ||
|
||
4. Add a reference to that file in `pyproject.toml` under the `tool.poetry.scripts` section. | ||
|
||
Example: `my_feeder = "bin.my_feeder:main"` | ||
|
||
5. Add a call in the list of importers of the start script in `bin/start.py`. | ||
|
||
Example: `my_feeder` | ||
|
||
6. Run `poetry install` to add the new script, and the command `my_feeder` is available. You can | ||
run it manually for testing, and it will be automatically started next time you | ||
restart the application. | ||
|
||
## Add the new source in the web interface | ||
|
||
1. Add `my_feeder` to the list of sources in `config/website.py.sample` (and update `config/website.py`). | ||
|
||
2. Update `website/web/templates/about.html` with the new source. | ||
|
||
``` | ||
<li class="list-group-item d-flex justify-content-between align-items-center"><a href="<URL>" rel="noreferrer" target="_blank">My Feed</a> | ||
<span class="badge bg-primary rounded-pill">{{ storage_info["db_sizes"]["myfeeder"] }} vulnerabilities</span> | ||
</li> | ||
``` | ||
|
||
3. Update `website/web/templates/main.html` with the new source. | ||
|
||
``` | ||
<link href="{{ url_for('home_bp.feed_recent', format='atom', source='myfeeder') }}" rel="alternate" title="Recent vulnerabilities from myfeeder." type="application/atom+xml"> | ||
``` | ||
|
||
4. If the source is not a CSAF provider, update `website/web/templates/recent.html` with the new source (see in the file for what is needed). | ||
|
||
5. Update ``website/web/templates/search.html with the new source (see in the file for what is needed). | ||
|
||
6. Update `website/web/templates/vuln.html` with the new source (see in the file for what is needed). | ||
|
||
7. Update `website/web/templates/vulnerability_templates.html` with the new source. This one is the macro to render the vulnerability on the website. Look at the file for details. |