-
Notifications
You must be signed in to change notification settings - Fork 755
feat: add Allowed Request Types plugin to control request processing #1335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added new plugin to control request processing based on allowed/blocked types with comprehensive test coverage.
Skipped files
plugins/default/manifest.json
: Skipped file pattern
...(allowedTypes.length > 0 | ||
? { allowedTypes } | ||
: mode === 'unrestricted' | ||
? { allowedTypes: ['all'] } | ||
: {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Code Refactor
Issue: Redundant check for allowedTypes.length > 0
in ternary condition.
Fix: Simplify the condition by removing redundant check.
Impact: Improves code readability and reduces complexity.
...(allowedTypes.length > 0 | |
? { allowedTypes } | |
: mode === 'unrestricted' | |
? { allowedTypes: ['all'] } | |
: {}), | |
? { allowedTypes } | |
: { allowedTypes: ['all'] }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added new plugin to control request processing based on allowed/blocked types with comprehensive test coverage.
...(allowedTypes.length > 0 | ||
? { allowedTypes } | ||
: mode === 'unrestricted' | ||
? { allowedTypes: ['all'] } | ||
: {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Code Refactor
Issue: Redundant check for allowedTypes.length > 0
in ternary condition.
Fix: Simplify the condition by removing redundant check.
Impact: Improves code readability and reduces complexity.
...(allowedTypes.length > 0 | |
? { allowedTypes } | |
: mode === 'unrestricted' | |
? { allowedTypes: ['all'] } | |
: {}), | |
? { allowedTypes } | |
: { allowedTypes: ['all'] }, |
This pull request introduces a new guardrail plugin,
allowedRequestTypes
, which provides fine-grained control over which request types (endpoints) can be processed. The plugin supports both allowlist and blocklist approaches, can be configured via parameters or metadata, and is integrated into the plugin system for use in request validation.New Guardrail Plugin: Allowed Request Types
allowedRequestTypes
plugin implementation inplugins/default/allowedRequestTypes.ts
, supporting allowlist, blocklist, and combined modes, with conflict detection and detailed explanations. The plugin can read configuration from parameters or metadata and returns a verdict on whether a request type is permitted.Manifest and Plugin System Integration
allowedRequestTypes
guardrail inplugins/default/manifest.json
with a comprehensive parameter schema and descriptions for configuration via UI or metadata.allowedRequestTypes
handler in the plugin index (plugins/index.ts
), making it available as part of the default plugin set. [1] [2]