Spaces:
Sleeping
Sleeping
Commit History
-
Plasmid: accept SnapGene .dna; fix button hover (black fill, both themes)
Tengo Gzirishvili +1: Claude Opus 4.8Two things: 1) Plasmid Editor now imports SnapGene .dna (binary) alongside GenBank/FASTA/ raw. Biopython 1.87 ships a SnapGene reader, so: - plasmid.py: _record_to_plasmid() shared mapper; parse_snapgene(bytes) + parse_binary() dispatcher (detects .dna by extension OR the 0x09+"SnapGene" signature; size-bounded; filename fallback for unnamed records). - server.py: /api/plasmid/import accepts a base64 `b64` payload (decodes, bounds, parses) in addition to the existing `text` path. - app.js: the Upload-file handler reads .dna/.snapgene/.xdna as bytes → base64 → import; text formats still load into the box. Parsed sequence is dropped into the editor so it's visible + editable. - index.html: accept=".dna,…"; label now says "SnapGene .dna". 2) White/cream buttons now invert to a near-black rectangle with white text on hover — in BOTH themes. The old hover used theme tokens that, in dark mode, flipped to off-white-on-dark (the filled CTAs visib…21dfced -
Plasmid: richer common-features auto-annotation (SnapGene-style)
Tengo Gzirishvili +1: Claude Opus 4.8Expand the _MOTIFS library from 8 → ~22 curated, highly-specific signatures so pasted/raw plasmids auto-annotate like Benchling/SnapGene: sequencing-primer sites (CMV-fwd, BGH-rev, M13), epitope/purification tags (His ×2 codon variants, FLAG ×2, HA, Myc, Strep-II, V5, T7), recombination sites (loxP, FRT, attB1/B2), plus the existing promoters/terminator/lac operator. All matched on both strands by find_motifs (exact, ≥18 bp → no false positives). GenBank imports keep their own curated features; this enriches the bare FASTA/raw case. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1755b9c
-
Adversarial audit of Plasmid Studio: fix XSS, DoS, and input-validation gaps
Tengo Gzirishvili +1: Claude Opus 4.8Findings + fixes from a full security/robustness pass over M1–M5: 1) Stored XSS (HIGH) — a feature `color` was injected unescaped into an inline `style="--featc:…"` (sequence view), so a saved plasmid whose feature colour broke out of the attribute (`red" onmouseover=…`) ran script on reopen. Fix: client only emits a validated hex colour into any SVG/style attr (pmColor gate); server sanitize_features() forces every stored/exported colour to a safe hex. Verified live: a malicious saved plasmid renders inert (handler never fires) on map, swatch, and sequence views. 2) DoS — find_orfs was O(n²): a long, ATG-rich, stop-less paste pinned the worker. Rewrote to a single linear pass per frame + an ORF cap. (120 kb stop-less input now returns in <2 s vs many seconds.) 3) DoS / crash — unbounded inputs: - parse_plasmid now rejects import text > 2 MB before parsing; GenBank feature parse capped at 5,000. - sanitize_features() clamps coords to [0,len], drops…d67ba8e -
Plasmid Studio (M1+M2): import/annotate/map + restriction/digest + library
Tengo Gzirishvili +1: Claude Opus 4.8New "Plasmid" tool — a Benchling/SnapGene-style plasmid design studio, built on primitives we already had (Biopython GenBank I/O + 1,088 REBASE enzymes, ORF detection, Supabase per-user save). Sign-in gated like CRISPR / the Primer Picker; per-user library from day one. Core (dee/core/plasmid.py, fully unit-tested): - parse_plasmid: GenBank / FASTA / raw DNA → one normalized model {name, sequence, topology, gc, length, features[]}. - auto_annotate: ORF detection + curated motif library (T7/T3/SP6/M13/lac/His) when a record has no features; GenBank features kept as-is. - build_genbank / build_fasta export. - restriction_analysis: per-enzyme cut sites over the common set (or any), circular-aware, classified single/double/multi/non-cutters. - digest: combined cut positions → fragment sizes (circular wraps the origin). API (server.py, sign-in gated): /api/plasmid/import, /restriction, /digest, /export, plus the library: /save, /library (list), /library/<id> (get/delete). auth.py: s…be23b1b