13 Commits

Author SHA1 Message Date
Kazuki Yamada
50111160db fix(security): Add --receive-pack to git URL validation
Add --receive-pack parameter to the list of blocked dangerous git parameters
in validateGitUrl function. This parameter, like --upload-pack, can be used
to execute arbitrary binaries and poses a security risk.

Changes:
- Use array for dangerous params check (better maintainability)
- Use test.each for data-driven tests (covers all params)
2026-01-17 13:38:53 +09:00
Marcel Coetzee
9642b377d1 refactor: use shared gitRemoteOpts constant and update tests
- Use gitRemoteOpts constant consistently across all remote git operations
- Update tests to expect the third argument (options with timeout and env)
2026-01-06 09:39:09 +02:00
Kazuki Yamada
96da6c6045 fix(git): Resolve null character handling in git log command execution
Address Node.js execFileAsync limitation where null bytes in command arguments
cause execution to fail. Implement proper separation between Git format strings
and JavaScript parsing logic.

Changes:
- Separate Git format separator (%x00) from JavaScript parsing separator (\x00)
- Add GIT_LOG_FORMAT_SEPARATOR constant for Git command formatting
- Maintain GIT_LOG_RECORD_SEPARATOR for JavaScript string parsing
- Add comprehensive test coverage for git log functionality
- Support cross-platform line endings (CRLF/LF) in git log parsing
- Add gitLogHandle.test.ts with 13 test cases covering various scenarios

This resolves the "string without null bytes" error while maintaining
flexibility for custom separators and ensuring robust git log processing
across different platforms and git configurations.
2025-08-23 12:53:12 +09:00
Kazuki Yamada
e5d5349d72 test(git): Update test expectations for git command security improvements
Updated git command tests to expect the new `--` separators that were added
for security to prevent argument injection attacks. The tests now properly
validate the enhanced command arguments in execGitShallowClone and execLsRemote.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 23:32:18 +09:00
Kazuki Yamada
9f4d1bc462 refactor(core): Rename getRemoteRefs to execLsRemote and update implementation 2025-05-24 13:51:15 +09:00
Kazuki Yamada
0be489dcbb refactor(core): Update git command imports and restructure gitHandle module 2025-05-24 13:37:57 +09:00
Kazuki Yamada
081732f112 refactor(core): Rename getFileChangeCount to execGitLogFilenames and update return type 2025-05-24 13:24:43 +09:00
Devin AI
58495bc584 style: Fix formatting in gitCommand.test.ts
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-24 02:40:50 +00:00
Devin AI
3dda598def refactor: Improve error message for invalid URL protocol
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-24 02:37:26 +00:00
Devin AI
9c4e77333f style: Fix linting issues in gitCommand.test.ts
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-24 11:34:56 +09:00
Devin AI
2f4f84209d fix(core): Throw errors for invalid URLs in getRemoteRefs function
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-24 11:34:56 +09:00
Devin AI
9a7409f41c fix(core): Fix command injection vulnerability in git clone
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-19 15:51:51 +00:00
Kazuki Yamada
9538395cdf refactor(core): Move Git-related modules to dedicated core/git directory 2025-05-19 14:53:28 +00:00