forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WiP] docs: external dependency dashboard.
This patch introduces a set of automatically generated tables (based on repository_locations.bzl) that enumerate the external dependencies that feature on Envoy's data/control planes, test, build, etc. Version and CPE information is currently included. In the future, we will also have last updated, distinguish core vs. extensions and populate with external dependency process maturity information. Part of envoyproxy#10471 Signed-off-by: Harvey Tuch <[email protected]>
- Loading branch information
Showing
6 changed files
with
152 additions
and
10 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
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
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
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,71 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Generate RST lists of external dependencies. | ||
|
||
from collections import defaultdict, namedtuple | ||
import pathlib | ||
import sys | ||
import urllib.parse | ||
|
||
from importlib.util import spec_from_loader, module_from_spec | ||
from importlib.machinery import SourceFileLoader | ||
|
||
# bazel/repository_locations.bzl must have a .bzl suffix for Starlark import, so | ||
# we are forced to do this workaround. | ||
_repository_locations_spec = spec_from_loader( | ||
'repository_locations', | ||
SourceFileLoader('repository_locations', 'bazel/repository_locations.bzl')) | ||
repository_locations = module_from_spec(_repository_locations_spec) | ||
_repository_locations_spec.loader.exec_module(repository_locations) | ||
|
||
|
||
def CsvTable(headers, widths, rows): | ||
csv_rows = '\n '.join(', '.join(row) for row in rows) | ||
return f'''.. csv-table:: | ||
:header: {', '.join(headers)} | ||
:widths: {', '.join(str(w) for w in widths) } | ||
{csv_rows} | ||
''' | ||
|
||
|
||
def RstLink(text, url): | ||
return f'`{text} <{url}>`__' | ||
|
||
|
||
def NistCpeUrl(cpe): | ||
encoded_cpe = urllib.parse.quote(cpe) | ||
return 'https://nvd.nist.gov/products/cpe/search/results?keyword=%s&status=FINAL&orderBy=CPEURI&namingFormat=2.3' % encoded_cpe | ||
|
||
|
||
if __name__ == '__main__': | ||
security_rst_root = sys.argv[1] | ||
|
||
Dep = namedtuple('Dep', ['name', 'sort_name', 'version', 'cpe']) | ||
use_categories = defaultdict(list) | ||
for k, v in repository_locations.DEPENDENCY_REPOSITORIES.items(): | ||
cpe = v.get('cpe', '') | ||
if cpe == 'N/A': | ||
cpe = '' | ||
if cpe: | ||
cpe = RstLink(cpe, NistCpeUrl(cpe)) | ||
project_name = v.get('project_name', k) | ||
if 'project_url' in v: | ||
project_url = v['project_url'] | ||
name = RstLink(project_name, project_url) | ||
else: | ||
name = project_name | ||
version = RstLink(v.get('version', '?'), v['urls'][0]) | ||
dep = Dep(name, project_name.lower(), version, cpe) | ||
for category in v['use_category']: | ||
use_categories[category].append(dep) | ||
|
||
def CsvRow(dep): | ||
return [dep.name, dep.version, dep.cpe] | ||
|
||
for category, deps in use_categories.items(): | ||
output_path = pathlib.Path(security_rst_root, f'external_dep_{category}.rst') | ||
content = CsvTable(['Name', 'Version', 'CPE'], [1, 1, 1], | ||
[CsvRow(dep) for dep in sorted(deps, key=lambda d: d.sort_name)]) | ||
output_path.write_text(content) |
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,42 @@ | ||
.. _arch_overview_external_deps: | ||
|
||
External dependencies | ||
===================== | ||
|
||
Below we enumerate the external dependencies that may be linked into the Envoy binary. | ||
|
||
Data plane dependencies: | ||
|
||
.. include:: external_dep_dataplane.rst | ||
|
||
Control plane dependencies: | ||
|
||
.. include:: external_dep_controlplane.rst | ||
|
||
Observability dependencies: | ||
|
||
.. include:: external_dep_observability.rst | ||
|
||
Test dependencies: | ||
|
||
.. include:: external_dep_test.rst | ||
|
||
Build dependencies: | ||
|
||
.. include:: external_dep_build.rst | ||
|
||
Miscellaneous dependencies: | ||
|
||
.. include:: external_dep_other.rst | ||
|
||
We exclude dependencies that only are used in CI or developer tooling above. | ||
|
||
TODO: also analyze `api/bazel/repository_locations.py` and `bazel/dependency_imports.bzl`. | ||
|
||
TODO: distinguish deps in core vs. extensions. | ||
|
||
TODO: add last updated column. | ||
|
||
TODO: integrate version into CPE links. | ||
|
||
TODO: populate with external dep maturity status. |
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ Security | |
:maxdepth: 2 | ||
|
||
threat_model | ||
external_deps | ||
google_vrp | ||
ssl | ||
jwt_authn_filter | ||
|