@mochabug/adapt-sdk 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +873 -0
- package/dist/api.d.ts +1605 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.spec.d.ts +2 -0
- package/dist/api.spec.d.ts.map +1 -0
- package/dist/cjs/api.cjs +2 -0
- package/dist/cjs/api.cjs.map +7 -0
- package/dist/cjs/frontend.cjs +2 -0
- package/dist/cjs/frontend.cjs.map +7 -0
- package/dist/cjs/mime.cjs +2 -0
- package/dist/cjs/mime.cjs.map +7 -0
- package/dist/cjs/router.cjs +2 -0
- package/dist/cjs/router.cjs.map +7 -0
- package/dist/cjs/types.cjs +2 -0
- package/dist/cjs/types.cjs.map +7 -0
- package/dist/esm/api.mjs +2 -0
- package/dist/esm/api.mjs.map +7 -0
- package/dist/esm/frontend.mjs +2 -0
- package/dist/esm/frontend.mjs.map +7 -0
- package/dist/esm/mime.mjs +2 -0
- package/dist/esm/mime.mjs.map +7 -0
- package/dist/esm/router.mjs +2 -0
- package/dist/esm/router.mjs.map +7 -0
- package/dist/esm/types.mjs +1 -0
- package/dist/esm/types.mjs.map +7 -0
- package/dist/frontend.d.ts +10 -0
- package/dist/frontend.d.ts.map +1 -0
- package/dist/genproto/buf/validate/validate_pb.d.ts +8491 -0
- package/dist/genproto/buf/validate/validate_pb.d.ts.map +1 -0
- package/dist/genproto/google/api/annotations_pb.d.ts +14 -0
- package/dist/genproto/google/api/annotations_pb.d.ts.map +1 -0
- package/dist/genproto/google/api/client_pb.d.ts +1432 -0
- package/dist/genproto/google/api/client_pb.d.ts.map +1 -0
- package/dist/genproto/google/api/http_pb.d.ts +843 -0
- package/dist/genproto/google/api/http_pb.d.ts.map +1 -0
- package/dist/genproto/google/api/launch_stage_pb.d.ts +94 -0
- package/dist/genproto/google/api/launch_stage_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/automations/v1/automations_pb.d.ts +1006 -0
- package/dist/genproto/mochabugapis/adapt/automations/v1/automations_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/graph/exchange_pb.d.ts +77 -0
- package/dist/genproto/mochabugapis/adapt/graph/exchange_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/graph/jtd_schema_pb.d.ts +401 -0
- package/dist/genproto/mochabugapis/adapt/graph/jtd_schema_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/graph/receiver_pb.d.ts +69 -0
- package/dist/genproto/mochabugapis/adapt/graph/receiver_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/graph/signal_binding_pb.d.ts +430 -0
- package/dist/genproto/mochabugapis/adapt/graph/signal_binding_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/graph/signal_data_pb.d.ts +198 -0
- package/dist/genproto/mochabugapis/adapt/graph/signal_data_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.d.ts +161 -0
- package/dist/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/graph/signal_format_pb.d.ts +305 -0
- package/dist/genproto/mochabugapis/adapt/graph/signal_format_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/graph/transceiver_pb.d.ts +77 -0
- package/dist/genproto/mochabugapis/adapt/graph/transceiver_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/graph/transmitter_pb.d.ts +120 -0
- package/dist/genproto/mochabugapis/adapt/graph/transmitter_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/graph/vertex_metadata_pb.d.ts +99 -0
- package/dist/genproto/mochabugapis/adapt/graph/vertex_metadata_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/compound_services_pb.d.ts +347 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/compound_services_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/file_pb.d.ts +64 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/file_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/http_proxy_service_pb.d.ts +1282 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/http_proxy_service_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/manifest_pb.d.ts +388 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/manifest_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/oauth2_service_pb.d.ts +805 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/oauth2_service_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/plugins_pb.d.ts +238 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/plugins_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/service_definition_pb.d.ts +241 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/service_definition_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/service_settings_pb.d.ts +539 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/service_settings_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/variable_service_pb.d.ts +190 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/variable_service_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/vertex_pb.d.ts +269 -0
- package/dist/genproto/mochabugapis/adapt/plugins/v1/vertex_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/runtime/v1/incoming_pb.d.ts +339 -0
- package/dist/genproto/mochabugapis/adapt/runtime/v1/incoming_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/runtime/v1/runtime_pb.d.ts +2721 -0
- package/dist/genproto/mochabugapis/adapt/runtime/v1/runtime_pb.d.ts.map +1 -0
- package/dist/genproto/mochabugapis/adapt/runtime/v1/store_pb.d.ts +872 -0
- package/dist/genproto/mochabugapis/adapt/runtime/v1/store_pb.d.ts.map +1 -0
- package/dist/grpcweb.d.ts +8 -0
- package/dist/grpcweb.d.ts.map +1 -0
- package/dist/mime.d.ts +11 -0
- package/dist/mime.d.ts.map +1 -0
- package/dist/router.d.ts +503 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.spec.d.ts +2 -0
- package/dist/router.spec.d.ts.map +1 -0
- package/dist/signal-api.spec.d.ts +17 -0
- package/dist/signal-api.spec.d.ts.map +1 -0
- package/dist/types.d.ts +149 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,1282 @@
|
|
|
1
|
+
import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { File, FileJson } from "./file_pb";
|
|
3
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
4
|
+
/**
|
|
5
|
+
* Describes the file mochabugapis/adapt/plugins/v1/http_proxy_service.proto.
|
|
6
|
+
*/
|
|
7
|
+
export declare const file_mochabugapis_adapt_plugins_v1_http_proxy_service: GenFile;
|
|
8
|
+
/**
|
|
9
|
+
* The http proxy service definition
|
|
10
|
+
*
|
|
11
|
+
* This service provides HTTP proxy capabilities with optional TLS configuration
|
|
12
|
+
* and dynamic header injection for outgoing requests.
|
|
13
|
+
*
|
|
14
|
+
* An HTTP proxy configuration must do at least one of the following:
|
|
15
|
+
* - Configure custom TLS settings (self-signed certs, mTLS, CA pinning)
|
|
16
|
+
* - Inject dynamic headers using template variables
|
|
17
|
+
*
|
|
18
|
+
* If neither TLS nor header injection is configured, the proxy provides no value
|
|
19
|
+
* and the plugin should use direct HTTP requests instead.
|
|
20
|
+
*
|
|
21
|
+
* Example use cases:
|
|
22
|
+
* - Adding authentication headers to upstream services (Bearer tokens, API keys)
|
|
23
|
+
* - Injecting custom correlation IDs or tracking headers
|
|
24
|
+
* - Using mutual TLS (mTLS) for B2B API authentication
|
|
25
|
+
* - Connecting to services with self-signed certificates
|
|
26
|
+
*
|
|
27
|
+
* @generated from message mochabugapis.adapt.plugins.v1.HttpProxyDefinition
|
|
28
|
+
*/
|
|
29
|
+
export type HttpProxyDefinition = Message<"mochabugapis.adapt.plugins.v1.HttpProxyDefinition"> & {
|
|
30
|
+
/**
|
|
31
|
+
* REQUIRED: Allowed upstream hosts that this proxy can connect to.
|
|
32
|
+
*
|
|
33
|
+
* Plugin authors define which external services the plugin will communicate with.
|
|
34
|
+
* Only publicly accessible hosts are allowed; private IP addresses and non-globally
|
|
35
|
+
* resolvable hostnames are blocked by the platform.
|
|
36
|
+
*
|
|
37
|
+
* ## Transparency & User Visibility
|
|
38
|
+
*
|
|
39
|
+
* IMPORTANT: This list is VISIBLE to users during plugin installation and in plugin settings.
|
|
40
|
+
* Users can see exactly which external endpoints your plugin will connect to.
|
|
41
|
+
*
|
|
42
|
+
* Plugin authors MUST be transparent about:
|
|
43
|
+
* - Which services the plugin connects to
|
|
44
|
+
* - Why the plugin needs to connect to these hosts
|
|
45
|
+
* - What data is sent to these endpoints
|
|
46
|
+
*
|
|
47
|
+
* Plugins that attempt to hide their network activity or connect to undisclosed endpoints
|
|
48
|
+
* will be flagged as malicious and removed from the plugin marketplace.
|
|
49
|
+
*
|
|
50
|
+
* ## Format
|
|
51
|
+
*
|
|
52
|
+
* Each entry must be a valid hostname or publicly routable IP address, optionally with a port:
|
|
53
|
+
* - "api.example.com" - Exact hostname match
|
|
54
|
+
* - "*.example.com" - Wildcard subdomain match (matches api.example.com, service.example.com, etc.)
|
|
55
|
+
* - "api.example.com:8443" - Hostname with specific port
|
|
56
|
+
* - "*.example.com:8443" - Wildcard subdomain with specific port
|
|
57
|
+
*
|
|
58
|
+
* ## Wildcard Rules
|
|
59
|
+
*
|
|
60
|
+
* - "*" at the start means "any subdomain" but NOT the root domain
|
|
61
|
+
* - "*.example.com" matches "api.example.com" but NOT "example.com"
|
|
62
|
+
* - To allow both, add both entries: ["*.example.com", "example.com"]
|
|
63
|
+
*
|
|
64
|
+
* - Wildcards only supported at the subdomain level
|
|
65
|
+
* - Valid: "*.example.com", "*.api.example.com"
|
|
66
|
+
* - Invalid: "api.*.com", "*", "example.*"
|
|
67
|
+
*
|
|
68
|
+
* ## Port Matching
|
|
69
|
+
*
|
|
70
|
+
* - If no port specified: matches any port on that host
|
|
71
|
+
* - "api.example.com" matches api.example.com:80, api.example.com:443, api.example.com:8080
|
|
72
|
+
*
|
|
73
|
+
* - If port specified: matches only that specific port
|
|
74
|
+
* - "api.example.com:443" matches ONLY api.example.com:443
|
|
75
|
+
* - Does NOT match api.example.com:80 or api.example.com:8443
|
|
76
|
+
*
|
|
77
|
+
* ## Restrictions
|
|
78
|
+
*
|
|
79
|
+
* The following are blocked and will cause validation errors:
|
|
80
|
+
* - Private IP ranges (RFC 1918): 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
|
|
81
|
+
* - Loopback addresses: 127.0.0.0/8, ::1
|
|
82
|
+
* - Link-local addresses: 169.254.0.0/16, fe80::/10
|
|
83
|
+
* - Non-globally resolvable hostnames: localhost, *.local, *.internal
|
|
84
|
+
*
|
|
85
|
+
* ## Examples
|
|
86
|
+
*
|
|
87
|
+
* 1. Single API endpoint:
|
|
88
|
+
* allowed_hosts: ["api.example.com"]
|
|
89
|
+
*
|
|
90
|
+
* 2. Multiple environments:
|
|
91
|
+
* allowed_hosts: ["api.prod.example.com", "api.staging.example.com"]
|
|
92
|
+
*
|
|
93
|
+
* 3. All subdomains of a service:
|
|
94
|
+
* allowed_hosts: ["*.service.example.com", "service.example.com"]
|
|
95
|
+
*
|
|
96
|
+
* 4. Specific port (e.g., non-standard HTTPS):
|
|
97
|
+
* allowed_hosts: ["api.example.com:8443"]
|
|
98
|
+
*
|
|
99
|
+
* @generated from field: repeated string allowed_hosts = 1;
|
|
100
|
+
*/
|
|
101
|
+
allowedHosts: string[];
|
|
102
|
+
/**
|
|
103
|
+
* Optional TLS configuration for the upstream connection.
|
|
104
|
+
*
|
|
105
|
+
* If not specified:
|
|
106
|
+
* - The protocol (HTTP/HTTPS) is forwarded from the incoming request
|
|
107
|
+
* - HTTP requests are proxied as HTTP
|
|
108
|
+
* - HTTPS requests are proxied as HTTPS using the system's default trust store
|
|
109
|
+
* (publicly trusted Certificate Authorities like Let's Encrypt, DigiCert, etc.)
|
|
110
|
+
*
|
|
111
|
+
* If specified:
|
|
112
|
+
* - For MODE_SERVER_ONLY: Validates the server certificate against the provided ca_bundle
|
|
113
|
+
* - For MODE_MTLS: Performs mutual TLS authentication with client certificate
|
|
114
|
+
*
|
|
115
|
+
* Use this when:
|
|
116
|
+
* - Upstream uses self-signed certificates (provide custom ca_bundle)
|
|
117
|
+
* - Upstream requires mutual TLS (provide client certificate and private key)
|
|
118
|
+
* - Need to pin specific CA certificates for security
|
|
119
|
+
*
|
|
120
|
+
* @generated from field: optional mochabugapis.adapt.plugins.v1.TlsDefinition tls = 2;
|
|
121
|
+
*/
|
|
122
|
+
tls?: TlsDefinition;
|
|
123
|
+
/**
|
|
124
|
+
* Dynamic headers to inject into every proxied request using template variables.
|
|
125
|
+
*
|
|
126
|
+
* This field is for headers that require DYNAMIC values resolved from template variables.
|
|
127
|
+
* The caller can always submit static headers directly with each request - this field
|
|
128
|
+
* is specifically for injecting headers that use variable substitution (e.g., %ACCESS_TOKEN%).
|
|
129
|
+
*
|
|
130
|
+
* ## When to Use inject_headers
|
|
131
|
+
*
|
|
132
|
+
* Use this field when you need to inject headers with:
|
|
133
|
+
* - Values that change per request or per user (tokens, session IDs)
|
|
134
|
+
* - Values that come from user configuration (API keys, tenant IDs)
|
|
135
|
+
* - Values that need to be kept secret (credentials, tokens)
|
|
136
|
+
* - Dynamic template substitution using %VARIABLE% syntax
|
|
137
|
+
*
|
|
138
|
+
* ## When NOT to Use inject_headers
|
|
139
|
+
*
|
|
140
|
+
* Do NOT use this field for:
|
|
141
|
+
* - Static headers that never change (use direct headers in the request)
|
|
142
|
+
* - Headers that the caller controls (they can submit these directly)
|
|
143
|
+
* - Constant values like "Content-Type: application/json"
|
|
144
|
+
*
|
|
145
|
+
* The caller can always add, modify, or override headers in their individual requests.
|
|
146
|
+
* This field is for headers that the plugin definition requires to be injected with
|
|
147
|
+
* dynamic values before reaching the upstream service.
|
|
148
|
+
*
|
|
149
|
+
* ## Header Processing
|
|
150
|
+
*
|
|
151
|
+
* The map key is the HTTP header name (e.g., "Authorization", "X-Api-Key").
|
|
152
|
+
* Header names are case-insensitive per RFC 7230 but will be sent as specified.
|
|
153
|
+
*
|
|
154
|
+
* If the same header name appears in both inject_headers and the caller's request:
|
|
155
|
+
* - The inject_headers value takes precedence (overrides caller's value)
|
|
156
|
+
* - This ensures plugin-level authentication/configuration is always applied
|
|
157
|
+
*
|
|
158
|
+
* ## Common Patterns
|
|
159
|
+
*
|
|
160
|
+
* - "Authorization": "Bearer %ACCESS_TOKEN%" - Dynamic OAuth2 token
|
|
161
|
+
* - "X-Api-Key": "%API_KEY%" - User-provided API key
|
|
162
|
+
* - "X-Request-ID": "%CORRELATION_ID%" - Tracing identifier
|
|
163
|
+
* - "X-Tenant-ID": "%TENANT_ID%" - Multi-tenant identifier
|
|
164
|
+
*
|
|
165
|
+
* @generated from field: map<string, mochabugapis.adapt.plugins.v1.HeaderTemplate> inject_headers = 3;
|
|
166
|
+
*/
|
|
167
|
+
injectHeaders: {
|
|
168
|
+
[key: string]: HeaderTemplate;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* The http proxy service definition
|
|
173
|
+
*
|
|
174
|
+
* This service provides HTTP proxy capabilities with optional TLS configuration
|
|
175
|
+
* and dynamic header injection for outgoing requests.
|
|
176
|
+
*
|
|
177
|
+
* An HTTP proxy configuration must do at least one of the following:
|
|
178
|
+
* - Configure custom TLS settings (self-signed certs, mTLS, CA pinning)
|
|
179
|
+
* - Inject dynamic headers using template variables
|
|
180
|
+
*
|
|
181
|
+
* If neither TLS nor header injection is configured, the proxy provides no value
|
|
182
|
+
* and the plugin should use direct HTTP requests instead.
|
|
183
|
+
*
|
|
184
|
+
* Example use cases:
|
|
185
|
+
* - Adding authentication headers to upstream services (Bearer tokens, API keys)
|
|
186
|
+
* - Injecting custom correlation IDs or tracking headers
|
|
187
|
+
* - Using mutual TLS (mTLS) for B2B API authentication
|
|
188
|
+
* - Connecting to services with self-signed certificates
|
|
189
|
+
*
|
|
190
|
+
* @generated from message mochabugapis.adapt.plugins.v1.HttpProxyDefinition
|
|
191
|
+
*/
|
|
192
|
+
export type HttpProxyDefinitionJson = {
|
|
193
|
+
/**
|
|
194
|
+
* REQUIRED: Allowed upstream hosts that this proxy can connect to.
|
|
195
|
+
*
|
|
196
|
+
* Plugin authors define which external services the plugin will communicate with.
|
|
197
|
+
* Only publicly accessible hosts are allowed; private IP addresses and non-globally
|
|
198
|
+
* resolvable hostnames are blocked by the platform.
|
|
199
|
+
*
|
|
200
|
+
* ## Transparency & User Visibility
|
|
201
|
+
*
|
|
202
|
+
* IMPORTANT: This list is VISIBLE to users during plugin installation and in plugin settings.
|
|
203
|
+
* Users can see exactly which external endpoints your plugin will connect to.
|
|
204
|
+
*
|
|
205
|
+
* Plugin authors MUST be transparent about:
|
|
206
|
+
* - Which services the plugin connects to
|
|
207
|
+
* - Why the plugin needs to connect to these hosts
|
|
208
|
+
* - What data is sent to these endpoints
|
|
209
|
+
*
|
|
210
|
+
* Plugins that attempt to hide their network activity or connect to undisclosed endpoints
|
|
211
|
+
* will be flagged as malicious and removed from the plugin marketplace.
|
|
212
|
+
*
|
|
213
|
+
* ## Format
|
|
214
|
+
*
|
|
215
|
+
* Each entry must be a valid hostname or publicly routable IP address, optionally with a port:
|
|
216
|
+
* - "api.example.com" - Exact hostname match
|
|
217
|
+
* - "*.example.com" - Wildcard subdomain match (matches api.example.com, service.example.com, etc.)
|
|
218
|
+
* - "api.example.com:8443" - Hostname with specific port
|
|
219
|
+
* - "*.example.com:8443" - Wildcard subdomain with specific port
|
|
220
|
+
*
|
|
221
|
+
* ## Wildcard Rules
|
|
222
|
+
*
|
|
223
|
+
* - "*" at the start means "any subdomain" but NOT the root domain
|
|
224
|
+
* - "*.example.com" matches "api.example.com" but NOT "example.com"
|
|
225
|
+
* - To allow both, add both entries: ["*.example.com", "example.com"]
|
|
226
|
+
*
|
|
227
|
+
* - Wildcards only supported at the subdomain level
|
|
228
|
+
* - Valid: "*.example.com", "*.api.example.com"
|
|
229
|
+
* - Invalid: "api.*.com", "*", "example.*"
|
|
230
|
+
*
|
|
231
|
+
* ## Port Matching
|
|
232
|
+
*
|
|
233
|
+
* - If no port specified: matches any port on that host
|
|
234
|
+
* - "api.example.com" matches api.example.com:80, api.example.com:443, api.example.com:8080
|
|
235
|
+
*
|
|
236
|
+
* - If port specified: matches only that specific port
|
|
237
|
+
* - "api.example.com:443" matches ONLY api.example.com:443
|
|
238
|
+
* - Does NOT match api.example.com:80 or api.example.com:8443
|
|
239
|
+
*
|
|
240
|
+
* ## Restrictions
|
|
241
|
+
*
|
|
242
|
+
* The following are blocked and will cause validation errors:
|
|
243
|
+
* - Private IP ranges (RFC 1918): 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
|
|
244
|
+
* - Loopback addresses: 127.0.0.0/8, ::1
|
|
245
|
+
* - Link-local addresses: 169.254.0.0/16, fe80::/10
|
|
246
|
+
* - Non-globally resolvable hostnames: localhost, *.local, *.internal
|
|
247
|
+
*
|
|
248
|
+
* ## Examples
|
|
249
|
+
*
|
|
250
|
+
* 1. Single API endpoint:
|
|
251
|
+
* allowed_hosts: ["api.example.com"]
|
|
252
|
+
*
|
|
253
|
+
* 2. Multiple environments:
|
|
254
|
+
* allowed_hosts: ["api.prod.example.com", "api.staging.example.com"]
|
|
255
|
+
*
|
|
256
|
+
* 3. All subdomains of a service:
|
|
257
|
+
* allowed_hosts: ["*.service.example.com", "service.example.com"]
|
|
258
|
+
*
|
|
259
|
+
* 4. Specific port (e.g., non-standard HTTPS):
|
|
260
|
+
* allowed_hosts: ["api.example.com:8443"]
|
|
261
|
+
*
|
|
262
|
+
* @generated from field: repeated string allowed_hosts = 1;
|
|
263
|
+
*/
|
|
264
|
+
allowedHosts?: string[];
|
|
265
|
+
/**
|
|
266
|
+
* Optional TLS configuration for the upstream connection.
|
|
267
|
+
*
|
|
268
|
+
* If not specified:
|
|
269
|
+
* - The protocol (HTTP/HTTPS) is forwarded from the incoming request
|
|
270
|
+
* - HTTP requests are proxied as HTTP
|
|
271
|
+
* - HTTPS requests are proxied as HTTPS using the system's default trust store
|
|
272
|
+
* (publicly trusted Certificate Authorities like Let's Encrypt, DigiCert, etc.)
|
|
273
|
+
*
|
|
274
|
+
* If specified:
|
|
275
|
+
* - For MODE_SERVER_ONLY: Validates the server certificate against the provided ca_bundle
|
|
276
|
+
* - For MODE_MTLS: Performs mutual TLS authentication with client certificate
|
|
277
|
+
*
|
|
278
|
+
* Use this when:
|
|
279
|
+
* - Upstream uses self-signed certificates (provide custom ca_bundle)
|
|
280
|
+
* - Upstream requires mutual TLS (provide client certificate and private key)
|
|
281
|
+
* - Need to pin specific CA certificates for security
|
|
282
|
+
*
|
|
283
|
+
* @generated from field: optional mochabugapis.adapt.plugins.v1.TlsDefinition tls = 2;
|
|
284
|
+
*/
|
|
285
|
+
tls?: TlsDefinitionJson;
|
|
286
|
+
/**
|
|
287
|
+
* Dynamic headers to inject into every proxied request using template variables.
|
|
288
|
+
*
|
|
289
|
+
* This field is for headers that require DYNAMIC values resolved from template variables.
|
|
290
|
+
* The caller can always submit static headers directly with each request - this field
|
|
291
|
+
* is specifically for injecting headers that use variable substitution (e.g., %ACCESS_TOKEN%).
|
|
292
|
+
*
|
|
293
|
+
* ## When to Use inject_headers
|
|
294
|
+
*
|
|
295
|
+
* Use this field when you need to inject headers with:
|
|
296
|
+
* - Values that change per request or per user (tokens, session IDs)
|
|
297
|
+
* - Values that come from user configuration (API keys, tenant IDs)
|
|
298
|
+
* - Values that need to be kept secret (credentials, tokens)
|
|
299
|
+
* - Dynamic template substitution using %VARIABLE% syntax
|
|
300
|
+
*
|
|
301
|
+
* ## When NOT to Use inject_headers
|
|
302
|
+
*
|
|
303
|
+
* Do NOT use this field for:
|
|
304
|
+
* - Static headers that never change (use direct headers in the request)
|
|
305
|
+
* - Headers that the caller controls (they can submit these directly)
|
|
306
|
+
* - Constant values like "Content-Type: application/json"
|
|
307
|
+
*
|
|
308
|
+
* The caller can always add, modify, or override headers in their individual requests.
|
|
309
|
+
* This field is for headers that the plugin definition requires to be injected with
|
|
310
|
+
* dynamic values before reaching the upstream service.
|
|
311
|
+
*
|
|
312
|
+
* ## Header Processing
|
|
313
|
+
*
|
|
314
|
+
* The map key is the HTTP header name (e.g., "Authorization", "X-Api-Key").
|
|
315
|
+
* Header names are case-insensitive per RFC 7230 but will be sent as specified.
|
|
316
|
+
*
|
|
317
|
+
* If the same header name appears in both inject_headers and the caller's request:
|
|
318
|
+
* - The inject_headers value takes precedence (overrides caller's value)
|
|
319
|
+
* - This ensures plugin-level authentication/configuration is always applied
|
|
320
|
+
*
|
|
321
|
+
* ## Common Patterns
|
|
322
|
+
*
|
|
323
|
+
* - "Authorization": "Bearer %ACCESS_TOKEN%" - Dynamic OAuth2 token
|
|
324
|
+
* - "X-Api-Key": "%API_KEY%" - User-provided API key
|
|
325
|
+
* - "X-Request-ID": "%CORRELATION_ID%" - Tracing identifier
|
|
326
|
+
* - "X-Tenant-ID": "%TENANT_ID%" - Multi-tenant identifier
|
|
327
|
+
*
|
|
328
|
+
* @generated from field: map<string, mochabugapis.adapt.plugins.v1.HeaderTemplate> inject_headers = 3;
|
|
329
|
+
*/
|
|
330
|
+
injectHeaders?: {
|
|
331
|
+
[key: string]: HeaderTemplateJson;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* Describes the message mochabugapis.adapt.plugins.v1.HttpProxyDefinition.
|
|
336
|
+
* Use `create(HttpProxyDefinitionSchema)` to create a new message.
|
|
337
|
+
*/
|
|
338
|
+
export declare const HttpProxyDefinitionSchema: GenMessage<HttpProxyDefinition, {
|
|
339
|
+
jsonType: HttpProxyDefinitionJson;
|
|
340
|
+
}>;
|
|
341
|
+
/**
|
|
342
|
+
* HeaderTemplate defines a template string using Envoy-style %VAR% syntax
|
|
343
|
+
* for dynamic header value substitution.
|
|
344
|
+
*
|
|
345
|
+
* ## Template Syntax
|
|
346
|
+
*
|
|
347
|
+
* Variables are enclosed in percent signs: %VARIABLE_NAME%
|
|
348
|
+
*
|
|
349
|
+
* Variable names must:
|
|
350
|
+
* - Start with a letter or underscore
|
|
351
|
+
* - Contain only letters, numbers, and underscores
|
|
352
|
+
* - Be case-sensitive
|
|
353
|
+
*
|
|
354
|
+
* ## Examples
|
|
355
|
+
*
|
|
356
|
+
* 1. Bearer Token:
|
|
357
|
+
* template: "Bearer %ACCESS_TOKEN%"
|
|
358
|
+
* Result: "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
359
|
+
*
|
|
360
|
+
* 2. API Key:
|
|
361
|
+
* template: "ApiKey %API_KEY%"
|
|
362
|
+
* Result: "ApiKey sk_live_51HqG8sKj..."
|
|
363
|
+
*
|
|
364
|
+
* 3. Multiple Variables:
|
|
365
|
+
* template: "%TENANT_ID%:%USER_ID%"
|
|
366
|
+
* Result: "org_123:user_456"
|
|
367
|
+
*
|
|
368
|
+
* 4. Mixed Static and Dynamic:
|
|
369
|
+
* template: "v1.0/%API_VERSION%/client/%CLIENT_ID%"
|
|
370
|
+
* Result: "v1.0/2024-01/client/client_abc123"
|
|
371
|
+
*
|
|
372
|
+
* ## Escaping Literal Percent Signs
|
|
373
|
+
*
|
|
374
|
+
* To include a literal percent sign (%) in the header value, double it:
|
|
375
|
+
*
|
|
376
|
+
* - template: "100%%" → Result: "100%"
|
|
377
|
+
* - template: "Completion: 95%% done" → Result: "Completion: 95% done"
|
|
378
|
+
* - template: "%%VAR%%" → Result: "%VAR%"
|
|
379
|
+
*
|
|
380
|
+
* ## Variable Resolution
|
|
381
|
+
*
|
|
382
|
+
* Template variables are provided by users when they configure or use the plugin.
|
|
383
|
+
* For system services, plugin authors provide the variable values.
|
|
384
|
+
*
|
|
385
|
+
* The resolution process is transparent:
|
|
386
|
+
* - Users see which hostname will receive the request (from allowed_hosts)
|
|
387
|
+
* - Users see which header is being modified
|
|
388
|
+
* - Users are prompted to provide values for each variable
|
|
389
|
+
*
|
|
390
|
+
* This ensures users know exactly what data they are sending and where it goes.
|
|
391
|
+
*
|
|
392
|
+
* If a variable is not provided, the header injection will fail at runtime,
|
|
393
|
+
* and the proxy request will not be sent.
|
|
394
|
+
*
|
|
395
|
+
* ## Security Considerations
|
|
396
|
+
*
|
|
397
|
+
* By default, template variables are treated as SECRETS.
|
|
398
|
+
*
|
|
399
|
+
* Set `plaintext: true` if the variable contains non-sensitive data like:
|
|
400
|
+
* - User IDs (not passwords)
|
|
401
|
+
* - Tenant/Organization IDs
|
|
402
|
+
* - Request correlation IDs
|
|
403
|
+
* - API version numbers
|
|
404
|
+
* - Public configuration values
|
|
405
|
+
*
|
|
406
|
+
* DO NOT set `plaintext: true` for:
|
|
407
|
+
* - Access tokens, API keys, passwords
|
|
408
|
+
* - Session tokens, JWTs
|
|
409
|
+
* - Private keys, certificates
|
|
410
|
+
* - Any credential material
|
|
411
|
+
*
|
|
412
|
+
* @generated from message mochabugapis.adapt.plugins.v1.HeaderTemplate
|
|
413
|
+
*/
|
|
414
|
+
export type HeaderTemplate = Message<"mochabugapis.adapt.plugins.v1.HeaderTemplate"> & {
|
|
415
|
+
/**
|
|
416
|
+
* The template string using %VAR% syntax.
|
|
417
|
+
*
|
|
418
|
+
* Pattern: %VARIABLE_NAME% where VARIABLE_NAME matches [A-Za-z_][A-Za-z0-9_]*
|
|
419
|
+
* Escape literal %: use %%
|
|
420
|
+
*
|
|
421
|
+
* @generated from field: string template = 1;
|
|
422
|
+
*/
|
|
423
|
+
template: string;
|
|
424
|
+
/**
|
|
425
|
+
* If true, variables in this template are NOT treated as secrets.
|
|
426
|
+
*
|
|
427
|
+
* Only set to true for non-sensitive identifiers like user IDs,
|
|
428
|
+
* tenant IDs, request IDs, or public configuration values.
|
|
429
|
+
*
|
|
430
|
+
* Default: false (variables are secrets)
|
|
431
|
+
*
|
|
432
|
+
* @generated from field: bool plaintext = 2;
|
|
433
|
+
*/
|
|
434
|
+
plaintext: boolean;
|
|
435
|
+
};
|
|
436
|
+
/**
|
|
437
|
+
* HeaderTemplate defines a template string using Envoy-style %VAR% syntax
|
|
438
|
+
* for dynamic header value substitution.
|
|
439
|
+
*
|
|
440
|
+
* ## Template Syntax
|
|
441
|
+
*
|
|
442
|
+
* Variables are enclosed in percent signs: %VARIABLE_NAME%
|
|
443
|
+
*
|
|
444
|
+
* Variable names must:
|
|
445
|
+
* - Start with a letter or underscore
|
|
446
|
+
* - Contain only letters, numbers, and underscores
|
|
447
|
+
* - Be case-sensitive
|
|
448
|
+
*
|
|
449
|
+
* ## Examples
|
|
450
|
+
*
|
|
451
|
+
* 1. Bearer Token:
|
|
452
|
+
* template: "Bearer %ACCESS_TOKEN%"
|
|
453
|
+
* Result: "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
454
|
+
*
|
|
455
|
+
* 2. API Key:
|
|
456
|
+
* template: "ApiKey %API_KEY%"
|
|
457
|
+
* Result: "ApiKey sk_live_51HqG8sKj..."
|
|
458
|
+
*
|
|
459
|
+
* 3. Multiple Variables:
|
|
460
|
+
* template: "%TENANT_ID%:%USER_ID%"
|
|
461
|
+
* Result: "org_123:user_456"
|
|
462
|
+
*
|
|
463
|
+
* 4. Mixed Static and Dynamic:
|
|
464
|
+
* template: "v1.0/%API_VERSION%/client/%CLIENT_ID%"
|
|
465
|
+
* Result: "v1.0/2024-01/client/client_abc123"
|
|
466
|
+
*
|
|
467
|
+
* ## Escaping Literal Percent Signs
|
|
468
|
+
*
|
|
469
|
+
* To include a literal percent sign (%) in the header value, double it:
|
|
470
|
+
*
|
|
471
|
+
* - template: "100%%" → Result: "100%"
|
|
472
|
+
* - template: "Completion: 95%% done" → Result: "Completion: 95% done"
|
|
473
|
+
* - template: "%%VAR%%" → Result: "%VAR%"
|
|
474
|
+
*
|
|
475
|
+
* ## Variable Resolution
|
|
476
|
+
*
|
|
477
|
+
* Template variables are provided by users when they configure or use the plugin.
|
|
478
|
+
* For system services, plugin authors provide the variable values.
|
|
479
|
+
*
|
|
480
|
+
* The resolution process is transparent:
|
|
481
|
+
* - Users see which hostname will receive the request (from allowed_hosts)
|
|
482
|
+
* - Users see which header is being modified
|
|
483
|
+
* - Users are prompted to provide values for each variable
|
|
484
|
+
*
|
|
485
|
+
* This ensures users know exactly what data they are sending and where it goes.
|
|
486
|
+
*
|
|
487
|
+
* If a variable is not provided, the header injection will fail at runtime,
|
|
488
|
+
* and the proxy request will not be sent.
|
|
489
|
+
*
|
|
490
|
+
* ## Security Considerations
|
|
491
|
+
*
|
|
492
|
+
* By default, template variables are treated as SECRETS.
|
|
493
|
+
*
|
|
494
|
+
* Set `plaintext: true` if the variable contains non-sensitive data like:
|
|
495
|
+
* - User IDs (not passwords)
|
|
496
|
+
* - Tenant/Organization IDs
|
|
497
|
+
* - Request correlation IDs
|
|
498
|
+
* - API version numbers
|
|
499
|
+
* - Public configuration values
|
|
500
|
+
*
|
|
501
|
+
* DO NOT set `plaintext: true` for:
|
|
502
|
+
* - Access tokens, API keys, passwords
|
|
503
|
+
* - Session tokens, JWTs
|
|
504
|
+
* - Private keys, certificates
|
|
505
|
+
* - Any credential material
|
|
506
|
+
*
|
|
507
|
+
* @generated from message mochabugapis.adapt.plugins.v1.HeaderTemplate
|
|
508
|
+
*/
|
|
509
|
+
export type HeaderTemplateJson = {
|
|
510
|
+
/**
|
|
511
|
+
* The template string using %VAR% syntax.
|
|
512
|
+
*
|
|
513
|
+
* Pattern: %VARIABLE_NAME% where VARIABLE_NAME matches [A-Za-z_][A-Za-z0-9_]*
|
|
514
|
+
* Escape literal %: use %%
|
|
515
|
+
*
|
|
516
|
+
* @generated from field: string template = 1;
|
|
517
|
+
*/
|
|
518
|
+
template?: string;
|
|
519
|
+
/**
|
|
520
|
+
* If true, variables in this template are NOT treated as secrets.
|
|
521
|
+
*
|
|
522
|
+
* Only set to true for non-sensitive identifiers like user IDs,
|
|
523
|
+
* tenant IDs, request IDs, or public configuration values.
|
|
524
|
+
*
|
|
525
|
+
* Default: false (variables are secrets)
|
|
526
|
+
*
|
|
527
|
+
* @generated from field: bool plaintext = 2;
|
|
528
|
+
*/
|
|
529
|
+
plaintext?: boolean;
|
|
530
|
+
};
|
|
531
|
+
/**
|
|
532
|
+
* Describes the message mochabugapis.adapt.plugins.v1.HeaderTemplate.
|
|
533
|
+
* Use `create(HeaderTemplateSchema)` to create a new message.
|
|
534
|
+
*/
|
|
535
|
+
export declare const HeaderTemplateSchema: GenMessage<HeaderTemplate, {
|
|
536
|
+
jsonType: HeaderTemplateJson;
|
|
537
|
+
}>;
|
|
538
|
+
/**
|
|
539
|
+
* TLS configuration defining the security requirements for upstream connections.
|
|
540
|
+
*
|
|
541
|
+
* Supports two authentication modes with flexible CA bundle placement.
|
|
542
|
+
*
|
|
543
|
+
* ## Security Model
|
|
544
|
+
*
|
|
545
|
+
* - Public certificates (CA bundles): Can be in definition OR config
|
|
546
|
+
* - Private keys and client certificates: MUST be in config (secrets)
|
|
547
|
+
*
|
|
548
|
+
* ## Mode Descriptions
|
|
549
|
+
*
|
|
550
|
+
* MODE_SERVER_ONLY: Validate server's certificate (standard HTTPS)
|
|
551
|
+
* - Client verifies server identity
|
|
552
|
+
* - Server does not verify client
|
|
553
|
+
* - Common for public APIs
|
|
554
|
+
*
|
|
555
|
+
* MODE_MTLS: Mutual authentication (both parties verify each other)
|
|
556
|
+
* - Client verifies server identity AND presents its own certificate
|
|
557
|
+
* - Server verifies client identity
|
|
558
|
+
* - Common for B2B integrations, internal services
|
|
559
|
+
*
|
|
560
|
+
* @generated from message mochabugapis.adapt.plugins.v1.TlsDefinition
|
|
561
|
+
*/
|
|
562
|
+
export type TlsDefinition = Message<"mochabugapis.adapt.plugins.v1.TlsDefinition"> & {
|
|
563
|
+
/**
|
|
564
|
+
* Select the TLS mode for the connection.
|
|
565
|
+
*
|
|
566
|
+
* @generated from field: mochabugapis.adapt.plugins.v1.TlsDefinition.Mode mode = 1;
|
|
567
|
+
*/
|
|
568
|
+
mode: TlsDefinition_Mode;
|
|
569
|
+
/**
|
|
570
|
+
* The expected hostname for certificate verification (SNI - Server Name Indication).
|
|
571
|
+
*
|
|
572
|
+
* If present, the client will:
|
|
573
|
+
* 1. Send this hostname in the TLS SNI extension during the handshake
|
|
574
|
+
* 2. Verify that the server's certificate authenticates this specific hostname
|
|
575
|
+
*
|
|
576
|
+
* If not provided:
|
|
577
|
+
* - The hostname is derived from the target upstream address
|
|
578
|
+
* - For IP addresses, certificate verification may fail unless the cert includes the IP as a SAN
|
|
579
|
+
*
|
|
580
|
+
* ## Use Cases
|
|
581
|
+
*
|
|
582
|
+
* 1. **IP-based connections with hostname certificates:**
|
|
583
|
+
* - Upstream address: 192.168.1.100:443
|
|
584
|
+
* - certificate_host: "api.example.com"
|
|
585
|
+
* - Server presents cert for api.example.com
|
|
586
|
+
*
|
|
587
|
+
* 2. **Load balancers or proxies:**
|
|
588
|
+
* - Upstream address: lb.internal:443
|
|
589
|
+
* - certificate_host: "api.example.com"
|
|
590
|
+
* - Verify against the public hostname, not internal LB name
|
|
591
|
+
*
|
|
592
|
+
* 3. **Shared hosting / Virtual hosting:**
|
|
593
|
+
* - Multiple services on same IP, different certs via SNI
|
|
594
|
+
* - Server selects correct certificate based on SNI hostname
|
|
595
|
+
*
|
|
596
|
+
* ## Certificate Verification
|
|
597
|
+
*
|
|
598
|
+
* The server certificate must contain this hostname in either:
|
|
599
|
+
* - Common Name (CN) field
|
|
600
|
+
* - Subject Alternative Name (SAN) extension
|
|
601
|
+
*
|
|
602
|
+
* ## Format
|
|
603
|
+
*
|
|
604
|
+
* Must be a valid hostname (DNS name), not an IP address.
|
|
605
|
+
* Examples: "api.example.com", "service.internal", "*.example.com" (for wildcard matching)
|
|
606
|
+
*
|
|
607
|
+
* @generated from field: optional string certificate_host = 2;
|
|
608
|
+
*/
|
|
609
|
+
certificateHost?: string;
|
|
610
|
+
/**
|
|
611
|
+
* Optional CA bundle for server certificate validation.
|
|
612
|
+
*
|
|
613
|
+
* ## Why CA Bundle in Definition?
|
|
614
|
+
*
|
|
615
|
+
* CA bundles contain PUBLIC certificates (not secrets), so they can be safely
|
|
616
|
+
* embedded in the plugin definition. This reduces configuration burden on users
|
|
617
|
+
* when the CA bundle is known ahead of time.
|
|
618
|
+
*
|
|
619
|
+
* ## When to Use This Field
|
|
620
|
+
*
|
|
621
|
+
* Set the CA bundle in the definition when:
|
|
622
|
+
* - The upstream service uses a self-signed certificate
|
|
623
|
+
* - The upstream uses a private/internal Certificate Authority
|
|
624
|
+
* - You want to pin specific CA certificates for security
|
|
625
|
+
* - The CA bundle is static and known at plugin authoring time
|
|
626
|
+
*
|
|
627
|
+
* ## When to Use TlsConfig.ca_bundle Instead
|
|
628
|
+
*
|
|
629
|
+
* Leave this empty and use TlsConfig.ca_bundle when:
|
|
630
|
+
* - Different users need different CA bundles
|
|
631
|
+
* - The CA bundle is dynamic or environment-specific
|
|
632
|
+
* - Users want to override the plugin's default CA bundle
|
|
633
|
+
*
|
|
634
|
+
* ## Configuration Rules
|
|
635
|
+
*
|
|
636
|
+
* For MODE_SERVER_ONLY:
|
|
637
|
+
* - At least one CA bundle must be provided (either here OR in TlsConfig)
|
|
638
|
+
* - If set here: users don't need to provide TlsConfig.ca_bundle
|
|
639
|
+
* - If NOT set here: users MUST provide TlsConfig.ca_bundle
|
|
640
|
+
*
|
|
641
|
+
* For MODE_MTLS:
|
|
642
|
+
* - Same CA bundle rules as MODE_SERVER_ONLY
|
|
643
|
+
* - Users must ALSO provide client certificate and private_key in TlsConfig
|
|
644
|
+
*
|
|
645
|
+
* ## Precedence
|
|
646
|
+
*
|
|
647
|
+
* If CA bundle is provided in both the definition AND TlsConfig:
|
|
648
|
+
* - TlsConfig.ca_bundle takes precedence (config overrides definition)
|
|
649
|
+
* - This allows users to override the plugin's default CA bundle if needed
|
|
650
|
+
*
|
|
651
|
+
* ## Format
|
|
652
|
+
*
|
|
653
|
+
* The CA bundle must be in PEM format (same as TlsConfig.ca_bundle).
|
|
654
|
+
* If a certificate chain is presented, the root CA must be included.
|
|
655
|
+
*
|
|
656
|
+
* IF this points to a file on the disk, then it will be loaded from there.
|
|
657
|
+
*
|
|
658
|
+
* @generated from field: optional mochabugapis.adapt.plugins.v1.File ca_bundle = 3;
|
|
659
|
+
*/
|
|
660
|
+
caBundle?: File;
|
|
661
|
+
};
|
|
662
|
+
/**
|
|
663
|
+
* TLS configuration defining the security requirements for upstream connections.
|
|
664
|
+
*
|
|
665
|
+
* Supports two authentication modes with flexible CA bundle placement.
|
|
666
|
+
*
|
|
667
|
+
* ## Security Model
|
|
668
|
+
*
|
|
669
|
+
* - Public certificates (CA bundles): Can be in definition OR config
|
|
670
|
+
* - Private keys and client certificates: MUST be in config (secrets)
|
|
671
|
+
*
|
|
672
|
+
* ## Mode Descriptions
|
|
673
|
+
*
|
|
674
|
+
* MODE_SERVER_ONLY: Validate server's certificate (standard HTTPS)
|
|
675
|
+
* - Client verifies server identity
|
|
676
|
+
* - Server does not verify client
|
|
677
|
+
* - Common for public APIs
|
|
678
|
+
*
|
|
679
|
+
* MODE_MTLS: Mutual authentication (both parties verify each other)
|
|
680
|
+
* - Client verifies server identity AND presents its own certificate
|
|
681
|
+
* - Server verifies client identity
|
|
682
|
+
* - Common for B2B integrations, internal services
|
|
683
|
+
*
|
|
684
|
+
* @generated from message mochabugapis.adapt.plugins.v1.TlsDefinition
|
|
685
|
+
*/
|
|
686
|
+
export type TlsDefinitionJson = {
|
|
687
|
+
/**
|
|
688
|
+
* Select the TLS mode for the connection.
|
|
689
|
+
*
|
|
690
|
+
* @generated from field: mochabugapis.adapt.plugins.v1.TlsDefinition.Mode mode = 1;
|
|
691
|
+
*/
|
|
692
|
+
mode?: TlsDefinition_ModeJson;
|
|
693
|
+
/**
|
|
694
|
+
* The expected hostname for certificate verification (SNI - Server Name Indication).
|
|
695
|
+
*
|
|
696
|
+
* If present, the client will:
|
|
697
|
+
* 1. Send this hostname in the TLS SNI extension during the handshake
|
|
698
|
+
* 2. Verify that the server's certificate authenticates this specific hostname
|
|
699
|
+
*
|
|
700
|
+
* If not provided:
|
|
701
|
+
* - The hostname is derived from the target upstream address
|
|
702
|
+
* - For IP addresses, certificate verification may fail unless the cert includes the IP as a SAN
|
|
703
|
+
*
|
|
704
|
+
* ## Use Cases
|
|
705
|
+
*
|
|
706
|
+
* 1. **IP-based connections with hostname certificates:**
|
|
707
|
+
* - Upstream address: 192.168.1.100:443
|
|
708
|
+
* - certificate_host: "api.example.com"
|
|
709
|
+
* - Server presents cert for api.example.com
|
|
710
|
+
*
|
|
711
|
+
* 2. **Load balancers or proxies:**
|
|
712
|
+
* - Upstream address: lb.internal:443
|
|
713
|
+
* - certificate_host: "api.example.com"
|
|
714
|
+
* - Verify against the public hostname, not internal LB name
|
|
715
|
+
*
|
|
716
|
+
* 3. **Shared hosting / Virtual hosting:**
|
|
717
|
+
* - Multiple services on same IP, different certs via SNI
|
|
718
|
+
* - Server selects correct certificate based on SNI hostname
|
|
719
|
+
*
|
|
720
|
+
* ## Certificate Verification
|
|
721
|
+
*
|
|
722
|
+
* The server certificate must contain this hostname in either:
|
|
723
|
+
* - Common Name (CN) field
|
|
724
|
+
* - Subject Alternative Name (SAN) extension
|
|
725
|
+
*
|
|
726
|
+
* ## Format
|
|
727
|
+
*
|
|
728
|
+
* Must be a valid hostname (DNS name), not an IP address.
|
|
729
|
+
* Examples: "api.example.com", "service.internal", "*.example.com" (for wildcard matching)
|
|
730
|
+
*
|
|
731
|
+
* @generated from field: optional string certificate_host = 2;
|
|
732
|
+
*/
|
|
733
|
+
certificateHost?: string;
|
|
734
|
+
/**
|
|
735
|
+
* Optional CA bundle for server certificate validation.
|
|
736
|
+
*
|
|
737
|
+
* ## Why CA Bundle in Definition?
|
|
738
|
+
*
|
|
739
|
+
* CA bundles contain PUBLIC certificates (not secrets), so they can be safely
|
|
740
|
+
* embedded in the plugin definition. This reduces configuration burden on users
|
|
741
|
+
* when the CA bundle is known ahead of time.
|
|
742
|
+
*
|
|
743
|
+
* ## When to Use This Field
|
|
744
|
+
*
|
|
745
|
+
* Set the CA bundle in the definition when:
|
|
746
|
+
* - The upstream service uses a self-signed certificate
|
|
747
|
+
* - The upstream uses a private/internal Certificate Authority
|
|
748
|
+
* - You want to pin specific CA certificates for security
|
|
749
|
+
* - The CA bundle is static and known at plugin authoring time
|
|
750
|
+
*
|
|
751
|
+
* ## When to Use TlsConfig.ca_bundle Instead
|
|
752
|
+
*
|
|
753
|
+
* Leave this empty and use TlsConfig.ca_bundle when:
|
|
754
|
+
* - Different users need different CA bundles
|
|
755
|
+
* - The CA bundle is dynamic or environment-specific
|
|
756
|
+
* - Users want to override the plugin's default CA bundle
|
|
757
|
+
*
|
|
758
|
+
* ## Configuration Rules
|
|
759
|
+
*
|
|
760
|
+
* For MODE_SERVER_ONLY:
|
|
761
|
+
* - At least one CA bundle must be provided (either here OR in TlsConfig)
|
|
762
|
+
* - If set here: users don't need to provide TlsConfig.ca_bundle
|
|
763
|
+
* - If NOT set here: users MUST provide TlsConfig.ca_bundle
|
|
764
|
+
*
|
|
765
|
+
* For MODE_MTLS:
|
|
766
|
+
* - Same CA bundle rules as MODE_SERVER_ONLY
|
|
767
|
+
* - Users must ALSO provide client certificate and private_key in TlsConfig
|
|
768
|
+
*
|
|
769
|
+
* ## Precedence
|
|
770
|
+
*
|
|
771
|
+
* If CA bundle is provided in both the definition AND TlsConfig:
|
|
772
|
+
* - TlsConfig.ca_bundle takes precedence (config overrides definition)
|
|
773
|
+
* - This allows users to override the plugin's default CA bundle if needed
|
|
774
|
+
*
|
|
775
|
+
* ## Format
|
|
776
|
+
*
|
|
777
|
+
* The CA bundle must be in PEM format (same as TlsConfig.ca_bundle).
|
|
778
|
+
* If a certificate chain is presented, the root CA must be included.
|
|
779
|
+
*
|
|
780
|
+
* IF this points to a file on the disk, then it will be loaded from there.
|
|
781
|
+
*
|
|
782
|
+
* @generated from field: optional mochabugapis.adapt.plugins.v1.File ca_bundle = 3;
|
|
783
|
+
*/
|
|
784
|
+
caBundle?: FileJson;
|
|
785
|
+
};
|
|
786
|
+
/**
|
|
787
|
+
* Describes the message mochabugapis.adapt.plugins.v1.TlsDefinition.
|
|
788
|
+
* Use `create(TlsDefinitionSchema)` to create a new message.
|
|
789
|
+
*/
|
|
790
|
+
export declare const TlsDefinitionSchema: GenMessage<TlsDefinition, {
|
|
791
|
+
jsonType: TlsDefinitionJson;
|
|
792
|
+
}>;
|
|
793
|
+
/**
|
|
794
|
+
* Mode specifies which TLS configuration to use.
|
|
795
|
+
*
|
|
796
|
+
* @generated from enum mochabugapis.adapt.plugins.v1.TlsDefinition.Mode
|
|
797
|
+
*/
|
|
798
|
+
export declare enum TlsDefinition_Mode {
|
|
799
|
+
/**
|
|
800
|
+
* Default value. Invalid.
|
|
801
|
+
*
|
|
802
|
+
* @generated from enum value: MODE_UNSPECIFIED = 0;
|
|
803
|
+
*/
|
|
804
|
+
UNSPECIFIED = 0,
|
|
805
|
+
/**
|
|
806
|
+
* Mutual TLS: Both client and server authenticate each other.
|
|
807
|
+
*
|
|
808
|
+
* Configuration requirements:
|
|
809
|
+
* - CA bundle: Set in TlsDefinition.ca_bundle OR TlsConfig.ca_bundle (at least one required)
|
|
810
|
+
* - Client certificate: REQUIRED in TlsConfig.certificate
|
|
811
|
+
* - Client private key: REQUIRED in TlsConfig.private_key
|
|
812
|
+
*
|
|
813
|
+
* Use when:
|
|
814
|
+
* - Upstream service requires client certificate authentication
|
|
815
|
+
* - Both parties need strong cryptographic authentication
|
|
816
|
+
* - Common in B2B APIs, internal microservices, banking/financial APIs
|
|
817
|
+
*
|
|
818
|
+
* @generated from enum value: MODE_MTLS = 1;
|
|
819
|
+
*/
|
|
820
|
+
MTLS = 1,
|
|
821
|
+
/**
|
|
822
|
+
* Server-only validation: Client verifies server identity.
|
|
823
|
+
*
|
|
824
|
+
* Configuration requirements:
|
|
825
|
+
* - CA bundle: Set in TlsDefinition.ca_bundle OR TlsConfig.ca_bundle (at least one required)
|
|
826
|
+
* - Client certificate: NOT used
|
|
827
|
+
* - Client private key: NOT used
|
|
828
|
+
*
|
|
829
|
+
* Use when:
|
|
830
|
+
* - Standard HTTPS with server authentication only
|
|
831
|
+
* - Upstream uses self-signed or internal CA certificates
|
|
832
|
+
* - Want to pin specific CA certificates for security
|
|
833
|
+
* - Most common mode for external APIs
|
|
834
|
+
*
|
|
835
|
+
* @generated from enum value: MODE_SERVER_ONLY = 2;
|
|
836
|
+
*/
|
|
837
|
+
SERVER_ONLY = 2
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* Mode specifies which TLS configuration to use.
|
|
841
|
+
*
|
|
842
|
+
* @generated from enum mochabugapis.adapt.plugins.v1.TlsDefinition.Mode
|
|
843
|
+
*/
|
|
844
|
+
export type TlsDefinition_ModeJson = "MODE_UNSPECIFIED" | "MODE_MTLS" | "MODE_SERVER_ONLY";
|
|
845
|
+
/**
|
|
846
|
+
* Describes the enum mochabugapis.adapt.plugins.v1.TlsDefinition.Mode.
|
|
847
|
+
*/
|
|
848
|
+
export declare const TlsDefinition_ModeSchema: GenEnum<TlsDefinition_Mode, TlsDefinition_ModeJson>;
|
|
849
|
+
/**
|
|
850
|
+
* The actual TLS configuration containing runtime secrets.
|
|
851
|
+
*
|
|
852
|
+
* This provides the secret/dynamic parts of the TLS configuration that cannot
|
|
853
|
+
* be embedded in the plugin definition (private keys, user-specific certificates).
|
|
854
|
+
*
|
|
855
|
+
* ## Relationship to TlsDefinition
|
|
856
|
+
*
|
|
857
|
+
* - TlsDefinition: Defines the TLS mode and optionally includes the CA bundle (public cert)
|
|
858
|
+
* - TlsConfig: Provides runtime secrets (private keys, client certificates)
|
|
859
|
+
*
|
|
860
|
+
* ## Configuration Requirements
|
|
861
|
+
*
|
|
862
|
+
* For MODE_SERVER_ONLY:
|
|
863
|
+
* - ca_bundle: Required if NOT provided in TlsDefinition.ca_bundle
|
|
864
|
+
* - certificate: NOT used
|
|
865
|
+
* - private_key: NOT used
|
|
866
|
+
*
|
|
867
|
+
* For MODE_MTLS:
|
|
868
|
+
* - ca_bundle: Required if NOT provided in TlsDefinition.ca_bundle
|
|
869
|
+
* - certificate: REQUIRED (client certificate for mutual TLS)
|
|
870
|
+
* - private_key: REQUIRED (client private key for mutual TLS)
|
|
871
|
+
*
|
|
872
|
+
* @generated from message mochabugapis.adapt.plugins.v1.TlsConfig
|
|
873
|
+
*/
|
|
874
|
+
export type TlsConfig = Message<"mochabugapis.adapt.plugins.v1.TlsConfig"> & {
|
|
875
|
+
/**
|
|
876
|
+
* Optional CA bundle for server certificate validation.
|
|
877
|
+
*
|
|
878
|
+
* The CA bundle in PEM format containing one or more trusted Certificate Authorities.
|
|
879
|
+
* The content of the file must be PEM format after decoding.
|
|
880
|
+
* If a certificate chain is presented, the root CA must be included.
|
|
881
|
+
*
|
|
882
|
+
* ## When to Provide This
|
|
883
|
+
*
|
|
884
|
+
* REQUIRED if TlsDefinition.ca_bundle is NOT set.
|
|
885
|
+
* OPTIONAL if TlsDefinition.ca_bundle is set (this will override the definition's CA bundle).
|
|
886
|
+
*
|
|
887
|
+
* ## Override Behavior
|
|
888
|
+
*
|
|
889
|
+
* If both TlsDefinition.ca_bundle and TlsConfig.ca_bundle are provided:
|
|
890
|
+
* - This config value takes precedence
|
|
891
|
+
* - Allows users to override the plugin author's default CA bundle
|
|
892
|
+
*
|
|
893
|
+
* ## Use Cases for Override
|
|
894
|
+
*
|
|
895
|
+
* - User's organization has different root CAs
|
|
896
|
+
* - Testing with different certificate chains
|
|
897
|
+
* - Environment-specific CA requirements
|
|
898
|
+
*
|
|
899
|
+
* @generated from field: optional mochabugapis.adapt.plugins.v1.File ca_bundle = 1;
|
|
900
|
+
*/
|
|
901
|
+
caBundle?: File;
|
|
902
|
+
/**
|
|
903
|
+
* Optional client certificate for mutual TLS authentication.
|
|
904
|
+
*
|
|
905
|
+
* The certificate in PEM format used to authenticate the client to the server.
|
|
906
|
+
* The content of the file must be PEM format after decoding.
|
|
907
|
+
* If a certificate chain is presented, the client certificate must be the first one.
|
|
908
|
+
*
|
|
909
|
+
* REQUIRED if TlsDefinition.mode is MODE_MTLS.
|
|
910
|
+
* MUST NOT be provided if TlsDefinition.mode is MODE_SERVER_ONLY.
|
|
911
|
+
*
|
|
912
|
+
* @generated from field: optional mochabugapis.adapt.plugins.v1.File certificate = 2;
|
|
913
|
+
*/
|
|
914
|
+
certificate?: File;
|
|
915
|
+
/**
|
|
916
|
+
* Optional client private key for mutual TLS authentication.
|
|
917
|
+
*
|
|
918
|
+
* The private key in PEM format corresponding to the client certificate.
|
|
919
|
+
* The content of the file must be PEM format after decoding.
|
|
920
|
+
* The content must contain a PRIVATE KEY block.
|
|
921
|
+
*
|
|
922
|
+
* REQUIRED if TlsDefinition.mode is MODE_MTLS.
|
|
923
|
+
* MUST NOT be provided if TlsDefinition.mode is MODE_SERVER_ONLY.
|
|
924
|
+
*
|
|
925
|
+
* @generated from field: optional mochabugapis.adapt.plugins.v1.File private_key = 3;
|
|
926
|
+
*/
|
|
927
|
+
privateKey?: File;
|
|
928
|
+
};
|
|
929
|
+
/**
|
|
930
|
+
* The actual TLS configuration containing runtime secrets.
|
|
931
|
+
*
|
|
932
|
+
* This provides the secret/dynamic parts of the TLS configuration that cannot
|
|
933
|
+
* be embedded in the plugin definition (private keys, user-specific certificates).
|
|
934
|
+
*
|
|
935
|
+
* ## Relationship to TlsDefinition
|
|
936
|
+
*
|
|
937
|
+
* - TlsDefinition: Defines the TLS mode and optionally includes the CA bundle (public cert)
|
|
938
|
+
* - TlsConfig: Provides runtime secrets (private keys, client certificates)
|
|
939
|
+
*
|
|
940
|
+
* ## Configuration Requirements
|
|
941
|
+
*
|
|
942
|
+
* For MODE_SERVER_ONLY:
|
|
943
|
+
* - ca_bundle: Required if NOT provided in TlsDefinition.ca_bundle
|
|
944
|
+
* - certificate: NOT used
|
|
945
|
+
* - private_key: NOT used
|
|
946
|
+
*
|
|
947
|
+
* For MODE_MTLS:
|
|
948
|
+
* - ca_bundle: Required if NOT provided in TlsDefinition.ca_bundle
|
|
949
|
+
* - certificate: REQUIRED (client certificate for mutual TLS)
|
|
950
|
+
* - private_key: REQUIRED (client private key for mutual TLS)
|
|
951
|
+
*
|
|
952
|
+
* @generated from message mochabugapis.adapt.plugins.v1.TlsConfig
|
|
953
|
+
*/
|
|
954
|
+
export type TlsConfigJson = {
|
|
955
|
+
/**
|
|
956
|
+
* Optional CA bundle for server certificate validation.
|
|
957
|
+
*
|
|
958
|
+
* The CA bundle in PEM format containing one or more trusted Certificate Authorities.
|
|
959
|
+
* The content of the file must be PEM format after decoding.
|
|
960
|
+
* If a certificate chain is presented, the root CA must be included.
|
|
961
|
+
*
|
|
962
|
+
* ## When to Provide This
|
|
963
|
+
*
|
|
964
|
+
* REQUIRED if TlsDefinition.ca_bundle is NOT set.
|
|
965
|
+
* OPTIONAL if TlsDefinition.ca_bundle is set (this will override the definition's CA bundle).
|
|
966
|
+
*
|
|
967
|
+
* ## Override Behavior
|
|
968
|
+
*
|
|
969
|
+
* If both TlsDefinition.ca_bundle and TlsConfig.ca_bundle are provided:
|
|
970
|
+
* - This config value takes precedence
|
|
971
|
+
* - Allows users to override the plugin author's default CA bundle
|
|
972
|
+
*
|
|
973
|
+
* ## Use Cases for Override
|
|
974
|
+
*
|
|
975
|
+
* - User's organization has different root CAs
|
|
976
|
+
* - Testing with different certificate chains
|
|
977
|
+
* - Environment-specific CA requirements
|
|
978
|
+
*
|
|
979
|
+
* @generated from field: optional mochabugapis.adapt.plugins.v1.File ca_bundle = 1;
|
|
980
|
+
*/
|
|
981
|
+
caBundle?: FileJson;
|
|
982
|
+
/**
|
|
983
|
+
* Optional client certificate for mutual TLS authentication.
|
|
984
|
+
*
|
|
985
|
+
* The certificate in PEM format used to authenticate the client to the server.
|
|
986
|
+
* The content of the file must be PEM format after decoding.
|
|
987
|
+
* If a certificate chain is presented, the client certificate must be the first one.
|
|
988
|
+
*
|
|
989
|
+
* REQUIRED if TlsDefinition.mode is MODE_MTLS.
|
|
990
|
+
* MUST NOT be provided if TlsDefinition.mode is MODE_SERVER_ONLY.
|
|
991
|
+
*
|
|
992
|
+
* @generated from field: optional mochabugapis.adapt.plugins.v1.File certificate = 2;
|
|
993
|
+
*/
|
|
994
|
+
certificate?: FileJson;
|
|
995
|
+
/**
|
|
996
|
+
* Optional client private key for mutual TLS authentication.
|
|
997
|
+
*
|
|
998
|
+
* The private key in PEM format corresponding to the client certificate.
|
|
999
|
+
* The content of the file must be PEM format after decoding.
|
|
1000
|
+
* The content must contain a PRIVATE KEY block.
|
|
1001
|
+
*
|
|
1002
|
+
* REQUIRED if TlsDefinition.mode is MODE_MTLS.
|
|
1003
|
+
* MUST NOT be provided if TlsDefinition.mode is MODE_SERVER_ONLY.
|
|
1004
|
+
*
|
|
1005
|
+
* @generated from field: optional mochabugapis.adapt.plugins.v1.File private_key = 3;
|
|
1006
|
+
*/
|
|
1007
|
+
privateKey?: FileJson;
|
|
1008
|
+
};
|
|
1009
|
+
/**
|
|
1010
|
+
* Describes the message mochabugapis.adapt.plugins.v1.TlsConfig.
|
|
1011
|
+
* Use `create(TlsConfigSchema)` to create a new message.
|
|
1012
|
+
*/
|
|
1013
|
+
export declare const TlsConfigSchema: GenMessage<TlsConfig, {
|
|
1014
|
+
jsonType: TlsConfigJson;
|
|
1015
|
+
}>;
|
|
1016
|
+
/**
|
|
1017
|
+
* The actual HTTP proxy configuration containing runtime values
|
|
1018
|
+
*
|
|
1019
|
+
* This message provides the actual configuration values for the HTTP proxy service,
|
|
1020
|
+
* including TLS certificates and template variable values for header injection.
|
|
1021
|
+
*
|
|
1022
|
+
* ## Relationship to HttpProxyDefinition
|
|
1023
|
+
*
|
|
1024
|
+
* - HttpProxyDefinition: Defines the schema (which headers to inject, template syntax, TLS mode)
|
|
1025
|
+
* - HttpProxyConfig: Provides the actual values (certificates, variable values)
|
|
1026
|
+
*
|
|
1027
|
+
* ## Example
|
|
1028
|
+
*
|
|
1029
|
+
* Given a definition with:
|
|
1030
|
+
* - inject_headers["Authorization"].template.template = "Bearer %ACCESS_TOKEN%"
|
|
1031
|
+
* - tls.mode = MODE_SERVER_ONLY
|
|
1032
|
+
*
|
|
1033
|
+
* The config would provide:
|
|
1034
|
+
* - tls_config.ca_bundle = <actual CA certificate>
|
|
1035
|
+
* - template_variables["ACCESS_TOKEN"] = "eyJhbGci..." (the actual token)
|
|
1036
|
+
*
|
|
1037
|
+
* @generated from message mochabugapis.adapt.plugins.v1.HttpProxyConfig
|
|
1038
|
+
*/
|
|
1039
|
+
export type HttpProxyConfig = Message<"mochabugapis.adapt.plugins.v1.HttpProxyConfig"> & {
|
|
1040
|
+
/**
|
|
1041
|
+
* The actual TLS configuration with certificates and private keys.
|
|
1042
|
+
*
|
|
1043
|
+
* REQUIRED if HttpProxyDefinition.tls is set.
|
|
1044
|
+
* MUST NOT be set if HttpProxyDefinition.tls is not set.
|
|
1045
|
+
*
|
|
1046
|
+
* For MODE_SERVER_ONLY:
|
|
1047
|
+
* - Provide only ca_bundle
|
|
1048
|
+
* - Leave certificate and private_key empty
|
|
1049
|
+
*
|
|
1050
|
+
* For MODE_MTLS:
|
|
1051
|
+
* - Provide ca_bundle, certificate, AND private_key
|
|
1052
|
+
*
|
|
1053
|
+
* @generated from field: optional mochabugapis.adapt.plugins.v1.TlsConfig tls_config = 1;
|
|
1054
|
+
*/
|
|
1055
|
+
tlsConfig?: TlsConfig;
|
|
1056
|
+
/**
|
|
1057
|
+
* Template variable values for dynamic header injection, organized by header name.
|
|
1058
|
+
*
|
|
1059
|
+
* This provides the actual values for template variables used in HttpProxyDefinition.inject_headers.
|
|
1060
|
+
* Each header that uses template variables needs its variables resolved here.
|
|
1061
|
+
*
|
|
1062
|
+
* ## Structure
|
|
1063
|
+
*
|
|
1064
|
+
* Outer map key: HTTP header name (must match a key in HttpProxyDefinition.inject_headers)
|
|
1065
|
+
* Outer map value: Map of variable names to their actual values for that specific header
|
|
1066
|
+
*
|
|
1067
|
+
* This structure mirrors HttpProxyDefinition.inject_headers, making it clear
|
|
1068
|
+
* which variables belong to which header template.
|
|
1069
|
+
*
|
|
1070
|
+
* ## Variable Name Requirements
|
|
1071
|
+
*
|
|
1072
|
+
* Variable names must match the %VARIABLE% patterns used in the header's template:
|
|
1073
|
+
* - Start with a letter or underscore
|
|
1074
|
+
* - Contain only letters, numbers, and underscores
|
|
1075
|
+
* - Case-sensitive (e.g., %ACCESS_TOKEN% requires variable name "ACCESS_TOKEN")
|
|
1076
|
+
*
|
|
1077
|
+
* ## Examples
|
|
1078
|
+
*
|
|
1079
|
+
* Given a definition with:
|
|
1080
|
+
* - inject_headers["Authorization"].template = "Bearer %ACCESS_TOKEN%"
|
|
1081
|
+
* - inject_headers["X-Correlation"].template = "%TENANT_ID%:%USER_ID%"
|
|
1082
|
+
*
|
|
1083
|
+
* The config must provide:
|
|
1084
|
+
* - header_variables["Authorization"]["ACCESS_TOKEN"] = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
1085
|
+
* - header_variables["X-Correlation"]["TENANT_ID"] = "org_123"
|
|
1086
|
+
* - header_variables["X-Correlation"]["USER_ID"] = "user_456"
|
|
1087
|
+
*
|
|
1088
|
+
* ## Security
|
|
1089
|
+
*
|
|
1090
|
+
* All values are stored securely and encrypted at rest.
|
|
1091
|
+
* The HeaderTemplate.plaintext flag (in the definition) controls whether
|
|
1092
|
+
* the variable value is treated as a secret or shown in logs/UI.
|
|
1093
|
+
*
|
|
1094
|
+
* ## Variable Resolution Process
|
|
1095
|
+
*
|
|
1096
|
+
* Users of the plugin are prompted to provide values for all template variables.
|
|
1097
|
+
* For system services, the plugin author provides the values programmatically.
|
|
1098
|
+
*
|
|
1099
|
+
* During configuration, it is fully transparent to users:
|
|
1100
|
+
* - Which hostname the request will be sent to (from allowed_hosts)
|
|
1101
|
+
* - Which headers are being injected
|
|
1102
|
+
* - What template variables are required
|
|
1103
|
+
* - Whether each variable is a secret or plaintext
|
|
1104
|
+
*
|
|
1105
|
+
* Users see exactly what data they are providing and where it will be sent.
|
|
1106
|
+
*
|
|
1107
|
+
* ## Runtime Behavior
|
|
1108
|
+
*
|
|
1109
|
+
* If a variable referenced in a header template is missing from this config,
|
|
1110
|
+
* the header injection will fail at runtime and the request will not be sent.
|
|
1111
|
+
*
|
|
1112
|
+
* ## Validation
|
|
1113
|
+
*
|
|
1114
|
+
* - Header names in this map MUST match headers in HttpProxyDefinition.inject_headers
|
|
1115
|
+
* - All variables referenced in each header's template must be provided
|
|
1116
|
+
* - Extra variables (not referenced in the template) are ignored
|
|
1117
|
+
*
|
|
1118
|
+
* @generated from field: map<string, mochabugapis.adapt.plugins.v1.HeaderVariables> header_variables = 2;
|
|
1119
|
+
*/
|
|
1120
|
+
headerVariables: {
|
|
1121
|
+
[key: string]: HeaderVariables;
|
|
1122
|
+
};
|
|
1123
|
+
};
|
|
1124
|
+
/**
|
|
1125
|
+
* The actual HTTP proxy configuration containing runtime values
|
|
1126
|
+
*
|
|
1127
|
+
* This message provides the actual configuration values for the HTTP proxy service,
|
|
1128
|
+
* including TLS certificates and template variable values for header injection.
|
|
1129
|
+
*
|
|
1130
|
+
* ## Relationship to HttpProxyDefinition
|
|
1131
|
+
*
|
|
1132
|
+
* - HttpProxyDefinition: Defines the schema (which headers to inject, template syntax, TLS mode)
|
|
1133
|
+
* - HttpProxyConfig: Provides the actual values (certificates, variable values)
|
|
1134
|
+
*
|
|
1135
|
+
* ## Example
|
|
1136
|
+
*
|
|
1137
|
+
* Given a definition with:
|
|
1138
|
+
* - inject_headers["Authorization"].template.template = "Bearer %ACCESS_TOKEN%"
|
|
1139
|
+
* - tls.mode = MODE_SERVER_ONLY
|
|
1140
|
+
*
|
|
1141
|
+
* The config would provide:
|
|
1142
|
+
* - tls_config.ca_bundle = <actual CA certificate>
|
|
1143
|
+
* - template_variables["ACCESS_TOKEN"] = "eyJhbGci..." (the actual token)
|
|
1144
|
+
*
|
|
1145
|
+
* @generated from message mochabugapis.adapt.plugins.v1.HttpProxyConfig
|
|
1146
|
+
*/
|
|
1147
|
+
export type HttpProxyConfigJson = {
|
|
1148
|
+
/**
|
|
1149
|
+
* The actual TLS configuration with certificates and private keys.
|
|
1150
|
+
*
|
|
1151
|
+
* REQUIRED if HttpProxyDefinition.tls is set.
|
|
1152
|
+
* MUST NOT be set if HttpProxyDefinition.tls is not set.
|
|
1153
|
+
*
|
|
1154
|
+
* For MODE_SERVER_ONLY:
|
|
1155
|
+
* - Provide only ca_bundle
|
|
1156
|
+
* - Leave certificate and private_key empty
|
|
1157
|
+
*
|
|
1158
|
+
* For MODE_MTLS:
|
|
1159
|
+
* - Provide ca_bundle, certificate, AND private_key
|
|
1160
|
+
*
|
|
1161
|
+
* @generated from field: optional mochabugapis.adapt.plugins.v1.TlsConfig tls_config = 1;
|
|
1162
|
+
*/
|
|
1163
|
+
tlsConfig?: TlsConfigJson;
|
|
1164
|
+
/**
|
|
1165
|
+
* Template variable values for dynamic header injection, organized by header name.
|
|
1166
|
+
*
|
|
1167
|
+
* This provides the actual values for template variables used in HttpProxyDefinition.inject_headers.
|
|
1168
|
+
* Each header that uses template variables needs its variables resolved here.
|
|
1169
|
+
*
|
|
1170
|
+
* ## Structure
|
|
1171
|
+
*
|
|
1172
|
+
* Outer map key: HTTP header name (must match a key in HttpProxyDefinition.inject_headers)
|
|
1173
|
+
* Outer map value: Map of variable names to their actual values for that specific header
|
|
1174
|
+
*
|
|
1175
|
+
* This structure mirrors HttpProxyDefinition.inject_headers, making it clear
|
|
1176
|
+
* which variables belong to which header template.
|
|
1177
|
+
*
|
|
1178
|
+
* ## Variable Name Requirements
|
|
1179
|
+
*
|
|
1180
|
+
* Variable names must match the %VARIABLE% patterns used in the header's template:
|
|
1181
|
+
* - Start with a letter or underscore
|
|
1182
|
+
* - Contain only letters, numbers, and underscores
|
|
1183
|
+
* - Case-sensitive (e.g., %ACCESS_TOKEN% requires variable name "ACCESS_TOKEN")
|
|
1184
|
+
*
|
|
1185
|
+
* ## Examples
|
|
1186
|
+
*
|
|
1187
|
+
* Given a definition with:
|
|
1188
|
+
* - inject_headers["Authorization"].template = "Bearer %ACCESS_TOKEN%"
|
|
1189
|
+
* - inject_headers["X-Correlation"].template = "%TENANT_ID%:%USER_ID%"
|
|
1190
|
+
*
|
|
1191
|
+
* The config must provide:
|
|
1192
|
+
* - header_variables["Authorization"]["ACCESS_TOKEN"] = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
1193
|
+
* - header_variables["X-Correlation"]["TENANT_ID"] = "org_123"
|
|
1194
|
+
* - header_variables["X-Correlation"]["USER_ID"] = "user_456"
|
|
1195
|
+
*
|
|
1196
|
+
* ## Security
|
|
1197
|
+
*
|
|
1198
|
+
* All values are stored securely and encrypted at rest.
|
|
1199
|
+
* The HeaderTemplate.plaintext flag (in the definition) controls whether
|
|
1200
|
+
* the variable value is treated as a secret or shown in logs/UI.
|
|
1201
|
+
*
|
|
1202
|
+
* ## Variable Resolution Process
|
|
1203
|
+
*
|
|
1204
|
+
* Users of the plugin are prompted to provide values for all template variables.
|
|
1205
|
+
* For system services, the plugin author provides the values programmatically.
|
|
1206
|
+
*
|
|
1207
|
+
* During configuration, it is fully transparent to users:
|
|
1208
|
+
* - Which hostname the request will be sent to (from allowed_hosts)
|
|
1209
|
+
* - Which headers are being injected
|
|
1210
|
+
* - What template variables are required
|
|
1211
|
+
* - Whether each variable is a secret or plaintext
|
|
1212
|
+
*
|
|
1213
|
+
* Users see exactly what data they are providing and where it will be sent.
|
|
1214
|
+
*
|
|
1215
|
+
* ## Runtime Behavior
|
|
1216
|
+
*
|
|
1217
|
+
* If a variable referenced in a header template is missing from this config,
|
|
1218
|
+
* the header injection will fail at runtime and the request will not be sent.
|
|
1219
|
+
*
|
|
1220
|
+
* ## Validation
|
|
1221
|
+
*
|
|
1222
|
+
* - Header names in this map MUST match headers in HttpProxyDefinition.inject_headers
|
|
1223
|
+
* - All variables referenced in each header's template must be provided
|
|
1224
|
+
* - Extra variables (not referenced in the template) are ignored
|
|
1225
|
+
*
|
|
1226
|
+
* @generated from field: map<string, mochabugapis.adapt.plugins.v1.HeaderVariables> header_variables = 2;
|
|
1227
|
+
*/
|
|
1228
|
+
headerVariables?: {
|
|
1229
|
+
[key: string]: HeaderVariablesJson;
|
|
1230
|
+
};
|
|
1231
|
+
};
|
|
1232
|
+
/**
|
|
1233
|
+
* Describes the message mochabugapis.adapt.plugins.v1.HttpProxyConfig.
|
|
1234
|
+
* Use `create(HttpProxyConfigSchema)` to create a new message.
|
|
1235
|
+
*/
|
|
1236
|
+
export declare const HttpProxyConfigSchema: GenMessage<HttpProxyConfig, {
|
|
1237
|
+
jsonType: HttpProxyConfigJson;
|
|
1238
|
+
}>;
|
|
1239
|
+
/**
|
|
1240
|
+
* Variable values for a specific header's template substitution.
|
|
1241
|
+
*
|
|
1242
|
+
* @generated from message mochabugapis.adapt.plugins.v1.HeaderVariables
|
|
1243
|
+
*/
|
|
1244
|
+
export type HeaderVariables = Message<"mochabugapis.adapt.plugins.v1.HeaderVariables"> & {
|
|
1245
|
+
/**
|
|
1246
|
+
* Map of variable name to value.
|
|
1247
|
+
*
|
|
1248
|
+
* Key: Variable name matching %VAR_NAME% in the header's template
|
|
1249
|
+
* Value: The actual value to substitute
|
|
1250
|
+
*
|
|
1251
|
+
* @generated from field: map<string, string> variables = 1;
|
|
1252
|
+
*/
|
|
1253
|
+
variables: {
|
|
1254
|
+
[key: string]: string;
|
|
1255
|
+
};
|
|
1256
|
+
};
|
|
1257
|
+
/**
|
|
1258
|
+
* Variable values for a specific header's template substitution.
|
|
1259
|
+
*
|
|
1260
|
+
* @generated from message mochabugapis.adapt.plugins.v1.HeaderVariables
|
|
1261
|
+
*/
|
|
1262
|
+
export type HeaderVariablesJson = {
|
|
1263
|
+
/**
|
|
1264
|
+
* Map of variable name to value.
|
|
1265
|
+
*
|
|
1266
|
+
* Key: Variable name matching %VAR_NAME% in the header's template
|
|
1267
|
+
* Value: The actual value to substitute
|
|
1268
|
+
*
|
|
1269
|
+
* @generated from field: map<string, string> variables = 1;
|
|
1270
|
+
*/
|
|
1271
|
+
variables?: {
|
|
1272
|
+
[key: string]: string;
|
|
1273
|
+
};
|
|
1274
|
+
};
|
|
1275
|
+
/**
|
|
1276
|
+
* Describes the message mochabugapis.adapt.plugins.v1.HeaderVariables.
|
|
1277
|
+
* Use `create(HeaderVariablesSchema)` to create a new message.
|
|
1278
|
+
*/
|
|
1279
|
+
export declare const HeaderVariablesSchema: GenMessage<HeaderVariables, {
|
|
1280
|
+
jsonType: HeaderVariablesJson;
|
|
1281
|
+
}>;
|
|
1282
|
+
//# sourceMappingURL=http_proxy_service_pb.d.ts.map
|