Skip to content

Commit

Permalink
Add a convenience redirect to ecosystems.txt (#1967)
Browse files Browse the repository at this point in the history
Inspired by a request from Dave Tamasi regarding current ecosystems, I
wanted a quicker, easier way to get to `ecosystems.txt`

Also update documentation to better match current `ecosystems.txt`

("it's complicated" with respect to Python (PSF) and GSD and UVI are not
included at https://osv.dev/list)
  • Loading branch information
andrewpollock committed May 9, 2024
1 parent 213dd5a commit 75a92ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions docs/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ Between the data served in OSV and the data converted to OSV the following ecosy
- AlmaLinux
- Alpine
- Android
- Bitnami
- crates.io
- Debian GNU/Linux
- Git ([including C/C++](https://osv.dev/blog/posts/introducing-broad-c-c++-support/))
- GitHub Actions
- Go
- Haskell
Expand All @@ -85,6 +87,7 @@ Between the data served in OSV and the data converted to OSV the following ecosy
- R (CRAN and Bioconductor)
- Rocky Linux
- RubyGems
- SwiftURL

## Data dumps

Expand Down
13 changes: 9 additions & 4 deletions gcp/appengine/frontend_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ def docs():
return redirect('https://google.github.io/osv.dev')


@blueprint.route('/ecosystems')
def ecosystems():
return redirect('https://osv-vulnerabilities.storage.googleapis.com/ecosystems.txt') # pylint: disable=line-too-long


_LIST_ARGS = ['q', 'ecosystem', 'page']


Expand Down Expand Up @@ -302,10 +307,10 @@ def add_source_info(bug, response):
response['source'] = source_repo.link + source_path
response['source_link'] = response['source']
if source_repo.human_link:
ecosystems = bug.ecosystem
bug_ecosystems = bug.ecosystem
bug_id = bug.id()
response['human_source_link'] = render_template_string(
source_repo.human_link, ECOSYSTEMS=ecosystems, BUG_ID=bug_id)
source_repo.human_link, ECOSYSTEMS=bug_ecosystems, BUG_ID=bug_id)


def _commit_to_link(repo_url, commit):
Expand Down Expand Up @@ -346,8 +351,8 @@ def osv_get_ecosystem_counts_cached():
def osv_get_ecosystem_counts() -> dict[str, int]:
"""Get count of vulnerabilities per ecosystem."""
counts = {}
ecosystems = osv_get_ecosystems()
for ecosystem in ecosystems:
ecosystem_names = osv_get_ecosystems()
for ecosystem in ecosystem_names:
if ':' in ecosystem:
# Count by the base ecosystem index. Otherwise we'll overcount as a
# single entry may refer to multiple sub-ecosystems.
Expand Down

0 comments on commit 75a92ab

Please sign in to comment.