Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

security: document threat model. #8906

Merged
merged 20 commits into from
Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions bazel/envoy_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,37 @@ EXTENSION_SECURITY_POSTURES = [
# This extension is not hardened and should only be used in deployments
# where both the downstream and upstream are trusted.
"requires_trusted_downstream_and_upstream",
# This is functionally equivaelnt to
# This is functionally equivalent to
# requires_trusted_downstream_and_upstream, but acts as a placeholder to
# allow us to identify extensions that need classifying.
"unknown",
# Not relevant to data plane threats, e.g. stats sinks.
"data_plane_agnostic",
]

EXTENSION_STATUS_VALUES = [
# This extension is stable and is expected to be production usable.
"stable",
# This extension is functional but has not had substantial production burn
# time, use only with this caveat.
"alpha",
# This extension is work-in-progress. Functionality is incomplete and it is
# not intended for production use.
"wip",
]

def envoy_cc_extension(
name,
security_posture,
# Only set this for internal, undocumented extensions.
undocumented = False,
status = "stable",
tags = [],
**kwargs):
if security_posture not in EXTENSION_SECURITY_POSTURES:
fail("Unknown extension security posture: " + security_posture)
tags = tags + ["secpos:" + security_posture]
if status not in EXTENSION_STATUS_VALUES:
fail("Unknown extension status: " + status)
envoy_cc_library(name, tags = tags, **kwargs)

# Envoy C++ library targets should be specified with this function.
Expand Down
2 changes: 0 additions & 2 deletions docs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ mkdir -p "${GENERATED_RST_DIR}"
source_venv "$BUILD_DIR"
pip3 install -r "${SCRIPT_DIR}"/requirements.txt

# Generate extension trust profile

# Clean up any stale files in the API tree output. Bazel remembers valid cached
# files still.
rm -rf bazel-bin/external/envoy_api
Expand Down
18 changes: 12 additions & 6 deletions docs/generate_extension_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,22 @@ class ExtensionDbError(Exception):
pass


def IsMissing(value):
return value == '(missing)'


