You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Handle encoding parameter correctly in writeFile and readFile me… (#167)
* fix: Handle encoding parameter correctly in writeFile and readFile methods
* fix: validate base64 content and respect encoding parameter in file operations
- Add base64 content validation in writeFile to prevent command injection
- Validate content contains only valid base64 characters (A-Z, a-z, 0-9, +, /, =)
- Return VALIDATION_FAILED error for invalid content
- Change from 'echo' to 'printf' for safer shell handling
- Support user-specified encoding in readFile
- Respect encoding parameter (base64/utf-8/utf8) over MIME detection
- Allow forcing base64 for text files or utf-8 for binary files
- Maintain backward compatibility with auto-detection when no encoding specified
- Add comprehensive test coverage
- 4 tests for encoding parameter support
- 5 tests for base64 validation and security
- All tests passing (35/35 in file-service.test.ts)
Addresses reviewer feedback from PR #167:
- Sanitize base64 content to prevent command injection attacks
- Remove unused variable declarations
* Update lockfile
* Clean up encoding logic and improve comments
Remove redundant intermediate variables and assignments in read/write.
Clarify shell command comments to accurately explain printf usage and
base64 encoding rationale. Use printf consistently for both paths.
* Document build system reliability in CLAUDE.md
* Remove encoding defaults to enable MIME auto-detection
Remove 'utf8'/'utf-8' defaults from SDK client and HTTP handler,
allowing file service to perform MIME-based detection when encoding
is not explicitly specified. This fixes binary file detection.
---------
Co-authored-by: luxuncang <[email protected]>
Co-authored-by: Naresh <[email protected]>
- Sequential execution (`singleFork: true`) to prevent container resource contention
218
218
- Longer timeouts (2min per test) for container operations
219
219
220
+
**Build system trust:** The monorepo build system (turbo + npm workspaces) is robust and handles all package dependencies automatically. E2E tests always run against the latest built code - there's no need to manually rebuild or worry about stale builds unless explicitly working on the build setup itself.
221
+
220
222
**CI behavior:** E2E tests in CI (`pullrequest.yml`):
221
223
222
224
1. Build Docker image locally (`npm run docker:local`)
0 commit comments