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.
Merge branch 'master' into mpuncel/secret-hc-sequence
* master: (22 commits) http: using CONNECT_ERROR for HTTP/2 (envoyproxy#13519) listener: respect address.pipe.mode (it didn't work) (envoyproxy#13493) examples: Fix more deprecations/warnings in configs (envoyproxy#13529) overload: tcp connection refusal overload action (envoyproxy#13311) tcp: towards pluggable upstreams (envoyproxy#13331) conn_pool: fixing comments (envoyproxy#13520) Prevent SEGFAULT when disabling listener (envoyproxy#13515) Convert overload manager config literals to YAML (envoyproxy#13518) Fix runtime feature variable name (envoyproxy#13533) dependencies: refactor repository location schema utils, cleanups. (envoyproxy#13452) router: fix an invalid ASSERT when encoding metadata frames in the router. (envoyproxy#13511) http2: Proactively disconnect connections flooded when resetting stream (envoyproxy#13482) ci use azp to sync filter example (envoyproxy#13501) mongo_proxy: support configurable command list for metrics (envoyproxy#13494) http local rate limit: note token bucket is shared (envoyproxy#13525) wasm/extensions: Wasm extension policy. (envoyproxy#13526) http: removing envoy.reloadable_features.http1_flood_protection (envoyproxy#13508) build: update ppc64le CI build status shield (envoyproxy#13521) dependencies: enforce dependency shepherd sign-off via RepoKitteh. (envoyproxy#13522) Add no_traffic_healthy_interval (envoyproxy#13336) ... Signed-off-by: Michael Puncel <[email protected]>
- Loading branch information
Showing
112 changed files
with
1,751 additions
and
796 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
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,116 @@ | ||
load("@envoy_api//bazel:repository_locations_utils.bzl", "load_repository_locations_spec") | ||
|
||
# Envoy dependencies may be annotated with the following attributes: | ||
DEPENDENCY_ANNOTATIONS = [ | ||
# List of the categories describing how the dependency is being used. This attribute is used | ||
# for automatic tracking of security posture of Envoy's dependencies. | ||
# Possible values are documented in the USE_CATEGORIES list below. | ||
# This attribute is mandatory for each dependecy. | ||
"use_category", | ||
|
||
# Attribute specifying CPE (Common Platform Enumeration, see https://nvd.nist.gov/products/cpe) ID | ||
# of the dependency. The ID may be in v2.3 or v2.2 format, although v2.3 is prefferred. See | ||
# https://nvd.nist.gov/products/cpe for CPE format. Use single wildcard '*' for version and vector elements | ||
# i.e. 'cpe:2.3:a:nghttp2:nghttp2:*'. Use "N/A" for dependencies without CPE assigned. | ||
# This attribute is optional for components with use categories listed in the | ||
# USE_CATEGORIES_WITH_CPE_OPTIONAL | ||
"cpe", | ||
] | ||
|
||
# NOTE: If a dependency use case is either dataplane or controlplane, the other uses are not needed | ||
# to be declared. | ||
USE_CATEGORIES = [ | ||
# This dependency is used in API protos. | ||
"api", | ||
# This dependency is used in build process. | ||
"build", | ||
# This dependency is used to process xDS requests. | ||
"controlplane", | ||
# This dependency is used in processing downstream or upstream requests (core). | ||
"dataplane_core", | ||
# This dependency is used in processing downstream or upstream requests (extensions). | ||
"dataplane_ext", | ||
# This dependecy is used for logging, metrics or tracing (core). It may process unstrusted input. | ||
"observability_core", | ||
# This dependecy is used for logging, metrics or tracing (extensions). It may process unstrusted input. | ||
"observability_ext", | ||
# This dependency does not handle untrusted data and is used for various utility purposes. | ||
"other", | ||
# This dependency is used only in tests. | ||
"test_only", | ||
] | ||
|
||
# Components with these use categories are not required to specify the 'cpe' | ||
# and 'last_updated' annotation. | ||
USE_CATEGORIES_WITH_CPE_OPTIONAL = ["build", "other", "test_only", "api"] | ||
|
||
def _fail_missing_attribute(attr, key): | ||
fail("The '%s' attribute must be defined for external dependecy " % attr + key) | ||
|
||
# Method for verifying content of the repository location specifications. | ||
# | ||
# We also remove repository metadata attributes so that further consumers, e.g. | ||
# http_archive, are not confused by them. | ||
def load_repository_locations(repository_locations_spec): | ||
locations = {} | ||
for key, location in load_repository_locations_spec(repository_locations_spec).items(): | ||
mutable_location = dict(location) | ||
locations[key] = mutable_location | ||
|
||
if "sha256" not in location or len(location["sha256"]) == 0: | ||
_fail_missing_attribute("sha256", key) | ||
|
||
if "project_name" not in location: | ||
_fail_missing_attribute("project_name", key) | ||
mutable_location.pop("project_name") | ||
|
||
if "project_desc" not in location: | ||
_fail_missing_attribute("project_desc", key) | ||
mutable_location.pop("project_desc") | ||
|
||
if "project_url" not in location: | ||
_fail_missing_attribute("project_url", key) | ||
project_url = mutable_location.pop("project_url") | ||
if not project_url.startswith("https://") and not project_url.startswith("http://"): | ||
fail("project_url must start with https:// or http://: " + project_url) | ||
|
||
if "version" not in location: | ||
_fail_missing_attribute("version", key) | ||
mutable_location.pop("version") | ||
|
||
if "use_category" not in location: | ||
_fail_missing_attribute("use_category", key) | ||
use_category = mutable_location.pop("use_category") | ||
|
||
if "dataplane_ext" in use_category or "observability_ext" in use_category: | ||
if "extensions" not in location: | ||
_fail_missing_attribute("extensions", key) | ||
mutable_location.pop("extensions") | ||
|
||
if "last_updated" not in location: | ||
_fail_missing_attribute("last_updated", key) | ||
last_updated = mutable_location.pop("last_updated") | ||
|
||
# Starlark doesn't have regexes. | ||
if len(last_updated) != 10 or last_updated[4] != "-" or last_updated[7] != "-": | ||
fail("last_updated must match YYYY-DD-MM: " + last_updated) | ||
|
||
if "cpe" in location: | ||
cpe = mutable_location.pop("cpe") | ||
|
||
# Starlark doesn't have regexes. | ||
cpe_components = len(cpe.split(":")) | ||
|
||
# We allow cpe:2.3:a:foo:* and cpe:2.3.:a:foo:bar:* only. | ||
cpe_components_valid = cpe_components in [5, 6] | ||
cpe_matches = (cpe == "N/A" or (cpe.startswith("cpe:2.3:a:") and cpe.endswith(":*") and cpe_components_valid)) | ||
if not cpe_matches: | ||
fail("CPE must match cpe:2.3:a:<facet>:<facet>:*: " + cpe) | ||
elif not [category for category in USE_CATEGORIES_WITH_CPE_OPTIONAL if category in location["use_category"]]: | ||
_fail_missing_attribute("cpe", key) | ||
|
||
for category in location["use_category"]: | ||
if category not in USE_CATEGORIES: | ||
fail("Unknown use_category value '" + category + "' for dependecy " + key) | ||
|
||
return locations |
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,20 @@ | ||
def _format_version(s, version): | ||
return s.format(version = version, dash_version = version.replace(".", "-"), underscore_version = version.replace(".", "_")) | ||
|
||
# Generate a "repository location specification" from raw repository | ||
# specification. The information should match the format required by | ||
# external_deps.bzl. This function mostly does interpolation of {version} in | ||
# the repository info fields. This code should be capable of running in both | ||
# Python and Starlark. | ||
def load_repository_locations_spec(repository_locations_spec): | ||
locations = {} | ||
for key, location in repository_locations_spec.items(): | ||
mutable_location = dict(location) | ||
locations[key] = mutable_location | ||
|
||
# Fixup with version information. | ||
if "version" in location: | ||
if "strip_prefix" in location: | ||
mutable_location["strip_prefix"] = _format_version(location["strip_prefix"], location["version"]) | ||
mutable_location["urls"] = [_format_version(url, location["version"]) for url in location["urls"]] | ||
return locations |
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
Oops, something went wrong.