injectIntegrityReactionFields adds endorsement-reactions, disapproval-reactions, disapproval-integrity, and endorser-min-integrity into an existing allow-only policy map when the integrity-reactions feature flag is enabled and the MCPG version supports it. This function is used exclusively for prox
(policy map[string]any, toolConfig map[string]any, data *WorkflowData, gatewayConfig *MCPGatewayRuntimeConfig)
| 392 | // |
| 393 | // No-op when the feature flag is disabled or the MCPG version is too old. |
| 394 | func injectIntegrityReactionFields(policy map[string]any, toolConfig map[string]any, data *WorkflowData, gatewayConfig *MCPGatewayRuntimeConfig) { |
| 395 | if !isFeatureEnabled(constants.IntegrityReactionsFeatureFlag, data) { |
| 396 | return |
| 397 | } |
| 398 | if !mcpgSupportsIntegrityReactions(gatewayConfig) { |
| 399 | return |
| 400 | } |
| 401 | if endorsement, ok := toolConfig["endorsement-reactions"]; ok { |
| 402 | policy["endorsement-reactions"] = endorsement |
| 403 | } else { |
| 404 | policy["endorsement-reactions"] = DefaultEndorsementReactions |
| 405 | } |
| 406 | if disapproval, ok := toolConfig["disapproval-reactions"]; ok { |
| 407 | policy["disapproval-reactions"] = disapproval |
| 408 | } else { |
| 409 | policy["disapproval-reactions"] = DefaultDisapprovalReactions |
| 410 | } |
| 411 | if disapprovalIntegrity, ok := toolConfig["disapproval-integrity"]; ok { |
| 412 | policy["disapproval-integrity"] = disapprovalIntegrity |
| 413 | } |
| 414 | if endorserMinIntegrity, ok := toolConfig["endorser-min-integrity"]; ok { |
| 415 | policy["endorser-min-integrity"] = endorserMinIntegrity |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | // mcpgSupportsIntegrityReactions returns true when the effective MCPG version supports |
| 420 | // endorsement-reactions and disapproval-reactions in the allow-only policy (>= v0.2.18). |
no test coverage detected