mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-02-12 15:05:10 -05:00
### CHANGES - Introduce `cmd` directory for all main application binaries. - Move all Go packages into the `internal` directory. - Rename the `restapi` package to `server` for clarity. - Consolidate patterns and strategies into a new `data` directory. - Group all auxiliary scripts into a new `scripts` directory. - Move all documentation and images into a `docs` directory. - Update all Go import paths to reflect the new structure. - Adjust CI/CD workflows and build commands for new layout.
51 lines
1.0 KiB
Markdown
51 lines
1.0 KiB
Markdown
# File Plugin Tests
|
|
|
|
Simple test file for validating file plugin functionality.
|
|
|
|
## Basic File Operations
|
|
|
|
```
|
|
Read File:
|
|
{{plugin:file:read:/path/to/file.txt}}
|
|
|
|
Last 5 Lines:
|
|
{{plugin:file:tail:/path/to/log.txt|5}}
|
|
|
|
Check Existence:
|
|
{{plugin:file:exists:/path/to/file.txt}}
|
|
|
|
Get Size:
|
|
{{plugin:file:size:/path/to/file.txt}}
|
|
|
|
Last Modified:
|
|
{{plugin:file:modified:/path/to/file.txt}}
|
|
```
|
|
|
|
## Error Cases
|
|
These should produce appropriate error messages:
|
|
|
|
```
|
|
Invalid Operation:
|
|
{{plugin:file:invalid:/path/to/file.txt}}
|
|
|
|
Non-existent File:
|
|
{{plugin:file:read:/path/to/nonexistent.txt}}
|
|
|
|
Path Traversal Attempt:
|
|
{{plugin:file:read:../../../etc/passwd}}
|
|
|
|
Invalid Tail Format:
|
|
{{plugin:file:tail:/path/to/file.txt}}
|
|
|
|
Large File:
|
|
{{plugin:file:read:/path/to/huge.iso}}
|
|
```
|
|
|
|
## Security Considerations
|
|
|
|
- Carefully control which paths are accessible
|
|
- Consider using path allow lists in production
|
|
- Be aware of file size limits (1MB max)
|
|
- No directory traversal is allowed
|
|
- Home directory (~/) expansion is supported
|
|
- All paths are cleaned and normalized |