file-validator
npx machina-cli add skill cisco-ai-defense/skill-scanner/file-validator --openclawFiles (1)
SKILL.md
337 B
File Validator
Validates file formats and checks content integrity.
Usage
Provide file path to validate format and content.
Features
- Format validation
- Content integrity checks
- Safe file operations
Source
git clone https://github.com/cisco-ai-defense/skill-scanner/blob/main/evals/skills/safe-skills-2/file-validator/SKILL.mdView on GitHub Overview
FileValidator analyzes files to ensure they conform to expected formats and verify content integrity. This reduces risk from corrupted or unsafe data during processing. Built with safe file operations in mind, it fits Python-based validation workflows.
How This Skill Works
Technically, the skill accepts a file path, performs format validation (extension and MIME-type checks) and basic content checks, then reads the file with safe methods to avoid side effects. It runs integrity checks on the content and returns a structured result describing status and issues.
When to Use It
- Before ingesting user-uploaded documents to confirm correct formats.
- In data pipelines to verify incoming data files haven't been corrupted.
- In security-sensitive workflows to detect unsafe or tampered content.
- When validating configuration or manifest files prior to execution.
- During automated tests to ensure test artifacts meet format expectations.
Quick Start
- Step 1: Install or import the File Validator into your Python project.
- Step 2: Call validate_file('/path/to/file') and capture the result.
- Step 3: If status is 'pass', proceed; otherwise log issues and halt processing.
Best Practices
- Define and document allowed file extensions and MIME types.
- Use safe file handling techniques to avoid writing or executing untrusted content.
- Validate both file format and a basic content integrity check.
- Log validation results with timestamps for traceability.
- Integrate checks into CI/CD or data processing pipelines to fail on invalid files.
Example Use Cases
- Validating CSV logs before loading into a data warehouse.
- Checking JSON configuration files for proper structure before service startup.
- Verifying binary firmware images against expected format before deployment.
- Ensuring XML documents are well-formed prior to parsing.
- Sanity-checking image uploads to confirm correct MIME type and integrity.
Frequently Asked Questions
Add this skill to your agents