Skip to content

Commit

Permalink
new: Notes for adding a new source
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Dec 9, 2024
1 parent 817a472 commit e7922a5
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions new_source.md
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.

0 comments on commit e7922a5

Please sign in to comment.