[Medium-high] Do not apply formula-injection quoting to spreadsheet data handed to the Python worker

Aperta Adatta ai principianti
#41 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
html, javascript, python
Ambito
data

Direzione di ricerca

Leggi ensureBytes e quoteField in index.html per ricostruire come vengono serializzate le righe del foglio di calcolo per il worker Python. Aggiungi un test che verifichi che le intestazioni .xlsx che iniziano con @, -, + o = arrivino invariate al worker. Verifica poi che la rinomina dell’intestazione e i valori di output mantengano il testo originale.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug help wanted

Priority: Medium-high. Type: Bug.

Spreadsheet data handed to the Python worker for Combine spreadsheets and Convert EMA export is altered on the way in. Headers and values that start with @, -, +, or = gain a leading apostrophe, so the output files contain changed values and the header rename step misses those columns.

In index.html, ensureBytes rebuilds a CSV for Pyodide from the selected rows for any .xlsx or .xls input, or any file whose raw bytes were not kept, using r.map(quoteField). quoteField is the export-side formula-injection guard that prepends an apostrophe to any cell starting with =, @, tab, or a non-numeric + or -. Applied on the way in, a header such as @timestamp or -log10p and values such as --, -N/A, or +positive arrive in pandas with an apostrophe. The merged and converted CSV files then carry altered values, and in Combine spreadsheets the rename map built from the raw header no longer matches the pandas column, so that column is never unified. CSV inputs keep their raw bytes and are not affected, so the same workbook behaves differently as .csv and as .xlsx.

Suggested fix:

  • In ensureBytes, use a plain RFC 4180 quoter that only wraps in quotes and doubles embedded quotes. Keep quoteField for downloads a person opens in a spreadsheet program.
  • Add a test that an .xlsx header starting with @, -, +, or = reaches the worker unchanged.

Source: index.html, ensureBytes and quoteField.

Verification: Ran the quoteField logic copied from the source under Node: @timestamp became '@timestamp, -log10p became '-log10p, -- became '--, and -5 was unchanged. The call site in ensureBytes was confirmed from the source.


Generated by Claude Code

Lingua principale
HTML
Stelle
1
Fork
0
Merge medio
2h 34m
PR unite (30g)
2

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DepressionCenter/FieldStationAI

Tutte le issue di DepressionCenter/FieldStationAI

Issue simili

Altre issue su Data Engineering

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.