Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterCheckServiceServer(s grpc.ServiceRegistrar, srv CheckServiceServer)
- type Action
- type CheckRequest
- func (*CheckRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CheckRequest) GetAuthority() string
- func (x *CheckRequest) GetBody() []byte
- func (x *CheckRequest) GetBodyTruncated() bool
- func (x *CheckRequest) GetClientIp() string
- func (x *CheckRequest) GetHeaders() []*Header
- func (x *CheckRequest) GetMethod() string
- func (x *CheckRequest) GetPeerIp() string
- func (x *CheckRequest) GetProtocol() string
- func (x *CheckRequest) GetRawUri() string
- func (x *CheckRequest) GetRequestId() string
- func (x *CheckRequest) GetRouteHint() string
- func (x *CheckRequest) GetScheme() string
- func (*CheckRequest) ProtoMessage()
- func (x *CheckRequest) ProtoReflect() protoreflect.Message
- func (x *CheckRequest) Reset()
- func (x *CheckRequest) String() string
- type CheckResponse
- func (*CheckResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CheckResponse) GetAction() Action
- func (x *CheckResponse) GetAnomalyScore() int32
- func (x *CheckResponse) GetDenyBody() string
- func (x *CheckResponse) GetDenyContentType() string
- func (x *CheckResponse) GetInspectionTime() *durationpb.Duration
- func (x *CheckResponse) GetInterruptingRuleId() uint32
- func (x *CheckResponse) GetMatches() []*RuleMatch
- func (x *CheckResponse) GetPolicy() string
- func (x *CheckResponse) GetReason() Reason
- func (x *CheckResponse) GetRequestId() string
- func (x *CheckResponse) GetResponseHeaders() []*Header
- func (x *CheckResponse) GetRuleIds() []uint32
- func (x *CheckResponse) GetStatus() uint32
- func (*CheckResponse) ProtoMessage()
- func (x *CheckResponse) ProtoReflect() protoreflect.Message
- func (x *CheckResponse) Reset()
- func (x *CheckResponse) String() string
- type CheckServiceClient
- type CheckServiceServer
- type Header
- func (*Header) Descriptor() ([]byte, []int)deprecated
- func (x *Header) GetName() string
- func (x *Header) GetRawValue() []byte
- func (x *Header) GetValue() string
- func (*Header) ProtoMessage()
- func (x *Header) ProtoReflect() protoreflect.Message
- func (x *Header) Reset()
- func (x *Header) String() string
- type Reason
- type RuleMatch
- type UnimplementedCheckServiceServer
- type UnsafeCheckServiceServer
Constants ¶
const (
CheckService_Check_FullMethodName = "/inkwall.engine.v1.CheckService/Check"
)
Variables ¶
var ( Action_name = map[int32]string{ 0: "ACTION_UNSPECIFIED", 1: "ACTION_ALLOW", 2: "ACTION_DENY", 3: "ACTION_LOG", } Action_value = map[string]int32{ "ACTION_UNSPECIFIED": 0, "ACTION_ALLOW": 1, "ACTION_DENY": 2, "ACTION_LOG": 3, } )
Enum value maps for Action.
var ( Reason_name = map[int32]string{ 0: "REASON_UNSPECIFIED", 1: "REASON_NONE", 2: "REASON_RULE", 3: "REASON_TIMEOUT", 4: "REASON_ERROR", 5: "REASON_CANCELED", 6: "REASON_OVERLOAD", 7: "REASON_OVERSIZE", 8: "REASON_SKIPPED", 9: "REASON_NO_POLICY", 10: "REASON_SUSPENDED", 11: "REASON_WEBSOCKET", 12: "REASON_IP_DENY", 13: "REASON_IP_ALLOW", 14: "REASON_GRPC", 15: "REASON_RATE_LIMIT", 16: "REASON_GEO_DENY", 17: "REASON_GEO_UNAVAILABLE", 40: "REASON_LLM", } Reason_value = map[string]int32{ "REASON_UNSPECIFIED": 0, "REASON_NONE": 1, "REASON_RULE": 2, "REASON_TIMEOUT": 3, "REASON_ERROR": 4, "REASON_CANCELED": 5, "REASON_OVERLOAD": 6, "REASON_OVERSIZE": 7, "REASON_SKIPPED": 8, "REASON_NO_POLICY": 9, "REASON_SUSPENDED": 10, "REASON_WEBSOCKET": 11, "REASON_IP_DENY": 12, "REASON_IP_ALLOW": 13, "REASON_GRPC": 14, "REASON_RATE_LIMIT": 15, "REASON_GEO_DENY": 16, "REASON_GEO_UNAVAILABLE": 17, "REASON_LLM": 40, } )
Enum value maps for Reason.
var CheckService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "inkwall.engine.v1.CheckService", HandlerType: (*CheckServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Check", Handler: _CheckService_Check_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "engine/v1/engine.proto", }
CheckService_ServiceDesc is the grpc.ServiceDesc for CheckService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_engine_v1_engine_proto protoreflect.FileDescriptor
Functions ¶
func RegisterCheckServiceServer ¶
func RegisterCheckServiceServer(s grpc.ServiceRegistrar, srv CheckServiceServer)
Types ¶
type Action ¶
type Action int32
Action tells the proxy what to do with the request.
func (Action) Descriptor ¶
func (Action) Descriptor() protoreflect.EnumDescriptor
func (Action) EnumDescriptor
deprecated
func (Action) Number ¶
func (x Action) Number() protoreflect.EnumNumber
func (Action) Type ¶
func (Action) Type() protoreflect.EnumType
type CheckRequest ¶
type CheckRequest struct {
// Correlates the request across proxy, engine and events. Empty or unsafe
// values (anything but 1-128 of [A-Za-z0-9._:-]) are replaced by a
// generated ID, returned in CheckResponse.request_id.
RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
// HTTP method, e.g. "GET".
Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"`
// "http" or "https" as seen by the proxy. Empty means "http".
Scheme string `protobuf:"bytes,3,opt,name=scheme,proto3" json:"scheme,omitempty"`
// Request authority (Host header or :authority).
Authority string `protobuf:"bytes,4,opt,name=authority,proto3" json:"authority,omitempty"`
// Path and query exactly as received, before any normalization. Must be in
// origin form ("/path?query") and must not contain a fragment.
RawUri string `protobuf:"bytes,5,opt,name=raw_uri,json=rawUri,proto3" json:"raw_uri,omitempty"`
// Request headers in received order. A Host header is ignored in favour of
// authority. Send Content-Length and Transfer-Encoding as received: rules
// check for their presence.
Headers []*Header `protobuf:"bytes,6,rep,name=headers,proto3" json:"headers,omitempty"`
// End client address after the proxy's own trusted-proxy resolution, e.g.
// "203.0.113.7" or "2001:db8::1". Empty means peer_ip.
ClientIp string `protobuf:"bytes,7,opt,name=client_ip,json=clientIp,proto3" json:"client_ip,omitempty"`
// Address of the proxy's direct TCP peer.
PeerIp string `protobuf:"bytes,8,opt,name=peer_ip,json=peerIp,proto3" json:"peer_ip,omitempty"`
// Body prefix. Bytes beyond the engine's --max-body-bytes are dropped and
// the body is treated as truncated.
Body []byte `protobuf:"bytes,9,opt,name=body,proto3" json:"body,omitempty"`
// The real body was longer than body.
BodyTruncated bool `protobuf:"varint,10,opt,name=body_truncated,json=bodyTruncated,proto3" json:"body_truncated,omitempty"`
// Reserved for selecting a policy by route once bundles exist; ignored.
RouteHint string `protobuf:"bytes,11,opt,name=route_hint,json=routeHint,proto3" json:"route_hint,omitempty"`
// Protocol version, e.g. "HTTP/1.1" or "HTTP/2.0". Empty means "HTTP/1.1".
Protocol string `protobuf:"bytes,12,opt,name=protocol,proto3" json:"protocol,omitempty"`
// contains filtered or unexported fields
}
CheckRequest describes one client request as the proxy received it.
func (*CheckRequest) Descriptor
deprecated
func (*CheckRequest) Descriptor() ([]byte, []int)
Deprecated: Use CheckRequest.ProtoReflect.Descriptor instead.
func (*CheckRequest) GetAuthority ¶
func (x *CheckRequest) GetAuthority() string
func (*CheckRequest) GetBody ¶
func (x *CheckRequest) GetBody() []byte
func (*CheckRequest) GetBodyTruncated ¶
func (x *CheckRequest) GetBodyTruncated() bool
func (*CheckRequest) GetClientIp ¶
func (x *CheckRequest) GetClientIp() string
func (*CheckRequest) GetHeaders ¶
func (x *CheckRequest) GetHeaders() []*Header
func (*CheckRequest) GetMethod ¶
func (x *CheckRequest) GetMethod() string
func (*CheckRequest) GetPeerIp ¶
func (x *CheckRequest) GetPeerIp() string
func (*CheckRequest) GetProtocol ¶
func (x *CheckRequest) GetProtocol() string
func (*CheckRequest) GetRawUri ¶
func (x *CheckRequest) GetRawUri() string
func (*CheckRequest) GetRequestId ¶
func (x *CheckRequest) GetRequestId() string
func (*CheckRequest) GetRouteHint ¶
func (x *CheckRequest) GetRouteHint() string
func (*CheckRequest) GetScheme ¶
func (x *CheckRequest) GetScheme() string
func (*CheckRequest) ProtoMessage ¶
func (*CheckRequest) ProtoMessage()
func (*CheckRequest) ProtoReflect ¶
func (x *CheckRequest) ProtoReflect() protoreflect.Message
func (*CheckRequest) Reset ¶
func (x *CheckRequest) Reset()
func (*CheckRequest) String ¶
func (x *CheckRequest) String() string
type CheckResponse ¶
type CheckResponse struct {
Action Action `protobuf:"varint,1,opt,name=action,proto3,enum=inkwall.engine.v1.Action" json:"action,omitempty"`
// HTTP status to return to the client when action is ACTION_DENY.
Status uint32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
// Headers to add to the forwarded request (allow, log) or to the denial.
ResponseHeaders []*Header `protobuf:"bytes,3,rep,name=response_headers,json=responseHeaders,proto3" json:"response_headers,omitempty"`
// Every rule that matched, including rules that only added to an anomaly
// score.
RuleIds []uint32 `protobuf:"varint,4,rep,packed,name=rule_ids,json=ruleIds,proto3" json:"rule_ids,omitempty"`
Reason Reason `protobuf:"varint,5,opt,name=reason,proto3,enum=inkwall.engine.v1.Reason" json:"reason,omitempty"`
// Rule that interrupted the request, or 0.
InterruptingRuleId uint32 `protobuf:"varint,6,opt,name=interrupting_rule_id,json=interruptingRuleId,proto3" json:"interrupting_rule_id,omitempty"`
// The request ID used in the engine's events.
RequestId string `protobuf:"bytes,7,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
// Time spent inspecting.
InspectionTime *durationpb.Duration `protobuf:"bytes,8,opt,name=inspection_time,json=inspectionTime,proto3" json:"inspection_time,omitempty"`
// The policy that decided, in bundle mode ("namespace/name"); empty when
// none did (no policy covers the request, or inspection is suspended),
// or outside bundle mode.
Policy string `protobuf:"bytes,9,opt,name=policy,proto3" json:"policy,omitempty"`
// Where the rules matched: each rule and the variable it matched (e.g.
// ARGS:q), never the matched value. At most 32, variable names cut to
// 128 bytes, as in security events.
Matches []*RuleMatch `protobuf:"bytes,10,rep,name=matches,proto3" json:"matches,omitempty"`
// The request's inbound anomaly score (the Core Rule Set's), 0 when no
// rule added to it.
AnomalyScore int32 `protobuf:"varint,11,opt,name=anomaly_score,json=anomalyScore,proto3" json:"anomaly_score,omitempty"`
// With ACTION_DENY and a policy that sets spec.denyResponse (or an
// InkwallConfig that does), the denial's Content-Type and body (UTF-8,
// with the request ID in it), for the caller to answer the client with,
// as the other adapters do. Empty: the caller writes its own denial.
// Engines before 0.7.0 leave them empty.
DenyContentType string `protobuf:"bytes,12,opt,name=deny_content_type,json=denyContentType,proto3" json:"deny_content_type,omitempty"`
DenyBody string `protobuf:"bytes,13,opt,name=deny_body,json=denyBody,proto3" json:"deny_body,omitempty"`
// contains filtered or unexported fields
}
CheckResponse is the verdict for one CheckRequest.
func (*CheckResponse) Descriptor
deprecated
func (*CheckResponse) Descriptor() ([]byte, []int)
Deprecated: Use CheckResponse.ProtoReflect.Descriptor instead.
func (*CheckResponse) GetAction ¶
func (x *CheckResponse) GetAction() Action
func (*CheckResponse) GetAnomalyScore ¶ added in v0.5.0
func (x *CheckResponse) GetAnomalyScore() int32
func (*CheckResponse) GetDenyBody ¶
func (x *CheckResponse) GetDenyBody() string
func (*CheckResponse) GetDenyContentType ¶
func (x *CheckResponse) GetDenyContentType() string
func (*CheckResponse) GetInspectionTime ¶
func (x *CheckResponse) GetInspectionTime() *durationpb.Duration
func (*CheckResponse) GetInterruptingRuleId ¶
func (x *CheckResponse) GetInterruptingRuleId() uint32
func (*CheckResponse) GetMatches ¶ added in v0.5.0
func (x *CheckResponse) GetMatches() []*RuleMatch
func (*CheckResponse) GetPolicy ¶ added in v0.1.1
func (x *CheckResponse) GetPolicy() string
func (*CheckResponse) GetReason ¶
func (x *CheckResponse) GetReason() Reason
func (*CheckResponse) GetRequestId ¶
func (x *CheckResponse) GetRequestId() string
func (*CheckResponse) GetResponseHeaders ¶
func (x *CheckResponse) GetResponseHeaders() []*Header
func (*CheckResponse) GetRuleIds ¶
func (x *CheckResponse) GetRuleIds() []uint32
func (*CheckResponse) GetStatus ¶
func (x *CheckResponse) GetStatus() uint32
func (*CheckResponse) ProtoMessage ¶
func (*CheckResponse) ProtoMessage()
func (*CheckResponse) ProtoReflect ¶
func (x *CheckResponse) ProtoReflect() protoreflect.Message
func (*CheckResponse) Reset ¶
func (x *CheckResponse) Reset()
func (*CheckResponse) String ¶
func (x *CheckResponse) String() string
type CheckServiceClient ¶
type CheckServiceClient interface {
// Check inspects one request and returns the verdict.
Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error)
}
CheckServiceClient is the client API for CheckService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
CheckService is the gRPC form of POST /v1/check.
func NewCheckServiceClient ¶
func NewCheckServiceClient(cc grpc.ClientConnInterface) CheckServiceClient
type CheckServiceServer ¶
type CheckServiceServer interface {
// Check inspects one request and returns the verdict.
Check(context.Context, *CheckRequest) (*CheckResponse, error)
// contains filtered or unexported methods
}
CheckServiceServer is the server API for CheckService service. All implementations must embed UnimplementedCheckServiceServer for forward compatibility.
CheckService is the gRPC form of POST /v1/check.
type Header ¶
type Header struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// Value, when it is valid UTF-8.
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
// Value as raw bytes, for values that are not valid UTF-8 (obs-text).
// Takes precedence over value when set.
RawValue []byte `protobuf:"bytes,3,opt,name=raw_value,json=rawValue,proto3" json:"raw_value,omitempty"`
// contains filtered or unexported fields
}
Header is one request or response header field.
func (*Header) Descriptor
deprecated
func (*Header) GetRawValue ¶
func (*Header) ProtoMessage ¶
func (*Header) ProtoMessage()
func (*Header) ProtoReflect ¶
func (x *Header) ProtoReflect() protoreflect.Message
type Reason ¶
type Reason int32
Reason explains a verdict.
const ( Reason_REASON_UNSPECIFIED Reason = 0 // No rule interrupted the request. Reason_REASON_NONE Reason = 1 // A rule interrupted the request. Reason_REASON_RULE Reason = 2 // Inspection exceeded the deadline. Reason_REASON_TIMEOUT Reason = 3 // The evaluator failed. Reason_REASON_ERROR Reason = 4 // The caller canceled the check. Reason_REASON_CANCELED Reason = 5 // All evaluation slots were busy; the request was not inspected. Reason_REASON_OVERLOAD Reason = 6 // The body was longer than the inspection limit. Reason_REASON_OVERSIZE Reason = 7 // The route is configured to skip inspection. Reason_REASON_SKIPPED Reason = 8 // No policy covers the route, so the request was not inspected. Reason_REASON_NO_POLICY Reason = 9 // Inspection is suspended (the emergency switch). Reason_REASON_SUSPENDED Reason = 10 // A WebSocket handshake didn't meet the policy's WebSocket rules (an // origin not allowed, a required header missing). Reason_REASON_WEBSOCKET Reason = 11 // The client IP is in the policy's IP deny list. Reason_REASON_IP_DENY Reason = 12 // The client IP is in the policy's IP allow list: not inspected. Reason_REASON_IP_ALLOW Reason = 13 // A gRPC call on a policy that refuses gRPC (body.grpc: Deny). Reason_REASON_GRPC Reason = 14 // The client was over one of the policy's rate limits (spec.rateLimits): // 429 with Retry-After in Block mode. Reason_REASON_RATE_LIMIT Reason = 15 // The client's country is denied by the policy's geo blocking // (spec.geo): 403 in Block mode. Reason_REASON_GEO_DENY Reason = 16 // The bundle names a country table the engine doesn't hold, and the // policy fails closed: 503. Reason_REASON_GEO_UNAVAILABLE Reason = 17 // A request on one of the policy's LLM endpoints failed an LLM check // (spec.llm): 400, or 413 for the size caps, in Block mode. (Numbered // from 40, apart from the reasons other features add meanwhile.) Reason_REASON_LLM Reason = 40 )
func (Reason) Descriptor ¶
func (Reason) Descriptor() protoreflect.EnumDescriptor
func (Reason) EnumDescriptor
deprecated
func (Reason) Number ¶
func (x Reason) Number() protoreflect.EnumNumber
func (Reason) Type ¶
func (Reason) Type() protoreflect.EnumType
type RuleMatch ¶ added in v0.5.0
type RuleMatch struct {
RuleId uint32 `protobuf:"varint,1,opt,name=rule_id,json=ruleId,proto3" json:"rule_id,omitempty"`
// The variable: collection and key, e.g. ARGS:q or REQUEST_HEADERS:User-Agent.
Variable string `protobuf:"bytes,2,opt,name=variable,proto3" json:"variable,omitempty"`
// contains filtered or unexported fields
}
RuleMatch is where a rule matched.
func (*RuleMatch) Descriptor
deprecated
added in
v0.5.0
func (*RuleMatch) GetVariable ¶ added in v0.5.0
func (*RuleMatch) ProtoMessage ¶ added in v0.5.0
func (*RuleMatch) ProtoMessage()
func (*RuleMatch) ProtoReflect ¶ added in v0.5.0
func (x *RuleMatch) ProtoReflect() protoreflect.Message
type UnimplementedCheckServiceServer ¶
type UnimplementedCheckServiceServer struct{}
UnimplementedCheckServiceServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedCheckServiceServer) Check ¶
func (UnimplementedCheckServiceServer) Check(context.Context, *CheckRequest) (*CheckResponse, error)
type UnsafeCheckServiceServer ¶
type UnsafeCheckServiceServer interface {
// contains filtered or unexported methods
}
UnsafeCheckServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CheckServiceServer will result in compilation errors.