This repository was archived by the owner on Mar 15, 2026. It is now read-only.
Add asset validation to prevent invalid/malicious content - #9
Merged
Conversation
## What Changed
- Created validation module with content and security checks
- Integrated validation into preview_creative and build_creative endpoints
- Added 47 comprehensive tests with 80% coverage of validation code
## Security Improvements
Validates all asset types before processing:
- HTML: Checks for valid tags and structure
- CSS: Validates rule syntax
- JavaScript: Basic content validation
- Text: Non-empty requirement
- URLs: Blocks javascript:, vbscript:, file: schemes
- Images: Format validation, dimension checks, data URI MIME type verification
- Data URIs: 10MB size limit, restricted to image/* MIME types
## Error Handling
Returns clear validation errors:
```json
{
"error": "Asset validation failed",
"validation_errors": [
"Asset 'headline': Text content cannot be empty",
"Asset 'background': URL scheme not allowed: javascript"
]
}
```
Fixes security gaps where Wellington previously accepted:
- Empty or malformed content
- Malicious URL schemes
- Invalid data URIs
- Broken image formats
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Adds comprehensive asset validation to Wellington to prevent invalid, broken, or malicious assets from being processed in
preview_creativeandbuild_creative.What Changed
src/creative_agent/validation.pywith content and security checksSecurity Improvements
Validates all asset types:
javascript:,vbscript:,file:schemesimage/*MIME types onlyClear error responses:
{ "error": "Asset validation failed", "validation_errors": [ "Asset 'headline': Text content cannot be empty", "Asset 'background': URL scheme not allowed: javascript" ] }Before vs After
Before: Wellington accepted dangerous/broken assets
asset_type: "html"withcontent: "not html"url: "javascript:alert('xss')"After: Strict validation with helpful errors
Testing
🤖 Generated with Claude Code