Harden GoogleDriveProvider downloads and folder listing
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 56/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 30
- Fork
- 10
- Merge medio
- 2g 12h
- PR unite (30g)
- 276
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Urigo/accounter-fullstack
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
Urigo/accounter-fullstack#5302 ·
I maintainer di solito rispondono entro 2 giorni
-
1214 annual-audit-workflow
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Urigo/accounter-fullstack#5257 ·
I maintainer di solito rispondono entro 2 giorni
-
1214 annual-audit-workflow
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
Urigo/accounter-fullstack#5256 ·
I maintainer di solito rispondono entro 2 giorni
-
annual-audit-workflow
Difficoltà 1/5 1-3 ore Idoneità per principianti 87/100
Urigo/accounter-fullstack#5252 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
Urigo/accounter-fullstack#4919 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di Urigo/accounter-fullstack
Issue simili
-
area: integrations documentation priority: P2 size: XS
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
eddiejaoude/StackDash#798 ·
I maintainer di solito rispondono entro 1 giorno
-
bot:ai-assisted component:midnight-js status:untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
midnightntwrk/midnight-js#1790 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
area:vscode bug has repro platform:macos platform:vscode regression
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
anthropics/claude-code#113502 ·
-
Add: Rajdhani TV HDApertacheck:passed streams:add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno