Repository navigation
feat(security): add payload size limits to workflow executor [OMN-670] #171
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
Merged
jonahgabriel
merged 13 commits into
main
from
jonah/omn-670-security-add-payload-size-limits-to-workflow-executor
Dec 13, 2025
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9390ac7
feat(security): add payload size limits to workflow executor [OMN-670]
jonahgabriel 90b3304
fix(arch): fix remaining single-class-per-file and backward-compat vi…
jonahgabriel 2dc7ad2
fix(security): address PR #171 review feedback for workflow executor …
jonahgabriel 5a29aa5
fix(security): address all PR #171 review feedback [OMN-670]
jonahgabriel cd2dedc
fix(tests): fix pre-existing test failures unrelated to PR #171
jonahgabriel 0a572cb
style: fix ruff formatting and import sorting violations
jonahgabriel f083347
Merge branch 'main' into jonah/omn-670-security-add-payload-size-limi…
jonahgabriel e8a8470
fix: add VALID_VALUE_TYPES to model_node_config_value re-exports
jonahgabriel ef42272
fix(tests): fix 12 test failures from main branch merge
jonahgabriel 518e71e
fix(workflow): eliminate redundant JSON serialization and improve cod…
jonahgabriel 47f1715
feat(security): enhance type safety, error handling, and observability
jonahgabriel 24f4c79
fix(tests): update tests to handle tuple return from _create_action_f…
jonahgabriel ba9a9a4
Merge remote-tracking branch 'origin/main' into jonah/omn-670-securit…
jonahgabriel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/omnibase_core/models/configuration/model_config_types.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| """Common types for configuration models.""" | ||
|
|
||
| from typing import Literal, TypeGuard | ||
|
|
||
| # Type alias for valid configuration value types | ||
| ConfigValue = int | float | bool | str | ||
|
|
||
| # Literal type constraining value_type/config_type to valid values | ||
| VALID_VALUE_TYPES = Literal["int", "float", "bool", "str"] | ||
|
|
||
| # Tuple of valid type names for runtime checking | ||
| _VALID_TYPE_NAMES: tuple[str, ...] = ("int", "float", "bool", "str") | ||
|
|
||
|
|
||
| def is_valid_value_type(type_name: str) -> TypeGuard[VALID_VALUE_TYPES]: | ||
| """Type guard to check if a string is a valid value type. | ||
|
|
||
| This function narrows the type of type_name from str to VALID_VALUE_TYPES | ||
| when it returns True, enabling mypy to understand the type refinement. | ||
|
|
||
| Args: | ||
| type_name: The type name string to validate. | ||
|
|
||
| Returns: | ||
| True if type_name is one of 'int', 'float', 'bool', 'str'. | ||
| """ | ||
| return type_name in _VALID_TYPE_NAMES | ||
|
|
||
|
|
||
| def validate_config_value_type( | ||
| value_type: VALID_VALUE_TYPES, default: ConfigValue | ||
| ) -> None: | ||
| """Validate that default value matches declared type. | ||
|
|
||
| Args: | ||
| value_type: The declared type ('int', 'float', 'bool', 'str') | ||
| default: The default value to validate | ||
|
|
||
| Raises: | ||
| ValueError: If default value doesn't match declared type | ||
| """ | ||
| type_map: dict[str, type | tuple[type, ...]] = { | ||
| "int": int, | ||
| "float": (int, float), # int is valid for float | ||
| "bool": bool, | ||
| "str": str, | ||
| } | ||
| expected = type_map[value_type] | ||
| # Strict bool check - don't allow int/float to match bool | ||
| if value_type == "bool" and not isinstance(default, bool): | ||
| raise ValueError( # error-ok: Pydantic validator requires ValueError | ||
| f"default must be bool, got {type(default).__name__}" | ||
| ) | ||
| if not isinstance(default, expected): | ||
| raise ValueError( # error-ok: Pydantic validator requires ValueError | ||
| f"default must be {value_type}, got {type(default).__name__}" | ||
| ) |
9 changes: 9 additions & 0 deletions
9
src/omnibase_core/models/configuration/model_git_hub_comment_change.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| """ModelGitHubCommentChange model.""" | ||
|
|
||
| from pydantic import BaseModel, Field | ||
|
|
||
|
|
||
| class ModelGitHubCommentChange(BaseModel): | ||
| """Represents a change to a GitHub comment field.""" | ||
|
|
||
| from_: str | None = Field(default=None, alias="from", description="Previous value") |
13 changes: 13 additions & 0 deletions
13
src/omnibase_core/models/configuration/model_git_hub_issue_comment_changes.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| """ModelGitHubIssueCommentChanges model.""" | ||
|
|
||
| from pydantic import BaseModel, Field | ||
|
|
||
| from .model_git_hub_comment_change import ModelGitHubCommentChange | ||
|
|
||
|
|
||
| class ModelGitHubIssueCommentChanges(BaseModel): | ||
| """Changes made to a GitHub issue comment (for edited action).""" | ||
|
|
||
| body: ModelGitHubCommentChange | None = Field( | ||
| default=None, description="Body content change" | ||
| ) |
28 changes: 9 additions & 19 deletions
28
src/omnibase_core/models/configuration/model_git_hub_issue_comment_event.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/omnibase_core/models/configuration/model_node_config_schema.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| """Model for node configuration schema.""" | ||
|
|
||
| from pydantic import BaseModel, Field, model_validator | ||
|
|
||
| from omnibase_core.models.configuration.model_config_types import ( | ||
| VALID_VALUE_TYPES, | ||
| ConfigValue, | ||
| validate_config_value_type, | ||
| ) | ||
|
|
||
|
|
||
| class ModelNodeConfigSchema(BaseModel): | ||
| """ | ||
| Strongly-typed model for node configuration schema. | ||
|
|
||
| Represents a complete configuration schema entry including | ||
| key, type, and default value information. | ||
|
|
||
| Attributes: | ||
| key: Configuration key | ||
| config_type: Type name of the value ('int', 'float', 'bool', 'str') | ||
| default: Default value | ||
| """ | ||
|
|
||
| key: str = Field(..., description="Configuration key") | ||
| config_type: VALID_VALUE_TYPES = Field( | ||
| ..., alias="type", description="Type name of the value" | ||
| ) | ||
| default: ConfigValue = Field(..., description="Default value") | ||
|
|
||
| model_config = {"frozen": True, "populate_by_name": True} | ||
|
|
||
| @model_validator(mode="after") | ||
| def validate_default_type(self) -> "ModelNodeConfigSchema": | ||
| """Ensure default value type matches declared config_type.""" | ||
| validate_config_value_type(self.config_type, self.default) | ||
| return self |
43 changes: 18 additions & 25 deletions
43
src/omnibase_core/models/configuration/model_node_config_value.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,23 @@ | ||
| """Model for node configuration schema.""" | ||
| """Model for node configuration values - re-exports from split files.""" | ||
|
|
||
| from pydantic import BaseModel, Field | ||
|
|
||
| from omnibase_core.models.configuration.model_node_config_entry import ( | ||
| from omnibase_core.models.configuration.model_config_types import ( | ||
| VALID_VALUE_TYPES, | ||
| ConfigValue, | ||
| is_valid_value_type, | ||
| validate_config_value_type, | ||
| ) | ||
| from omnibase_core.models.configuration.model_node_config_entry import ( | ||
| ModelNodeConfigEntry, | ||
| ) | ||
| from omnibase_core.models.configuration.model_node_config_schema import ( | ||
| ModelNodeConfigSchema, | ||
| ) | ||
|
|
||
| __all__ = ["ConfigValue", "ModelNodeConfigEntry", "ModelNodeConfigSchema"] | ||
|
|
||
|
|
||
| class ModelNodeConfigSchema(BaseModel): | ||
| """ | ||
| Strongly-typed model for node configuration schema. | ||
|
|
||
| Represents a complete configuration schema entry including | ||
| key, type, and default value information. | ||
|
|
||
| Attributes: | ||
| key: Configuration key | ||
| type: Type name of the value | ||
| default: Default value | ||
| """ | ||
|
|
||
| key: str = Field(..., description="Configuration key") | ||
| type: str = Field(..., description="Type name of the value") | ||
| default: ConfigValue = Field(..., description="Default value") | ||
|
|
||
| model_config = {"frozen": True} | ||
| __all__ = [ | ||
| "ConfigValue", | ||
| "ModelNodeConfigEntry", | ||
| "ModelNodeConfigSchema", | ||
| "VALID_VALUE_TYPES", | ||
| "is_valid_value_type", | ||
| "validate_config_value_type", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/omnibase_core/models/configuration/model_priority_metadata_summary.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| """ONEX-compatible Priority Metadata Summary Model. | ||
|
|
||
| Summary model for priority metadata with ONEX compliance. | ||
| """ | ||
|
|
||
| from pydantic import BaseModel, Field | ||
|
|
||
|
|
||
| class ModelPriorityMetadataSummary(BaseModel): | ||
| """Summary of priority metadata.""" | ||
|
|
||
| owner: str | None = Field(default=None, description="Owner of the priority") | ||
| approval_required: bool = Field( | ||
| default=False, description="Whether approval is required" | ||
| ) | ||
| approved_users_count: int = Field(default=0, description="Number of approved users") | ||
| approved_groups_count: int = Field( | ||
| default=0, description="Number of approved groups" | ||
| ) | ||
| tags_count: int = Field(default=0, description="Number of tags") | ||
| has_sla: bool = Field(default=False, description="Whether SLA is defined") | ||
| has_cost: bool = Field(default=False, description="Whether cost is defined") | ||
| has_usage_limit: bool = Field( | ||
| default=False, description="Whether usage limit is defined" | ||
| ) | ||
| age_days: float = Field(default=0.0, description="Age in days since creation") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: OmniNode-ai/omnibase_core
Length of output: 1935
Remove unnecessary re-exports from
__all__.The
__all__list in this file re-exportsModelGitHubCommentChangeandModelGitHubIssueCommentChanges, but these classes are never imported from this module. All code imports these classes directly from their source modules (model_git_hub_comment_changeandmodel_git_hub_issue_comment_changes), and the package__init__.pyalready handles their public API exposure. Keep onlyModelGitHubIssueCommentEventin__all__.🤖 Prompt for AI Agents