feat: Implement Git repository multi-file upload API - #39
feat: Implement Git repository multi-file upload API#39sureshchouksey8 wants to merge 6 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds an authenticated PUT /file/Git/:noProtocolURL endpoint and GitFileService to download a repository, copy sanitized uploaded files into the workspace, and push changes via git-utility using OAuth-backed HTTP auth; persists OAuth usernames and includes tests and small Docker/package updates. ChangesGit Repository Multi-File Upload
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
Dockerfile (1)
3-8: ⚡ Quick winClean up apt cache to reduce image size.
After installing packages with
apt-get, the apt cache remains in/var/lib/apt/lists/and bloats the image. Chain the cleanup commands in the sameRUNlayer to keep the intermediate layer small.🐳 Proposed fix to add apt cache cleanup
FROM node:22-slim AS base -RUN apt-get update && \ - apt-get install curl git -y --no-install-recommends +RUN apt-get update && \ + apt-get install curl git -y --no-install-recommends && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* ENV PNPM_HOME="/pnpm"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Dockerfile` around lines 3 - 8, The apt cache isn't cleaned after installing packages in the Dockerfile RUN that performs "apt-get update && apt-get install curl git -y --no-install-recommends"; modify that single RUN layer to include apt-get clean and remove /var/lib/apt/lists/* (e.g., chain "apt-get clean && rm -rf /var/lib/apt/lists/*") so the intermediate image stays small; keep existing ENV PNPM_HOME and PATH lines and the following "RUN npm i pnpm@latest -g" unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@source/service/GitFile.ts`:
- Around line 150-157: The copyIncomingFile flow can be exploited via symlink
ancestors: before creating dirs or copying, resolve realpath for
repositoryFolder and then for each existing ancestor of targetPath (and the
nearest existing parent for non-existing ancestors) call fs.realpath (and use
fs.lstat to detect symlinks) and reject if any resolved ancestor does not
startWith the repositoryFolder realpath; only after these checks call mkdir and
copyFile to the final segment. Also harden external git calls used by
runCommand/git-utility by adding a bounded timeout option to execFile
invocations (pass a sensible timeout and propagate errors on timeout) so
downloads/uploads cannot hang indefinitely. Ensure references: copyIncomingFile,
resolveRepositoryPath, runCommand (git-utility).
- Around line 64-68: In GitFileService.runCommand, execFileAsync currently only
sets maxBuffer and can hang indefinitely; update the call to include sensible
default timeout and killSignal values (e.g., timeout in ms and killSignal like
'SIGKILL') merged with the incoming options so callers can override them, and
ensure the timeout/killSignal are passed into execFileAsync alongside maxBuffer
and env; modify the options merging around the execFileAsync invocation in
runCommand to include these defaults.
---
Nitpick comments:
In `@Dockerfile`:
- Around line 3-8: The apt cache isn't cleaned after installing packages in the
Dockerfile RUN that performs "apt-get update && apt-get install curl git -y
--no-install-recommends"; modify that single RUN layer to include apt-get clean
and remove /var/lib/apt/lists/* (e.g., chain "apt-get clean && rm -rf
/var/lib/apt/lists/*") so the intermediate image stays small; keep existing ENV
PNPM_HOME and PATH lines and the following "RUN npm i pnpm@latest -g" unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 811c7f57-a062-4a1e-85c8-2bee9edbcdb9
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (11)
Dockerfilepackage.jsonsource/controller/File.tssource/controller/OAuth.tssource/model/File.tssource/model/OAuth.tssource/service/GitFile.tssource/service/index.tstest/FileController.test.tstest/GitFile.test.tstest/OAuth.test.ts
|
Addressed the CodeRabbit review on this PR in commit Changes made:
Validation:
|
Closes #33
Summary by CodeRabbit
New Features
Bug Fixes / Safety
Tests