attribute_context.proto 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. syntax = "proto3";
  2. package envoy.service.auth.v3;
  3. import "envoy/config/core/v3/address.proto";
  4. import "envoy/config/core/v3/base.proto";
  5. import "google/protobuf/timestamp.proto";
  6. import "udpa/annotations/status.proto";
  7. import "udpa/annotations/versioning.proto";
  8. option java_package = "io.envoyproxy.envoy.service.auth.v3";
  9. option java_outer_classname = "AttributeContextProto";
  10. option java_multiple_files = true;
  11. option go_package = "github.com/envoyproxy/go-control-plane/envoy/service/auth/v3;authv3";
  12. option (udpa.annotations.file_status).package_version_status = ACTIVE;
  13. // [#protodoc-title: Attribute Context ]
  14. // See :ref:`network filter configuration overview <config_network_filters_ext_authz>`
  15. // and :ref:`HTTP filter configuration overview <config_http_filters_ext_authz>`.
  16. // An attribute is a piece of metadata that describes an activity on a network.
  17. // For example, the size of an HTTP request, or the status code of an HTTP response.
  18. //
  19. // Each attribute has a type and a name, which is logically defined as a proto message field
  20. // of the `AttributeContext`. The `AttributeContext` is a collection of individual attributes
  21. // supported by Envoy authorization system.
  22. // [#comment: The following items are left out of this proto
  23. // Request.Auth field for jwt tokens
  24. // Request.Api for api management
  25. // Origin peer that originated the request
  26. // Caching Protocol
  27. // request_context return values to inject back into the filter chain
  28. // peer.claims -- from X.509 extensions
  29. // Configuration
  30. // - field mask to send
  31. // - which return values from request_context are copied back
  32. // - which return values are copied into request_headers]
  33. // [#next-free-field: 12]
  34. message AttributeContext {
  35. option (udpa.annotations.versioning).previous_message_type =
  36. "envoy.service.auth.v2.AttributeContext";
  37. // This message defines attributes for a node that handles a network request.
  38. // The node can be either a service or an application that sends, forwards,
  39. // or receives the request. Service peers should fill in the `service`,
  40. // `principal`, and `labels` as appropriate.
  41. // [#next-free-field: 6]
  42. message Peer {
  43. option (udpa.annotations.versioning).previous_message_type =
  44. "envoy.service.auth.v2.AttributeContext.Peer";
  45. // The address of the peer, this is typically the IP address.
  46. // It can also be UDS path, or others.
  47. config.core.v3.Address address = 1;
  48. // The canonical service name of the peer.
  49. // It should be set to :ref:`the HTTP x-envoy-downstream-service-cluster
  50. // <config_http_conn_man_headers_downstream-service-cluster>`
  51. // If a more trusted source of the service name is available through mTLS/secure naming, it
  52. // should be used.
  53. string service = 2;
  54. // The labels associated with the peer.
  55. // These could be pod labels for Kubernetes or tags for VMs.
  56. // The source of the labels could be an X.509 certificate or other configuration.
  57. map<string, string> labels = 3;
  58. // The authenticated identity of this peer.
  59. // For example, the identity associated with the workload such as a service account.
  60. // If an X.509 certificate is used to assert the identity this field should be sourced from
  61. // `URI Subject Alternative Names`, `DNS Subject Alternate Names` or `Subject` in that order.
  62. // The primary identity should be the principal. The principal format is issuer specific.
  63. //
  64. // Example:
  65. // * SPIFFE format is `spiffe://trust-domain/path`
  66. // * Google account format is `https://accounts.google.com/{userid}`
  67. string principal = 4;
  68. // The X.509 certificate used to authenticate the identify of this peer.
  69. // When present, the certificate contents are encoded in URL and PEM format.
  70. string certificate = 5;
  71. }
  72. // Represents a network request, such as an HTTP request.
  73. message Request {
  74. option (udpa.annotations.versioning).previous_message_type =
  75. "envoy.service.auth.v2.AttributeContext.Request";
  76. // The timestamp when the proxy receives the first byte of the request.
  77. google.protobuf.Timestamp time = 1;
  78. // Represents an HTTP request or an HTTP-like request.
  79. HttpRequest http = 2;
  80. }
  81. // This message defines attributes for an HTTP request.
  82. // HTTP/1.x, HTTP/2, gRPC are all considered as HTTP requests.
  83. // [#next-free-field: 13]
  84. message HttpRequest {
  85. option (udpa.annotations.versioning).previous_message_type =
  86. "envoy.service.auth.v2.AttributeContext.HttpRequest";
  87. // The unique ID for a request, which can be propagated to downstream
  88. // systems. The ID should have low probability of collision
  89. // within a single day for a specific service.
  90. // For HTTP requests, it should be X-Request-ID or equivalent.
  91. string id = 1;
  92. // The HTTP request method, such as `GET`, `POST`.
  93. string method = 2;
  94. // The HTTP request headers. If multiple headers share the same key, they
  95. // must be merged according to the HTTP spec. All header keys must be
  96. // lower-cased, because HTTP header keys are case-insensitive.
  97. map<string, string> headers = 3;
  98. // The request target, as it appears in the first line of the HTTP request. This includes
  99. // the URL path and query-string. No decoding is performed.
  100. string path = 4;
  101. // The HTTP request `Host` or 'Authority` header value.
  102. string host = 5;
  103. // The HTTP URL scheme, such as `http` and `https`.
  104. string scheme = 6;
  105. // This field is always empty, and exists for compatibility reasons. The HTTP URL query is
  106. // included in `path` field.
  107. string query = 7;
  108. // This field is always empty, and exists for compatibility reasons. The URL fragment is
  109. // not submitted as part of HTTP requests; it is unknowable.
  110. string fragment = 8;
  111. // The HTTP request size in bytes. If unknown, it must be -1.
  112. int64 size = 9;
  113. // The network protocol used with the request, such as "HTTP/1.0", "HTTP/1.1", or "HTTP/2".
  114. //
  115. // See :repo:`headers.h:ProtocolStrings <source/common/http/headers.h>` for a list of all
  116. // possible values.
  117. string protocol = 10;
  118. // The HTTP request body.
  119. string body = 11;
  120. // The HTTP request body in bytes. This is used instead of
  121. // :ref:`body <envoy_v3_api_field_service.auth.v3.AttributeContext.HttpRequest.body>` when
  122. // :ref:`pack_as_bytes <envoy_v3_api_field_extensions.filters.http.ext_authz.v3.BufferSettings.pack_as_bytes>`
  123. // is set to true.
  124. bytes raw_body = 12;
  125. }
  126. // The source of a network activity, such as starting a TCP connection.
  127. // In a multi hop network activity, the source represents the sender of the
  128. // last hop.
  129. Peer source = 1;
  130. // The destination of a network activity, such as accepting a TCP connection.
  131. // In a multi hop network activity, the destination represents the receiver of
  132. // the last hop.
  133. Peer destination = 2;
  134. // Represents a network request, such as an HTTP request.
  135. Request request = 4;
  136. // This is analogous to http_request.headers, however these contents will not be sent to the
  137. // upstream server. Context_extensions provide an extension mechanism for sending additional
  138. // information to the auth server without modifying the proto definition. It maps to the
  139. // internal opaque context in the filter chain.
  140. map<string, string> context_extensions = 10;
  141. // Dynamic metadata associated with the request.
  142. config.core.v3.Metadata metadata_context = 11;
  143. }