def GetExtensionMetadata(target):
r = subprocess.run([BUILDOZER_PATH, '-stdout', 'print security_posture undocumented', target],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
security_posture, undocumented = r.stdout.decode('utf-8').strip().split(' ')
if security_posture == '(missing)':
r = subprocess.run(
[BUILDOZER_PATH, '-stdout', 'print security_posture status undocumented', target],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
security_posture, status, undocumented = r.stdout.decode('utf-8').strip().split(' ')
if IsMissing(security_posture):
raise ExtensionDbError('Missing security posture for %s' % target)
return {
'security_posture': security_posture,
'undocumented': bool(undocumented) if undocumented != '(missing)' else False
'undocumented': False if IsMissing(undocumented) else bool(undocumented),
'status': 'stable' if IsMissing(status) else status,
}


Expand Down
5 changes: 3 additions & 2 deletions docs/generate_extension_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def FormatItem(extension, metadata):
if metadata['undocumented']:
if metadata['undocumented'] or metadata['status'] == 'wip':
return '* %s' % extension
return '* :ref:`%s <extension_%s>`' % (extension, extension)

Expand All @@ -25,5 +25,6 @@ def FormatItem(extension, metadata):

for sp, extensions in security_postures.items():
output_path = pathlib.Path(security_rst_root, 'secpos_%s.rst' % sp)
content = '\n'.join(FormatItem(extension, extension_db[extension]) for extension in extensions)
content = '\n'.join(
FormatItem(extension, extension_db[extension]) for extension in sorted(extensions))
output_path.write_text(content)
23 changes: 14 additions & 9 deletions docs/root/intro/arch_overview/security/threat_model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Below we articulate the Envoy threat model, which is of relevance to Envoy opera
security researchers. We detail our security release process at
https://github.com/envoyproxy/envoy/security/policy.


Confidentiality, integrity and availability
-------------------------------------------

Expand All @@ -28,12 +27,12 @@ hardening status quo. Examples of disclosures that would elicit this response:
e.g. that delivered by a single client.

Note that we do not currently consider the default settings for Envoy to be safe from an availability
perspective. It is necessary for operators to explicitly configure watermarks, the overload manager,
circuit breakers and other resource related features in Envoy to provide a robust availability
story. We will not act on any security disclosure that relates to a lack of safe defaults. Over
time, we will work towards improved safe-by-default configuration, but due to backwards
compatibility and performance concerns, this will require following the breaking change deprecation
policy.
perspective. It is necessary for operators to explicitly :ref:`configure <best_practices_edge>`
watermarks, the overload manager, circuit breakers and other resource related features in Envoy to
provide a robust availability story. We will not act on any security disclosure that relates to a
lack of safe defaults. Over time, we will work towards improved safe-by-default configuration, but
due to backwards compatibility and performance concerns, this will require following the breaking
change deprecation policy.

Data and control plane
----------------------
Expand Down Expand Up @@ -69,11 +68,16 @@ Anything in the Envoy core may be used in both untrusted and trusted deployments
it should be hardened with this model in mind. Security issues related to core code will usually
trigger the security release process as described in this document.

The following extensions are considered hardened against untrusted downstream and upstreams:
The following extensions are intended to be hardened against untrusted downstream and upstreams:

.. include:: secpos_robust_to_untrusted_downstream_and_upstream.rst

The following extensions are considered hardened against untrusted downstreams but assume trusted
The following extensions should not be exposed to data plane attack vectors and hence are intended
to be robust to untrusted downstreams and upstreams:

.. include:: secpos_data_plane_agnostic.rst

The following extensions are intended to be hardened against untrusted downstreams but assume trusted
upstreams:

.. include:: secpos_robust_to_untrusted_downstream.rst
Expand All @@ -82,6 +86,7 @@ The following extensions should only be used when both the downstream and upstre

.. include:: secpos_requires_trusted_downstream_and_upstream.rst


The following extensions have an unknown security posture:

.. include:: secpos_unknown.rst
Expand Down
2 changes: 1 addition & 1 deletion source/extensions/clusters/redis/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ envoy_cc_extension(
"redis_cluster.cc",
"redis_cluster.h",
],
security_posture = "robust_to_untrusted_downstream",
security_posture = "requires_trusted_downstream_and_upstream",
deps = [
"redis_cluster_lb",
"//include/envoy/api:api_interface",
Expand Down
8 changes: 4 additions & 4 deletions source/extensions/extensions_build_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ EXTENSIONS = {
"envoy.filters.network.echo": "//source/extensions/filters/network/echo:config",
"envoy.filters.network.ext_authz": "//source/extensions/filters/network/ext_authz:config",
"envoy.filters.network.http_connection_manager": "//source/extensions/filters/network/http_connection_manager:config",
# Not implemented yet
#"envoy.filters.network.kafka": "//source/extensions/filters/network/kafka:kafka_request_codec_lib",
# WiP
"envoy.filters.network.kafka": "//source/extensions/filters/network/kafka:kafka_request_codec_lib",
"envoy.filters.network.mongo_proxy": "//source/extensions/filters/network/mongo_proxy:config",
"envoy.filters.network.mysql_proxy": "//source/extensions/filters/network/mysql_proxy:config",
"envoy.filters.network.ratelimit": "//source/extensions/filters/network/ratelimit:config",
Expand Down Expand Up @@ -124,8 +124,8 @@ EXTENSIONS = {
"envoy.tracers.datadog": "//source/extensions/tracers/datadog:config",
"envoy.tracers.zipkin": "//source/extensions/tracers/zipkin:config",
"envoy.tracers.opencensus": "//source/extensions/tracers/opencensus:config",
# Not implemented yet
#"envoy.tracers.xray": "//source/extensions/tracers/xray:config",
# WiP
"envoy.tracers.xray": "//source/extensions/tracers/xray:config",

#
# Transport sockets
Expand Down
1 change: 1 addition & 0 deletions source/extensions/filters/http/adaptive_concurrency/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ envoy_cc_extension(
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "unknown",
status = "alpha",
deps = [
"//include/envoy/registry",
"//source/extensions/filters/http:well_known_names",
Expand Down
1 change: 1 addition & 0 deletions source/extensions/filters/http/dynamic_forward_proxy/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ envoy_cc_extension(
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "robust_to_untrusted_downstream",
status = "alpha",
deps = [
"//include/envoy/registry",
"//include/envoy/server:filter_config_interface",
Expand Down
2 changes: 1 addition & 1 deletion source/extensions/filters/http/ext_authz/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ envoy_cc_extension(
name = "config",
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "unknown",
security_posture = "robust_to_untrusted_downstream",
deps = [
":ext_authz",
"//include/envoy/registry",
Expand Down
2 changes: 1 addition & 1 deletion source/extensions/filters/http/fault/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ envoy_cc_extension(
name = "config",
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "unknown",
security_posture = "robust_to_untrusted_downstream",
deps = [
"//include/envoy/registry",
"//source/extensions/filters/http:well_known_names",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ envoy_cc_extension(
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "unknown",
status = "alpha",
deps = [
":filter_lib",
"//include/envoy/http:filter_interface",
Expand Down
1 change: 1 addition & 0 deletions source/extensions/filters/http/grpc_stats/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ envoy_cc_extension(
srcs = ["grpc_stats_filter.cc"],
hdrs = ["grpc_stats_filter.h"],
security_posture = "unknown",
status = "alpha",
deps = [
"//include/envoy/registry",
"//include/envoy/server:filter_config_interface",
Expand Down
1 change: 1 addition & 0 deletions source/extensions/filters/http/jwt_authn/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ envoy_cc_extension(
srcs = ["filter_factory.cc"],
hdrs = ["filter_factory.h"],
security_posture = "robust_to_untrusted_downstream",
status = "alpha",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is used in production now? @lizan @qiwzhang? If so and this is still using alpha protos can we promote to non-alpha?

deps = [
":filter_lib",
"//include/envoy/registry",
Expand Down
1 change: 1 addition & 0 deletions source/extensions/filters/http/original_src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ envoy_cc_extension(
srcs = ["original_src_config_factory.cc"],
hdrs = ["original_src_config_factory.h"],
security_posture = "robust_to_untrusted_downstream",
status = "alpha",
deps = [
":config_lib",
":original_src_lib",
Expand Down
2 changes: 1 addition & 1 deletion source/extensions/filters/http/router/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ envoy_cc_extension(
name = "config",
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "unknown",
security_posture = "robust_to_untrusted_downstream",
deps = [
"//include/envoy/registry",
"//source/common/router:router_lib",
Expand Down
2 changes: 1 addition & 1 deletion source/extensions/filters/http/squash/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ envoy_cc_extension(
name = "config",
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "robust_to_untrusted_downstream",
security_posture = "requires_trusted_downstream_and_upstream",
deps = [
"//include/envoy/registry",
"//source/common/protobuf:utility_lib",
Expand Down
1 change: 1 addition & 0 deletions source/extensions/filters/http/tap/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ envoy_cc_extension(
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "requires_trusted_downstream_and_upstream",
status = "alpha",
deps = [
":tap_config_impl",
":tap_filter_lib",
Expand Down
1 change: 1 addition & 0 deletions source/extensions/filters/listener/original_src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ envoy_cc_extension(
srcs = ["original_src_config_factory.cc"],
hdrs = ["original_src_config_factory.h"],
security_posture = "robust_to_untrusted_downstream",
status = "alpha",
deps = [
":config_lib",
":original_src_lib",
Expand Down
2 changes: 1 addition & 1 deletion source/extensions/filters/listener/proxy_protocol/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ envoy_cc_library(
envoy_cc_extension(
name = "config",
srcs = ["config.cc"],
security_posture = "unknown",
security_posture = "robust_to_untrusted_downstream",
deps = [
"//include/envoy/registry",
"//include/envoy/server:filter_config_interface",
Expand Down
2 changes: 1 addition & 1 deletion source/extensions/filters/network/client_ssl_auth/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ envoy_cc_extension(
name = "config",
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "unknown",
security_posture = "robust_to_untrusted_downstream",
deps = [
":client_ssl_auth",
"//include/envoy/registry",
Expand Down
1 change: 1 addition & 0 deletions source/extensions/filters/network/dubbo_proxy/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ envoy_cc_extension(
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "requires_trusted_downstream_and_upstream",
status = "alpha",
deps = [
":conn_manager_lib",
"//include/envoy/registry",
Expand Down
1 change: 1 addition & 0 deletions source/extensions/filters/network/kafka/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ envoy_cc_extension(
"request_codec.h",
],
security_posture = "requires_trusted_downstream_and_upstream",
status = "wip",
deps = [
":abstract_codec_lib",
":kafka_request_parser_lib",
Expand Down
1 change: 1 addition & 0 deletions source/extensions/filters/network/mysql_proxy/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ envoy_cc_extension(
srcs = ["mysql_config.cc"],
hdrs = ["mysql_config.h"],
security_posture = "requires_trusted_downstream_and_upstream",
status = "alpha",
deps = [
":proxy_lib",
"//source/extensions/filters/network:well_known_names",
Expand Down
2 changes: 1 addition & 1 deletion source/extensions/filters/network/ratelimit/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ envoy_cc_extension(
name = "config",
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "unknown",
security_posture = "robust_to_untrusted_downstream",
deps = [
"//include/envoy/registry",
"//source/common/protobuf:utility_lib",
Expand Down
1 change: 1 addition & 0 deletions source/extensions/filters/network/thrift_proxy/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ envoy_cc_extension(
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "requires_trusted_downstream_and_upstream",
status = "alpha",
deps = [
":app_exception_lib",
":auto_protocol_lib",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ envoy_cc_extension(
name = "config",
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "unknown",
security_posture = "requires_trusted_downstream_and_upstream",
status = "alpha",
deps = [
":ratelimit_lib",
"//include/envoy/registry",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ envoy_cc_extension(
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "requires_trusted_downstream_and_upstream",
status = "alpha",
deps = [
":router_lib",
"//include/envoy/registry",
Expand Down
1 change: 1 addition & 0 deletions source/extensions/filters/network/zookeeper_proxy/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ envoy_cc_extension(
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "requires_trusted_downstream_and_upstream",
status = "alpha",
deps = [
":proxy_lib",
"//source/extensions/filters/network:well_known_names",
Expand Down
3 changes: 2 additions & 1 deletion source/extensions/grpc_credentials/aws_iam/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ envoy_cc_extension(
srcs = ["config.cc"],
hdrs = ["config.h"],
external_deps = ["grpc"],
security_posture = "unknown",
security_posture = "data_plane_agnostic",
status = "alpha",
deps = [
"//include/envoy/grpc:google_grpc_creds_interface",
"//include/envoy/registry",
Expand Down
3 changes: 2 additions & 1 deletion source/extensions/grpc_credentials/file_based_metadata/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ envoy_cc_extension(
srcs = ["config.cc"],
hdrs = ["config.h"],
external_deps = ["grpc"],
security_posture = "robust_to_untrusted_downstream",
security_posture = "data_plane_agnostic",
status = "alpha",
deps = [
"//include/envoy/grpc:google_grpc_creds_interface",
"//include/envoy/registry",
Expand Down
3 changes: 2 additions & 1 deletion source/extensions/resource_monitors/fixed_heap/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ envoy_cc_extension(
name = "config",
srcs = ["config.cc"],
hdrs = ["config.h"],
security_posture = "robust_to_untrusted_downstream",
security_posture = "data_plane_agnostic",
status = "alpha",
deps = [
":fixed_heap_monitor",
"//include/envoy/registry",
Expand Down
Loading