Closed titpetric closed 1 month ago
API Changes
--- prev.txt 2024-07-11 08:39:14.974033174 +0000
+++ current.txt 2024-07-11 08:39:12.150020059 +0000
@@ -6069,12 +6069,23 @@
TYPES
type AccessDefinition struct {
- ApiName string `protobuf:"bytes,1,opt,name=api_name,json=apiName,proto3" json:"api_name,omitempty"`
- ApiId string `protobuf:"bytes,2,opt,name=api_id,json=apiId,proto3" json:"api_id,omitempty"`
- Versions []string `protobuf:"bytes,3,rep,name=versions,proto3" json:"versions,omitempty"`
+
+ // ApiName is the name of the API that the session request relates to.
+ ApiName string `protobuf:"bytes,1,opt,name=api_name,json=apiName,proto3" json:"api_name,omitempty"`
+ // ApiId is the ID of the API that the session request relates to.
+ ApiId string `protobuf:"bytes,2,opt,name=api_id,json=apiId,proto3" json:"api_id,omitempty"`
+ // Versions is a list of allowed API versions, e.g. `"versions": [ "Default" ]`.
+ Versions []string `protobuf:"bytes,3,rep,name=versions,proto3" json:"versions,omitempty"`
+ // AllowedUrls is a list of AccessSpec instances. Each instance defines a URL (endpoint)
+ // with an associated allowed list of methods. If all URLs (endpoints) are allowed then the
+ // attribute is not set.
AllowedUrls []*AccessSpec `protobuf:"bytes,4,rep,name=allowed_urls,json=allowedUrls,proto3" json:"allowed_urls,omitempty"`
// Has unexported fields.
}
+ AccessDefinition is defined as an attribute within a SessionState instance.
+ Contains the allowed versions and URLs (endpoints) for the API that the
+ session request relates to. Each URL (endpoint) specifies an associated list
+ of allowed methods. See also AccessSpec.
func (*AccessDefinition) Descriptor() ([]byte, []int)
Deprecated: Use AccessDefinition.ProtoReflect.Descriptor instead.
@@ -6096,10 +6107,16 @@
func (x *AccessDefinition) String() string
type AccessSpec struct {
- Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
+
+ // Url is a URL (endpoint) belonging to the API associated with the request session.
+ Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
+ // Methods is a list of allowed methods for the URL (endpoint), e.g. 'methods': [ 'GET'. 'POST', 'PUT', 'PATCH' ]
+ // The list of methods are case sensitive.
Methods []string `protobuf:"bytes,2,rep,name=methods,proto3" json:"methods,omitempty"`
// Has unexported fields.
}
+ AccessSpec defines an API's URL (endpoint) and associated list of allowed
+ methods.
func (*AccessSpec) Descriptor() ([]byte, []int)
Deprecated: Use AccessSpec.ProtoReflect.Descriptor instead.
@@ -6117,10 +6134,15 @@
func (x *AccessSpec) String() string
type BasicAuthData struct {
+
+ // Password is a hashed password.
Password string `protobuf:"bytes,1,opt,name=password,proto3" json:"password,omitempty"`
- Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
+ // Hash is the name of the hashing algorithm used to hash the password, e.g. bcrypt, Argon2.
+ Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
// Has unexported fields.
}
+ BasicAuthData contains a hashed password and the name of the hashing
+ algorithm used.
func (*BasicAuthData) Descriptor() ([]byte, []int)
Deprecated: Use BasicAuthData.ProtoReflect.Descriptor instead.
@@ -6160,7 +6182,9 @@
PythonDispatcher for reference.
type DispatcherClient interface {
+ // Dispatch is an RPC method that accepts and returns an Object.
Dispatch(ctx context.Context, in *Object, opts ...grpc.CallOption) (*Object, error)
+ // DispatchEvent dispatches an event to the target language.
DispatchEvent(ctx context.Context, in *Event, opts ...grpc.CallOption) (*EventReply, error)
}
DispatcherClient is the client API for Dispatcher service.
@@ -6171,17 +6195,22 @@
func NewDispatcherClient(cc grpc.ClientConnInterface) DispatcherClient
type DispatcherServer interface {
+ // Dispatch is an RPC method that accepts and returns an Object.
Dispatch(context.Context, *Object) (*Object, error)
+ // DispatchEvent dispatches an event to the target language.
DispatchEvent(context.Context, *Event) (*EventReply, error)
}
DispatcherServer is the server API for Dispatcher service. All
implementations should embed UnimplementedDispatcherServer for forward
- compatibility
+ compatibility.
type Event struct {
+
+ // Payload represents the JSON payload.
Payload string `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
// Has unexported fields.
}
+ Event is represented as a JSON payload.
func (*Event) Descriptor() ([]byte, []int)
Deprecated: Use Event.ProtoReflect.Descriptor instead.
@@ -6199,6 +6228,7 @@
type EventReply struct {
// Has unexported fields.
}
+ EventReply is the response for event.
func (*EventReply) Descriptor() ([]byte, []int)
Deprecated: Use EventReply.ProtoReflect.Descriptor instead.
@@ -6212,10 +6242,14 @@
func (x *EventReply) String() string
type Header struct {
- Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
+
+ // Key represents the name of the header.
+ Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
+ // Values is a list of values for a given header content.
Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"`
// Has unexported fields.
}
+ Header is a reponse header that contains multiple associated values.
func (*Header) Descriptor() ([]byte, []int)
Deprecated: Use Header.ProtoReflect.Descriptor instead.
@@ -6233,14 +6267,33 @@
func (x *Header) String() string
type HookType int32
+ HookType is an enumeration that identifies the type of plugin.
const (
- HookType_Unknown HookType = 0
- HookType_Pre HookType = 1
- HookType_Post HookType = 2
- HookType_PostKeyAuth HookType = 3
+ // Unknown is used for error checking and handling of an unrecognised hook type.
+ HookType_Unknown HookType = 0
+ // Pre is executed before request sent to upstream target and before any
+ // authentication information is extracted from the header or
+ // parameter list of the request. Applies to both keyless and protected
+ // APIs.
+ HookType_Pre HookType = 1
+ // Post is executed after authentication, validation, throttling and quota-limiting
+ // middleware has been executed, just before the request is proxied upstream. Use this
+ // to post-process a request before sending it to upstream API. This is only called
+ // when using protected APIs.
+ HookType_Post HookType = 2
+ // PostKeyAuth is executed after authentication, validation, throttling, and quota-limiting
+ // middleware has been executed, just before the request is proxied upstream. Use this
+ // to post-process a request before sending it to upstream API. This is only called
+ // when using protected APIs.
+ HookType_PostKeyAuth HookType = 3
+ // CustomKeyCheck is executed for performing customised authentication.
HookType_CustomKeyCheck HookType = 4
- HookType_Response HookType = 5
+ // Response is executed after the upstream API replies. The arguments passed to this hook include
+ // both the request and response data. Use this to modify the HTTP response before it’s
+ // sent to the client. This hook also receives the request object, the session object,
+ // the metadata and API definition associated with the request.
+ HookType_Response HookType = 5
)
func (HookType) Descriptor() protoreflect.EnumDescriptor
@@ -6256,9 +6309,14 @@
func (HookType) Type() protoreflect.EnumType
type JWTData struct {
+
+ // Secret is the shared secret.
Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"`
// Has unexported fields.
}
+ JWTData is added to sessions where a Tyk key (embedding a shared secret) is
+ used as the public key for signing the JWT. This message contains the shared
+ secret.
func (*JWTData) Descriptor() ([]byte, []int)
Deprecated: Use JWTData.ProtoReflect.Descriptor instead.
@@ -6274,22 +6332,39 @@
func (x *JWTData) String() string
type MiniRequestObject struct {
- Headers map[string]string `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- SetHeaders map[string]string `protobuf:"bytes,2,rep,name=set_headers,json=setHeaders,proto3" json:"set_headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- DeleteHeaders []string `protobuf:"bytes,3,rep,name=delete_headers,json=deleteHeaders,proto3" json:"delete_headers,omitempty"`
- Body string `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"`
- Url string `protobuf:"bytes,5,opt,name=url,proto3" json:"url,omitempty"`
- Params map[string]string `protobuf:"bytes,6,rep,name=params,proto3" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- AddParams map[string]string `protobuf:"bytes,7,rep,name=add_params,json=addParams,proto3" json:"add_params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- ExtendedParams map[string]string `protobuf:"bytes,8,rep,name=extended_params,json=extendedParams,proto3" json:"extended_params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- DeleteParams []string `protobuf:"bytes,9,rep,name=delete_params,json=deleteParams,proto3" json:"delete_params,omitempty"`
- ReturnOverrides *ReturnOverrides `protobuf:"bytes,10,opt,name=return_overrides,json=returnOverrides,proto3" json:"return_overrides,omitempty"`
- Method string `protobuf:"bytes,11,opt,name=method,proto3" json:"method,omitempty"`
- RequestUri string `protobuf:"bytes,12,opt,name=request_uri,json=requestUri,proto3" json:"request_uri,omitempty"`
- Scheme string `protobuf:"bytes,13,opt,name=scheme,proto3" json:"scheme,omitempty"`
- RawBody []byte `protobuf:"bytes,14,opt,name=raw_body,json=rawBody,proto3" json:"raw_body,omitempty"`
+
+ // Headers is a read-only field for reading headers injected by previous middleware.
+ Headers map[string]string `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // SetHeaders is a map of header key values to append to the request.
+ SetHeaders map[string]string `protobuf:"bytes,2,rep,name=set_headers,json=setHeaders,proto3" json:"set_headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // DeleteHeaders is a list of header names to be removed from the request.
+ DeleteHeaders []string `protobuf:"bytes,3,rep,name=delete_headers,json=deleteHeaders,proto3" json:"delete_headers,omitempty"`
+ // Body is the request body.
+ Body string `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"`
+ // Url is the request URL.
+ Url string `protobuf:"bytes,5,opt,name=url,proto3" json:"url,omitempty"`
+ // Params is a read only map of request params.
+ Params map[string]string `protobuf:"bytes,6,rep,name=params,proto3" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // AddParams is a map of parameter keys and values to add to the request.
+ AddParams map[string]string `protobuf:"bytes,7,rep,name=add_params,json=addParams,proto3" json:"add_params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // ExtendedParams allows a parameter to have multiple values, currently unsupported.
+ ExtendedParams map[string]string `protobuf:"bytes,8,rep,name=extended_params,json=extendedParams,proto3" json:"extended_params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // DeleteParams is a list of parameter keys to be removed from the request.
+ DeleteParams []string `protobuf:"bytes,9,rep,name=delete_params,json=deleteParams,proto3" json:"delete_params,omitempty"`
+ // ReturnOverrides override the response for the request, see ReturnOverrides.
+ ReturnOverrides *ReturnOverrides `protobuf:"bytes,10,opt,name=return_overrides,json=returnOverrides,proto3" json:"return_overrides,omitempty"`
+ // Method is the request method, eg GET, POST, etc.
+ Method string `protobuf:"bytes,11,opt,name=method,proto3" json:"method,omitempty"`
+ // RequestUri is the raw unprocessed request URL, including query string and fragments.
+ RequestUri string `protobuf:"bytes,12,opt,name=request_uri,json=requestUri,proto3" json:"request_uri,omitempty"`
+ // Scheme is the URL scheme, e.g. http or https.
+ Scheme string `protobuf:"bytes,13,opt,name=scheme,proto3" json:"scheme,omitempty"`
+ // RawBody is the raw request body.
+ RawBody []byte `protobuf:"bytes,14,opt,name=raw_body,json=rawBody,proto3" json:"raw_body,omitempty"`
// Has unexported fields.
}
+ MiniRequestObject is used for middleware calls and contains important fields
+ like headers, parameters, body and URL.
func (*MiniRequestObject) Descriptor() ([]byte, []int)
Deprecated: Use MiniRequestObject.ProtoReflect.Descriptor instead.
@@ -6331,9 +6406,14 @@
func (x *MiniRequestObject) String() string
type Monitor struct {
+
+ // TriggerLimits is a list of quota percentage limits, defined in descending order.
TriggerLimits []float64 `protobuf:"fixed64,1,rep,packed,name=trigger_limits,json=triggerLimits,proto3" json:"trigger_limits,omitempty"`
// Has unexported fields.
}
+ Monitor allows API endpoint users, stakeholders or an organisation to be
+ notified by webhook when certain quota limits have been reached for their
+ session token.
func (*Monitor) Descriptor() ([]byte, []int)
Deprecated: Use Monitor.ProtoReflect.Descriptor instead.
@@ -6349,15 +6429,28 @@
func (x *Monitor) String() string
type Object struct {
- HookType HookType `protobuf:"varint,1,opt,name=hook_type,json=hookType,proto3,enum=coprocess.HookType" json:"hook_type,omitempty"`
- HookName string `protobuf:"bytes,2,opt,name=hook_name,json=hookName,proto3" json:"hook_name,omitempty"`
- Request *MiniRequestObject `protobuf:"bytes,3,opt,name=request,proto3" json:"request,omitempty"`
- Session *SessionState `protobuf:"bytes,4,opt,name=session,proto3" json:"session,omitempty"`
- Metadata map[string]string `protobuf:"bytes,5,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- Spec map[string]string `protobuf:"bytes,6,rep,name=spec,proto3" json:"spec,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- Response *ResponseObject `protobuf:"bytes,7,opt,name=response,proto3" json:"response,omitempty"`
- // Has unexported fields.
-}
+
+ // HookType is an enumeration that identifies the plugin hook type.
+ HookType HookType `protobuf:"varint,1,opt,name=hook_type,json=hookType,proto3,enum=coprocess.HookType" json:"hook_type,omitempty"`
+ // HookName is the plugin name.
+ HookName string `protobuf:"bytes,2,opt,name=hook_name,json=hookName,proto3" json:"hook_name,omitempty"`
+ // Request relates to the main request data structure used by rich plugins. It’s used for middleware calls
+ // and contains important fields like headers, parameters, body and URL.
+ Request *MiniRequestObject `protobuf:"bytes,3,opt,name=request,proto3" json:"request,omitempty"`
+ // Session stores information about the current key/user that’s used for authentication.
+ Session *SessionState `protobuf:"bytes,4,opt,name=session,proto3" json:"session,omitempty"`
+ // Metadata is a dynamic filed that contains the metadata.
+ Metadata map[string]string `protobuf:"bytes,5,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // Spec contains information about API definition, including APIID, OrgID and config_data.
+ Spec map[string]string `protobuf:"bytes,6,rep,name=spec,proto3" json:"spec,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // Response relates to the ResponseObject used by response hooks. The fields are populated with the upstream HTTP
+ // response data. All the field contents can be modified.
+ Response *ResponseObject `protobuf:"bytes,7,opt,name=response,proto3" json:"response,omitempty"`
+ // Has unexported fields.
+}
+ Object wraps a MiniRequestObject and contains additional fields that are
+ useful for users that implement their own request dispatchers, like the
+ middleware hook type and name.
func (*Object) Descriptor() ([]byte, []int)
Deprecated: Use Object.ProtoReflect.Descriptor instead.
@@ -6385,13 +6478,20 @@
func (x *Object) String() string
type ResponseObject struct {
- StatusCode int32 `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
- RawBody []byte `protobuf:"bytes,2,opt,name=raw_body,json=rawBody,proto3" json:"raw_body,omitempty"`
- Body string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
- Headers map[string]string `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- MultivalueHeaders []*Header `protobuf:"bytes,5,rep,name=multivalue_headers,json=multivalueHeaders,proto3" json:"multivalue_headers,omitempty"`
+
+ // StatusCode is the HTTP status code received from the upstream.
+ StatusCode int32 `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
+ // RawBody represents the raw bytes of HTTP response body.
+ RawBody []byte `protobuf:"bytes,2,opt,name=raw_body,json=rawBody,proto3" json:"raw_body,omitempty"`
+ // Body represents the HTTP response body. Excluded when the raw_body contains invalid UTF-8 characters.
+ Body string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
+ // Headers represents the headers received from upstream.
+ Headers map[string]string `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // MultivalueHeaders is a list of headers. Useful when header has multiple values. See Header.
+ MultivalueHeaders []*Header `protobuf:"bytes,5,rep,name=multivalue_headers,json=multivalueHeaders,proto3" json:"multivalue_headers,omitempty"`
// Has unexported fields.
}
+ ResponseObject is used by response hooks. All fields are modifiable.
func (*ResponseObject) Descriptor() ([]byte, []int)
Deprecated: Use ResponseObject.ProtoReflect.Descriptor instead.
@@ -6415,13 +6515,22 @@
func (x *ResponseObject) String() string
type ReturnOverrides struct {
- ResponseCode int32 `protobuf:"varint,1,opt,name=response_code,json=responseCode,proto3" json:"response_code,omitempty"`
- ResponseError string `protobuf:"bytes,2,opt,name=response_error,json=responseError,proto3" json:"response_error,omitempty"`
- Headers map[string]string `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- OverrideError bool `protobuf:"varint,4,opt,name=override_error,json=overrideError,proto3" json:"override_error,omitempty"`
- ResponseBody string `protobuf:"bytes,5,opt,name=response_body,json=responseBody,proto3" json:"response_body,omitempty"`
+
+ // ResponseCode overrides the upstream response status code.
+ ResponseCode int32 `protobuf:"varint,1,opt,name=response_code,json=responseCode,proto3" json:"response_code,omitempty"`
+ // ResponseError overrides the upstream response error message.
+ ResponseError string `protobuf:"bytes,2,opt,name=response_error,json=responseError,proto3" json:"response_error,omitempty"`
+ // Headers overrides the upstream response headers.
+ Headers map[string]string `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // OverrideError overrides the upstream error response with response_error when set to true.
+ OverrideError bool `protobuf:"varint,4,opt,name=override_error,json=overrideError,proto3" json:"override_error,omitempty"`
+ // ResponseBody is an alias of response_error that contains the response body.
+ ResponseBody string `protobuf:"bytes,5,opt,name=response_body,json=responseBody,proto3" json:"response_body,omitempty"`
// Has unexported fields.
}
+ ReturnOverrides is used to override the response for a given HTTP request
+ When returned within an Object for a given HTTP request, the upstream
+ reponse is replaced with the fields encapsulated within ReturnOverrides.
func (*ReturnOverrides) Descriptor() ([]byte, []int)
Deprecated: Use ReturnOverrides.ProtoReflect.Descriptor instead.
@@ -6445,39 +6554,98 @@
func (x *ReturnOverrides) String() string
type SessionState struct {
- LastCheck int64 `protobuf:"varint,1,opt,name=last_check,json=lastCheck,proto3" json:"last_check,omitempty"`
- Allowance float64 `protobuf:"fixed64,2,opt,name=allowance,proto3" json:"allowance,omitempty"`
- Rate float64 `protobuf:"fixed64,3,opt,name=rate,proto3" json:"rate,omitempty"`
- Per float64 `protobuf:"fixed64,4,opt,name=per,proto3" json:"per,omitempty"`
- Expires int64 `protobuf:"varint,5,opt,name=expires,proto3" json:"expires,omitempty"`
- QuotaMax int64 `protobuf:"varint,6,opt,name=quota_max,json=quotaMax,proto3" json:"quota_max,omitempty"`
- QuotaRenews int64 `protobuf:"varint,7,opt,name=quota_renews,json=quotaRenews,proto3" json:"quota_renews,omitempty"`
- QuotaRemaining int64 `protobuf:"varint,8,opt,name=quota_remaining,json=quotaRemaining,proto3" json:"quota_remaining,omitempty"`
- QuotaRenewalRate int64 `protobuf:"varint,9,opt,name=quota_renewal_rate,json=quotaRenewalRate,proto3" json:"quota_renewal_rate,omitempty"`
- AccessRights map[string]*AccessDefinition `protobuf:"bytes,10,rep,name=access_rights,json=accessRights,proto3" json:"access_rights,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- OrgId string `protobuf:"bytes,11,opt,name=org_id,json=orgId,proto3" json:"org_id,omitempty"`
- OauthClientId string `protobuf:"bytes,12,opt,name=oauth_client_id,json=oauthClientId,proto3" json:"oauth_client_id,omitempty"`
- OauthKeys map[string]string `protobuf:"bytes,13,rep,name=oauth_keys,json=oauthKeys,proto3" json:"oauth_keys,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- BasicAuthData *BasicAuthData `protobuf:"bytes,14,opt,name=basic_auth_data,json=basicAuthData,proto3" json:"basic_auth_data,omitempty"`
- JwtData *JWTData `protobuf:"bytes,15,opt,name=jwt_data,json=jwtData,proto3" json:"jwt_data,omitempty"`
- HmacEnabled bool `protobuf:"varint,16,opt,name=hmac_enabled,json=hmacEnabled,proto3" json:"hmac_enabled,omitempty"`
- HmacSecret string `protobuf:"bytes,17,opt,name=hmac_secret,json=hmacSecret,proto3" json:"hmac_secret,omitempty"`
- IsInactive bool `protobuf:"varint,18,opt,name=is_inactive,json=isInactive,proto3" json:"is_inactive,omitempty"`
- ApplyPolicyId string `protobuf:"bytes,19,opt,name=apply_policy_id,json=applyPolicyId,proto3" json:"apply_policy_id,omitempty"`
- DataExpires int64 `protobuf:"varint,20,opt,name=data_expires,json=dataExpires,proto3" json:"data_expires,omitempty"`
- Monitor *Monitor `protobuf:"bytes,21,opt,name=monitor,proto3" json:"monitor,omitempty"`
- EnableDetailedRecording bool `protobuf:"varint,22,opt,name=enable_detailed_recording,json=enableDetailedRecording,proto3" json:"enable_detailed_recording,omitempty"`
- Metadata map[string]string `protobuf:"bytes,23,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- Tags []string `protobuf:"bytes,24,rep,name=tags,proto3" json:"tags,omitempty"`
- Alias string `protobuf:"bytes,25,opt,name=alias,proto3" json:"alias,omitempty"`
- LastUpdated string `protobuf:"bytes,26,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"`
- IdExtractorDeadline int64 `protobuf:"varint,27,opt,name=id_extractor_deadline,json=idExtractorDeadline,proto3" json:"id_extractor_deadline,omitempty"`
- SessionLifetime int64 `protobuf:"varint,28,opt,name=session_lifetime,json=sessionLifetime,proto3" json:"session_lifetime,omitempty"`
- ApplyPolicies []string `protobuf:"bytes,29,rep,name=apply_policies,json=applyPolicies,proto3" json:"apply_policies,omitempty"`
- Certificate string `protobuf:"bytes,30,opt,name=certificate,proto3" json:"certificate,omitempty"`
- MaxQueryDepth int64 `protobuf:"varint,31,opt,name=max_query_depth,json=maxQueryDepth,proto3" json:"max_query_depth,omitempty"`
- // Has unexported fields.
-}
+
+ // LastCheck is deprecated.
+ LastCheck int64 `protobuf:"varint,1,opt,name=last_check,json=lastCheck,proto3" json:"last_check,omitempty"`
+ // Allowance is deprecated, replaced by rate.
+ Allowance float64 `protobuf:"fixed64,2,opt,name=allowance,proto3" json:"allowance,omitempty"`
+ // Rate is the number of requests that are allowed in the specified rate limiting window.
+ Rate float64 `protobuf:"fixed64,3,opt,name=rate,proto3" json:"rate,omitempty"`
+ // Per is the duration of the rate window, in seconds.
+ Per float64 `protobuf:"fixed64,4,opt,name=per,proto3" json:"per,omitempty"`
+ // Expires is an epoch that defines when the key should expire.
+ Expires int64 `protobuf:"varint,5,opt,name=expires,proto3" json:"expires,omitempty"`
+ // QuotaMax is the maximum number of requests allowed during the quota period.
+ QuotaMax int64 `protobuf:"varint,6,opt,name=quota_max,json=quotaMax,proto3" json:"quota_max,omitempty"`
+ // QuotaRenews is an epoch that defines when the quota renews.
+ QuotaRenews int64 `protobuf:"varint,7,opt,name=quota_renews,json=quotaRenews,proto3" json:"quota_renews,omitempty"`
+ // QuotaRemaining is the number of requests remaining for this user’s quota (unrelated to rate
+ // limit).
+ QuotaRemaining int64 `protobuf:"varint,8,opt,name=quota_remaining,json=quotaRemaining,proto3" json:"quota_remaining,omitempty"`
+ // QuotaRenewalRate is the time in seconds during which the quota is valid.
+ // So for 1000 requests per hour, this value would be 3600 while quota_max and
+ // quota_remaining would be 1000.
+ QuotaRenewalRate int64 `protobuf:"varint,9,opt,name=quota_renewal_rate,json=quotaRenewalRate,proto3" json:"quota_renewal_rate,omitempty"`
+ // AccessRights maps the session's API ID to an AccessDefinition. The AccessDefinition defines the access rights for the API in terms
+ // of allowed: versions and URLs(endpoints). Each URL (endpoint) has a list of allowed methods.
+ AccessRights map[string]*AccessDefinition `protobuf:"bytes,10,rep,name=access_rights,json=accessRights,proto3" json:"access_rights,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // OrgId represents the organisation the session user belongs to. This can be used in conjunction with the org_id
+ // setting in the API Definition object to have tokens owned by organisations.
+ OrgId string `protobuf:"bytes,11,opt,name=org_id,json=orgId,proto3" json:"org_id,omitempty"`
+ // OauthClientId is the OAuth client ID that is set if the token is generated by an OAuth client during an
+ // OAuth authorisation flow.
+ OauthClientId string `protobuf:"bytes,12,opt,name=oauth_client_id,json=oauthClientId,proto3" json:"oauth_client_id,omitempty"`
+ // OauthKeys maps an OAuth client ID with a corresponding access token value. Currently unsupported and under development.
+ OauthKeys map[string]string `protobuf:"bytes,13,rep,name=oauth_keys,json=oauthKeys,proto3" json:"oauth_keys,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // BasicAuthData contains a hashed password and the name of the hashing algorithm used.
+ BasicAuthData *BasicAuthData `protobuf:"bytes,14,opt,name=basic_auth_data,json=basicAuthData,proto3" json:"basic_auth_data,omitempty"`
+ // JwtData is added to sessions where a Tyk key (embedding a shared secret) is used as the public key
+ // for signing the JWT. The JWT token's KID header value references the ID of a Tyk key.
+ JwtData *JWTData `protobuf:"bytes,15,opt,name=jwt_data,json=jwtData,proto3" json:"jwt_data,omitempty"`
+ // HmacEnabled is set to `true` to indicate generation of a HMAC signature using the secret provided in `hmac_secret`.
+ // If the generated signature matches the signature provided in the Authorizaton header then authentication of
+ // the request has passed.
+ HmacEnabled bool `protobuf:"varint,16,opt,name=hmac_enabled,json=hmacEnabled,proto3" json:"hmac_enabled,omitempty"`
+ // HmacSecret represents the HMAC secret.
+ HmacSecret string `protobuf:"bytes,17,opt,name=hmac_secret,json=hmacSecret,proto3" json:"hmac_secret,omitempty"`
+ // IsInactive when set to true, indicates that access is denied.
+ IsInactive bool `protobuf:"varint,18,opt,name=is_inactive,json=isInactive,proto3" json:"is_inactive,omitempty"`
+ // ApplyPolicyId represents the policy ID that is bound to the token. Deprecated use apply_policies instead.
+ ApplyPolicyId string `protobuf:"bytes,19,opt,name=apply_policy_id,json=applyPolicyId,proto3" json:"apply_policy_id,omitempty"`
+ // DataExpires is a value, in seconds, that defines when data generated by the session token expires in
+ // the analytics DB (must be using Pro edition and MongoDB).
+ DataExpires int64 `protobuf:"varint,20,opt,name=data_expires,json=dataExpires,proto3" json:"data_expires,omitempty"`
+ // Monitor represents the quota monitor settings, currently unsupported in gRPC sessions.
+ Monitor *Monitor `protobuf:"bytes,21,opt,name=monitor,proto3" json:"monitor,omitempty"`
+ // EnableDetailedRecording should be set to true to have Tyk store the inbound request and outbound
+ // response data in HTTP Wire format as part of the analytics data.
+ EnableDetailedRecording bool `protobuf:"varint,22,opt,name=enable_detailed_recording,json=enableDetailedRecording,proto3" json:"enable_detailed_recording,omitempty"`
+ // Metadata represents meta-data to be included as part of the session that can be used in other
+ // middleware such as transforms and header injection to embed user-specific
+ // data into a request, or alternatively to query the providence of a key.
+ Metadata map[string]string `protobuf:"bytes,23,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // Tags is a list of tags to embed into analytics data when the request completes. If a policy
+ // has tags, those tags take precedence and are used instead.
+ Tags []string `protobuf:"bytes,24,rep,name=tags,proto3" json:"tags,omitempty"`
+ // Alias is an identifier for the token for use in analytics, to allow easier tracing of hashed
+ // and unhashed tokens.
+ Alias string `protobuf:"bytes,25,opt,name=alias,proto3" json:"alias,omitempty"`
+ // LastUpdated is a timestamp that represents the time the session was last updated.
+ // With *PostAuth* hooks this is a UNIX timestamp.
+ LastUpdated string `protobuf:"bytes,26,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"`
+ // IdExtractorDeadline is a UNIX timestamp that signifies when a cached key or ID will expire.
+ // This relates to custom authentication, where authenticated keys can be cached to save repeated requests
+ // to the gRPC server.
+ IdExtractorDeadline int64 `protobuf:"varint,27,opt,name=id_extractor_deadline,json=idExtractorDeadline,proto3" json:"id_extractor_deadline,omitempty"`
+ // SessionLifetime is a UNIX timestamp that denotes when the key will automatically expire.
+ // Any·subsequent API request made using the key will be rejected.
+ // Overrides the global session lifetime.
+ SessionLifetime int64 `protobuf:"varint,28,opt,name=session_lifetime,json=sessionLifetime,proto3" json:"session_lifetime,omitempty"`
+ // ApplyPolicies is a list of IDs for the policies that are bound to the token.
+ ApplyPolicies []string `protobuf:"bytes,29,rep,name=apply_policies,json=applyPolicies,proto3" json:"apply_policies,omitempty"`
+ // Certificate is the client certificate used to authenticate the request. Exists in the session instance if mTLS is configured
+ // for the API. Currently unsupported.
+ Certificate string `protobuf:"bytes,30,opt,name=certificate,proto3" json:"certificate,omitempty"`
+ // MaxQueryDepth relates to graphQL APIs. If the session key has a maximum query depth limit defined then it is included in the
+ // session instance. Currently unsupported and under development.
+ MaxQueryDepth int64 `protobuf:"varint,31,opt,name=max_query_depth,json=maxQueryDepth,proto3" json:"max_query_depth,omitempty"`
+ // Has unexported fields.
+}
+ SessionState is created for every authenticated request and stored in Redis.
+ Used to track the activity of a given key in different ways, mainly by the
+ built-in Tyk middleware such as the quota middleware or the rate limiter.
+ A GRPC plugin is able to create a SessionState object and store it in the
+ same way built-in authentication mechanisms do.
func (*SessionState) Descriptor() ([]byte, []int)
Deprecated: Use SessionState.ProtoReflect.Descriptor instead.
@@ -6553,9 +6721,12 @@
func (x *SessionState) String() string
type StringSlice struct {
+
+ // Items is a list of string items.
Items []string `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
// Has unexported fields.
}
+ StringSlice is a list of strings.
func (*StringSlice) Descriptor() ([]byte, []int)
Deprecated: Use StringSlice.ProtoReflect.Descriptor instead.
@@ -11476,6 +11647,8 @@
func MyPluginReturningError(rw http.ResponseWriter, r *http.Request)
# Package: ./tests/regression
+package regression // import "github.com/TykTechnologies/tyk/tests/regression"
+
# Package: ./trace
package trace // import "github.com/TykTechnologies/tyk/trace"
⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪ |
🧪 No relevant tests |
🔒 No security concerns identified |
⚡ Key issues to review **Possible Bug:** The updated protobuf files for Go and Python include significant changes to the structure and documentation of the messages. Ensure that these changes are compatible with existing systems that use these protobuf definitions. **Performance Concern:** The addition of detailed comments and metadata in protobuf files might increase the size of the generated code and potentially impact the performance. Verify if the increase in size affects the performance of the applications using these protobufs. **Dependency Update:** The PR updates the versions of `protoc-gen-go`, `protoc`, and `protoc-gen-go-grpc`. Ensure that these version changes are compatible with the rest of the project's dependencies and do not introduce breaking changes. |
Category | Suggestion | Score |
Maintainability |
Remove deprecated fields from the
___
**Replace the deprecated fields | 9 |
Remove redundant comments to enhance code clarity___ **Remove the redundant description in the comment forHookType_Post and HookType_PostKeyAuth since they share the same functionality description.** [coprocess/coprocess_common.pb.go [35-43]](https://github.com/TykTechnologies/tyk/pull/6399/files#diff-37e6340e3fc0a6aa3f6786536531e7a656a90b07cb2d6653dde922c0ede50477R35-R43) ```diff // Post is executed after authentication, validation, throttling and quota-limiting // middleware has been executed, just before the request is proxied upstream. Use this // to post-process a request before sending it to upstream API. This is only called // when using protected APIs. HookType_Post HookType = 2 -// PostKeyAuth is executed after authentication, validation, throttling, and quota-limiting -// middleware has been executed, just before the request is proxied upstream. Use this -// to post-process a request before sending it to upstream API. This is only called -// when using protected APIs. HookType_PostKeyAuth HookType = 3 ``` Suggestion importance[1-10]: 8Why: Removing redundant comments enhances code clarity and maintainability, making it easier for future developers to understand the code. | 8 | |
Use a loop to set options for multiple entries to reduce redundancy___ **Replace the manual setting of_loaded_options and _serialized_options with a loop to reduce redundancy and potential errors in future modifications.** [coprocess/bindings/python/coprocess_mini_request_object_pb2.py [23-29]](https://github.com/TykTechnologies/tyk/pull/6399/files#diff-412221f231bbc1bc1b55a9cebe883d06bd2a3bf7f1b0b0cc127e5b18be9def48R23-R29) ```diff -_globals['DESCRIPTOR']._loaded_options = None -_globals['DESCRIPTOR']._serialized_options = b'Z\n/coprocess' -_globals['_MINIREQUESTOBJECT_HEADERSENTRY']._loaded_options = None -_globals['_MINIREQUESTOBJECT_HEADERSENTRY']._serialized_options = b'8\001' -_globals['_MINIREQUESTOBJECT_SETHEADERSENTRY']._loaded_options = None -_globals['_MINIREQUESTOBJECT_SETHEADERSENTRY']._serialized_options = b'8\001' +entries_to_update = ['DESCRIPTOR', '_MINIREQUESTOBJECT_HEADERSENTRY', '_MINIREQUESTOBJECT_SETHEADERSENTRY'] +for entry in entries_to_update: + _globals[entry]._loaded_options = None + if entry == 'DESCRIPTOR': + _globals[entry]._serialized_options = b'Z\n/coprocess' + else: + _globals[entry]._serialized_options = b'8\001' ``` Suggestion importance[1-10]: 8Why: Replacing manual settings with a loop reduces redundancy and potential errors in future modifications, improving maintainability significantly. | 8 | |
Rename the hook type for consistency and readability___ **Consider renamingHookType_PostKeyAuth to HookType_Post_Auth to maintain consistency with other hook type names and improve readability.** [coprocess/coprocess_common.pb.go [40]](https://github.com/TykTechnologies/tyk/pull/6399/files#diff-37e6340e3fc0a6aa3f6786536531e7a656a90b07cb2d6653dde922c0ede50477R40-R40) ```diff -HookType_PostKeyAuth HookType = 3 +HookType_Post_Auth HookType = 3 ``` Suggestion importance[1-10]: 7Why: The suggestion improves code readability and consistency, but it is not crucial for functionality. | 7 | |
Use a consistent method for defining and manipulating descriptors to avoid confusion___ **To maintain consistency and clarity, consider using a single approach to define andmanipulate descriptors throughout your code. Mixing _descriptor_pool.Default().AddSerializedFile() with manual descriptor manipulations can lead to confusion and maintenance issues.** [coprocess/bindings/python/coprocess_object_pb2.py [21]](https://github.com/TykTechnologies/tyk/pull/6399/files#diff-a6b9eab22b2b5d5e967db957d94460876733862f175d45c24e4c4931bff2a1c5R21-R21) ```diff +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x16\x63oprocess_object.proto\x12\tcoprocess\x1a#coprocess_mini_request_object.proto\x1a\x1f\x63oprocess_response_object.proto\x1a\x1d\x63oprocess_session_state.proto\x1a\x16\x63oprocess_common.proto\"\x85\x03\n\x06Object\x12&\n\thook_type\x18\x01 \x01(\x0e\x32\x13.coprocess.HookType\x12\x11\n\thook_name\x18\x02 \x01(\t\x12-\n\x07request\x18\x03 \x01(\x0b\x32\x1c.coprocess.MiniRequestObject\x12(\n\x07session\x18\x04 \x01(\x0b\x32\x17.coprocess.SessionState\x12\x31\n\x08metadata\x18\x05 \x03(\x0b\x32\x1f.coprocess.Object.MetadataEntry\x12)\n\x04spec\x18\x06 \x03(\x0b\x32\x1b.coprocess.Object.SpecEntry\x12+\n\x08response\x18\x07 \x01(\x0b\x32\x19.coprocess.ResponseObject\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a+\n\tSpecEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\x18\n\x05\x45vent\x12\x0f\n\x07payload\x18\x01 \x01(\t\"\x0c\n\nEventReply2|\n\nDispatcher\x12\x32\n\x08\x44ispatch\x12\x11.coprocess.Object\x1a\x11.coprocess.Object\"\x00\x12:\n\rDispatchEvent\x12\x10.coprocess.Event\x1a\x15.coprocess.EventReply\"\x00\x42\x0cZ\n/coprocessb\x06proto3') - ``` Suggestion importance[1-10]: 7Why: This suggestion promotes code consistency and maintainability by recommending a single approach for descriptor manipulation. While it is a good practice, it is not crucial for functionality. | 7 | |
Improve variable naming for better readability___ **Consider using a more descriptive variable name instead of_globals to improve code readability and maintainability.** [coprocess/bindings/python/coprocess_mini_request_object_pb2.py [20]](https://github.com/TykTechnologies/tyk/pull/6399/files#diff-412221f231bbc1bc1b55a9cebe883d06bd2a3bf7f1b0b0cc127e5b18be9def48R20-R20) ```diff -_globals = globals() +global_descriptors = globals() ``` Suggestion importance[1-10]: 6Why: The suggestion to use a more descriptive variable name improves code readability and maintainability, but it is not crucial for functionality. | 6 | |
Possible issue |
Add a condition check to ensure settings are applied only when C descriptors are not used___ **Consider checking the condition for_descriptor._USE_C_DESCRIPTORS before setting _loaded_options and _serialized_options to None . This ensures that these settings are only applied when C descriptors are not being used, which can prevent potential issues if C descriptors are enabled later.** [coprocess/bindings/python/coprocess_object_pb2.py [26-28]](https://github.com/TykTechnologies/tyk/pull/6399/files#diff-a6b9eab22b2b5d5e967db957d94460876733862f175d45c24e4c4931bff2a1c5R26-R28) ```diff +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None + _globals['DESCRIPTOR']._serialized_options = b'Z\n/coprocess' - ``` Suggestion importance[1-10]: 9Why: This suggestion addresses a potential issue where settings are applied without checking if C descriptors are used, which could lead to problems if C descriptors are enabled later. Adding this condition improves the robustness of the code. | 9 |
Ensure consistent setting of serialized options___ **Ensure that the serialized options are correctly set for all entries to maintainconsistency and avoid potential issues with protobuf serialization.** [coprocess/bindings/python/coprocess_mini_request_object_pb2.py [26-35]](https://github.com/TykTechnologies/tyk/pull/6399/files#diff-412221f231bbc1bc1b55a9cebe883d06bd2a3bf7f1b0b0cc127e5b18be9def48R26-R35) ```diff -_globals['_MINIREQUESTOBJECT_HEADERSENTRY']._serialized_options = b'8\001' -_globals['_MINIREQUESTOBJECT_SETHEADERSENTRY']._serialized_options = b'8\001' -_globals['_MINIREQUESTOBJECT_PARAMSENTRY']._serialized_options = b'8\001' -_globals['_MINIREQUESTOBJECT_ADDPARAMSENTRY']._serialized_options = b'8\001' -_globals['_MINIREQUESTOBJECT_EXTENDEDPARAMSENTRY']._serialized_options = b'8\001' +serialized_options_value = b'8\001' +_globals['_MINIREQUESTOBJECT_HEADERSENTRY']._serialized_options = serialized_options_value +_globals['_MINIREQUESTOBJECT_SETHEADERSENTRY']._serialized_options = serialized_options_value +_globals['_MINIREQUESTOBJECT_PARAMSENTRY']._serialized_options = serialized_options_value +_globals['_MINIREQUESTOBJECT_ADDPARAMSENTRY']._serialized_options = serialized_options_value +_globals['_MINIREQUESTOBJECT_EXTENDEDPARAMSENTRY']._serialized_options = serialized_options_value ``` Suggestion importance[1-10]: 7Why: Ensuring consistent setting of serialized options can prevent potential issues with protobuf serialization, making the code more robust and maintainable. | 7 | |
Robustness |
Add error handling for descriptor building functions___ **Add error handling for potential failures in descriptor building functions to ensurerobustness of the code.** [coprocess/bindings/python/coprocess_mini_request_object_pb2.py [21-22]](https://github.com/TykTechnologies/tyk/pull/6399/files#diff-412221f231bbc1bc1b55a9cebe883d06bd2a3bf7f1b0b0cc127e5b18be9def48R21-R22) ```diff -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'coprocess_mini_request_object_pb2', _globals) +try: + _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) + _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'coprocess_mini_request_object_pb2', _globals) +except Exception as e: + print(f"Error building descriptors: {e}") ``` Suggestion importance[1-10]: 9Why: Adding error handling for descriptor building functions enhances the robustness of the code by ensuring that potential failures are managed gracefully. | 9 |
Enhancement |
Add URL validation to the
___
**Consider adding validation for the | 8 |
Add exception handling around the building of message and enum descriptors to enhance robustness___ **It's recommended to handle exceptions that may occur during the building of message andenum descriptors. This can prevent runtime errors and provide clearer error messages, improving the robustness of the module initialization.** [coprocess/bindings/python/coprocess_object_pb2.py [24]](https://github.com/TykTechnologies/tyk/pull/6399/files#diff-a6b9eab22b2b5d5e967db957d94460876733862f175d45c24e4c4931bff2a1c5R24-R24) ```diff -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +try: + _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +except Exception as e: + logging.error("Failed to build message and enum descriptors: %s", e) + raise ``` Suggestion importance[1-10]: 8Why: Adding exception handling improves the robustness of the code by preventing runtime errors and providing clearer error messages, which is important for debugging and maintenance. | 8 | |
Introduce a new hook type for post-response operations___ **Add a new hook typeHookType_AfterResponse to handle logic after the response is sent to the client, which can be useful for logging or cleanup operations.** [coprocess/coprocess_common.pb.go [51]](https://github.com/TykTechnologies/tyk/pull/6399/files#diff-37e6340e3fc0a6aa3f6786536531e7a656a90b07cb2d6653dde922c0ede50477R51-R51) ```diff HookType_Response HookType = 5 +HookType_AfterResponse HookType = 6 ``` Suggestion importance[1-10]: 6Why: While adding a new hook type could be useful, it is an enhancement that is not directly related to the current changes in the PR. | 6 | |
Security |
Add validation for HTTP methods in the
___
**For the | 8 |
Possible bug |
Verify successful loading of protobuf definitions to ensure correct initialization___ **To ensure that the protobuf definitions are correctly loaded and accessible, verify thesuccessful addition of serialized files to the descriptor pool. This can be done by checking the return value of AddSerializedFile .**
[coprocess/bindings/python/coprocess_object_pb2.py [21]](https://github.com/TykTechnologies/tyk/pull/6399/files#diff-a6b9eab22b2b5d5e967db957d94460876733862f175d45c24e4c4931bff2a1c5R21-R21)
```diff
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x16\x63oprocess_object.proto\x12\tcoprocess\x1a#coprocess_mini_request_object.proto\x1a\x1f\x63oprocess_response_object.proto\x1a\x1d\x63oprocess_session_state.proto\x1a\x16\x63oprocess_common.proto\"\x85\x03\n\x06Object\x12&\n\thook_type\x18\x01 \x01(\x0e\x32\x13.coprocess.HookType\x12\x11\n\thook_name\x18\x02 \x01(\t\x12-\n\x07request\x18\x03 \x01(\x0b\x32\x1c.coprocess.MiniRequestObject\x12(\n\x07session\x18\x04 \x01(\x0b\x32\x17.coprocess.SessionState\x12\x31\n\x08metadata\x18\x05 \x03(\x0b\x32\x1f.coprocess.Object.MetadataEntry\x12)\n\x04spec\x18\x06 \x03(\x0b\x32\x1b.coprocess.Object.SpecEntry\x12+\n\x08response\x18\x07 \x01(\x0b\x32\x19.coprocess.ResponseObject\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a+\n\tSpecEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\x18\n\x05\x45vent\x12\x0f\n\x07payload\x18\x01 \x01(\t\"\x0c\n\nEventReply2|\n\nDispatcher\x12\x32\n\x08\x44ispatch\x12\x11.coprocess.Object\x1a\x11.coprocess.Object\"\x00\x12:\n\rDispatchEvent\x12\x10.coprocess.Event\x1a\x15.coprocess.EventReply\"\x00\x42\x0cZ\n/coprocessb\x06proto3')
+if DESCRIPTOR is None:
+ raise RuntimeError("Failed to load protobuf definitions")
```
Suggestion importance[1-10]: 8Why: This suggestion ensures that protobuf definitions are correctly loaded, which is crucial for the correct functioning of the module. Verifying the return value adds an extra layer of reliability. | 8 |
Best practice |
Encapsulate slice management within the
___
**Refactor the | 7 |
Implement validation for the
___
**Consider implementing a method to validate the | 7 |
My main concern here is bindings, won't it be a breaking change?
My main concern here is bindings, won't it be a breaking change?
@buger It was a documentation change. There we're no API changes on the DX ticket reported so we should be safe.
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
@buger verified again in coprocess/ against release 5.2; to repeat verification:
cd coprocess
schema-gen extract
schema-gen list | sort # This just lists all fields as <Struct>.Field <fieldType>, enough to verify a diff
no api changes.
User description
https://tyktech.atlassian.net/browse/TT-12575
This PR copies the following locations from master to LTS, updating CI state:
coprocess/ is a documentation change, an update of the bindings was made: https://github.com/TykTechnologies/tyk/pull/6251
Expecting all tests to pass
PR Type
enhancement, documentation
Description
protoc-gen-go
,protoc
, andprotoc-gen-go-grpc
versions across multiple Go protobuf files.descriptor_data
and added frozen string literal comment.Changes walkthrough 📝
10 files
coprocess_session_state.pb.go
Update protobuf definitions and add comments
coprocess/coprocess_session_state.pb.go
protoc-gen-go
andprotoc
versions.coprocess_mini_request_object.pb.go
Update protobuf definitions and add comments
coprocess/coprocess_mini_request_object.pb.go
protoc-gen-go
andprotoc
versions.coprocess_object.pb.go
Update protobuf definitions and add comments
coprocess/coprocess_object.pb.go
protoc-gen-go
andprotoc
versions.coprocess_response_object.pb.go
Update protobuf definitions and add comments
coprocess/coprocess_response_object.pb.go
protoc-gen-go
andprotoc
versions.coprocess_common.pb.go
Update protobuf definitions and add comments
coprocess/coprocess_common.pb.go
protoc-gen-go
andprotoc
versions.coprocess_return_overrides.pb.go
Update protobuf definitions and add comments
coprocess/coprocess_return_overrides.pb.go
protoc-gen-go
andprotoc
versions.coprocess_object_grpc.pb.go
Update gRPC protobuf definitions and add comments
coprocess/coprocess_object_grpc.pb.go
protoc-gen-go-grpc
andprotoc
versions.coprocess_session_state_pb2.py
Update Python protobuf bindings
coprocess/bindings/python/coprocess_session_state_pb2.py
_builder
.coprocess_session_state_pb2.py
Update Python protobuf bindings
coprocess/python/proto/coprocess_session_state_pb2.py
_builder
.coprocess_response_object_pb.rb
Update Ruby protobuf bindings
coprocess/bindings/ruby/coprocess_response_object_pb.rb
descriptor_data
.38 files
coprocess_mini_request_object_pb2.py
...
coprocess/bindings/python/coprocess_mini_request_object_pb2.py ...
coprocess_mini_request_object_pb2.py
...
coprocess/python/proto/coprocess_mini_request_object_pb2.py ...
coprocess_object_pb2.py
...
coprocess/bindings/python/coprocess_object_pb2.py ...
coprocess_object_pb2.py
...
coprocess/python/proto/coprocess_object_pb2.py ...
coprocess_response_object_pb2.py
...
coprocess/bindings/python/coprocess_response_object_pb2.py ...
coprocess_response_object_pb2.py
...
coprocess/python/proto/coprocess_response_object_pb2.py ...
coprocess_return_overrides_pb2.py
...
coprocess/bindings/python/coprocess_return_overrides_pb2.py ...
coprocess_return_overrides_pb2.py
...
coprocess/python/proto/coprocess_return_overrides_pb2.py ...
coprocess_object_pb2_grpc.py
...
coprocess/bindings/python/coprocess_object_pb2_grpc.py ...
coprocess_object_pb2_grpc.py
...
coprocess/python/proto/coprocess_object_pb2_grpc.py ...
coprocess_common_pb2.py
...
coprocess/bindings/python/coprocess_common_pb2.py ...
coprocess_common_pb2.py
...
coprocess/python/proto/coprocess_common_pb2.py ...
coprocess_session_state_pb.rb
...
coprocess/bindings/ruby/coprocess_session_state_pb.rb ...
coprocess_mini_request_object_pb.rb
...
coprocess/bindings/ruby/coprocess_mini_request_object_pb.rb ...
coprocess_object_pb.rb
...
coprocess/bindings/ruby/coprocess_object_pb.rb ...
coprocess_common_pb.rb
...
coprocess/bindings/ruby/coprocess_common_pb.rb ...
coprocess_return_overrides_pb.rb
...
coprocess/bindings/ruby/coprocess_return_overrides_pb.rb ...
coprocess_session_state.proto
...
coprocess/proto/coprocess_session_state.proto ...
docker-compose.yml
...
ci/tests/tracing/docker-compose.yml ...
ci-tests.yml
...
.github/workflows/ci-tests.yml ...
test.yml
...
.taskfiles/test.yml ...
Taskfile.yml
...
ci/tests/tracing/Taskfile.yml ...
Taskfile.yml
...
Taskfile.yml ...
coprocess_common.proto
...
coprocess/proto/coprocess_common.proto ...
Taskfile.yml
...
coprocess/proto/Taskfile.yml ...
coprocess_mini_request_object.proto
...
coprocess/proto/coprocess_mini_request_object.proto ...
coprocess_object.proto
...
coprocess/proto/coprocess_object.proto ...
Taskfile.yml
...
ci/tests/tracing/tracetest/Taskfile.yml ...
Taskfile.yml
...
coprocess/Taskfile.yml ...
coprocess_response_object.proto
...
coprocess/proto/coprocess_response_object.proto ...
collector.config.yml
...
ci/tests/tracing/configs/otelcollector/collector.config.yml ...
Taskfile.yml
...
.taskfiles/deps/Taskfile.yml ...
coprocess_return_overrides.proto
...
coprocess/proto/coprocess_return_overrides.proto ...
docker-compose.yml
...
docker-compose.yml ...
tyk.env
...
ci/tests/tracing/configs/tyk.env ...
httpbin.yml
...
docker/services/httpbin.yml ...
redis.yml
...
docker/services/redis.yml ...
docker-compose.yml
...
docker/services/docker-compose.yml ...