nimwire/security
This page is generated from the module’s exported API and ## documentation comments.
Small, opt-in security controls shared by transports and handlers.
McpSecurityLimits
Section titled “McpSecurityLimits”Zero means unlimited for that limit.
McpSecurityLimits = object maxLineBytes*: int maxToolCount*: int maxContentBytes*: int maxConcurrentCalls*: intProcedures
Section titled “Procedures”validateSecurityLimits
Section titled “validateSecurityLimits”proc validateSecurityLimits(limits: McpSecurityLimits) {.raises: [McpError], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
limits |
McpSecurityLimits |
newMcpSecurityLimits
Section titled “newMcpSecurityLimits”proc newMcpSecurityLimits(maxLineBytes = 0; maxToolCount = 0; maxContentBytes = 0; maxConcurrentCalls = 0): McpSecurityLimits {. raises: [Exception], tags: [RootEffect], forbids: [].}Returns: McpSecurityLimits.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
maxLineBytes |
inferred |
0 |
maxToolCount |
inferred |
0 |
maxContentBytes |
inferred |
0 |
maxConcurrentCalls |
inferred |
0 |
validateJsonSize
Section titled “validateJsonSize”proc validateJsonSize(value: JsonNode; maxBytes: int; label = "JSON value") {. raises: [McpError], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
value |
JsonNode |
|
maxBytes |
int |
|
label |
inferred |
"JSON value" |
redactJson
Section titled “redactJson”proc redactJson(value: JsonNode; sensitiveKeys: seq[string] = @[]): JsonNode {. raises: [], tags: [], forbids: [].}Returns: JsonNode.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
value |
JsonNode |
|
sensitiveKeys |
seq[string] |
@[] |
redactHeaderValue
Section titled “redactHeaderValue”proc redactHeaderValue(name, value: string): string {.raises: [], tags: [], forbids: [].}Returns: string.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
name |
string |
|
value |
string |
redactBearerToken
Section titled “redactBearerToken”proc redactBearerToken(value: string): string {.raises: [], tags: [], forbids: [].}Returns: string.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
value |
string |
isSafeMcpUrl
Section titled “isSafeMcpUrl”proc isSafeMcpUrl(value: string; allowHttp = false): bool {.raises: [], tags: [], forbids: [].}Returns: bool.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
value |
string |
|
allowHttp |
inferred |
false |
requireSafeMcpUrl
Section titled “requireSafeMcpUrl”proc requireSafeMcpUrl(value: string; allowHttp = false): string {. raises: [McpError], tags: [], forbids: [].}Returns: string.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
value |
string |
|
allowHttp |
inferred |
false |