attribute_context.proto 6.6 KB

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