Harden GoogleDriveProvider downloads and folder listing
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 56/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start with packages/server/src/modules/app-providers/google-drive/google-drive.provider.ts and compare its download limits and MIME checks with fetch-remote-document.helper.ts. Then inspect the existing URL recognition test in documents/helpers/fetch-remote-document.test.ts for the project’s test setup. Done means mocked-fetch tests cover download validation, complete folder pagination and filtering, readable HTTP errors, and the missing API key.
Written by the indexing model from the issue text.
Description
Problem
GoogleDriveProvider (packages/server/src/modules/app-providers/google-drive/google-drive.provider.ts) trusts Drive's responses in ways that can store a non-document as a financial record, or silently skip files. It backs batchUploadDocumentsFromUrls (Drive file links, including the MCP tool accounter_upload_documents with documentUrls) and batchUploadDocumentsFromGoogleDrive (shared folders, used from the client's upload modal).
fetchFile: download is not validated
The download is an anonymous GET https://drive.google.com/uc?export=download&id=<id>. Before turning the body into a File stamped with the MIME type from the metadata call, it checks none of these:
response.ok- the response
Content-Type - the body size (
fetchRemoteDocumentcaps at 25MB; this path has no cap)
When Drive answers with an HTML page instead of the file, that page is uploaded to Cloudinary and OCR'd as if it were a PDF or image. This happens for a sign-in or permission page (file not public) and for the large-file "virus scan" confirmation page.
fetchFolderContent: listing is incomplete and errors are opaque
The listing is GET https://www.googleapis.com/drive/v3/files?q='<folderId>'+in+parents&key=.... Problems:
- No paging. There is no
pageSize/pageTokenhandling, so only the first page of a large folder is returned. The rest is dropped silently. - Trashed files included. There is no
trashed = falsefilter. - Unescaped id. The folder id is not URL-encoded, and anything after it in the path (e.g. a trailing
/) stays in the id. - Status never checked.
res.okis not checked. A 4xx error body (bad or missing API key, folder not shared) fails schema parsing and surfaces as the genericFailed to parse response from Google Drive.
Other
- With
GOOGLE_DRIVE_API_KEYunset, the provider still sends requests with an emptykey=. A clear "Drive is not configured" error would be better. - There are no tests for network behaviour. The only Drive test is
isFileUrlURL recognition, indocuments/helpers/fetch-remote-document.test.ts.
Out of scope
Access to private, non-public Drive files (service account or OAuth). This issue is only about the existing public-link path.
Done when
-
fetchFilerejects:- a non-2xx response
- an HTML or otherwise unexpected
Content-Type, judged from the response and not the metadata - an oversized body
Each rejection gives a clear message telling the user to share the file as "anyone with the link". Consider reusing the limits and allowlist in
fetch-remote-document.helper.ts. -
Folder listing pages through every result, excludes trashed files, encodes the id, and turns HTTP errors into readable messages.
-
A missing API key fails fast with a configuration error.
-
Unit tests with a mocked
fetchcover each case above.
- Dominant language
- TypeScript
- Stars
- 30
- Forks
- 10
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 276
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Urigo/accounter-fullstack
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Urigo/accounter-fullstack#5302 ·
Maintainers usually reply within 2 days
-
1214 annual-audit-workflow
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Urigo/accounter-fullstack#5257 ·
Maintainers usually reply within 2 days
-
1214 annual-audit-workflow
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Urigo/accounter-fullstack#5256 ·
Maintainers usually reply within 2 days
-
annual-audit-workflow
Difficulty 1/5 1-3 hours Newbie friendliness 87/100
Urigo/accounter-fullstack#5252 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Urigo/accounter-fullstack#4919 ·
Maintainers usually reply within 2 days
All issues in Urigo/accounter-fullstack
Similar issues
-
area: integrations documentation priority: P2 size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eddiejaoude/StackDash#798 ·
Maintainers usually reply within 1 day
-
bot:ai-assisted component:midnight-js status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
midnightntwrk/midnight-js#1790 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
area:vscode bug has repro platform:macos platform:vscode regression
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
anthropics/claude-code#113502 ·
-
Add: Rajdhani TV HDOpencheck:passed streams:add
Difficulty 1/5 Under an hour Newbie friendliness 77/100
Maintainers usually reply within 1 day