From 27bb1ebf065a58fc415ac9eb05c04a834d3cbb38 Mon Sep 17 00:00:00 2001 From: totoz64 <47389794+totoz64@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:19:25 +0100 Subject: [PATCH 001/183] CP: Adapt French proofing to shared Language packs Keep French locales in Pack(PackLocale), reusing the shared dictionary cache, affix reader and suggestion engine. Add French elisions, bounded accent and split tuning, conservative typography and Quebec punctuation rules. Validate displayed suggestion casing before OCONV and retain the original eligible form when an explicit target is excluded. Preserve historical text fixtures with three documented pre-existing upstream chain differences. Ported from WordCraft #3185; no dictionary or hyphenation data is bundled. --- crates/proof/README.md | 41 ++ crates/proof/src/affix.rs | 66 ++ crates/proof/src/affix_suggest.rs | 30 + crates/proof/src/fr/grammar.rs | 665 ++++++++++++++++++ crates/proof/src/fr/mod.rs | 181 +++++ crates/proof/src/fr/suggest.rs | 81 +++ crates/proof/src/fr/test_dict.rs | 234 ++++++ crates/proof/src/hunspell.rs | 17 +- crates/proof/src/lib.rs | 5 + crates/proof/src/pack_lang.rs | 8 +- crates/proof/tests/affix_compatibility.rs | 92 +++ .../fixtures/affix_compatibility.compact | 7 + .../fixtures/affix_compatibility.expected | 497 +++++++++++++ .../fixtures/affix_compatibility_cases.rs | 61 ++ crates/proof/tests/french_dictionary.rs | 107 +++ crates/proof/tests/french_packs.rs | 124 ++++ 16 files changed, 2210 insertions(+), 6 deletions(-) create mode 100644 crates/proof/src/fr/grammar.rs create mode 100644 crates/proof/src/fr/mod.rs create mode 100644 crates/proof/src/fr/suggest.rs create mode 100644 crates/proof/src/fr/test_dict.rs create mode 100644 crates/proof/tests/affix_compatibility.rs create mode 100644 crates/proof/tests/fixtures/affix_compatibility.compact create mode 100644 crates/proof/tests/fixtures/affix_compatibility.expected create mode 100644 crates/proof/tests/fixtures/affix_compatibility_cases.rs create mode 100644 crates/proof/tests/french_dictionary.rs create mode 100644 crates/proof/tests/french_packs.rs diff --git a/crates/proof/README.md b/crates/proof/README.md index 970670143..b4b4b5ba8 100644 --- a/crates/proof/README.md +++ b/crates/proof/README.md @@ -16,6 +16,7 @@ craft-proof = { git = "https://github.com/storytold/craft-libs", rev = " | English (en-US, en-CA, en-AU, en-GB and the British-spelling Englishes such as en-NZ) | SCOWL 2026 Hunspell dictionary per English + `en-extra.txt`, dialect policy (`en-variants.txt`); a dictionaries-folder English first; without SCOWL the installed Hunspell English, else the built-in Moby list ([below](#english-is-always-checked)) | yes | Moby list, our patterns, heuristic | | Polish, Portuguese, Italian | the installed Hunspell dictionary | yes | TeX patterns (embedded, or a Language pack) | | Croatian, Turkish, Russian, Czech, Indonesian, Spanish (es, es-MX, es-419, es-UY) | the installed Hunspell dictionary (Russian also `ru-extra.txt`) | yes | Turkish and Russian rules; English fallback otherwise | +| French (fr-FR, fr-CA and other French pack locales) | the installed Language pack or Hunspell dictionary; dictionary-driven elisions and accent-oriented suggestions | conservative typography and basic checks, with Quebec punctuation spacing in fr-CA | the Language pack (generic fr fallback) | | German | — | — | TeX patterns (embedded, or a Language pack) | | Bulgarian | — | — | syllable rules | @@ -41,6 +42,12 @@ application data (`%LOCALAPPDATA%\WordCraft\dictionaries` and `%APPDATA%\WordCra `~/Library/Application Support/WordCraft/dictionaries`, `$XDG_DATA_HOME/wordcraft/dictionaries`), then the usual Hunspell and LibreOffice locations. None on the web. +French remains a `ProofLang::Pack` locale: use its full `tag()` for settings and issue identity. +The shared pack loader keeps regional dictionary overrides, fallback to `fr`, reloads and its +memory budget; no separate French dictionary slot or embedded French patterns are added. +Only French packs receive the French spelling tuning and typography; other pack languages +keep their existing behavior. French agreement and conjugation are outside these checks. + State is process-wide: `add_word`, `ignore_word`, `set_dictionaries_folder`, `load_user_dictionary`/`save_user_dictionary`. The crate reads no document model; callers pass plain text and language spans. @@ -221,6 +228,40 @@ CI: `.github/workflows/proof.yml`. storytold/craft-libs#30/#31 by brzuchal (Michał Marcin Brzuchalski) started the shared crate. +### French adaptation validation + +The French rules and original synthetic fixtures are adapted from +[totoz64’s WordCraft contribution #3185](https://github.com/storytold/wordcraft/pull/3185). +They use the shared affix reader and Language pack cache; WCAFF1 remains deliberately rejected. +The historical text fixtures retain their original expected data. Three observations for +Indonesian `bermainkanlah` are explicitly updated in the compatibility test because the +shared reader already supports that prefix plus two suffixes. This is a finite regression +check, not a universal compatibility claim. + +The ordinary tests cover French packs, regional overrides and reloads, options, user words, +NFC/NFD lookup with original ranges, suggestions and pack hyphenation. The opt-in real French +dictionary gate fails when its input is missing; it never silently skips its assertions: + +```sh +WORDCRAFT_DICTIONARIES=/absolute/isolated/french-dictionary cargo test -p craft-proof --test french_dictionary -- --ignored +``` + +For a reproducible real-dictionary run, use Dicollecte 7.7 from LibreOffice/dictionaries +revision `67032ee957631908098a72edf48dc81cac27e369`: +[fr.aff](https://raw.githubusercontent.com/LibreOffice/dictionaries/67032ee957631908098a72edf48dc81cac27e369/fr_FR/dictionaries/fr.aff) and +[fr.dic](https://raw.githubusercontent.com/LibreOffice/dictionaries/67032ee957631908098a72edf48dc81cac27e369/fr_FR/dictionaries/fr.dic). +Verify SHA-256 before invoking the gate (the test checks location and behavior, not hashes): + +| File | SHA-256 | +|---|---| +| fr.aff | `c176610cd5dc4846806a65ddd029f422d87978bf58f224aa44222662a16a2de5` | +| fr.dic | `b78a868e31dd6e373b6c3217969afb898a9acde828a5e7ef97308da42218c88c` | + +Use a dedicated directory containing only the intended `fr.aff`/`fr.dic` pair (or explicit +regional pairs for both regions). The gate requires more than 50,000 dictionary entries and +checks the actual source folder, spelling, accent/elision suggestions, regional dispatch, +combining-mark ranges and hyphenated compounds. No real dictionary is committed here. + ## Owners WordCraft maintainers: echelon, dylanmtaylor, aiongg. diff --git a/crates/proof/src/affix.rs b/crates/proof/src/affix.rs index 0df68665b..32de07659 100644 --- a/crates/proof/src/affix.rs +++ b/crates/proof/src/affix.rs @@ -2212,6 +2212,37 @@ impl AffixDict { self.check_except(w, self.excluded(true)) } + /// Validate a collected suggestion in its displayed case, before OCONV. Only identity, + /// first-letter and uppercase variants are allowed (including uppercase that keeps sharp s). + /// An exact target excluded from suggestions cannot be rescued by a lowercase fallback. + /// This preserves the checker's homonym, compound and CHECKSHARPS rules without scanning + /// stems or changing which words the spelling checker accepts. + pub(crate) fn can_suggest_cased(&self, original: &str, changed: &str) -> bool { + if original.len() > MAX_INPUT_BYTES || changed.len() > MAX_INPUT_BYTES { + return false; + } + if changed != original + && changed != capitalize(original) + && changed != original.to_uppercase() + && changed != original.split('ß').map(str::to_uppercase).collect::>().join("ß") + { + return false; + } + let target = self.normalize(changed); + if self.is_forbidden(&target) { + return false; + } + // The exact simple-word path includes affixes; asking with no exclusions detects a + // target whose only derivations carry NOSUGGEST, SUBSTANDARD or FORBIDDENWORD. Spend + // the same shared suggestion budget as the normal checker, and abstain if it runs out. + match self.simple_word_budgeted(&target, Excluded::default(), true) { + None => return false, + Some(true) if !self.simple_word(&target, self.excluded(true)) => return false, + _ => {} + } + self.can_suggest(changed) + } + /// Whether `w` is a word only through a `KEEPCASE` stem, so it is correct in this letter case /// alone (`km` from `km/K`, which `Km` and `KM` are not). pub(crate) fn case_locked(&self, w: &str) -> bool { @@ -3298,6 +3329,41 @@ pub(crate) mod tests { assert!(d.check("ASSASSASSASSASS") && !d.check(&"SS".repeat(60))); } + #[test] + fn displayed_casing_rejects_exact_exclusions_before_case_fallback() { + for flag in ["N", "F", "S"] { + let aff = "SET UTF-8\nNOSUGGEST N\nFORBIDDENWORD F\nSUBSTANDARD S\nSFX A Y 1\nSFX A 0 s .\nSFX B Y 1\nSFX B 0 S .\n"; + let dic = format!("5\nnormal/A\nNORMAL/{flag}B\nmixCase\npour\nkm/K\n"); + let d = AffixDict::from_hunspell(&format!("{aff}KEEPCASE K\n"), &dic, &[]).unwrap(); + for (original, changed) in [("normal", "NORMAL"), ("normals", "NORMALS")] { + assert!(!d.can_suggest_cased(changed, changed), "{flag}: {changed}"); + assert!(!d.can_suggest_cased(original, changed), "{flag}: {original} → {changed}"); + } + assert!(d.can_suggest_cased("normal", "Normal")); + assert!(d.can_suggest_cased("mixCase", "MIXCASE")); + assert!(d.can_suggest_cased("km", "km") && !d.can_suggest_cased("km", "KM")); + assert!(!d.can_suggest_cased("normal", "pour"), "no arbitrary replacement"); + let back = AffixDict::from_bytes(&d.to_bytes().unwrap()).unwrap(); + assert!(!back.can_suggest_cased("normal", "NORMAL")); + } + } + + #[test] + fn displayed_casing_uses_normalization_and_native_homonym_policy() { + let aff = "SET UTF-8\nNOSUGGEST N\nSUBSTANDARD S\nIGNORE ()\nICONV 1\nICONV Q NORMAL\n"; + for flag in ["N", "S"] { + let d = AffixDict::from_hunspell(aff, &format!("3\nnormal\nNORMAL/{flag}\nNORMAL\n"), &[]).unwrap(); + // Native homonyms carry exclusions: a second entry does not erase NOSUGGEST. + assert!(!d.contains_suggestible("NORMAL")); + assert!(!d.can_suggest_cased("(normal)", "(NORMAL)")); + assert!(!d.can_suggest_cased("Q", "Q")); + } + let plain = AffixDict::from_hunspell(aff, "3\nnormal\nNORMAL\nNORMAL\n", &[]).unwrap(); + assert!(plain.can_suggest_cased("normal", "NORMAL")); + assert!(plain.can_suggest_cased("Q", "Q")); + assert!(!plain.can_suggest_cased(&"x".repeat(MAX_INPUT_BYTES + 1), "NORMAL")); + } + #[test] fn oconv_converts_suggestions_only() { // Answers as Hunspell 1.7 gives them on the same files: `kbt` → `k’t`. diff --git a/crates/proof/src/affix_suggest.rs b/crates/proof/src/affix_suggest.rs index 3b498542c..68336de16 100644 --- a/crates/proof/src/affix_suggest.rs +++ b/crates/proof/src/affix_suggest.rs @@ -426,6 +426,18 @@ pub(crate) fn suggest_in(d: &AffixDict, word: &str, max: usize, t: &Tuning) -> V _ => vec![text.clone()], }; for t in recased { + let eligible = |candidate: &str| { + let original: Vec<_> = text.split(' ').collect(); + let changed: Vec<_> = candidate.split(' ').collect(); + original.len() == changed.len() && original.iter().zip(changed).all(|(a, b)| d.can_suggest_cased(a, b)) + }; + let t = if eligible(&t) { + t + } else if eligible(&text) { + text.clone() + } else { + continue; + }; // Shown as the dictionary's OCONV table writes it (`'` → `’` in French). let t = d.output(&t).into_owned(); if t != word && !out.contains(&t) { @@ -763,6 +775,24 @@ mod tests { assert_eq!(suggest_in(&d, "Piesx", 4, &Tuning::DEFAULT).first().map(String::as_str), Some("Pies")); } + #[test] + fn recasing_keeps_valid_original_when_exact_target_is_excluded() { + for flag in ["N", "F", "S"] { + let aff = "SET UTF-8\nNOSUGGEST N\nFORBIDDENWORD F\nSUBSTANDARD S\nTRY normal\n"; + let d = AffixDict::from_hunspell(aff, &format!("2\nnormal\nNORMAL/{flag}\n"), &[]).unwrap(); + let got = suggest_in(&d, "NORMALL", 4, &Tuning::DEFAULT); + assert!(got.iter().any(|w| w == "normal"), "{flag}: {got:?}"); + assert!(!got.iter().any(|w| w == "NORMAL"), "{flag}: {got:?}"); + let split = AffixDict::from_hunspell(aff, &format!("3\nnormal\nNORMAL/{flag}\npour\n"), &[]).unwrap(); + let got = suggest_in(&split, "NORMALPOUR", 4, &Tuning::DEFAULT); + assert!(got.iter().any(|w| w == "normal pour"), "{flag}: {got:?}"); + assert!(!got.iter().any(|w| w == "NORMAL POUR"), "{flag}: {got:?}"); + } + let d = AffixDict::from_hunspell("NOSUGGEST N\n", "3\nnormal\nNORMAL/N\npour\n", &[]).unwrap(); + assert!(!d.can_suggest_cased("normal", "NORMAL")); + assert!(!d.can_suggest_cased("normal", "pour")); + } + /// A language's tables come after its dictionary's, a TRY alphabet stands in for a missing TRY /// line, and a split rule decides which missing spaces are offered. #[test] diff --git a/crates/proof/src/fr/grammar.rs b/crates/proof/src/fr/grammar.rs new file mode 100644 index 000000000..1d5449b1f --- /dev/null +++ b/crates/proof/src/fr/grammar.rs @@ -0,0 +1,665 @@ +//! French grammar and typography checks: cheap, rule-based and tuned to stay quiet when unsure +//! (a missed mistake costs less than a wrong mark on correct text). Messages are in French. +//! +//! - **Space before `;` `!` `?` `:`**: French typography puts a non-breaking space there — a +//! narrow one (U+202F) before `;` `!` `?`, a full one (U+00A0) before `:`. Only a missing +//! space is flagged (`Bonjour!`): an ordinary one stays quiet until typing turns it into a +//! non-breaking one (no French AutoFormat yet). Quebec French (`fr-CA`) has no space before +//! `;` `!` `?`, only before `:`. Addresses (`https://…`) and times (`10:30`) are left alone. +//! - **Space inside `« »`**: a missing one after `«` or before `»` (`«oui»`) → U+00A0. +//! - **Straight double quotes** around a phrase (`"bonjour"`) → `« bonjour »`; inch marks +//! (`27"`) and unbalanced quotes are left alone. +//! - **Repeated word** (`le le`, `que que`), except repetitions French makes on purpose +//! (`nous nous lavons`, `vous vous trompez`, `si si`, interjections) and a proper noun after +//! the same lower-case word (`de De…`). +//! - **Capital letter at the start of a sentence** after `.` `!` `?`, knowing French +//! abbreviations (`etc.`, `M.`, `p.`, `cf.`), initials, numbers, ellipses, addresses, +//! dialogue (`« Tu viens ? » demanda-t-elle`), inversions (`Quoi ? dit-il`) and exclamations +//! after an interjection (`Ah ! que c'est beau`). +//! - **Elision** (`de avoir` → `d’avoir`, `je ai` → `j’ai`, `le homme` → `l’homme`) for `le`, +//! `la`, `de`, `je`, `me`, `te`, `se`, `ne`, `que` before a vowel. Before an `h` only for words +//! known to have a mute `h`, so aspirated ones (`le hibou`, `la hache`, `le héros`) stay quiet; +//! never before a proper noun, `onze`, `oui`, `y…` words (`le yaourt`) or `la une`. +//! +//! No agreement or conjugation rule, and no English rule (such as `a`/`an`), applies to French +//! text. + +use crate::{Issue, IssueKind, ProofLang, words}; + +/// Non-breaking space, before `:` and inside `« »`. +const NBSP: char = '\u{A0}'; +/// Narrow non-breaking space, before `;` `!` `?`. +const NNBSP: char = '\u{202F}'; + +/// Words French repeats on purpose: pronominal verbs (`nous nous lavons`), emphasis, +/// interjections, onomatopoeia. +const ALLOWED_REPEATS: &[&str] = &[ + "nous", "vous", "si", "oui", "non", "très", "bon", "vite", "là", "ah", "oh", "eh", "ha", "hé", "ho", "hi", "bla", "chut", "toc", "pan", "bravo", + "merci", "allez", "encore", "beaucoup", "fort", "tchin", "bye", "couci", "tam", "miam", "glou", +]; + +/// Abbreviations written with a final period after which a sentence goes on in lower case +/// (lower case, without the period). +const ABBREVIATIONS: &[&str] = &[ + "etc", "cf", "ex", "env", "av", "apr", "mm", "mme", "mmes", "mlle", "mlles", "mgr", "dr", "pr", "me", "st", "ste", "sts", "pp", "vol", "chap", + "fig", "éd", "coll", "trad", "réf", "tél", "art", "al", "op", "cit", "ibid", "id", "resp", "min", "max", "sq", "sqq", "suiv", "hab", "janv", + "févr", "avr", "juil", "sept", "oct", "nov", "déc", "bd", "boul", "cie", "éts", "vve", "nb", "ps", "no", "nos", "vs", "qqch", "qqn", "ca", + "approx", "prof", "dir", "sté", "dépt", "adj", "adv", "fém", "masc", "sing", "plur", "à-d", "ms", "mss", "éds", "trim", "hôp", +]; + +/// Words after which `!` or `?` doesn't end the sentence (`Ah ! que c'est beau`, `Eh bien ? +/// et alors`). +const INTERJECTIONS: &[&str] = &[ + "ah", "oh", "eh", "hé", "hein", "hélas", "bah", "ô", "aïe", "ouf", "oups", "quoi", "comment", "ha", "ho", "bon", "tiens", "allons", "zut", + "chut", "bravo", "hourra", "dame", "bien", "là", "oui", "non", "pardon", "voyons", +]; + +/// Pronouns ending an inversion (`dit-il`, `demanda-t-elle`): after one, a `!` or `?` doesn't +/// end the sentence (`Quoi ? dit-il`). +const INVERTED: &[&str] = &["-il", "-elle", "-on", "-ils", "-elles", "-je", "-tu", "-nous", "-vous"]; + +/// Speech verbs of a dialogue tag: after one, a `!` or `?` doesn't end the sentence (`— Tu +/// viens ? demanda le voisin`). +const SPEECH_VERBS: &[&str] = &[ + "dit", + "demanda", + "répondit", + "cria", + "murmura", + "ajouta", + "reprit", + "fit", + "lança", + "souffla", + "répliqua", + "interrogea", + "hurla", + "poursuivit", + "continua", + "déclara", + "expliqua", + "protesta", + "soupira", + "chuchota", + "insista", + "s'écria", + "s’écria", + "s'exclama", + "s’exclama", + "objecta", + "conclut", + "dis", + "dit-on", +]; + +/// The words that elide before a vowel, and their elided form. +const ELIDING: &[(&str, &str)] = + &[("le", "l"), ("la", "l"), ("de", "d"), ("je", "j"), ("me", "m"), ("te", "t"), ("se", "s"), ("ne", "n"), ("que", "qu")]; + +/// Words starting with a vowel that don't take an elision (`le onze`, `le oui`, `de ouate`). +const NO_ELISION: &[&str] = &["onze", "onzième", "onzièmes", "oui", "ouistiti", "ouistitis", "ouate", "ouates", "uhlan", "uhlans"]; + +/// Words with a mute `h`, which take an elision (`l’homme`, `d’habitude`, `j’habite`). Only these +/// are flagged: an `h` word outside the list may be aspirated (`le hibou`, `la hache`, `le +/// héros`), and staying quiet is the safe side. +const MUTE_H: &[&str] = &[ + "homme", + "hommes", + "heure", + "heures", + "histoire", + "histoires", + "hiver", + "hivers", + "hôtel", + "hôtels", + "herbe", + "herbes", + "habitude", + "habitudes", + "habitant", + "habitants", + "habit", + "habits", + "hôpital", + "hôpitaux", + "humain", + "humains", + "humanité", + "honneur", + "honneurs", + "horizon", + "horizons", + "huile", + "huiles", + "hypothèse", + "hypothèses", + "harmonie", + "héritage", + "héroïne", + "héroïnes", + "hésitation", + "hommage", + "hommages", + "horaire", + "horaires", + "horreur", + "horreurs", + "humeur", + "humour", + "hygiène", + "hymne", + "habiter", + "hériter", + "hésiter", + "habiller", + "honorer", + "habite", + "habites", + "habitent", + "habitais", + "habitait", + "hésite", + "hésites", + "hésitent", + "hésitais", + "hésitait", + "habille", + "habillent", + "honore", + "hier", + "hôte", + "hôtes", + "hôtesse", + "humidité", + "haleine", + "hebdomadaire", + "hectare", + "hectares", + "hélicoptère", + "hémisphère", + "heureux", + "heureuse", + "hippopotame", + "hirondelle", + "honnête", + "honnêteté", + "huître", + "huîtres", + "humble", + "humilité", + "hydrogène", + "hypocrite", + "horloge", + "hôtellerie", + "hérédité", + "historien", + "historique", + "humanitaire", + "hormone", + "hormones", + "hospitalité", +]; + +fn issue(start: usize, end: usize, message: String, suggestions: Vec) -> Issue { + Issue { start, end, kind: IssueKind::Grammar, message, suggestions, lang: ProofLang::from_tag(Some("fr-FR")) } +} + +/// Is `c` a space that doesn't break (or a thin space some writers use instead)? +fn is_fixed_space(c: char) -> bool { + matches!(c, '\u{A0}' | '\u{202F}' | '\u{2007}' | '\u{2009}' | '\u{2060}') +} + +/// The byte range of the whitespace-delimited token around byte `i` of `text`. +fn token_bounds(text: &str, i: usize) -> (usize, usize) { + let start = text.get(..i).and_then(|t| t.char_indices().rev().find(|(_, c)| c.is_whitespace())).map_or(0, |(k, c)| k + c.len_utf8()); + let end = text.get(i..).and_then(|t| t.find(char::is_whitespace)).map_or(text.len(), |k| i + k); + (start, end) +} + +/// The whitespace-delimited token around byte `i` of `text`. +fn token_at(text: &str, i: usize) -> &str { + let (start, end) = token_bounds(text, i); + text.get(start..end).unwrap_or("") +} + +/// Is `token` a web or e-mail address, a path or an HTML entity, where punctuation isn't prose? +fn is_address(token: &str) -> bool { + token.contains("://") || token.contains('@') || token.starts_with("www.") || token.contains('&') || token.contains('\\') +} + +/// `«` + text + `»` in a message, with French spacing. +fn quoted(s: &str) -> String { + format!("«{NBSP}{s}{NBSP}»") +} + +/// `;` `!` `?` `:` without the non-breaking space French puts before them. +/// Quebec typography (`quebec`) puts no space before `;` `!` `?`, only before `:`. +fn high_punctuation(text: &str, quebec: bool, v: &mut Vec) { + let mut token: Option<(usize, usize, bool)> = None; + for (i, p) in text.char_indices() { + if !matches!(p, ';' | ':' | '!' | '?') || (quebec && p != ':') { + continue; + } + let before = text.get(..i).and_then(|t| t.chars().next_back()); + let after = text.get(i + p.len_utf8()..).and_then(|t| t.chars().next()); + // One look per token, so a long run of marks stays linear. + let address = match token { + Some((start, end, address)) if start <= i && i < end => address, + _ => { + let (start, end) = token_bounds(text, i); + let address = is_address(text.get(start..end).unwrap_or("")); + token = Some((start, end, address)); + address + } + }; + if address { + continue; + } + let (space, kind) = if p == ':' { (NBSP, "insécable") } else { (NNBSP, "fine insécable") }; + let message = format!("Espace {kind} attendue avant {}", quoted(&p.to_string())); + let fix = format!("{space}{p}"); + // Only a missing space is flagged: an ordinary one stays quiet until typing turns it into + // a non-breaking one by itself (French AutoFormat). + if before.is_some_and(char::is_alphabetic) { + // `10:30`, `a:b`, `C:` and `x;y` aren't prose: the mark must end the word. + let ends = match p { + ':' => after.is_none_or(char::is_whitespace), + _ => after.is_none_or(|a| a.is_whitespace() || matches!(a, '!' | '?' | '»' | '"' | '”' | ')')), + }; + if ends { + v.push(issue(i, i + p.len_utf8(), message, vec![fix])); + } + } + } +} + +/// `«` and `»` without a non-breaking space inside. +fn guillemets(text: &str, v: &mut Vec) { + for (i, c) in text.char_indices() { + let len = c.len_utf8(); + match c { + '«' => { + let mut next = text.get(i + len..).unwrap_or("").chars(); + let message = format!("Espace insécable attendue après {}", quoted("«")); + if next.next().is_some_and(char::is_alphanumeric) { + v.push(issue(i, i + len, message, vec![format!("«{NBSP}")])); + } + } + '»' => { + let prev = text.get(..i).unwrap_or("").chars().next_back(); + let message = format!("Espace insécable attendue avant {}", quoted("»")); + if prev.is_some_and(|n| n.is_alphanumeric() || matches!(n, '.' | '!' | '?' | '…')) { + v.push(issue(i, i + len, message, vec![format!("{NBSP}»")])); + } + } + _ => {} + } + } +} + +/// `"…"` around a phrase, where French uses `« … »`. +fn straight_quotes(text: &str, v: &mut Vec) { + let quotes: Vec = text.match_indices('"').map(|(i, _)| i).collect(); + // An odd count leaves no telling which quote opens and which closes. + if !quotes.len().is_multiple_of(2) { + return; + } + for pair in quotes.chunks(2) { + let [a, b] = pair else { continue }; + let (Some(inner), Some(before), Some(after)) = (text.get(a + 1..*b), text.get(..*a), text.get(b + 1..)) else { continue }; + let opens = before.chars().next_back().is_none_or(|c| c.is_whitespace() || matches!(c, '(' | '[' | '—' | '–')); + let closes = after.chars().next().is_none_or(|c| c.is_whitespace() || matches!(c, '.' | ',' | ';' | ':' | '!' | '?' | ')' | ']' | '…')); + let phrase = inner.trim(); + if !opens || !closes || !phrase.chars().any(char::is_alphabetic) || phrase.chars().count() > 120 || phrase.contains('\n') { + continue; + } + v.push(issue(*a, b + 1, format!("Guillemets français attendus{NBSP}: {}", quoted(phrase)), vec![quoted(phrase)])); + } +} + +fn repeated_words(text: &str, ws: &[(usize, usize)], v: &mut Vec) { + for pair in ws.windows(2) { + let [(a0, b0), (a1, b1)] = pair else { continue }; + let (Some(w0), Some(w1), Some(gap)) = (text.get(*a0..*b0), text.get(*a1..*b1), text.get(*b0..*a1)) else { continue }; + let lower = w0.to_lowercase(); + let starts_upper = |w: &str| w.chars().next().is_some_and(char::is_uppercase); + if !gap.is_empty() + && gap.chars().all(char::is_whitespace) + && w0.chars().all(char::is_alphabetic) + && lower == w1.to_lowercase() + && !ALLOWED_REPEATS.contains(&lower.as_str()) + // `de De…`, `Bora Bora`: a capitalized second word is a name. + && !starts_upper(w1) + { + v.push(issue(*a0, *b1, format!("Mot répété{NBSP}: {}", quoted(w1)), vec![w0.to_string()])); + } + } +} + +/// Is `prev`, before a period, an abbreviation, an initial, a number or a Roman numeral (after +/// which a lower-case word doesn't start a sentence)? +fn abbreviation_or_number(prev: &str) -> bool { + prev.chars().count() <= 1 + || prev.chars().any(|c| c.is_ascii_digit()) + || prev.chars().all(|c| matches!(c, 'I' | 'V' | 'X' | 'L' | 'C' | 'D' | 'M')) + || ABBREVIATIONS.contains(&prev.to_lowercase().as_str()) +} + +/// Does `gap`, between the words `prev` and `next`, end a sentence: a `.`, `!` or `?` (French +/// puts a space before the last two), then a space, with only quotes and brackets around? Not +/// an ellipsis, not after an abbreviation; for `!` and `?`, not after an interjection, not before +/// a closing quote (dialogue goes on: `« Tu viens ? » demanda-t-elle`), not before an inversion +/// or a speech verb (`Quoi ? dit-il`, `— Viens ! cria-t-on`), and never in a `dialogue` line (one +/// opening with a dash). +fn ends_sentence(gap: &str, prev: &str, next: &str, dialogue: bool) -> bool { + let closing = ['"', '”', '’', '\'', ')', '»', ']']; + let t = gap.trim_start_matches(|c: char| c.is_whitespace() || is_fixed_space(c) || closing.contains(&c)); + let Some(end) = t.chars().next() else { return false }; + if !matches!(end, '.' | '!' | '?') || t.starts_with("..") { + return false; + } + if end == '.' && abbreviation_or_number(prev) { + return false; + } + let exclamation = end != '.'; + let lower_next = next.to_lowercase(); + if exclamation + && (dialogue + || INTERJECTIONS.contains(&prev.to_lowercase().as_str()) + || INVERTED.iter().any(|p| lower_next.ends_with(p)) + || SPEECH_VERBS.contains(&lower_next.as_str())) + { + return false; + } + let rest = t.trim_start_matches(['.', '!', '?']); + let after_marks = rest.trim_start_matches(is_fixed_space); + if after_marks.starts_with(closing) { + if exclamation { + return false; + } + return ends_sentence_after(after_marks.trim_start_matches(|c: char| closing.contains(&c) || is_fixed_space(c))); + } + ends_sentence_after(rest) +} + +/// Is `rest` (after the final mark) a space, then nothing but opening quotes and brackets? +fn ends_sentence_after(rest: &str) -> bool { + rest.starts_with(char::is_whitespace) + && rest.trim_start().chars().all(|c| c.is_whitespace() || is_fixed_space(c) || matches!(c, '"' | '“' | '«' | '(' | '[' | '—' | '–')) +} + +fn sentence_capitals(text: &str, ws: &[(usize, usize)], v: &mut Vec) { + let dialogue = text.trim_start().starts_with(['—', '–']); + for pair in ws.windows(2) { + let [(a0, b0), (a1, b1)] = pair else { continue }; + let (Some(prev), Some(gap), Some(w)) = (text.get(*a0..*b0), text.get(*b0..*a1), text.get(*a1..*b1)) else { continue }; + let word_like = w.chars().all(|c| c.is_alphabetic() || matches!(c, '\'' | '’' | '-')); + if word_like && w.chars().next().is_some_and(char::is_lowercase) && ends_sentence(gap, prev, w, dialogue) && !is_address(token_at(text, *a1)) + { + let fixed: String = w.chars().next().map(|f| f.to_uppercase().chain(w.chars().skip(1)).collect()).unwrap_or_default(); + v.push(issue(*a1, *b1, "Majuscule attendue en début de phrase".into(), vec![fixed])); + } + } +} + +/// Does `w` (lower case) start with a sound that makes `le`, `de`, `que`… elide? +fn takes_elision(w: &str) -> bool { + let Some(first) = w.chars().next() else { return false }; + if NO_ELISION.contains(&w) { + return false; + } + match first { + 'a' | 'à' | 'â' | 'ä' | 'e' | 'é' | 'è' | 'ê' | 'ë' | 'i' | 'î' | 'ï' | 'o' | 'ô' | 'ö' | 'u' | 'ù' | 'û' | 'ü' | 'œ' | 'æ' => { + true + } + 'h' => MUTE_H.contains(&w), + // Only `y` itself (`j’y vais`): `le yaourt`, `de yoga`. + 'y' => w == "y", + _ => false, + } +} + +fn elisions(text: &str, ws: &[(usize, usize)], v: &mut Vec) { + for pair in ws.windows(2) { + let [(a0, b0), (a1, b1)] = pair else { continue }; + let (Some(w0), Some(w1), Some(gap)) = (text.get(*a0..*b0), text.get(*a1..*b1), text.get(*b0..*a1)) else { continue }; + if gap.is_empty() || !gap.chars().all(|c| c == ' ') { + continue; + } + let lower0 = w0.to_lowercase(); + let Some((_, elided)) = ELIDING.iter().find(|(full, _)| *full == lower0) else { continue }; + // `le`/`Le` only, not `LE`; never before a proper noun (`de Orléans`) or a capital. + let capital = w0.chars().next().is_some_and(char::is_uppercase); + if w0.chars().skip(1).any(char::is_uppercase) || !w1.chars().next().is_some_and(char::is_lowercase) { + continue; + } + if !w1.chars().all(|c| c.is_alphabetic() || c == '-') { + continue; + } + let lower1 = w1.to_lowercase(); + // `le un`, `la une` (the number, the front page); a single letter only where it is a word + // the elision is certain for (`n’a`, `qu’a`, `j’y`). + if matches!(lower0.as_str(), "le" | "la") && matches!(lower1.as_str(), "un" | "une") { + continue; + } + let certain = (lower1 == "y" && matches!(lower0.as_str(), "je" | "me" | "te" | "se" | "ne")) + || (lower1 == "a" && matches!(lower0.as_str(), "ne" | "que")); + if lower1.chars().count() == 1 && !certain { + continue; + } + if !takes_elision(&lower1) { + continue; + } + let head = if capital { crate::affix::capitalize(elided) } else { (*elided).to_string() }; + let fixed = format!("{head}’{w1}"); + v.push(issue(*a0, *b1, format!("Élision{NBSP}: {}", quoted(&fixed)), vec![fixed])); + } +} + +/// Grammar issues in a paragraph of French text (France's typography), in order. +pub fn check(text: &str) -> Vec { + check_in(text, ProofLang::from_tag(Some("fr-FR"))) +} + +/// Grammar issues in a French Language pack locale, with Quebec typography in `fr-CA`. +/// Other locales have no French issues; the original locale is retained on every issue. +pub fn check_in(text: &str, lang: ProofLang) -> Vec { + let Some(locale) = lang.pack_locale().filter(|l| l.primary() == "fr") else { return Vec::new() }; + let ws: Vec<(usize, usize)> = words(text); + let mut v = Vec::new(); + high_punctuation(text, crate::lang::region(locale.as_str()).is_some_and(|r| r.eq_ignore_ascii_case("CA")), &mut v); + guillemets(text, &mut v); + straight_quotes(text, &mut v); + repeated_words(text, &ws, &mut v); + sentence_capitals(text, &ws, &mut v); + elisions(text, &ws, &mut v); + for i in &mut v { + i.lang = lang; + } + v.sort_by_key(|i| (i.start, i.end)); + v +} + +#[cfg(test)] +mod tests { + use super::*; + + /// The issues of `text` as (flagged text, first suggestion). + fn found(text: &str) -> Vec<(String, String)> { + check(text) + .iter() + .map(|i| (text.get(i.start..i.end).unwrap_or("?").to_string(), i.suggestions.first().cloned().unwrap_or_default())) + .collect() + } + + fn quiet(text: &str) { + let v = check(text); + assert!(v.is_empty(), "{text:?} → {v:?}"); + } + + fn one(text: &str, flagged: &str, fix: &str) { + assert_eq!(found(text), [(flagged.to_string(), fix.to_string())], "{text:?}"); + } + + #[test] + fn missing_space_before_high_punctuation() { + one("Bonjour!", "!", "\u{202F}!"); + one("Tu viens?", "?", "\u{202F}?"); + one("Il pleut; il vente.", ";", "\u{202F};"); + one("Note: rien.", ":", "\u{A0}:"); + // `?!`: only the first mark needs the space. + one("Quoi?!", "?", "\u{202F}?"); + assert!(check("Bonjour!").iter().all(|i| i.lang == ProofLang::from_tag(Some("fr-FR")) && i.message.contains("fine insécable"))); + assert!(check("Note: rien.").iter().all(|i| i.message.contains("insécable") && !i.message.contains("fine"))); + } + + #[test] + fn an_ordinary_space_stays_quiet_until_french_autoformat() { + // Typing can't produce a non-breaking space yet, so an ordinary one is accepted. + quiet("Vraiment ? Bonjour ! Il pleut ; note : rien."); + quiet("Il dit « oui » hier."); + } + + #[test] + fn quebec_has_no_space_before_semicolon_exclamation_and_question() { + let fr_ca = |t: &str| check_in(t, ProofLang::from_tag(Some("fr-CA"))); + assert!(fr_ca("Bonjour! Tu viens? Il pleut; il vente.").is_empty(), "{:?}", fr_ca("Bonjour! Tu viens?")); + // The colon and the guillemets still want their space in Quebec. + let v = fr_ca("Note: «oui»."); + assert_eq!(v.len(), 3, "{v:?}"); + assert!(v.iter().all(|i| i.lang == ProofLang::from_tag(Some("fr-CA"))), "{v:?}"); + assert_eq!(check_in("Bonjour!", ProofLang::from_tag(Some("fr-FR"))).len(), 1, "France still wants the space"); + } + + #[test] + fn high_punctuation_stays_quiet() { + quiet("Bonjour\u{202F}! Tu viens\u{202F}? Il pleut\u{202F}; note\u{A0}: rien."); + quiet("Bonjour\u{A0}! Quoi\u{202F}?! Ah\u{2009}!"); + quiet("Il est 10:30."); + quiet("Voir https://exemple.org:8080/a?b=c pour la suite."); + quiet("Écrire à contact@exemple.org!"); + quiet("Super :) et ;-) aussi :D"); + quiet("a:b et x;y"); + quiet("Le fichier C:\\dossier est là."); + } + + #[test] + fn missing_space_inside_guillemets() { + assert_eq!(found("Il dit «oui» hier."), [("«".to_string(), "«\u{A0}".to_string()), ("»".to_string(), "\u{A0}»".to_string())]); + quiet("Il dit «\u{A0}oui\u{A0}» hier."); + quiet("Il dit «\u{202F}oui\u{202F}» hier."); + } + + #[test] + fn straight_quotes_become_guillemets() { + one("Il a dit \"bonjour\" hier.", "\"bonjour\"", "«\u{A0}bonjour\u{A0}»"); + one("\"Bonne idée\", dit-elle.", "\"Bonne idée\"", "«\u{A0}Bonne idée\u{A0}»"); + // Inch marks and unbalanced quotes are left alone. + quiet("Un écran de 27\" et un de 32\" ici."); + quiet("Il a dit \"bonjour hier."); + } + + #[test] + fn repeated_words_are_flagged() { + one("Le le chat dort.", "Le le", "Le"); + one("Je pense que que tu viens.", "que que", "que"); + one("Il mange la la pomme.", "la la", "la"); + } + + #[test] + fn deliberate_repetitions_stay_quiet() { + quiet("Nous nous lavons et vous vous trompez."); + quiet("Si si, très très bien."); + quiet("Ah ah, bla bla."); + quiet("Je crois que qu’il viendra."); + quiet("Le livre de De Gaulle."); + quiet("Nous partons à Bora Bora."); + quiet("Ils ont dit bye bye. Tchin tchin\u{202F}!"); + } + + #[test] + fn sentence_capitals_are_flagged() { + one("Il pleut. il fait froid.", "il", "Il"); + one("Il pleut\u{202F}! il fait froid.", "il", "Il"); + one("Tu viens\u{202F}? on part.", "on", "On"); + one("Il pleut. l’orage arrive.", "l’orage", "L’orage"); + one("Il pleut. «\u{A0}tout va bien\u{A0}», dit-il.", "tout", "Tout"); + } + + #[test] + fn sentence_capitals_stay_quiet() { + quiet("Voir p. 12 et cf. la note, etc. puis la suite."); + quiet("M. le maire est là."); + quiet("Il attend… puis part. Il attend... puis part."); + quiet("«\u{A0}Tu viens\u{202F}?\u{A0}» demanda-t-elle."); + quiet("Ah\u{202F}! que c’est beau."); + quiet("Quoi\u{202F}? dit-il."); + quiet("Tu viens\u{202F}? demanda le voisin."); + quiet("— Tu viens\u{202F}? reprends-tu, inquiet."); + quiet("– Viens\u{202F}! on part."); + quiet("Voir www.exemple.fr pour la suite."); + quiet("En 2026. ensuite rien."); + quiet("il commence en minuscule."); + } + + #[test] + fn missing_elisions_are_flagged() { + one("Il refuse de avoir peur.", "de avoir", "d’avoir"); + one("Je ai faim.", "Je ai", "J’ai"); + one("Voici le homme.", "le homme", "l’homme"); + one("Je sais que il viendra.", "que il", "qu’il"); + one("Le arbre est grand.", "Le arbre", "L’arbre"); + one("Il ne a pas faim.", "ne a", "n’a"); + one("Bon, je y vais.", "je y", "j’y"); + one("Il se est levé.", "se est", "s’est"); + one("Voici la école.", "la école", "l’école"); + one("Il me aime.", "me aime", "m’aime"); + } + + #[test] + fn aspirated_h_and_other_exceptions_stay_quiet() { + for w in [ + "hibou", + "héros", + "haricot", + "hasard", + "haut", + "hall", + "hamac", + "hangar", + "hockey", + "homard", + "huit", + "hérisson", + "hors-jeu", + "onze", + "oui", + "yaourt", + ] { + quiet(&format!("Voici le {w}.")); + } + // hiérarchie has an aspirated h, despite the mute h in hiéroglyphe: + // https://www.academie-francaise.fr/le-hieroglyphe-pour-lhieroglyphe + for w in ["honte", "hache", "harpe", "hausse", "hiérarchie"] { + quiet(&format!("Voici la {w}.")); + } + quiet("Une question de hiérarchie."); + quiet("Le onze de France. À la une du journal."); + quiet("Il vient de Orléans."); + quiet("De a à z, le a et le b."); + quiet("Le y et le x sont des variables. La dérivée de y."); + quiet("Je mange de la viande."); + } + + #[test] + fn hostile_input_never_panics() { + for t in ["", " ", "!", " !", "«", "»", " »", "« ", "\"", "\"\"", ". a", "de", "de ", "\u{202F}?", "é!é", "« » « »", ":", " :", "a :)"] + { + let _ = check(t); + } + // A long run of marks in one token: linear, not one token scan per mark. + let run = format!("mot{}", "?".repeat(200_000)); + assert_eq!(check(&run).len(), 1); + } +} diff --git a/crates/proof/src/fr/mod.rs b/crates/proof/src/fr/mod.rs new file mode 100644 index 000000000..541fcac0d --- /dev/null +++ b/crates/proof/src/fr/mod.rs @@ -0,0 +1,181 @@ +//! French proofing through the shared Language pack cache. +//! +//! A French locale remains [`ProofLang::Pack`]: dictionary selection, installation, reloads, +//! memory limits and hyphenation use the same paths as other packs. This module adds French +//! elisions, accent-oriented suggestions and conservative typography, including Quebec spacing. +//! No dictionary or hyphenation data is bundled here. + +pub mod grammar; +mod suggest; +#[cfg(test)] +#[allow(clippy::unwrap_used)] +pub(crate) mod test_dict; + +use crate::affix::AffixDict; +use crate::{Options, ProofLang}; + +pub use suggest::suggest_in; + +/// Words after whose elision a user-dictionary entry is accepted. Ordinary words and their +/// elisions are always decided by the dictionary (`l'arbre`, but not `l'arbres`). +const ELISIONS: &[&str] = &["l", "d", "j", "m", "t", "s", "n", "c", "qu", "jusqu", "lorsqu", "puisqu", "quoiqu", "presqu", "quelqu"]; + +/// Check French spelling in the installed France/generic pack, with the default options. +/// Regional callers should use [`crate::is_correct_in`] with their full locale. +pub fn is_correct(word: &str) -> bool { + crate::is_correct_in(word, ProofLang::from_tag(Some("fr-FR"))) +} + +/// French suggestions from the installed France/generic pack, best first, at most `max`. +/// Regional callers should use [`crate::suggest_in`] with their full locale. +pub fn suggest(word: &str, max: usize) -> Vec { + crate::suggest_in(word, max, ProofLang::from_tag(Some("fr-FR"))) +} + +/// Check against a supplied dictionary, without changing any installed pack or cache. +pub fn is_correct_with(d: &AffixDict, word: &str) -> bool { + check(d, &crate::composed(word), &Options::default()) +} + +pub(crate) fn check(d: &AffixDict, word: &str, opts: &Options) -> bool { + let Some(w) = crate::spelling::word_to_check(d, word, opts) else { return true }; + // A regional dictionary may store the curly apostrophe without ICONV. Honor that entry + // before the French ASCII-apostrophe fallback. + if known(d, w) { + return true; + } + let w = w.replace('’', "'"); + if known(d, &w) { + return true; + } + if let Some((head, tail)) = w.split_once('\'') + && ELISIONS.contains(&head.to_lowercase().as_str()) + && !tail.is_empty() + && !tail.contains('\'') + && crate::in_user_dictionary(&tail.to_lowercase()) + { + return true; + } + w.contains('-') && w.split('-').all(|p| !p.is_empty() && (p.chars().count() <= 1 || known(d, p))) +} + +fn known(d: &AffixDict, word: &str) -> bool { + d.check(word) || crate::in_user_dictionary(&word.to_lowercase()) +} + +#[cfg(test)] +#[allow(clippy::unwrap_used)] +mod tests { + use super::*; + + #[test] + fn original_french_words_and_elisions() { + let d = test_dict::dictionary(); + for word in [ + "maison", + "maisons", + "école", + "écoles", + "grand", + "grande", + "grands", + "grandes", + "aimer", + "aime", + "aimons", + "aiment", + "suis", + "est", + "sommes", + "sont", + "a", + "avons", + "ont", + "Paris", + "Montréal", + "œuvre", + "sœur", + "aujourd'hui", + "aujourd’hui", + "peut-être", + "arc-en-ciel", + "km", + "Maison", + "MAISON", + "SNCF", + "2026", + "très", + "rivière", + "l'arbre", + "l’arbre", + "L'arbre", + "d'enfants", + "l'homme", + "qu'elle", + "qu’il", + "j'aime", + "j’ai", + "d'avoir", + "l'école", + "jusqu'à", + "maison-école", + "est-il", + "a-t-il", + ] { + assert!(is_correct_with(&d, word), "{word}"); + } + for word in [ + "maisonn", + "ecole", + "arbrre", + "beaucoups", + "aimmer", + "soeur", + "Km", + "grandd", + "aim", + "l'hasard", + "l'chat", + "l'arbres", + "l'arbrre", + "qu'maison", + "maison-ecole", + "maison--école", + ] { + assert!(!is_correct_with(&d, word), "{word}"); + } + assert!(is_correct_with(&d, "e\u{301}cole")); + assert!(!is_correct_with(&d, "maison\u{338}"), "a trailing mark is part of the word"); + } + + #[test] + fn explicit_curly_apostrophe_without_iconv() { + let d = AffixDict::from_hunspell("SET UTF-8\n", "1\naujourd’hui\n", &[]).unwrap(); + assert!(is_correct_with(&d, "aujourd’hui")); + assert!(!is_correct_with(&d, "aujourd’huui")); + } + + #[test] + fn user_word_after_an_elision() { + let d = test_dict::dictionary(); + let word = "zxqmotadaptfr"; + assert!(!is_correct_with(&d, word) && !is_correct_with(&d, &format!("l'{word}"))); + crate::add_word(word); + assert!(is_correct_with(&d, word) && is_correct_with(&d, &format!("l'{word}")) && is_correct_with(&d, &format!("d’{word}"))); + assert!(!is_correct_with(&d, &format!("chat'{word}"))); + crate::remove_word(word); + } + + #[test] + fn options_and_missing_dictionary() { + let d = test_dict::dictionary(); + let defaults = Options::default(); + let strict = Options { ignore_uppercase: false, ignore_numbers: false, ..defaults }; + assert!(check(&d, "SNCF", &defaults) && check(&d, "mp3x", &defaults)); + assert!(!check(&d, "SNCF", &strict) && !check(&d, "mp3x", &strict)); + assert!(check(&d, "MAISON", &strict) && check(&d, "2026", &strict)); + for word in ["école", "l'arbre", "xqzv", "SNCF", ""] { + assert!(check(&AffixDict::default(), word, &strict)); + } + } +} diff --git a/crates/proof/src/fr/suggest.rs b/crates/proof/src/fr/suggest.rs new file mode 100644 index 000000000..86477d33f --- /dev/null +++ b/crates/proof/src/fr/suggest.rs @@ -0,0 +1,81 @@ +//! French tuning of the shared, bounded affix suggestion engine. + +use crate::affix::AffixDict; +use crate::affix_suggest::{Split, Tuning}; + +/// Short words often run into the next one (`et la`, `de Paris`, `pour moi`). +const LEADING_WORDS: &[&str] = &[ + "à", "a", "au", "aux", "de", "du", "des", "le", "la", "les", "un", "une", "et", "ou", "où", "en", "y", "ce", "se", "ne", "je", "tu", "il", "on", + "nous", "vous", "ils", "elle", "par", "pour", "sur", "sous", "dans", "avec", "sans", "chez", "vers", "entre", "très", "plus", "moins", "bien", + "pas", "que", "qui", "mais", "donc", "car", "si", "son", "sa", "ses", "mon", "ma", "mes", "ton", "ta", "tes", "est", "tout", "tous", "toute", + "comme", "quand", "puis", "encore", "déjà", "jamais", "toujours", +]; +/// Short words often run into the one before (`dis-moi` without the hyphen, `là-bas`, or a +/// dropped space: `pourmoi` → `pour moi`). +const TRAILING_WORDS: &[&str] = + &["moi", "toi", "lui", "elle", "nous", "vous", "eux", "le", "la", "les", "en", "y", "là", "ci", "il", "on", "ils", "elles", "est", "et"]; + +const TUNING: Tuning = Tuning { + split: Split::Near { leading: LEADING_WORDS, trailing: TRAILING_WORDS }, + alphabet: "esaitnrulodcpmévqfbghjàxèêyçôîâûùœ", + ..Tuning::DEFAULT +}; + +/// French suggestions from a supplied dictionary; keeps the writer's apostrophe and case. +/// Dictionary OCONV remains active for every other output conversion. +pub fn suggest_in(d: &AffixDict, word: &str, max: usize) -> Vec { + let word = crate::composed(word); + let curly = word.contains('’'); + let apostrophe = if curly { '’' } else { '\'' }; + let mut out = Vec::new(); + for text in crate::affix_suggest::suggest_in(d, &word, max, &TUNING) { + let styled: String = text.chars().map(|c| if c == '\'' || c == '’' { apostrophe } else { c }).collect(); + // A pack may spell only one apostrophe and have no ICONV. Keep its valid output + // rather than turn it back into the spelling mistake the caller is correcting. + let text = if styled.split(' ').all(|p| d.can_suggest_cased(p, p)) { styled } else { text }; + if text != word && !out.contains(&text) { + out.push(text); + } + } + out +} + +#[cfg(test)] +#[allow(clippy::unwrap_used)] +mod tests { + use super::*; + + #[test] + fn french_accents_confusions_splits_and_elisions() { + let d = super::super::test_dict::dictionary(); + for (typo, expected) in [ + ("ecole", "école"), + ("riviere", "rivière"), + ("soeur", "sœur"), + ("maisonn", "maison"), + ("pourmoi", "pour moi"), + ("l'arbrre", "l'arbre"), + ("l’arbrre", "l’arbre"), + ] { + let got = suggest_in(&d, typo, 8); + assert!(got.iter().any(|s| s == expected), "{typo}: {got:?}"); + } + assert!(suggest_in(&d, "e\u{301}cole", 4).iter().all(|s| s != "école")); + assert!(suggest_in(&d, "ecole", 0).is_empty()); + assert!(suggest_in(&d, &"a".repeat(41), 4).is_empty()); + } + + #[test] + fn curly_dictionary_without_iconv_remains_suggestible() { + let d = AffixDict::from_hunspell("SET UTF-8\n", "1\naujourd’hui\n", &[]).unwrap(); + assert!(suggest_in(&d, "aujourd’huui", 4).iter().any(|s| s == "aujourd’hui")); + assert!(suggest_in(&d, "aujourd'hui", 4).iter().any(|s| s == "aujourd’hui")); + } + + #[test] + fn output_conversion_preserves_typed_apostrophe() { + let d = AffixDict::from_hunspell("SET UTF-8\nICONV 1\nICONV ’ '\nOCONV 1\nOCONV ' ’\n", "1\nl'arbre\n", &[]).unwrap(); + assert!(suggest_in(&d, "l'arbrre", 4).iter().any(|s| s == "l'arbre")); + assert!(suggest_in(&d, "l’arbrre", 4).iter().any(|s| s == "l’arbre")); + } +} diff --git a/crates/proof/src/fr/test_dict.rs b/crates/proof/src/fr/test_dict.rs new file mode 100644 index 000000000..23637254c --- /dev/null +++ b/crates/proof/src/fr/test_dict.rs @@ -0,0 +1,234 @@ +//! A tiny synthetic French Hunspell dictionary for tests (written for these tests; not taken +//! from any real dictionary). Real dictionaries are installed on the system, never bundled. +//! +//! It exercises what the Dicollecte French dictionary uses: two-character flags (`FLAG long`), +//! stems that need an affix (`NEEDAFFIX`, with an empty suffix for the singular), elisions as +//! prefixes licensed by a suffix's continuation (`l'arbre` but not `l'arbres`), irregular verbs +//! through `FULLSTRIP` (`être` → `suis`), `KEEPCASE` (`km`), `NOSUGGEST` (`bah`), `ICONV` (`’` +//! read as `'`) and the +//! suggestion tables (`TRY`, `MAP` for accents, `REP` for common confusions). + +pub const AFF: &str = "SET UTF-8 +FLAG long +NEEDAFFIX () +KEEPCASE || +NOSUGGEST -- +FULLSTRIP +ICONV 1 +ICONV ’ ' +TRY esaitnrulodcpmévqfbghjàxèêyçôîâûùœ +MAP 6 +MAP aàâä +MAP eéèêë +MAP iîï +MAP oôö +MAP uùûü +MAP cç +REP 3 +REP oe œ +REP ph f +REP f ph +PFX L' Y 1 +PFX L' 0 l' [aàâeéèêiîoôuœh] +PFX D' Y 1 +PFX D' 0 d' [aàâeéèêiîoôuœh] +PFX Q' Y 1 +PFX Q' 0 qu' [aàâeéèêiîoôuœh] +PFX J' Y 1 +PFX J' 0 j' [aàâeéèêiîoôuœhy] +SFX S. Y 2 +SFX S. 0 0/L'D'Q' [^sxz] +SFX S. 0 s/D'Q' [^sxz] +SFX S= Y 2 +SFX S= 0 0 [^sxz] +SFX S= 0 s [^sxz] +SFX F. Y 4 +SFX F. 0 0/L'D'Q' . +SFX F. 0 e/L'D'Q' . +SFX F. 0 s/D'Q' . +SFX F. 0 es/D'Q' . +SFX Er Y 6 +SFX Er er er/D' er +SFX Er er e/J' er +SFX Er er es er +SFX Er er ons er +SFX Er er ez er +SFX Er er ent er +SFX Et N 7 +SFX Et être être être +SFX Et être suis être +SFX Et être es être +SFX Et être est être +SFX Et être sommes être +SFX Et être êtes être +SFX Et être sont être +SFX Av N 7 +SFX Av avoir avoir/D' avoir +SFX Av avoir ai/J' avoir +SFX Av avoir as avoir +SFX Av avoir a avoir +SFX Av avoir avons avoir +SFX Av avoir avez avoir +SFX Av avoir ont/Q' avoir +"; + +/// Stems (the count line first, as in Hunspell files). +pub const DIC: &str = "150 +maison/S.() +arbre/S.() +enfant/S.() +ami/S.() +amie/S.() +homme/S.() +école/S.() +café/S.() +chat/S.() +rivière/S.() +ville/S.() +heure/S.() +histoire/S.() +sœur/S.() +œuvre/S.() +photo/S.() +téléphone/S.() +année/S.() +vie/S.() +livre/S.() +table/S.() +porte/S.() +femme/S.() +garçon/S.() +fille/S.() +père/S.() +mère/S.() +langue/S.() +mot/S.() +texte/S.() +phrase/S.() +exemple/S.() +jour/S.() +nuit/S.() +monde/S.() +hasard/S=() +haricot/S=() +grand/F.() +petit/F.() +noir/F.() +aimer/Er() +parler/Er() +chanter/Er() +arriver/Er() +être/Et() +avoir/Av() +il/Q' +ils/Q' +elle/Q' +elles/Q' +on/Q'L' +un/D'Q'L' +une/D'Q'L' +en/Q'J' +y/J' +à/Q' +jusqu'à +aujourd'hui/D' +peut-être +arc-en-ciel +km/|| +bah/-- +Paris +France +Montréal +le +la +les +de +des +du +et +à +je +tu +nous +vous +que +qui +ne +pas +se +me +te +ce +ça +avec +pour +dans +sur +sous +très +près +beaucoup +si +oui +non +mais +ou +où +dit +demanda +quand +comme +plus +bien +tout +toujours +jamais +ici +là +alors +donc +aussi +encore +déjà +mon +ma +mes +son +sa +ses +notre +votre +leur +cette +ces +au +aux +par +entre +vers +chez +sans +moi +toi +lui +rien +chose +temps +fois +eau +voici +voilà +bonjour +merci +beau +belle +la +etc +M +p +"; + +/// The original synthetic fixture, parsed independently of the installed pack cache. +pub fn dictionary() -> crate::affix::AffixDict { + crate::affix::AffixDict::from_hunspell(AFF, DIC, &[]).unwrap() +} diff --git a/crates/proof/src/hunspell.rs b/crates/proof/src/hunspell.rs index 966ded72f..948d0e25b 100644 --- a/crates/proof/src/hunspell.rs +++ b/crates/proof/src/hunspell.rs @@ -754,9 +754,13 @@ mod tests { /// spec's default `~/.local/share` applies, and with no home there is no folder. #[test] fn xdg_data_home_follows_the_spec() { - let home = Path::new("/home/a"); - assert_eq!(xdg_data_home(Some("/data".into()), Some(home)), Some(PathBuf::from("/data"))); - assert_eq!(xdg_data_home(Some("/data".into()), None), Some(PathBuf::from("/data"))); + // On Windows a rooted path without a drive is not absolute. Keep the same + // absolute/relative contract on each platform instead of changing the loader. + let (home, data) = if cfg!(windows) { (r"C:\Users\a", r"C:\data") } else { ("/home/a", "/data") }; + let (home, data) = (Path::new(home), Path::new(data)); + assert!(data.is_absolute()); + assert_eq!(xdg_data_home(Some(data.as_os_str().into()), Some(home)), Some(data.to_path_buf())); + assert_eq!(xdg_data_home(Some(data.as_os_str().into()), None), Some(data.to_path_buf())); for xdg in [None, Some(""), Some("relative/data")] { assert_eq!(xdg_data_home(xdg.map(Into::into), Some(home)), Some(home.join(".local/share")), "{xdg:?}"); assert_eq!(xdg_data_home(xdg.map(Into::into), None), None, "{xdg:?}"); @@ -1010,7 +1014,12 @@ mod tests { assert!(load(&aff, &big).unwrap_err().contains("too large")); // A directory, and on Unix an endless device, are not dictionary files. (No clock: a // reader that read `/dev/zero` would never return, so the error itself is the proof.) - assert!(load(&aff, &dir).unwrap_err().contains("not a regular file")); + // Windows rejects directories in File::open, before the regular-file guard. The + // rejection is required everywhere; its diagnostic is platform-dependent. + let directory_error = load(&aff, &dir).unwrap_err(); + assert!(directory_error.contains(&dir.display().to_string()), "{directory_error}"); + #[cfg(unix)] + assert!(directory_error.contains("not a regular file"), "{directory_error}"); #[cfg(unix)] assert!(load(&aff, Path::new("/dev/zero")).unwrap_err().contains("not a regular file")); // Turkish reads through the same reader. diff --git a/crates/proof/src/lib.rs b/crates/proof/src/lib.rs index 3df6cd017..f0f33d007 100644 --- a/crates/proof/src/lib.rs +++ b/crates/proof/src/lib.rs @@ -42,6 +42,9 @@ //! existing English fallback. //! - **German** ([`ProofLang::De`]): hyphenation by `hyph-utf8`'s German patterns (reformed //! spelling, MIT); no spelling or grammar marks yet. +//! - **French** (a [`ProofLang::Pack`] locale; module [`fr`]): the pack dictionary with French +//! elisions and accent-oriented suggestions, plus conservative typography and basic checks. +//! France and Canada retain their regional tags; Quebec uses its own punctuation spacing. //! - **Any other language** ([`ProofLang::Pack`], module [`packs`]): spelling and suggestions //! from its Hunspell dictionary (an installed Language pack, the dictionaries folder or the //! system's) with default tuning, hyphenation from its pack, no grammar rules; without a @@ -73,6 +76,7 @@ pub mod dict; pub mod en_variants; mod english; pub mod es; +pub mod fr; pub mod hr; pub mod hunspell; pub mod hyphen; @@ -976,6 +980,7 @@ fn grammar_in(text: &str, lang: ProofLang, capital_first: bool) -> Vec { match lang { ProofLang::En => grammar_en(text, capital_first), ProofLang::EnGb | ProofLang::EnAu | ProofLang::EnCa => grammar_en(text, capital_first).into_iter().map(|i| Issue { lang, ..i }).collect(), + ProofLang::Pack(locale) if locale.primary() == "fr" => fr::grammar::check_in(text, lang), // `pt-pt` shares Portuguese's rules, its issues in its own language. _ => language(lang.built_in()) .map_or_else(Vec::new, |l| (l.grammar)(text, lang, capital_first).into_iter().map(|i| Issue { lang, ..i }).collect()), diff --git a/crates/proof/src/pack_lang.rs b/crates/proof/src/pack_lang.rs index 7b4d19315..8b6cea902 100644 --- a/crates/proof/src/pack_lang.rs +++ b/crates/proof/src/pack_lang.rs @@ -1,6 +1,7 @@ //! Proofing for any language by its locale ([`crate::ProofLang::Pack`]): its Hunspell dictionary (the //! dictionaries folder, then an installed Language pack, then the system's), read by the shared -//! affix engine, with default suggestion tuning and no grammar rules. +//! affix engine. Most use default suggestion tuning and no grammar rules; French locales add +//! the spelling tuning and conservative typography in [`crate::fr`] without a separate cache. //! //! The loaded dictionaries share a memory budget ([`MAX_LOADED_BYTES`], estimated from their //! files); the one used least recently goes first, but never one used during the current @@ -320,6 +321,9 @@ pub(crate) fn is_correct(word: &str, locale: PackLocale, opts: &crate::Options) if other_script(w, &scripts) { return true; } + if locale.primary() == "fr" { + return crate::fr::check(&d, w, opts); + } let known = |w: &str| d.check(w) || crate::in_user_dictionary(&w.to_lowercase()); if w.contains('-') && !known(w) { return w.split('-').all(|p| p.chars().count() <= 1 || known(p)); @@ -333,7 +337,7 @@ pub(crate) fn suggest(word: &str, max: usize, locale: PackLocale) -> Vec if d.is_empty() { return Vec::new(); } - crate::affix_suggest::suggest_in(&d, word, max, &Tuning::DEFAULT) + if locale.primary() == "fr" { crate::fr::suggest_in(&d, word, max) } else { crate::affix_suggest::suggest_in(&d, word, max, &Tuning::DEFAULT) } } /// The pack locales whose hyphenation patterns serve a [`crate::ProofLang::Pack`] language: the locale, diff --git a/crates/proof/tests/affix_compatibility.rs b/crates/proof/tests/affix_compatibility.rs new file mode 100644 index 000000000..6d09e5f90 --- /dev/null +++ b/crates/proof/tests/affix_compatibility.rs @@ -0,0 +1,92 @@ +//! Frozen public output from the pre-French shared affix engine at upstream +//! e6c5a701ddff5be16e266028168c70658aae39d9, using original synthetic fixtures. +//! Do not regenerate expectations from the new implementation: they establish the baseline. +//! Legacy WCAFF1 bytes remain frozen, but are explicitly refused by the WCAFF2 engine. + +use craft_proof::affix::{AffixDict, capitalize}; +use std::fmt::Write; + +#[path = "fixtures/affix_compatibility_cases.rs"] +mod fixtures; + +fn snapshot(case: &fixtures::Case, dict: &AffixDict) -> String { + let mut out = format!("{}\nlen={} rules={}\n", case.name, dict.len(), dict.rule_count()); + writeln!(out, "try={:?} key={:?} map={:?} rep={:?} comments={:?}", dict.try_chars(), dict.key(), dict.map(), dict.rep(), dict.comments()) + .unwrap(); + let mut stems: Vec<_> = dict.stems().collect(); + stems.sort_unstable(); + for stem in &stems { + let mut forms = dict.forms(stem); + forms.sort_unstable(); + forms.dedup(); + writeln!(out, "forms {stem:?}: {forms:?}").unwrap(); + } + let mut probes: Vec = case.probes.iter().map(|word| (*word).to_string()).collect(); + for stem in stems { + probes.extend(dict.forms(stem)); + } + let originals = probes.clone(); + for word in originals { + probes.extend([word.to_uppercase(), word.to_lowercase(), capitalize(&word)]); + } + probes.sort_unstable(); + probes.dedup(); + for word in probes { + writeln!( + out, + "{word:?}: contains={} check={} suggest={} raw_suggest={}", + dict.contains(&word), + dict.check(&word), + dict.can_suggest(&word), + dict.contains_suggestible(&word) + ) + .unwrap(); + } + out +} + +#[test] +fn non_french_affix_outputs_match_pre_french_baseline() { + let expected = include_str!("fixtures/affix_compatibility.expected"); + let mut actual = String::new(); + for case in fixtures::cases() { + let dict = AffixDict::from_hunspell(&case.aff, &case.dic, &["original compatibility fixture"]).unwrap(); + let result = snapshot(&case, &dict); + let restored = AffixDict::from_bytes(&dict.to_bytes().unwrap()).unwrap(); + assert_eq!(snapshot(&case, &restored), result, "current compact round trip: {}", case.name); + actual.push_str(&result); + } + // craft-libs 55332dd predates this adaptation and supports a prefix plus a two-suffix + // chain (native test affix::tests::a_prefix_with_a_suffix_chain). The old Indonesian + // fixture's bermain + kan + lah therefore became a word, in these three cases only. + // Keep the frozen historical file untouched and assert every explicit transition once. + let mut expected = expected.to_string(); + let mut transitions = 0; + for word in ["BERMAINKANLAH", "Bermainkanlah", "bermainkanlah"] { + let before = format!("{word:?}: contains=false check=false suggest=false raw_suggest=false\n"); + let after = if word == "bermainkanlah" { + format!("{word:?}: contains=true check=true suggest=true raw_suggest=true\n") + } else { + format!("{word:?}: contains=false check=true suggest=true raw_suggest=false\n") + }; + assert_eq!(expected.matches(&before).count(), 1, "one historical observable: {word}"); + expected = expected.replacen(&before, &after, 1); + transitions += 1; + } + assert_eq!(transitions, 3, "the documented upstream exception has exactly three observables"); + assert_eq!(actual, expected, "shared engine output changed beyond the explicit upstream chain exception"); +} + +#[test] +fn legacy_compact_data_is_refused_without_reinterpreting_homonyms() { + let encoded = include_str!("fixtures/affix_compatibility.compact"); + let cases = fixtures::cases(); + let lines: Vec<_> = encoded.lines().collect(); + assert_eq!(lines.len(), cases.len()); + for (case, hex) in cases.iter().zip(lines) { + assert_eq!(hex.len() % 2, 0); + let bytes: Vec<_> = + hex.as_bytes().as_chunks::<2>().0.iter().map(|pair| u8::from_str_radix(std::str::from_utf8(pair).unwrap(), 16).unwrap()).collect(); + assert!(AffixDict::from_bytes(&bytes).is_err(), "WCAFF1 must be regenerated as WCAFF2: {}", case.name); + } +} diff --git a/crates/proof/tests/fixtures/affix_compatibility.compact b/crates/proof/tests/fixtures/affix_compatibility.compact new file mode 100644 index 000000000..5c8c627de --- /dev/null +++ b/crates/proof/tests/fixtures/affix_compatibility.compact @@ -0,0 +1,7 @@ +4d8bc10a825014446b7bbf62a07dd62744e5ae120b2ca2e02aafb8bceac54b295d067e91db76ea7f2516d16666ce30138c47ae3ba41e8c95a35cf884c89caf1c4b282789531ce4112756d1cadf809591a47e6a4bb39107aef2d64d5924e44f3dd42fd8ac4d09ca823c778d101b0c7011853e2d1be696536cf7e9ee57280dcd8dfe2dd4f97b88306faa2a0753b0f0274bea046c6f19dfd989a8a34dec70485d6b3e7c157553da617a03 +1d8c410e82301045bb9e534ce2deea11a8d8c48d10304196058b990418534aa25ec7852770e9aa17b3b27c79ffbf6a9768bd8515b2a32b8da6c796879bf1d4504ffe811dddfdec2c9c8a1a8d259ec33bbcc2077456a8439aee8f5556a418be90eb33e658e3069dc535941193888c462ae485d5a2a768ffa71244c32379968902d19a290e4174e6699dcc41d0308f17962aa67f +1dc7410ac2301005d0ace7141fdc1b3d42aa64a9a15d5497d392ca40eac818416f6fe8eaf1c65388f1483ba8c9439e5c30ebfae22a9314a93f2cf2ad1fcb94e20d09771c60823d0dada15521d06d1d2e6064308dd7fe3c90eb75657233bfd97789dcc2967db3c864ea03fd01 +1d8a3d0a02311406b77ea7f8c0dee8114437651453ac220a51a33cc88fc408e62c9e451bf55e1bb6199861baf94cca298d10135f39188753f43793f9c88e73c1859ff9912cade4060a5b4c102cc6a4abea410b7687b21f425b0f83df0b86bae57aa1a9f1ce9cbf6fa1a8b9e714bd50b51551f1ffd860444b3d +1d8c310e82401444b1dd53fcc45ef408282cb11008ab414b346a3641310413ed0cad95072034f450488c46f10a7f6fe4aeddcc9bcc0b4606a503d28538e15bbe0f2358c5bb4398f2258f787a860d3fa5c7644d268607d8881ba1ae3f1c9ba6e504ae6f0296c471d9ccb62d3605cc8947e780052ca00ff8c1067a842952fd89b8caae6e8c6878c716df3a56a4f3c01abfe222ed998ea5222f6c552e64d64426e7a794d53ae612fc00 +2dc84b0e8230100050d6738a49dc8b1e0114589800a11864398522c3a768a951120f2f212edf2b4e5e181e618793e13b6b1ab09ac60759963cb05db0e18f7d1905795622c9aa56dc6bb804253edfcad8e54b73dd4016a45877d8419c886b140522c718d2f08629967840a90cee41acf636f7a45dff3ffe3603b5ab8b243b0b702455e47ae08cc4daf552700cb534f37a31fc00 +35c7b98e82600045e1a9790a92e967dc97d20df71515b51345455114c1ed6d2616c6c2cad8d8fe2f36e67269cec9a7e5328a1296be65db31e7e6666cc9137bbd1dbba66e5aa67b9667e6c9f51c435295813c961b72e8d31f4887746a024da82934a50cc8a066d08c9a43736a012d281332a925b4a456d08ab2208b5a436b6a036d281bb2a92db4a576d08e722087da437bca855cca833cea001da82374a44ed0893a4367ea025da80c94a1b25096ca41392a0fe5a90254a01448a18a50912a4125aa0c95a90a54a1aa5095aa4135aa0ed5a906d4a09a50936a412daa0db5a90ed4a15448a5ba5097ea413daa0ff5290dd2a80134a086d0901a41232a0485a83014a62250848a42512a06c5a83814a71250824a42492a05a5a83494a6c41ff8197df77d0ffcf0fd08fcf4fd0cfcf6fd0e7cf37d0b7cf57d0dfcf2fdfa586b76f2aaf4657bae63ff8a97f475301cddfe0d8523d1583c914ca533d95cbea0144be54ab5566f345bed8edaedf5b5c17034d6275363365f98cb95b5ded8db9db377bdc3f174be883f71153771170ff1142ff196fe01 diff --git a/crates/proof/tests/fixtures/affix_compatibility.expected b/crates/proof/tests/fixtures/affix_compatibility.expected new file mode 100644 index 000000000..8fe3a9929 --- /dev/null +++ b/crates/proof/tests/fixtures/affix_compatibility.expected @@ -0,0 +1,497 @@ +pl: conditional strip, prefix cross products, diacritics +len=4 rules=5 +try="aeoiułkr" key="" map=[['a', 'ą'], ['o', 'ó', 'u']] rep=[("ż", "rz"), ("u", "ó")] comments=["original compatibility fixture"] +forms "Warszawa": ["Warszawa", "Warszawą"] +forms "kot": ["kot", "kotem", "koty", "niekot", "niekotem", "niekoty"] +forms "krowa": ["krowa", "krową"] +forms "piesek": ["piesek", "piesekem", "pieseky", "pieska"] +"": contains=false check=false suggest=false raw_suggest=false +"KOT": contains=false check=true suggest=true raw_suggest=false +"KOTEM": contains=false check=true suggest=true raw_suggest=false +"KOTY": contains=false check=true suggest=true raw_suggest=false +"KOTĄ": contains=false check=false suggest=false raw_suggest=false +"KROWA": contains=false check=true suggest=true raw_suggest=false +"KROWY": contains=false check=false suggest=false raw_suggest=false +"KROWĄ": contains=false check=true suggest=true raw_suggest=false +"Kot": contains=false check=true suggest=true raw_suggest=false +"Kotem": contains=false check=true suggest=true raw_suggest=false +"Koty": contains=false check=true suggest=true raw_suggest=false +"Kotą": contains=false check=false suggest=false raw_suggest=false +"Krowa": contains=false check=true suggest=true raw_suggest=false +"Krowy": contains=false check=false suggest=false raw_suggest=false +"Krową": contains=false check=true suggest=true raw_suggest=false +"NIE": contains=false check=false suggest=false raw_suggest=false +"NIEKOT": contains=false check=true suggest=true raw_suggest=false +"NIEKOTEM": contains=false check=true suggest=true raw_suggest=false +"NIEKOTY": contains=false check=true suggest=true raw_suggest=false +"NIEPIESKA": contains=false check=false suggest=false raw_suggest=false +"Nie": contains=false check=false suggest=false raw_suggest=false +"Niekot": contains=false check=true suggest=true raw_suggest=false +"Niekotem": contains=false check=true suggest=true raw_suggest=false +"Niekoty": contains=false check=true suggest=true raw_suggest=false +"Niepieska": contains=false check=false suggest=false raw_suggest=false +"PIESEK": contains=false check=true suggest=true raw_suggest=false +"PIESEKA": contains=false check=false suggest=false raw_suggest=false +"PIESEKEM": contains=false check=true suggest=true raw_suggest=false +"PIESEKY": contains=false check=true suggest=true raw_suggest=false +"PIESKA": contains=false check=true suggest=true raw_suggest=false +"Piesek": contains=false check=true suggest=true raw_suggest=false +"Pieseka": contains=false check=false suggest=false raw_suggest=false +"Piesekem": contains=false check=true suggest=true raw_suggest=false +"Pieseky": contains=false check=true suggest=true raw_suggest=false +"Pieska": contains=false check=true suggest=true raw_suggest=false +"WARSZAWA": contains=false check=true suggest=true raw_suggest=false +"WARSZAWĄ": contains=false check=true suggest=true raw_suggest=false +"Warszawa": contains=true check=true suggest=true raw_suggest=true +"Warszawą": contains=true check=true suggest=true raw_suggest=true +"kot": contains=true check=true suggest=true raw_suggest=true +"kotem": contains=true check=true suggest=true raw_suggest=true +"koty": contains=true check=true suggest=true raw_suggest=true +"kotą": contains=false check=false suggest=false raw_suggest=false +"krowa": contains=true check=true suggest=true raw_suggest=true +"krowy": contains=false check=false suggest=false raw_suggest=false +"krową": contains=true check=true suggest=true raw_suggest=true +"nie": contains=false check=false suggest=false raw_suggest=false +"niekot": contains=true check=true suggest=true raw_suggest=true +"niekotem": contains=true check=true suggest=true raw_suggest=true +"niekoty": contains=true check=true suggest=true raw_suggest=true +"niepieska": contains=false check=false suggest=false raw_suggest=false +"piesek": contains=true check=true suggest=true raw_suggest=true +"pieseka": contains=false check=false suggest=false raw_suggest=false +"piesekem": contains=true check=true suggest=true raw_suggest=true +"pieseky": contains=true check=true suggest=true raw_suggest=true +"pieska": contains=true check=true suggest=true raw_suggest=true +"warszawa": contains=false check=false suggest=false raw_suggest=false +"warszawą": contains=false check=false suggest=false raw_suggest=false +pt: UTF-8 flags, forbidden words, two suffixes +len=4 rules=3 +try="aeiouçãõ" key="" map=[] rep=[] comments=["original compatibility fixture"] +forms "bonito": ["bonita", "bonitas", "bonito", "bonitos"] +forms "casa": ["casa", "casas"] +forms "fazer": ["fazer", "refazer"] +forms "imundo": [] +"BONITA": contains=false check=true suggest=true raw_suggest=false +"BONITAS": contains=false check=true suggest=true raw_suggest=false +"BONITASS": contains=false check=false suggest=false raw_suggest=false +"BONITO": contains=false check=true suggest=true raw_suggest=false +"BONITOS": contains=false check=true suggest=true raw_suggest=false +"Bonita": contains=false check=true suggest=true raw_suggest=false +"Bonitas": contains=false check=true suggest=true raw_suggest=false +"Bonitass": contains=false check=false suggest=false raw_suggest=false +"Bonito": contains=false check=true suggest=true raw_suggest=false +"Bonitos": contains=false check=true suggest=true raw_suggest=false +"CASA": contains=false check=true suggest=true raw_suggest=false +"CASAA": contains=false check=false suggest=false raw_suggest=false +"CASAS": contains=false check=true suggest=true raw_suggest=false +"Casa": contains=false check=true suggest=true raw_suggest=false +"Casaa": contains=false check=false suggest=false raw_suggest=false +"Casas": contains=false check=true suggest=true raw_suggest=false +"FAZER": contains=false check=true suggest=true raw_suggest=false +"Fazer": contains=false check=true suggest=true raw_suggest=false +"IMUNDO": contains=false check=false suggest=false raw_suggest=false +"IMUNDOS": contains=false check=false suggest=false raw_suggest=false +"Imundo": contains=false check=false suggest=false raw_suggest=false +"Imundos": contains=false check=false suggest=false raw_suggest=false +"RECASAS": contains=false check=false suggest=false raw_suggest=false +"REFAZER": contains=false check=true suggest=true raw_suggest=false +"Recasas": contains=false check=false suggest=false raw_suggest=false +"Refazer": contains=false check=true suggest=true raw_suggest=false +"bonita": contains=true check=true suggest=true raw_suggest=true +"bonitas": contains=true check=true suggest=true raw_suggest=true +"bonitass": contains=false check=false suggest=false raw_suggest=false +"bonito": contains=true check=true suggest=true raw_suggest=true +"bonitos": contains=true check=true suggest=true raw_suggest=true +"casa": contains=true check=true suggest=true raw_suggest=true +"casaa": contains=false check=false suggest=false raw_suggest=false +"casas": contains=true check=true suggest=true raw_suggest=true +"fazer": contains=true check=true suggest=true raw_suggest=true +"imundo": contains=false check=false suggest=false raw_suggest=false +"imundos": contains=false check=false suggest=false raw_suggest=false +"recasas": contains=false check=false suggest=false raw_suggest=false +"refazer": contains=true check=true suggest=true raw_suggest=true +it: stripping, non-crossing suffix, proper-name casing +len=4 rules=3 +try="" key="" map=[] rep=[] comments=["original compatibility fixture"] +forms "Roma": ["Roma"] +forms "casa": ["casa", "case", "ricasa"] +forms "fare": ["fare", "rifare"] +forms "libro": ["libri", "libro"] +"": contains=false check=false suggest=false raw_suggest=false +"CASA": contains=false check=true suggest=true raw_suggest=false +"CASE": contains=false check=true suggest=true raw_suggest=false +"Casa": contains=false check=true suggest=true raw_suggest=false +"Case": contains=false check=true suggest=true raw_suggest=false +"FARE": contains=false check=true suggest=true raw_suggest=false +"Fare": contains=false check=true suggest=true raw_suggest=false +"LIBRI": contains=false check=true suggest=true raw_suggest=false +"LIBRO": contains=false check=true suggest=true raw_suggest=false +"LIBROS": contains=false check=false suggest=false raw_suggest=false +"Libri": contains=false check=true suggest=true raw_suggest=false +"Libro": contains=false check=true suggest=true raw_suggest=false +"Libros": contains=false check=false suggest=false raw_suggest=false +"R ILIBRI": contains=false check=false suggest=false raw_suggest=false +"R ilibri": contains=false check=false suggest=false raw_suggest=false +"RICAS A": contains=false check=false suggest=false raw_suggest=false +"RICASA": contains=false check=true suggest=true raw_suggest=false +"RICASE": contains=false check=false suggest=false raw_suggest=false +"RIFARE": contains=false check=true suggest=true raw_suggest=false +"ROMA": contains=false check=true suggest=true raw_suggest=false +"Ricas a": contains=false check=false suggest=false raw_suggest=false +"Ricasa": contains=false check=true suggest=true raw_suggest=false +"Ricase": contains=false check=false suggest=false raw_suggest=false +"Rifare": contains=false check=true suggest=true raw_suggest=false +"Roma": contains=true check=true suggest=true raw_suggest=true +"casa": contains=true check=true suggest=true raw_suggest=true +"case": contains=true check=true suggest=true raw_suggest=true +"fare": contains=true check=true suggest=true raw_suggest=true +"libri": contains=true check=true suggest=true raw_suggest=true +"libro": contains=true check=true suggest=true raw_suggest=true +"libros": contains=false check=false suggest=false raw_suggest=false +"r ilibri": contains=false check=false suggest=false raw_suggest=false +"ricas a": contains=false check=false suggest=false raw_suggest=false +"ricasa": contains=true check=true suggest=true raw_suggest=true +"ricase": contains=false check=false suggest=false raw_suggest=false +"rifare": contains=true check=true suggest=true raw_suggest=true +"roma": contains=false check=false suggest=false raw_suggest=false +cs: negated conditions and shared Unicode stems +len=4 rules=3 +try="" key="" map=[] rep=[] comments=["original compatibility fixture"] +forms "mladý": ["mladý", "nemladý"] +forms "strom": ["nestrom", "nestromy", "strom", "stromy"] +forms "y": ["y"] +forms "žena": ["žena", "ženě"] +"MLADÝ": contains=false check=true suggest=true raw_suggest=false +"MLADÝY": contains=false check=false suggest=false raw_suggest=false +"Mladý": contains=false check=true suggest=true raw_suggest=false +"Mladýy": contains=false check=false suggest=false raw_suggest=false +"NEMLADÝ": contains=false check=true suggest=true raw_suggest=false +"NESTROM": contains=false check=true suggest=true raw_suggest=false +"NESTROMY": contains=false check=true suggest=true raw_suggest=false +"NEŽENĚ": contains=false check=false suggest=false raw_suggest=false +"Nemladý": contains=false check=true suggest=true raw_suggest=false +"Nestrom": contains=false check=true suggest=true raw_suggest=false +"Nestromy": contains=false check=true suggest=true raw_suggest=false +"Neženě": contains=false check=false suggest=false raw_suggest=false +"STROM": contains=false check=true suggest=true raw_suggest=false +"STROMY": contains=false check=true suggest=true raw_suggest=false +"Strom": contains=false check=true suggest=true raw_suggest=false +"Stromy": contains=false check=true suggest=true raw_suggest=false +"Y": contains=false check=true suggest=true raw_suggest=false +"YY": contains=false check=false suggest=false raw_suggest=false +"Yy": contains=false check=false suggest=false raw_suggest=false +"mladý": contains=true check=true suggest=true raw_suggest=true +"mladýy": contains=false check=false suggest=false raw_suggest=false +"nemladý": contains=true check=true suggest=true raw_suggest=true +"nestrom": contains=true check=true suggest=true raw_suggest=true +"nestromy": contains=true check=true suggest=true raw_suggest=true +"neženě": contains=false check=false suggest=false raw_suggest=false +"strom": contains=true check=true suggest=true raw_suggest=true +"stromy": contains=true check=true suggest=true raw_suggest=true +"y": contains=true check=true suggest=true raw_suggest=true +"yy": contains=false check=false suggest=false raw_suggest=false +"ŽENA": contains=false check=true suggest=true raw_suggest=false +"ŽENY": contains=false check=false suggest=false raw_suggest=false +"ŽENĚ": contains=false check=true suggest=true raw_suggest=false +"Žena": contains=false check=true suggest=true raw_suggest=false +"Ženy": contains=false check=false suggest=false raw_suggest=false +"Ženě": contains=false check=true suggest=true raw_suggest=false +"žena": contains=true check=true suggest=true raw_suggest=true +"ženy": contains=false check=false suggest=false raw_suggest=false +"ženě": contains=true check=true suggest=true raw_suggest=true +ru: Cyrillic flags and suggestions exclusion +len=4 rules=2 +try="" key="" map=[['е', 'ё']] rep=[] comments=["original compatibility fixture"] +forms "дом": ["дом", "домы"] +forms "запрет": [] +forms "кот": ["кот", "коты", "некот", "некоты"] +forms "тайна": ["тайна", "тайнаы"] +"ДОМ": contains=false check=true suggest=true raw_suggest=false +"ДОМЫ": contains=false check=true suggest=true raw_suggest=false +"Дом": contains=false check=true suggest=true raw_suggest=false +"Домы": contains=false check=true suggest=true raw_suggest=false +"ЗАПРЕТ": contains=false check=false suggest=false raw_suggest=false +"ЗАПРЕТЫ": contains=false check=false suggest=false raw_suggest=false +"Запрет": contains=false check=false suggest=false raw_suggest=false +"Запреты": contains=false check=false suggest=false raw_suggest=false +"КОТ": contains=false check=true suggest=true raw_suggest=false +"КОТЫ": contains=false check=true suggest=true raw_suggest=false +"КОт": contains=false check=false suggest=false raw_suggest=false +"Кот": contains=false check=true suggest=true raw_suggest=false +"Коты": contains=false check=true suggest=true raw_suggest=false +"НЕДОМЫ": contains=false check=false suggest=false raw_suggest=false +"НЕКОТ": contains=false check=true suggest=true raw_suggest=false +"НЕКОТЫ": contains=false check=true suggest=true raw_suggest=false +"Недомы": contains=false check=false suggest=false raw_suggest=false +"Некот": contains=false check=true suggest=true raw_suggest=false +"Некоты": contains=false check=true suggest=true raw_suggest=false +"ТАЙНА": contains=false check=true suggest=false raw_suggest=false +"ТАЙНАЫ": contains=false check=true suggest=false raw_suggest=false +"Тайна": contains=false check=true suggest=false raw_suggest=false +"Тайнаы": contains=false check=true suggest=false raw_suggest=false +"дом": contains=true check=true suggest=true raw_suggest=true +"домы": contains=true check=true suggest=true raw_suggest=true +"запрет": contains=false check=false suggest=false raw_suggest=false +"запреты": contains=false check=false suggest=false raw_suggest=false +"кОт": contains=false check=false suggest=false raw_suggest=false +"кот": contains=true check=true suggest=true raw_suggest=true +"коты": contains=true check=true suggest=true raw_suggest=true +"недомы": contains=false check=false suggest=false raw_suggest=false +"некот": contains=true check=true suggest=true raw_suggest=true +"некоты": contains=true check=true suggest=true raw_suggest=true +"тайна": contains=true check=true suggest=false raw_suggest=false +"тайнаы": contains=true check=true suggest=false raw_suggest=false +id: continuation and NOSUGGEST through derivations +len=3 rules=3 +try="abcdeikn" key="qwerty|asdf" map=[] rep=[("dj", "j")] comments=["original compatibility fixture"] +forms "baca": ["baca", "bacakan", "bacakanlah"] +forms "main": ["bermain", "bermainkan", "main", "mainkan", "mainkanlah"] +forms "rahasia": ["rahasia", "rahasiakan", "rahasiakanlah"] +"BACA": contains=false check=true suggest=true raw_suggest=false +"BACAKAN": contains=false check=true suggest=true raw_suggest=false +"BACAKANLAH": contains=false check=true suggest=true raw_suggest=false +"BERBACA": contains=false check=false suggest=false raw_suggest=false +"BERMAIN": contains=false check=true suggest=true raw_suggest=false +"BERMAINKAN": contains=false check=true suggest=true raw_suggest=false +"BERMAINKANLAH": contains=false check=false suggest=false raw_suggest=false +"Baca": contains=false check=true suggest=true raw_suggest=false +"Bacakan": contains=false check=true suggest=true raw_suggest=false +"Bacakanlah": contains=false check=true suggest=true raw_suggest=false +"Berbaca": contains=false check=false suggest=false raw_suggest=false +"Bermain": contains=false check=true suggest=true raw_suggest=false +"Bermainkan": contains=false check=true suggest=true raw_suggest=false +"Bermainkanlah": contains=false check=false suggest=false raw_suggest=false +"MAIN": contains=false check=true suggest=true raw_suggest=false +"MAINKAN": contains=false check=true suggest=true raw_suggest=false +"MAINKANLAH": contains=false check=true suggest=true raw_suggest=false +"MAINKANLAHLAH": contains=false check=false suggest=false raw_suggest=false +"MAINLAH": contains=false check=false suggest=false raw_suggest=false +"Main": contains=false check=true suggest=true raw_suggest=false +"Mainkan": contains=false check=true suggest=true raw_suggest=false +"Mainkanlah": contains=false check=true suggest=true raw_suggest=false +"Mainkanlahlah": contains=false check=false suggest=false raw_suggest=false +"Mainlah": contains=false check=false suggest=false raw_suggest=false +"RAHASIA": contains=false check=true suggest=false raw_suggest=false +"RAHASIAKAN": contains=false check=true suggest=false raw_suggest=false +"RAHASIAKANLAH": contains=false check=true suggest=false raw_suggest=false +"Rahasia": contains=false check=true suggest=false raw_suggest=false +"Rahasiakan": contains=false check=true suggest=false raw_suggest=false +"Rahasiakanlah": contains=false check=true suggest=false raw_suggest=false +"baca": contains=true check=true suggest=true raw_suggest=true +"bacakan": contains=true check=true suggest=true raw_suggest=true +"bacakanlah": contains=true check=true suggest=true raw_suggest=true +"berbaca": contains=false check=false suggest=false raw_suggest=false +"bermain": contains=true check=true suggest=true raw_suggest=true +"bermainkan": contains=true check=true suggest=true raw_suggest=true +"bermainkanlah": contains=false check=false suggest=false raw_suggest=false +"main": contains=true check=true suggest=true raw_suggest=true +"mainkan": contains=true check=true suggest=true raw_suggest=true +"mainkanlah": contains=true check=true suggest=true raw_suggest=true +"mainkanlahlah": contains=false check=false suggest=false raw_suggest=false +"mainlah": contains=false check=false suggest=false raw_suggest=false +"rahasia": contains=true check=true suggest=false raw_suggest=false +"rahasiakan": contains=true check=true suggest=false raw_suggest=false +"rahasiakanlah": contains=true check=true suggest=false raw_suggest=false +pt-sized: 70 distinct flags across the old u128 boundary +len=2 rules=70 +try="" key="" map=[] rep=[] comments=["original compatibility fixture"] +forms "outro": ["outro", "outroõ"] +forms "verbo": ["verbo", "verbo1", "verbo2", "verbo3", "verbo4", "verbo5", "verbo6", "verbo7", "verbo8", "verbo9", "verboA", "verboB", "verboC", "verboD", "verboE", "verboF", "verboG", "verboH", "verboI", "verboJ", "verboK", "verboL", "verboM", "verboN", "verboO", "verboP", "verboQ", "verboR", "verboS", "verboT", "verboU", "verboV", "verboW", "verboX", "verboY", "verboZ", "verboa", "verbob", "verboc", "verbod", "verboe", "verbof", "verbog", "verboh", "verboi", "verboj", "verbok", "verbol", "verbom", "verbon", "verboo", "verbop", "verboq", "verbor", "verbos", "verbot", "verbou", "verbov", "verbow", "verbox", "verboy", "verboz", "verboá", "verboã", "verboç", "verboé", "verboí", "verboó", "verboõ", "verboú"] +"OUTRO": contains=false check=true suggest=true raw_suggest=false +"OUTROA": contains=false check=false suggest=false raw_suggest=false +"OUTROÕ": contains=false check=true suggest=true raw_suggest=false +"Outro": contains=false check=true suggest=true raw_suggest=false +"Outroa": contains=false check=false suggest=false raw_suggest=false +"Outroõ": contains=false check=true suggest=true raw_suggest=false +"VERBO": contains=false check=true suggest=true raw_suggest=false +"VERBO0": contains=false check=false suggest=false raw_suggest=false +"VERBO1": contains=false check=true suggest=true raw_suggest=false +"VERBO2": contains=false check=true suggest=true raw_suggest=false +"VERBO3": contains=false check=true suggest=true raw_suggest=false +"VERBO4": contains=false check=true suggest=true raw_suggest=false +"VERBO5": contains=false check=true suggest=true raw_suggest=false +"VERBO6": contains=false check=true suggest=true raw_suggest=false +"VERBO7": contains=false check=true suggest=true raw_suggest=false +"VERBO8": contains=false check=true suggest=true raw_suggest=false +"VERBO9": contains=false check=true suggest=true raw_suggest=false +"VERBOA": contains=false check=true suggest=true raw_suggest=false +"VERBOB": contains=false check=true suggest=true raw_suggest=false +"VERBOC": contains=false check=true suggest=true raw_suggest=false +"VERBOD": contains=false check=true suggest=true raw_suggest=false +"VERBOE": contains=false check=true suggest=true raw_suggest=false +"VERBOF": contains=false check=true suggest=true raw_suggest=false +"VERBOG": contains=false check=true suggest=true raw_suggest=false +"VERBOH": contains=false check=true suggest=true raw_suggest=false +"VERBOI": contains=false check=true suggest=true raw_suggest=false +"VERBOJ": contains=false check=true suggest=true raw_suggest=false +"VERBOK": contains=false check=true suggest=true raw_suggest=false +"VERBOL": contains=false check=true suggest=true raw_suggest=false +"VERBOM": contains=false check=true suggest=true raw_suggest=false +"VERBON": contains=false check=true suggest=true raw_suggest=false +"VERBOO": contains=false check=true suggest=true raw_suggest=false +"VERBOP": contains=false check=true suggest=true raw_suggest=false +"VERBOQ": contains=false check=true suggest=true raw_suggest=false +"VERBOR": contains=false check=true suggest=true raw_suggest=false +"VERBOS": contains=false check=true suggest=true raw_suggest=false +"VERBOSS": contains=false check=false suggest=false raw_suggest=false +"VERBOT": contains=false check=true suggest=true raw_suggest=false +"VERBOU": contains=false check=true suggest=true raw_suggest=false +"VERBOV": contains=false check=true suggest=true raw_suggest=false +"VERBOW": contains=false check=true suggest=true raw_suggest=false +"VERBOX": contains=false check=true suggest=true raw_suggest=false +"VERBOY": contains=false check=true suggest=true raw_suggest=false +"VERBOZ": contains=false check=true suggest=true raw_suggest=false +"VERBOÁ": contains=false check=true suggest=true raw_suggest=false +"VERBOÃ": contains=false check=true suggest=true raw_suggest=false +"VERBOÇ": contains=false check=true suggest=true raw_suggest=false +"VERBOÉ": contains=false check=true suggest=true raw_suggest=false +"VERBOÍ": contains=false check=true suggest=true raw_suggest=false +"VERBOÓ": contains=false check=true suggest=true raw_suggest=false +"VERBOÕ": contains=false check=true suggest=true raw_suggest=false +"VERBOÚ": contains=false check=true suggest=true raw_suggest=false +"Verbo": contains=false check=true suggest=true raw_suggest=false +"Verbo0": contains=false check=false suggest=false raw_suggest=false +"Verbo1": contains=false check=true suggest=true raw_suggest=false +"Verbo2": contains=false check=true suggest=true raw_suggest=false +"Verbo3": contains=false check=true suggest=true raw_suggest=false +"Verbo4": contains=false check=true suggest=true raw_suggest=false +"Verbo5": contains=false check=true suggest=true raw_suggest=false +"Verbo6": contains=false check=true suggest=true raw_suggest=false +"Verbo7": contains=false check=true suggest=true raw_suggest=false +"Verbo8": contains=false check=true suggest=true raw_suggest=false +"Verbo9": contains=false check=true suggest=true raw_suggest=false +"VerboA": contains=false check=false suggest=false raw_suggest=false +"VerboB": contains=false check=false suggest=false raw_suggest=false +"VerboC": contains=false check=false suggest=false raw_suggest=false +"VerboD": contains=false check=false suggest=false raw_suggest=false +"VerboE": contains=false check=false suggest=false raw_suggest=false +"VerboF": contains=false check=false suggest=false raw_suggest=false +"VerboG": contains=false check=false suggest=false raw_suggest=false +"VerboH": contains=false check=false suggest=false raw_suggest=false +"VerboI": contains=false check=false suggest=false raw_suggest=false +"VerboJ": contains=false check=false suggest=false raw_suggest=false +"VerboK": contains=false check=false suggest=false raw_suggest=false +"VerboL": contains=false check=false suggest=false raw_suggest=false +"VerboM": contains=false check=false suggest=false raw_suggest=false +"VerboN": contains=false check=false suggest=false raw_suggest=false +"VerboO": contains=false check=false suggest=false raw_suggest=false +"VerboP": contains=false check=false suggest=false raw_suggest=false +"VerboQ": contains=false check=false suggest=false raw_suggest=false +"VerboR": contains=false check=false suggest=false raw_suggest=false +"VerboS": contains=false check=false suggest=false raw_suggest=false +"VerboT": contains=false check=false suggest=false raw_suggest=false +"VerboU": contains=false check=false suggest=false raw_suggest=false +"VerboV": contains=false check=false suggest=false raw_suggest=false +"VerboW": contains=false check=false suggest=false raw_suggest=false +"VerboX": contains=false check=false suggest=false raw_suggest=false +"VerboY": contains=false check=false suggest=false raw_suggest=false +"VerboZ": contains=false check=false suggest=false raw_suggest=false +"Verboa": contains=false check=true suggest=true raw_suggest=false +"Verbob": contains=false check=true suggest=true raw_suggest=false +"Verboc": contains=false check=true suggest=true raw_suggest=false +"Verbod": contains=false check=true suggest=true raw_suggest=false +"Verboe": contains=false check=true suggest=true raw_suggest=false +"Verbof": contains=false check=true suggest=true raw_suggest=false +"Verbog": contains=false check=true suggest=true raw_suggest=false +"Verboh": contains=false check=true suggest=true raw_suggest=false +"Verboi": contains=false check=true suggest=true raw_suggest=false +"Verboj": contains=false check=true suggest=true raw_suggest=false +"Verbok": contains=false check=true suggest=true raw_suggest=false +"Verbol": contains=false check=true suggest=true raw_suggest=false +"Verbom": contains=false check=true suggest=true raw_suggest=false +"Verbon": contains=false check=true suggest=true raw_suggest=false +"Verboo": contains=false check=true suggest=true raw_suggest=false +"Verbop": contains=false check=true suggest=true raw_suggest=false +"Verboq": contains=false check=true suggest=true raw_suggest=false +"Verbor": contains=false check=true suggest=true raw_suggest=false +"Verbos": contains=false check=true suggest=true raw_suggest=false +"Verbot": contains=false check=true suggest=true raw_suggest=false +"Verbou": contains=false check=true suggest=true raw_suggest=false +"Verbov": contains=false check=true suggest=true raw_suggest=false +"Verbow": contains=false check=true suggest=true raw_suggest=false +"Verbox": contains=false check=true suggest=true raw_suggest=false +"Verboy": contains=false check=true suggest=true raw_suggest=false +"Verboz": contains=false check=true suggest=true raw_suggest=false +"Verboß": contains=false check=false suggest=false raw_suggest=false +"Verboá": contains=false check=true suggest=true raw_suggest=false +"Verboã": contains=false check=true suggest=true raw_suggest=false +"Verboç": contains=false check=true suggest=true raw_suggest=false +"Verboé": contains=false check=true suggest=true raw_suggest=false +"Verboí": contains=false check=true suggest=true raw_suggest=false +"Verboó": contains=false check=true suggest=true raw_suggest=false +"Verboõ": contains=false check=true suggest=true raw_suggest=false +"Verboú": contains=false check=true suggest=true raw_suggest=false +"outro": contains=true check=true suggest=true raw_suggest=true +"outroa": contains=false check=false suggest=false raw_suggest=false +"outroõ": contains=true check=true suggest=true raw_suggest=true +"verbo": contains=true check=true suggest=true raw_suggest=true +"verbo0": contains=false check=false suggest=false raw_suggest=false +"verbo1": contains=true check=true suggest=true raw_suggest=true +"verbo2": contains=true check=true suggest=true raw_suggest=true +"verbo3": contains=true check=true suggest=true raw_suggest=true +"verbo4": contains=true check=true suggest=true raw_suggest=true +"verbo5": contains=true check=true suggest=true raw_suggest=true +"verbo6": contains=true check=true suggest=true raw_suggest=true +"verbo7": contains=true check=true suggest=true raw_suggest=true +"verbo8": contains=true check=true suggest=true raw_suggest=true +"verbo9": contains=true check=true suggest=true raw_suggest=true +"verboA": contains=true check=true suggest=true raw_suggest=true +"verboB": contains=true check=true suggest=true raw_suggest=true +"verboC": contains=true check=true suggest=true raw_suggest=true +"verboD": contains=true check=true suggest=true raw_suggest=true +"verboE": contains=true check=true suggest=true raw_suggest=true +"verboF": contains=true check=true suggest=true raw_suggest=true +"verboG": contains=true check=true suggest=true raw_suggest=true +"verboH": contains=true check=true suggest=true raw_suggest=true +"verboI": contains=true check=true suggest=true raw_suggest=true +"verboJ": contains=true check=true suggest=true raw_suggest=true +"verboK": contains=true check=true suggest=true raw_suggest=true +"verboL": contains=true check=true suggest=true raw_suggest=true +"verboM": contains=true check=true suggest=true raw_suggest=true +"verboN": contains=true check=true suggest=true raw_suggest=true +"verboO": contains=true check=true suggest=true raw_suggest=true +"verboP": contains=true check=true suggest=true raw_suggest=true +"verboQ": contains=true check=true suggest=true raw_suggest=true +"verboR": contains=true check=true suggest=true raw_suggest=true +"verboS": contains=true check=true suggest=true raw_suggest=true +"verboT": contains=true check=true suggest=true raw_suggest=true +"verboU": contains=true check=true suggest=true raw_suggest=true +"verboV": contains=true check=true suggest=true raw_suggest=true +"verboW": contains=true check=true suggest=true raw_suggest=true +"verboX": contains=true check=true suggest=true raw_suggest=true +"verboY": contains=true check=true suggest=true raw_suggest=true +"verboZ": contains=true check=true suggest=true raw_suggest=true +"verboa": contains=true check=true suggest=true raw_suggest=true +"verbob": contains=true check=true suggest=true raw_suggest=true +"verboc": contains=true check=true suggest=true raw_suggest=true +"verbod": contains=true check=true suggest=true raw_suggest=true +"verboe": contains=true check=true suggest=true raw_suggest=true +"verbof": contains=true check=true suggest=true raw_suggest=true +"verbog": contains=true check=true suggest=true raw_suggest=true +"verboh": contains=true check=true suggest=true raw_suggest=true +"verboi": contains=true check=true suggest=true raw_suggest=true +"verboj": contains=true check=true suggest=true raw_suggest=true +"verbok": contains=true check=true suggest=true raw_suggest=true +"verbol": contains=true check=true suggest=true raw_suggest=true +"verbom": contains=true check=true suggest=true raw_suggest=true +"verbon": contains=true check=true suggest=true raw_suggest=true +"verboo": contains=true check=true suggest=true raw_suggest=true +"verbop": contains=true check=true suggest=true raw_suggest=true +"verboq": contains=true check=true suggest=true raw_suggest=true +"verbor": contains=true check=true suggest=true raw_suggest=true +"verbos": contains=true check=true suggest=true raw_suggest=true +"verbot": contains=true check=true suggest=true raw_suggest=true +"verbou": contains=true check=true suggest=true raw_suggest=true +"verbov": contains=true check=true suggest=true raw_suggest=true +"verbow": contains=true check=true suggest=true raw_suggest=true +"verbox": contains=true check=true suggest=true raw_suggest=true +"verboy": contains=true check=true suggest=true raw_suggest=true +"verboz": contains=true check=true suggest=true raw_suggest=true +"verboß": contains=false check=false suggest=false raw_suggest=false +"verboá": contains=true check=true suggest=true raw_suggest=true +"verboã": contains=true check=true suggest=true raw_suggest=true +"verboç": contains=true check=true suggest=true raw_suggest=true +"verboé": contains=true check=true suggest=true raw_suggest=true +"verboí": contains=true check=true suggest=true raw_suggest=true +"verboó": contains=true check=true suggest=true raw_suggest=true +"verboõ": contains=true check=true suggest=true raw_suggest=true +"verboú": contains=true check=true suggest=true raw_suggest=true diff --git a/crates/proof/tests/fixtures/affix_compatibility_cases.rs b/crates/proof/tests/fixtures/affix_compatibility_cases.rs new file mode 100644 index 000000000..d0c2973b4 --- /dev/null +++ b/crates/proof/tests/fixtures/affix_compatibility_cases.rs @@ -0,0 +1,61 @@ +// Original, deliberately small fixtures for behavior supported before French proofing. +// These are not extracts from installed dictionaries and do not claim full language coverage. +pub struct Case { + pub name: &'static str, + pub aff: String, + pub dic: String, + pub probes: Vec<&'static str>, +} + +pub fn cases() -> Vec { + let mut out = vec![ + Case { + name: "pl: conditional strip, prefix cross products, diacritics", + aff: "SET UTF-8\nTRY aeoiułkr\nPFX b Y 1\nPFX b 0 nie .\nSFX a Y 3\nSFX a 0 y [^y]\nSFX a ek ka ek\nSFX a 0 em .\nSFX c N 1\nSFX c a ą a\nMAP 2\nMAP aą\nMAP oóu\nREP 2\nREP ż rz\nREP u ó\n".into(), + dic: "4\nkot/ab\npiesek/a\nkrowa/c\nWarszawa/c\n".into(), + probes: vec!["kot", "koty", "kotem", "niekoty", "pieska", "pieseka", "niepieska", "krową", "krowy", "Warszawą", "warszawą", "kotą", "nie", ""], + }, + Case { + name: "pt: UTF-8 flags, forbidden words, two suffixes", + aff: "SET UTF-8\nFLAG UTF-8\nFORBIDDENWORD ý\nTRY aeiouçãõ\nSFX A Y 1\nSFX A o a/B o\nSFX B Y 1\nSFX B 0 s .\nPFX P Y 1\nPFX P 0 re .\n".into(), + dic: "4\nbonito/AB\ncasa/B\nfazer/P\nimundo/ýB\n".into(), + probes: vec!["bonito", "bonita", "bonitos", "bonitas", "bonitass", "casa", "casas", "casaa", "refazer", "recasas", "imundo", "imundos", "Imundo", "IMUNDO"], + }, + Case { + name: "it: stripping, non-crossing suffix, proper-name casing", + aff: "SET UTF-8\nSFX A Y 1\nSFX A o i o\nSFX B N 1\nSFX B a e a\nPFX P Y 1\nPFX P 0 ri .\n".into(), + dic: "4\nlibro/A\ncasa/BP\nfare/P\nRoma\n".into(), + probes: vec!["libri", "libros", "case", "ricas a", "ricasa", "ricase", "rifare", "r ilibri", "Roma", "roma", "ROMA", ""], + }, + Case { + name: "cs: negated conditions and shared Unicode stems", + aff: "SET UTF-8\nPFX N Y 1\nPFX N 0 ne .\nSFX S Y 1\nSFX S 0 y [^y]\nSFX E N 1\nSFX E a ě a\n".into(), + dic: "4\nstrom/NS\nžena/E\nmladý/N\ny/S\n".into(), + probes: vec!["stromy", "nestromy", "nestrom", "ženě", "ženy", "neženě", "nemladý", "mladýy", "yy", "Ženě", "STROMY"], + }, + Case { + name: "ru: Cyrillic flags and suggestions exclusion", + aff: "SET UTF-8\nFLAG UTF-8\nNOSUGGEST Н\nFORBIDDENWORD Ф\nSFX Я Y 1\nSFX Я 0 ы .\nPFX П Y 1\nPFX П 0 не .\nMAP 1\nMAP её\n".into(), + dic: "4\nкот/ЯП\nдом/Я\nтайна/НЯ\nзапрет/ФЯ\n".into(), + probes: vec!["кот", "коты", "некоты", "домы", "недомы", "тайна", "тайнаы", "ТАЙНАЫ", "запрет", "запреты", "КОТЫ", "кОт"], + }, + Case { + name: "id: continuation and NOSUGGEST through derivations", + aff: "SET UTF-8\nNOSUGGEST N\nKEY qwerty|asdf\nTRY abcdeikn\nREP 1\nREP dj j\nPFX P Y 1\nPFX P 0 ber .\nSFX A Y 1\nSFX A 0 kan/B .\nSFX B Y 1\nSFX B 0 lah .\n".into(), + dic: "3\nmain/PA\nbaca/A\nrahasia/NA\n".into(), + probes: vec!["main", "bermain", "mainkan", "mainkanlah", "bermainkanlah", "mainlah", "mainkanlahlah", "bacakanlah", "berbaca", "rahasia", "rahasiakan", "RAHASIAKANLAH"], + }, + ]; + let flags: Vec = ('a'..='z').chain('A'..='Z').chain('0'..='9').chain(['á', 'é', 'í', 'ó', 'ú', 'ç', 'ã', 'õ']).collect(); + let mut aff = String::from("SET UTF-8\nFLAG UTF-8\n"); + for flag in &flags { + aff.push_str(&format!("SFX {flag} N 1\nSFX {flag} 0 {flag} .\n")); + } + out.push(Case { + name: "pt-sized: 70 distinct flags across the old u128 boundary", + aff, + dic: format!("2\nverbo/{}\noutro/õ\n", flags.iter().collect::()), + probes: vec!["verboa", "verboz", "verboA", "verboZ", "verbo0", "verbo9", "verboç", "verboõ", "verboß", "outroõ", "outroa"], + }); + out +} diff --git a/crates/proof/tests/french_dictionary.rs b/crates/proof/tests/french_dictionary.rs new file mode 100644 index 000000000..5612a0e61 --- /dev/null +++ b/crates/proof/tests/french_dictionary.rs @@ -0,0 +1,107 @@ +//! Explicit manual real-dictionary gate. Verify the pinned runtime inputs as documented in +//! crates/proof/README.md before running with `--ignored`. Missing data is a failure, +//! never a silently successful test that checked nothing. + +#![cfg(not(target_arch = "wasm32"))] +#![allow(clippy::unwrap_used, clippy::expect_used)] + +use craft_proof::{IssueKind, Options, ProofLang, fr}; + +#[test] +#[ignore = "requires a real French dictionary in WORDCRAFT_DICTIONARIES"] +fn real_french_dictionary_spelling_suggestions_and_dispatch() { + let directory = std::env::var_os("WORDCRAFT_DICTIONARIES").expect("set WORDCRAFT_DICTIONARIES to the test dictionary folder"); + craft_proof::set_dictionaries_folder(Some(std::path::PathBuf::from(&directory))); + let french = ProofLang::from_tag(Some("fr-FR")); + let installed = craft_proof::pack_dictionary_file(french).expect("the real French dictionary must be installed"); + assert_eq!(installed.parent(), Some(std::path::Path::new(&directory)), "do not silently use another system dictionary"); + let aff = installed.with_extension("aff"); + let dictionary = craft_proof::hunspell::load(&aff, &installed).expect("the real French dictionary loads"); + assert!(dictionary.len() > 50_000, "expected Dicollecte, not the synthetic fixture: {}", dictionary.len()); + for word in [ + "maison", + "maisons", + "Paris", + "mangeons", + "finissaient", + "étaient", + "l'arbre", + "l’arbre", + "qu'elles", + "école", + "œuvre", + "aujourd'hui", + "chevaux", + "heureuse", + "va-t-il", + ] { + assert!(fr::is_correct(word), "correct French word: {word}"); + } + for (typo, expected) in [("maisonn", "maison"), ("ecole", "école"), ("l’ecole", "l’école"), ("documant", "document")] { + assert!(!fr::is_correct(typo), "misspelling: {typo}"); + let suggestions = fr::suggest(typo, 8); + assert!(suggestions.iter().any(|s| s == expected), "{typo} -> {suggestions:?}, expected {expected}"); + } + let text = "Une maisonn près de l’école."; + for lang in [ProofLang::from_tag(Some("fr-FR")), ProofLang::from_tag(Some("fr-CA"))] { + let issues = craft_proof::check_text(text, &[(0..text.len(), lang)]); + assert_eq!(issues.len(), 1, "{lang:?}: {issues:?}"); + let issue = &issues[0]; + assert_eq!(&text[issue.start..issue.end], "maisonn"); + assert_eq!(issue.lang, lang); + assert_eq!(issue.message, "Faute d’orthographe possible"); + } + check_combining_marks_and_compounds(&dictionary); + assert!(craft_proof::dictionary_load_error(ProofLang::from_tag(Some("fr-FR"))).is_none()); +} + +fn check_combining_marks_and_compounds(dictionary: &craft_proof::affix::AffixDict) { + let spelling = |text: &str, spans: &[(std::ops::Range, ProofLang)]| { + craft_proof::check_text_with(text, spans, &Options::default(), false, false) + .into_iter() + .filter(|i| i.kind == IssueKind::Spelling) + .map(|i| (i.start, i.end, i.lang)) + .collect::>() + }; + let mut failures = Vec::new(); + for lang in [ProofLang::from_tag(Some("fr-FR")), ProofLang::from_tag(Some("fr-CA"))] { + for text in + ["école", "e\u{301}cole", "l’école", "l’e\u{301}cole", "café", "cafe\u{301}", "porte-monnaie", "va-t-il", "a-t-il", "maison-école"] + { + assert!( + fr::is_correct_with(dictionary, text) || ["va-t-il", "a-t-il", "maison-école"].contains(&text), + "real dictionary recognizes {text:?}" + ); + let issues = spelling(text, &[(0..text.len(), lang)]); + if !issues.is_empty() { + failures.push(format!("correct {lang:?} {text:?}: {issues:?}")); + } + } + for text in ["porte--monnaie", "va--t-il", "maison--école", "e\u{301}colllle", "cafffe\u{301}"] { + assert!(!fr::is_correct_with(dictionary, text), "the explicit dictionary entry must not already accept {text:?}"); + let issues = spelling(text, &[(0..text.len(), lang)]); + let expected = vec![(0, text.len(), lang)]; + if issues != expected { + failures.push(format!("typo {lang:?} {text:?}: {issues:?}, wanted {expected:?}")); + } + } + let text = "e\u{301}cole cafe\u{301} xyzxyz porte--monnaie"; + let foreign = text.find("xyzxyz").unwrap(); + let compound = text.find("porte").unwrap(); + let spans = [(0..foreign, lang), (foreign..compound, ProofLang::Other), (compound..text.len(), lang)]; + let issues = spelling(text, &spans); + if issues != [(compound, text.len(), lang)] { + failures.push(format!("mixed {lang:?}: {issues:?}")); + } + assert!(spelling(text, &[(0..text.len(), ProofLang::Other)]).is_empty()); + // An English word remains in its own dictionary next to the original French bytes. + let text = "e\u{301}cole hello cafe\u{301}"; + let en = text.find("hello").unwrap(); + let spans = [(0..en, lang), (en..en + 5, ProofLang::En), (en + 5..text.len(), lang)]; + let issues = spelling(text, &spans); + if !issues.is_empty() { + failures.push(format!("English boundary {lang:?}: {issues:?}")); + } + } + assert!(failures.is_empty(), "{}", failures.join("\n")); +} diff --git a/crates/proof/tests/french_packs.rs b/crates/proof/tests/french_packs.rs new file mode 100644 index 000000000..64ad46748 --- /dev/null +++ b/crates/proof/tests/french_packs.rs @@ -0,0 +1,124 @@ +//! French uses ordinary Language packs and keeps each regional locale at the public API. +#![allow(clippy::unwrap_used, clippy::expect_used)] + +use craft_proof::affix; +use craft_proof::{IssueKind, Options, ProofLang, check_text_with, is_correct_in_with, suggest_in}; +use std::path::{Path, PathBuf}; + +#[path = "../src/fr/test_dict.rs"] +mod fixture; + +struct Tools(PathBuf); +impl Drop for Tools { + fn drop(&mut self) { + craft_proof::set_dictionaries_folder(None); + craft_proof::packs::set_packs_dir(None); + craft_proof::remove_word("zxqrechargefr"); + let _ = std::fs::remove_dir_all(&self.0); + } +} + +fn pair(dir: &Path, name: &str, aff: &str, dic: &str) { + std::fs::create_dir_all(dir).unwrap(); + std::fs::write(dir.join(format!("{name}.aff")), aff).unwrap(); + std::fs::write(dir.join(format!("{name}.dic")), dic).unwrap(); +} + +#[test] +fn french_packs_regions_reload_and_original_ranges() { + assert!(!fixture::dictionary().is_empty()); + let root = std::env::temp_dir().join(format!("craft-fr-packs-{}", std::process::id())); + let _tools = Tools(root.clone()); + let pack = root.join("packs/fr"); + pair(&pack, "spelling", fixture::AFF, fixture::DIC); + std::fs::write(pack.join("pack.toml"), "locale = 'fr'\nname = 'Français'\nlicence = 'MIT'\n").unwrap(); + std::fs::write(pack.join("hyphenation.pat"), "ma1ison\n").unwrap(); + let folder = root.join("dictionaries"); + std::fs::create_dir_all(&folder).unwrap(); + craft_proof::packs::set_packs_dir(Some(root.join("packs"))); + craft_proof::set_dictionaries_folder(Some(folder.clone())); + let defaults = Options::default(); + let strict = Options { ignore_uppercase: false, ignore_numbers: false, ..defaults }; + check_locales(defaults, strict); + check_typography(strict); + let fr = ProofLang::from_tag(Some("fr-FR")); + let ca = ProofLang::from_tag(Some("fr-CA")); + check_user_word(fr, ca, strict); + check_overrides(folder, fr, ca, strict); +} + +fn check_locales(defaults: Options, strict: Options) { + for tag in ["fr", "fr-FR", "fr-CA", "fr-BE", "fr-CA-u-nu-latn", "fr-u-ca-gregory"] { + let lang = ProofLang::from_tag(Some(tag)); + assert!(matches!(lang, ProofLang::Pack(_)), "{tag}"); + assert!(craft_proof::has_dictionary(Some(tag)), "{tag}"); + assert!(craft_proof::pack_dictionary_file(lang).unwrap().ends_with("fr/spelling.dic"), "{tag}"); + for word in ["école", "e\u{301}cole", "l'arbre", "l’arbre", "maison-école"] { + assert!(is_correct_in_with(word, lang, &strict), "{tag}: {word}"); + } + assert!(!is_correct_in_with("maison--école", lang, &strict)); + assert!(!is_correct_in_with("l'arbres", lang, &strict)); + assert!(is_correct_in_with("SNCF", lang, &defaults)); + assert!(!is_correct_in_with("SNCF", lang, &strict)); + assert!(is_correct_in_with("mp3x", lang, &defaults)); + assert!(!is_correct_in_with("mp3x", lang, &strict)); + assert!(suggest_in("ecole", 6, lang).iter().any(|s| s == "école")); + let text = "🙂 maison\u{338} école"; + let issues = check_text_with(text, &[(0..text.len(), lang)], &strict, false, false); + assert_eq!(issues.len(), 1, "{tag}: {issues:?}"); + assert_eq!(&text[issues[0].start..issues[0].end], "maison\u{338}"); + assert_eq!(issues[0].lang, lang); + assert_eq!(issues[0].kind, IssueKind::Spelling); + assert_eq!(issues[0].message, "Faute d’orthographe possible"); + } +} + +fn check_typography(strict: Options) { + let fr = ProofLang::from_tag(Some("fr-FR")); + let ca = ProofLang::from_tag(Some("fr-CA")); + for lang in [fr, ca] { + assert_eq!(craft_proof::hyphen::hyphen_points_in("maison", &craft_proof::hyphen::Limits::default(), lang), [2]); + } + for tag in ["fr-FR", "fr-BE", "fr-u-ca-gregory", "fr-FR-u-rg-cazzzz"] { + let issues = craft_proof::check_grammar_in("Bonjour!", ProofLang::from_tag(Some(tag))); + assert_eq!(issues.len(), 1, "{tag}: {issues:?}"); + assert_eq!(issues[0].suggestions, ["\u{202f}!"]); + } + assert!(craft_proof::check_grammar_in("Bonjour!", ca).is_empty()); + assert!(craft_proof::check_grammar_in("Bonjour!", ProofLang::from_tag(Some("fr-Latn-CA"))).is_empty()); + assert!(craft_proof::check_grammar_in("Bonjour!", ProofLang::from_tag(Some("nl-NL"))).is_empty()); + assert!(craft_proof::fr::grammar::check_in("Bonjour!", ProofLang::En).is_empty()); + let text = "Bonjour! Salut!"; + let issues = check_text_with(text, &[(0..8, fr), (8..text.len(), ca)], &strict, true, false); + let spacing: Vec<_> = issues.iter().filter(|i| i.kind == IssueKind::Grammar && i.message.contains("fine insécable")).collect(); + assert_eq!(spacing.len(), 1, "{issues:?}"); + assert_eq!(spacing[0].lang, fr); +} + +fn check_user_word(fr: ProofLang, ca: ProofLang, strict: Options) { + craft_proof::add_word("zxqrechargefr"); + for lang in [fr, ca] { + assert!(is_correct_in_with("l’zxqrechargefr", lang, &strict)); + } + craft_proof::remove_word("zxqrechargefr"); + assert!(!is_correct_in_with("l’zxqrechargefr", ca, &strict)); +} + +fn check_overrides(folder: PathBuf, fr: ProofLang, ca: ProofLang, strict: Options) { + // Regional overrides keep the generic pack fallback and the shared reload generation. + pair(&folder, "fr_FR", "SET UTF-8\n", "1\nhexagonefixture\n"); + pair(&folder, "fr_CA", "SET UTF-8\n", "1\nquebecfixture\n"); + let generation = craft_proof::dictionary_generation(); + craft_proof::set_dictionaries_folder(Some(folder.clone())); + assert!(craft_proof::dictionary_generation() > generation); + assert!(is_correct_in_with("hexagonefixture", fr, &strict)); + assert!(!is_correct_in_with("hexagonefixture", ca, &strict)); + assert!(is_correct_in_with("quebecfixture", ca, &strict)); + assert!(!is_correct_in_with("quebecfixture", fr, &strict)); + assert!(craft_proof::pack_dictionary_file(ca).unwrap().ends_with("fr_CA.dic")); + std::fs::remove_file(folder.join("fr_CA.dic")).unwrap(); + std::fs::remove_file(folder.join("fr_CA.aff")).unwrap(); + craft_proof::set_dictionaries_folder(Some(folder)); + assert!(is_correct_in_with("école", ca, &strict), "removed regional override falls back to fr pack"); + assert!(craft_proof::pack_dictionary_file(ca).unwrap().ends_with("fr/spelling.dic")); +} From 3c5ffadd3b3fb4bcbf657a245ad9c480d2b6e304 Mon Sep 17 00:00:00 2001 From: totoz64 <47389794+totoz64@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:53:24 +0100 Subject: [PATCH 002/183] Proofing: retain exact apostrophes in French compounds Check each original compound component before its ASCII-apostrophe alias. Add a curly-only dictionary regression, prove legacy fixture headers before rejecting WCAFF1, and clarify French-specific Pack grammar in the README. Preserve the existing one-letter component policy. --- crates/proof/README.md | 13 ++++++++----- crates/proof/src/fr/mod.rs | 14 +++++++++++++- crates/proof/tests/affix_compatibility.rs | 2 ++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/crates/proof/README.md b/crates/proof/README.md index b4b4b5ba8..4cc4b2ca4 100644 --- a/crates/proof/README.md +++ b/crates/proof/README.md @@ -89,19 +89,22 @@ pub fn load_errors() -> Vec<(String, String)>; // + (locale or folder, pub fn embedded_locales() -> &'static [&'static str]; // + locales with embedded upstream data, not our supplements ("en-us", "en-gb", "en-ca", "en-au", "pl", "pt", "it", "de" by default; the four English ones with CRAFT_PROOF_EMBED=en) // craft_proof (crate root) -pub enum ProofLang { …, Pack(PackLocale), Other } // + Pack: any language without tools of its own (nl, fr, sr-Latn…) +pub enum ProofLang { …, Pack(PackLocale), Other } // + Pack: a language without a dedicated built-in variant (nl, fr, sr-Latn…) pub struct PackLocale; // + Copy; PackLocale::new(tag) -> Option, .as_str() "nl-nl", .primary() "nl", Display impl ProofLang { pub fn pack_locale(self) -> Option; } // + pub fn pack_dictionary_file(lang: ProofLang) -> Option; // + the .dic a Pack language reads now; None = unchecked ``` -`ProofLang::from_tag` now gives `Pack(locale)` for every valid language tag it has no tools for +`ProofLang::from_tag` now gives `Pack(locale)` for every valid language tag without a dedicated built-in variant (`nl-NL` → `Pack("nl-nl")`, `fr-FR`, `ja-JP`, `sr-Latn`…); `Other` is left for `x-none`, `und`, `zxx`, `mul`, `mis`, `i-…` and malformed tags. A `Pack` language is spell-checked and given suggestions from its Hunspell dictionary (dictionaries folder → installed pack → system Hunspell) -through the shared affix engine with default tuning, and hyphenated from its pack's -`hyphenation.pat`; it has no grammar rules and the generic English spelling message. Without a -dictionary or pack it behaves exactly as `Other` did (no marks, English hyphenation fallback). +through the shared affix engine with default tuning (French tuning for `fr` packs), and +hyphenated from its pack's `hyphenation.pat`. Most pack languages use no dedicated grammar +rules; regional variants can reuse a built-in language's rules. French packs use the French +spelling message and the conservative French grammar and typography described above. Without a dictionary or pack, +spelling has no marks and hyphenation falls back to English; French grammar and typography +still apply independently of a spelling dictionary. `has_dictionary(tag)` / `ProofLang::is_proofed()` say whether a `Pack` language has a dictionary now (read on first use, cached). Loaded `Pack` dictionaries share a 256 MB budget (estimated from their files); the least recently used goes first, but never one used in the paragraph being checked, and languages with no dictionary take no room. Downstream `match`es on `ProofLang` need a `Pack(_)` arm; `code()` stays `&'static str` and is `""` for it, as for `Other`: anything that keys, saves or reports a language (settings, caches, JSON/MCP output) uses `tag()`, which is `code()` for the built-ins and the locale (`nl`, `fr-fr`) for a pack language. diff --git a/crates/proof/src/fr/mod.rs b/crates/proof/src/fr/mod.rs index 541fcac0d..c67c3ffc0 100644 --- a/crates/proof/src/fr/mod.rs +++ b/crates/proof/src/fr/mod.rs @@ -44,6 +44,7 @@ pub(crate) fn check(d: &AffixDict, word: &str, opts: &Options) -> bool { if known(d, w) { return true; } + let original = w; let w = w.replace('’', "'"); if known(d, &w) { return true; @@ -56,7 +57,7 @@ pub(crate) fn check(d: &AffixDict, word: &str, opts: &Options) -> bool { { return true; } - w.contains('-') && w.split('-').all(|p| !p.is_empty() && (p.chars().count() <= 1 || known(d, p))) + original.contains('-') && original.split('-').all(|p| !p.is_empty() && (p.chars().count() <= 1 || known(d, p) || known(d, &p.replace('’', "'")))) } fn known(d: &AffixDict, word: &str) -> bool { @@ -148,6 +149,17 @@ mod tests { assert!(!is_correct_with(&d, "maison\u{338}"), "a trailing mark is part of the word"); } + #[test] + fn curly_apostrophes_in_compounds_keep_exact_dictionary_parts() { + let d = AffixDict::from_hunspell("SET UTF-8\n", "4\naujourd’hui\nécole\ncafé\nl'école\n", &[]).unwrap(); + for word in ["aujourd’hui-école", "aujourd’hui-e\u{301}cole", "café-aujourd’hui", "l’école-aujourd’hui"] { + assert!(is_correct_with(&d, word), "{word}"); + } + for word in ["aujourd’hui-écolle", "aujourd’hui--école", "aujourd'hui-école"] { + assert!(!is_correct_with(&d, word), "{word}"); + } + } + #[test] fn explicit_curly_apostrophe_without_iconv() { let d = AffixDict::from_hunspell("SET UTF-8\n", "1\naujourd’hui\n", &[]).unwrap(); diff --git a/crates/proof/tests/affix_compatibility.rs b/crates/proof/tests/affix_compatibility.rs index 6d09e5f90..c18d9fd03 100644 --- a/crates/proof/tests/affix_compatibility.rs +++ b/crates/proof/tests/affix_compatibility.rs @@ -87,6 +87,8 @@ fn legacy_compact_data_is_refused_without_reinterpreting_homonyms() { assert_eq!(hex.len() % 2, 0); let bytes: Vec<_> = hex.as_bytes().as_chunks::<2>().0.iter().map(|pair| u8::from_str_radix(std::str::from_utf8(pair).unwrap(), 16).unwrap()).collect(); + let raw = miniz_oxide::inflate::decompress_to_vec(&bytes).unwrap(); + assert!(raw.starts_with(b"WCAFF1\n"), "fixture must contain WCAFF1 data: {}", case.name); assert!(AffixDict::from_bytes(&bytes).is_err(), "WCAFF1 must be regenerated as WCAFF2: {}", case.name); } } From 870bad52e20a62e0260c90d5d18c5643181377b7 Mon Sep 17 00:00:00 2001 From: totoz64 <47389794+totoz64@users.noreply.github.com> Date: Wed, 4 Nov 2026 17:43:22 +0100 Subject: [PATCH 003/183] M15: Preserve accepted suggestions after the shared collection budget runs out Collector::keep has already validated the stored text. Avoid rechecking identity candidates against an exhausted SuggestSteps budget; validate only changed case and fall back to the accepted original if that validation cannot succeed. Keep the same time/work caps, exclusion rules, parser and ranking. An integrated regression uses the real REP/TRY/affix pipeline and normal budget: it loses the accepted affixed suggestion on parent b5 and retains it with this change, for lower and upper input. No injected state or relaxed limit. Exact-source fmt and strict proof Clippy passed; full local/hosted validation is still being collected. Addresses CodeRabbit4470300723. --- crates/proof/src/affix_suggest.rs | 40 +++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/crates/proof/src/affix_suggest.rs b/crates/proof/src/affix_suggest.rs index 07194c548..b3f07e43c 100644 --- a/crates/proof/src/affix_suggest.rs +++ b/crates/proof/src/affix_suggest.rs @@ -452,13 +452,9 @@ pub(crate) fn suggest_in(d: &AffixDict, word: &str, max: usize, t: &Tuning) -> V let changed: Vec<_> = candidate.split(' ').collect(); original.len() == changed.len() && original.iter().zip(changed).all(|(a, b)| d.can_suggest_cased(a, b)) }; - let t = if eligible(&t) { - t - } else if eligible(&text) { - text.clone() - } else { - continue; - }; + // Collector::keep already accepted text. Collection may have exhausted the shared + // affix budget, so recheck only a changed case and otherwise retain that accepted form. + let t = if t == text || eligible(&t) { t } else { text.clone() }; // Shown as the dictionary's OCONV table writes it (`'` → `’` in French). let t = d.output(&t).into_owned(); if t != word && !out.contains(&t) { @@ -904,4 +900,34 @@ mod tests { assert!(suggest_in(&d, "neer", 4, &english).contains(&"ne'er".to_string())); assert_eq!(suggest_in(&d, "neer", 4, &Tuning::DEFAULT).first().map(String::as_str), Some("ne'er"), "an elision"); } + /// A REP candidate is admitted before costly TRY checks consume the normal shared budget. + /// Finalization must retain that accepted affixed word, including a conservative case fallback. + #[test] + fn accepted_affixed_suggestions_survive_exhausted_collection_budget() { + let input = format!("{}x{}", "a".repeat(20), "a".repeat(19)); + let mut aff = String::from("SET UTF-8\nFLAG num\nTRY "); + aff.extend(('a'..='z').chain((0x100..0x166).filter_map(char::from_u32))); + aff.push_str(&format!("\nREP 1\nREP {input} kots\n")); + // The bounded adversarial rule shape of the existing shared-budget regression. + for f in 1..=1000u32 { + let c = char::from_u32(0x4e00 + f).unwrap(); + aff.push_str(&format!("PFX {f} Y 1\nPFX {f} {c} 0 .\n")); + } + let conts: Vec = (0..286).map(|k| (5000 + k * 7).to_string()).collect(); + for len in 1..=40 { + for k in 0..50 { + let f = 5000 + (len - 1) * 50 + k; + aff.push_str(&format!("SFX {f} Y 1\nSFX {f} 0 {}/{} .\n", "a".repeat(len), conts.join(","))); + } + } + aff.push_str("SFX 9000 Y 1\nSFX 9000 0 s .\n"); + let d = AffixDict::from_hunspell(&aff, "3\nb/1,5000\nab/2\nkot/9000\n", &[]).unwrap(); + assert!(!d.stems().any(|s| s == "kots") && d.can_suggest("kots")); + for word in [input.clone(), input.to_uppercase()] { + let got = suggest_in(&d, &word, 1, &Tuning::DEFAULT); + assert_eq!(got.len(), 1, "accepted affixed candidate lost: {word}: {got:?}"); + assert!(got[0].eq_ignore_ascii_case("kots"), "{word}: {got:?}"); + assert!(d.can_suggest(&got[0])); + } + } } From 55a16b7a724cd7ab3f9873a415fbd6fbcd8b3c96 Mon Sep 17 00:00:00 2001 From: totoz64 <47389794+totoz64@users.noreply.github.com> Date: Wed, 4 Nov 2026 17:56:56 +0100 Subject: [PATCH 004/183] M15: Validate exact suggestion eligibility before admitting candidates Collector::keep now uses the exact-case eligibility guard before insertion, preserving NOSUGGEST, SUBSTANDARD, FORBIDDENWORD and KEEPCASE rules. Finalization can safely retain the admitted original after the collection budget is exhausted, and still validates actual case variants. No fresh budget, parser, ranking or historical fixture change. This completes CodeRabbit4470300723 without the provisional870 exclusion regression. On this exact source: workspace fmt and strict proof Clippy passed; 458 unit tests passed with52 ignored, compatibility2 and French Pack integration1 passed, and the real pinned Dicollecte test passed. The integrated normal-budget regression and all15 suggestion/casing/exclusion tests passed together in the fresh complete execution. Hosted validation of this new SHA is still required. --- crates/proof/src/affix_suggest.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/proof/src/affix_suggest.rs b/crates/proof/src/affix_suggest.rs index b3f07e43c..4d8bfea59 100644 --- a/crates/proof/src/affix_suggest.rs +++ b/crates/proof/src/affix_suggest.rs @@ -248,7 +248,8 @@ impl Collector<'_> { /// Keep a suggestion known to be correct, unless the dictionary says never to offer it. fn keep(&mut self, text: String, cost: u32) { - if !text.split(' ').all(|part| self.d.can_suggest(part)) { + // Reject exact excluded spellings at admission, before later candidates spend the budget. + if !text.split(' ').all(|part| self.d.can_suggest_cased(part, part)) { return; } self.seq += 1; From 1f53b809737c5f3141406387f9aa93c971b4007b Mon Sep 17 00:00:00 2001 From: totoz64 <47389794+totoz64@users.noreply.github.com> Date: Sun, 15 Nov 2026 19:58:06 +0100 Subject: [PATCH 005/183] Proofing: retain eligible exact compound suggestions Address CodeRabbit4575003662 by considering all normalized exact derivations in the displayed-case eligibility guard, without lowercase fallback. Preserve forbidden-word handling, case exclusions, shared budgets and ranking. A real REP regression fails before the fix and passes for NOSUGGEST/SUBSTANDARD compound paths after it, while FORBIDDEN remains rejected; cover WCAFF2 round trips.460 unit tests, compatibility2, French Pack1, real Dicollecte1, formatting and strict all-target proof Clippy pass on Rust1.100. New hosted checks are still required. --- crates/proof/src/affix.rs | 5 +++-- crates/proof/src/affix_suggest.rs | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/crates/proof/src/affix.rs b/crates/proof/src/affix.rs index 4c76815bb..b0407c59f 100644 --- a/crates/proof/src/affix.rs +++ b/crates/proof/src/affix.rs @@ -2248,11 +2248,12 @@ impl AffixDict { return false; } // The exact simple-word path includes affixes; asking with no exclusions detects a - // target whose only derivations carry NOSUGGEST, SUBSTANDARD or FORBIDDENWORD. Spend + // target that may carry NOSUGGEST, SUBSTANDARD or FORBIDDENWORD. An eligible exact + // compound derivation still counts, but a lowercase fallback must not rescue it. Spend // the same shared suggestion budget as the normal checker, and abstain if it runs out. match self.simple_word_budgeted(&target, Excluded::default(), true) { None => return false, - Some(true) if !self.simple_word(&target, self.excluded(true)) => return false, + Some(true) if !self.contains_except(&target, self.excluded(true)) => return false, _ => {} } self.can_suggest(changed) diff --git a/crates/proof/src/affix_suggest.rs b/crates/proof/src/affix_suggest.rs index 4d8bfea59..2a102c00b 100644 --- a/crates/proof/src/affix_suggest.rs +++ b/crates/proof/src/affix_suggest.rs @@ -822,6 +822,20 @@ mod tests { assert!(!d.can_suggest_cased("normal", "pour")); } + /// An excluded simple entry does not exclude an eligible exact COMPOUNDRULE derivation. + #[test] + fn rep_keeps_eligible_exact_compound_beside_an_excluded_simple_entry() { + for flag in ["N", "S", "F"] { + let aff = "SET UTF-8\nNOSUGGEST N\nSUBSTANDARD S\nFORBIDDENWORD F\nCOMPOUNDRULE ab\nREP 1\nREP zz foobar\n"; + let d = AffixDict::from_hunspell(aff, &format!("3\nfoobar/{flag}\nfoo/a\nbar/b\n"), &[]).unwrap(); + for d in [&d, &AffixDict::from_bytes(&d.to_bytes().unwrap()).unwrap()] { + assert_eq!(d.contains_suggestible("foobar"), flag != "F", "{flag}: exact compound eligibility"); + let got = suggest_in(d, "zz", 4, &Tuning::DEFAULT); + assert_eq!(got.iter().any(|w| w == "foobar"), flag != "F", "{flag}: {got:?}"); + } + } + } + /// A language's tables come after its dictionary's, a TRY alphabet stands in for a missing TRY /// line, and a split rule decides which missing spaces are offered. #[test] From 30e5deb660ee195fe713f2fee973f5764b956339 Mon Sep 17 00:00:00 2001 From: Call4han Date: Mon, 16 Nov 2026 21:19:24 -0500 Subject: [PATCH 006/183] fix(xfl): read ZIPs with overstated central directory sizes --- crates/xfl/src/lib.rs | 13 +++++++++++++ crates/xfl/src/tests.rs | 17 +++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/crates/xfl/src/lib.rs b/crates/xfl/src/lib.rs index fbcb3ecc2..7283b56a0 100644 --- a/crates/xfl/src/lib.rs +++ b/crates/xfl/src/lib.rs @@ -318,6 +318,19 @@ fn find_end(data: &[u8]) -> Result<(u64, u64, u64, usize), ZipError> { let Some((_, shift)) = locate_directory(data, count.into(), size.into(), offset.into(), candidate) .filter(|&(dir, _)| directory_is_exact(data, dir, size.into(), count.into(), &mut directory_jumps)) else { + // An overstated size is safe to ignore only when the recorded entries fill + // the byte range from the declared offset to this single-disk end record. + // The classic entry count is below MAX_ENTRIES, so the walk checks every entry. + if count != 0 + && u32_at(data, candidate + 4) == Some(0) + && u16_at(data, candidate + 8) == Some(count) + && let Ok(start) = usize::try_from(offset) + && let Some(measured) = candidate.checked_sub(start).and_then(|n| u32::try_from(n).ok()) + && measured < size + && directory_is_exact(data, start, measured.into(), count.into(), &mut directory_jumps) + { + return Ok((count.into(), measured.into(), offset.into(), candidate)); + } continue; }; if count == 0 && shift > 0 { diff --git a/crates/xfl/src/tests.rs b/crates/xfl/src/tests.rs index 5ae0713ba..5611a92ca 100644 --- a/crates/xfl/src/tests.rs +++ b/crates/xfl/src/tests.rs @@ -108,6 +108,23 @@ fn damaged_archives_are_errors() { assert!(Archive::open(&z).is_err()); } +#[test] +fn reads_a_directory_with_an_overstated_size() { + let mut z = zip(&[("DOMDocument.xml", b"", true), ("LIBRARY/ball.xml", b"", false)]); + let end = z.len() - 22; + let size = u32_at(&z, end + 12).unwrap(); + z[end + 12..end + 16].copy_from_slice(&(size + 13).to_le_bytes()); + + let archive = Archive::open(&z).unwrap(); + assert_eq!(archive.counts().0, 2); + assert_eq!(archive.read("DOMDocument.xml").unwrap().unwrap(), b""); + assert_eq!(archive.read("LIBRARY/ball.xml").unwrap().unwrap(), b""); + + // Keep the overstated end record but remove the last byte of the final entry's name. + z.remove(end - 1); + assert_eq!(Archive::open(&z).err(), Some(ZipError::Damaged("the central directory is outside the archive"))); +} + #[test] fn a_truncated_central_directory_is_damaged() { let z = zip(&[("DOMDocument.xml", b"", true), ("b.xml", b"", true), ("c.xml", b"", false)]); From 841e6a726ba4aba563cc0ed9c1465c8345502666 Mon Sep 17 00:00:00 2001 From: Call4han Date: Mon, 16 Nov 2026 21:35:57 -0500 Subject: [PATCH 007/183] fix(xfl): prefer valid ZIP end records over recovered ones --- crates/xfl/src/lib.rs | 13 +++++++++++-- crates/xfl/src/tests.rs | 26 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/crates/xfl/src/lib.rs b/crates/xfl/src/lib.rs index 7283b56a0..f89ec10fe 100644 --- a/crates/xfl/src/lib.rs +++ b/crates/xfl/src/lib.rs @@ -279,6 +279,7 @@ fn find_end(data: &[u8]) -> Result<(u64, u64, u64, usize), ZipError> { // it from an empty EOCD-shaped record inside the preceding archive's comment. Keep it as a // last resort while searching for an older, structurally stronger candidate. let mut empty_sfx = None; + let mut measured_directory = None; let mut fallback = None; // Fake EOCD records in a comment can all describe the same large directory. Cache binary // directory jumps so checking each candidate does not rescan every entry. @@ -329,7 +330,9 @@ fn find_end(data: &[u8]) -> Result<(u64, u64, u64, usize), ZipError> { && measured < size && directory_is_exact(data, start, measured.into(), count.into(), &mut directory_jumps) { - return Ok((count.into(), measured.into(), offset.into(), candidate)); + // Keep scanning for a valid declared size. Among measured candidates, + // prefer the earliest record so a copy in its comment cannot hide it. + measured_directory = Some((count.into(), measured.into(), offset.into(), candidate)); } continue; }; @@ -341,7 +344,13 @@ fn find_end(data: &[u8]) -> Result<(u64, u64, u64, usize), ZipError> { eocd = Some(candidate); break; } - let eocd = eocd.or(empty_sfx).or(fallback).ok_or(ZipError::NotZip)?; + let eocd = eocd.or(empty_sfx); + if eocd.is_none() + && let Some(directory) = measured_directory + { + return Ok(directory); + } + let eocd = eocd.or(fallback).ok_or(ZipError::NotZip)?; let field16 = |o: usize| u16_at(data, eocd + o).ok_or(ZipError::Damaged("the end record is cut short")); let field32 = |o: usize| u32_at(data, eocd + o).ok_or(ZipError::Damaged("the end record is cut short")); let (disk, dir_disk, on_disk, count) = (field16(4)?, field16(6)?, field16(8)?, field16(10)?); diff --git a/crates/xfl/src/tests.rs b/crates/xfl/src/tests.rs index 5611a92ca..6075e4e57 100644 --- a/crates/xfl/src/tests.rs +++ b/crates/xfl/src/tests.rs @@ -323,6 +323,32 @@ fn nonempty_comment_eocd_candidate_does_not_mask_valid_archive() { assert_eq!(archive.read("a.xml").unwrap().unwrap(), b"x"); } +#[test] +fn overstated_comment_eocd_does_not_mask_valid_archive() { + let mut bytes = zip(&[("a.xml", b"x", false)]); + let end = bytes.len() - 22; + let size = u32_at(&bytes, end + 12).unwrap(); + let start = u32_at(&bytes, end + 16).unwrap() as usize; + let fake_start = bytes.len(); + + // Copy the directory and end record into the real comment, then corrupt the copies. + bytes.extend_from_within(start..); + let comment_len = u16::try_from(bytes.len() - fake_start).unwrap(); + bytes[end + 20..end + 22].copy_from_slice(&comment_len.to_le_bytes()); + bytes[fake_start + 42..fake_start + 46].copy_from_slice(&1u32.to_le_bytes()); + let fake_end = bytes.len() - 22; + bytes[fake_end + 12..fake_end + 16].copy_from_slice(&(size + 1).to_le_bytes()); + bytes[fake_end + 16..fake_end + 20].copy_from_slice(&u32::try_from(fake_start).unwrap().to_le_bytes()); + + let archive = Archive::open(&bytes).unwrap(); + assert_eq!(archive.read("a.xml").unwrap().unwrap(), b"x"); + + // If both candidates need recovery, the record before the comment still wins. + bytes[end + 12..end + 16].copy_from_slice(&(size + 1).to_le_bytes()); + let archive = Archive::open(&bytes).unwrap(); + assert_eq!(archive.read("a.xml").unwrap().unwrap(), b"x"); +} + #[test] fn repeated_eocd_directory_candidates_reuse_entry_validation() { let entries = (0..1024).map(|index| Raw::new(&format!("entry-{index:04}.xml"), b"", false)).collect::>(); From 976e4ef8ea3315f066bdfe65bdfa6e313caa196c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 19:01:57 -0800 Subject: [PATCH 008/183] craft-csv: rows of empty cells decide the delimiter when nothing else does sniff_delimiter skipped every record without a non-whitespace character other than the delimiter, so a record such as ";" or ";;;" was blank to the semicolon candidate. A semicolon export of a sheet whose only value is far down (B40001) starts with 40,000 ";" rows, which fill the 64 KiB sample, and the file was read as comma-separated with one column. Records that hold only a candidate's delimiters and whitespace are now kept apart, at most 20 per candidate. When no candidate separates the records with other text, the same rules pick among the candidates whose sample holds only such records. Every result that did not fall back to comma stays the same: a row of tabs alone is still blank to the other candidates and does not outweigh them, as #1209 set out. --- crates/csv/README.md | 2 +- crates/csv/src/lib.rs | 122 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 110 insertions(+), 14 deletions(-) diff --git a/crates/csv/README.md b/crates/csv/README.md index bfd525c8c..8fd264d4c 100644 --- a/crates/csv/README.md +++ b/crates/csv/README.md @@ -11,7 +11,7 @@ mapping a SYLK sheet onto a document are the caller's work. | Function | What it does | |---|---| | `decode_text(bytes)` | UTF-8 and UTF-16 byte order marks; without one, valid UTF-8 is kept; other bytes are Windows-1256 when they read as Arabic, else Windows-1252 | -| `sniff_delimiter(text, quote)` | comma, semicolon or tab: the one with the most consistent field count over the first 20 non-blank records in a 64 KiB sample; when no candidate finds coherent complete records with a delimiter in each, a candidate that finds no complete record counts the delimiters of the first record up to the end of the sample, or up to a quoted field still open there, and a quote inside a field that does not start with one makes that record incoherent; quote boundaries must be coherent, and ties prefer tab, comma, then semicolon | +| `sniff_delimiter(text, quote)` | comma, semicolon or tab: the one with the most consistent field count over the first 20 records with other text in a 64 KiB sample; when none separates those records, the candidates whose records hold only their delimiters and whitespace (rows of empty cells) are compared the same way, leaving out any candidate that found a record with other text; when no candidate finds coherent complete records with a delimiter in each, a candidate that finds no complete record with other text counts the delimiters of the first such record up to the end of the sample, or up to a quoted field still open there (after its rows of empty cells, a record without its delimiter is left out), and a quote inside a field that does not start with one makes that record incoherent; quote boundaries must be coherent, and ties prefer tab, comma, then semicolon | | `parse_records(text, delim, quote, max_fields, on_record)` | records of fields, one callback per record (return `false` to stop); CR, LF and CRLF line ends; quoted fields with doubled quotes and line breaks; a quote in the middle of a field is text | | `records(text, delim, quote, max_records, max_fields)` | the same, collected | | `push_field(out, field, delim)`, `field_len(field, delim)` | one field as written, quoted only when it holds the delimiter, a quote or a line break; its exact length, to enforce a size cap before writing | diff --git a/crates/csv/src/lib.rs b/crates/csv/src/lib.rs index 70f6148a6..395ad2152 100644 --- a/crates/csv/src/lib.rs +++ b/crates/csv/src/lib.rs @@ -33,13 +33,17 @@ pub use decode::{decode_text, decode_utf8}; /// Picks comma, semicolon or tab by consistent field counts in the first non-blank records. /// Quotes start only at a candidate field boundary; candidates with incoherent quoted fields /// are discarded when another coherent candidate separates the records. Ties prefer tab, -/// then comma, then semicolon. Comma is the fallback when no candidate separates the text. +/// then comma, then semicolon. When no candidate separates the records that hold other text, +/// the same rules pick among the candidates whose records hold only their delimiters and +/// whitespace, such as an exported row of empty cells; a candidate that finds a record with +/// other text is left out of that pick. Comma is the fallback when neither pick finds one. /// Only the first 64 KiB are read. A record cut off at the end of that sample is left out, /// except when no candidate finds coherent complete records with a delimiter in each. Then a candidate -/// that finds no complete record counts the delimiters read so far in the first record, and that -/// record is incoherent when it has a quote inside a field that does not start with one. When one -/// of those candidates ends the sample inside a quoted field, each of them counts only up to that -/// field's opening quote. +/// that finds no complete record with other text counts the delimiters read so far in the first +/// such record, unless it found rows of its empty cells and that record has none of its +/// delimiters. That record is incoherent when it has a quote inside a field that does not start +/// with one. When one of those candidates ends the sample inside a quoted field, each of them +/// counts only up to that field's opening quote. pub fn sniff_delimiter(text: &str, quote: char) -> u8 { const SAMPLE_BYTES: usize = 64 * 1024; let mut sample_end = text.len().min(SAMPLE_BYTES); @@ -64,7 +68,15 @@ pub fn sniff_delimiter(text: &str, quote: char) -> u8 { (scan.count, scan.record_has_content, scan.record_coherent, scan.record_bare_quote) = (before_cut.count, before_cut.record_has_content, before_cut.record_coherent, before_cut.record_bare_quote); } - if scan.record_has_content { + if scan.delimiter_only_counts.is_empty() { + if scan.record_has_content { + scan.coherent &= scan.record_coherent && !scan.record_bare_quote; + scan.counts.push(scan.count); + } else { + scan.push_delimiter_only_record(); + } + } else if scan.record_has_content && scan.count > 0 { + // After rows of empty cells, a cut record without this delimiter is left out. scan.coherent &= scan.record_coherent && !scan.record_bare_quote; scan.counts.push(scan.count); } @@ -79,6 +91,8 @@ pub fn sniff_delimiter(text: &str, quote: char) -> u8 { } else if scan.record_has_content { scan.coherent &= scan.record_coherent; scan.counts.push(scan.count); + } else { + scan.push_delimiter_only_record(); } } } @@ -86,23 +100,34 @@ pub fn sniff_delimiter(text: &str, quote: char) -> u8 { } fn pick_delimiter(scans: [DelimiterScan; 3]) -> u8 { - let candidates = - scans.map(|scan| (scan.delimiter, scan.counts.iter().copied().min().unwrap_or(0), scan.counts.iter().sum::(), scan.coherent)); + let with_text = scans.each_ref().map(|scan| (scan.delimiter, scan.counts.as_slice(), scan.coherent)); + // Records of delimiters alone have no quotes, so they are coherent. + let delimiters_only = + scans.each_ref().map(|scan| (scan.delimiter, if scan.counts.is_empty() { scan.delimiter_only_counts.as_slice() } else { &[] }, true)); + best_delimiter(with_text).or_else(|| best_delimiter(delimiters_only)).unwrap_or(b',') +} + +fn best_delimiter(candidates: [(u8, &[usize], bool); 3]) -> Option { + let candidates = candidates + .map(|(delimiter, counts, coherent)| (delimiter, counts.iter().copied().min().unwrap_or(0), counts.iter().sum::(), coherent)); let prefer_coherent = candidates.iter().any(|(_, min, _, coherent)| *min > 0 && *coherent); - let mut best = (b',', 0usize, 0usize); + let mut best: Option<(u8, usize, usize)> = None; for (delimiter, min, total, coherent) in candidates { - if min > 0 && (!prefer_coherent || coherent) && (min, total) > (best.1, best.2) { - best = (delimiter, min, total); + if min > 0 && (!prefer_coherent || coherent) && best.is_none_or(|(_, best_min, best_total)| (min, total) > (best_min, best_total)) { + best = Some((delimiter, min, total)); } } - best.0 + best.map(|(delimiter, _, _)| delimiter) } /// One candidate delimiter's pass over the sample in [`sniff_delimiter`]. struct DelimiterScan { delimiter: u8, - /// Delimiter counts of the complete non-blank records, at most 20. + /// Delimiter counts of the complete records that hold other text, at most 20. counts: Vec, + /// Delimiter counts of the complete records that hold only this candidate's delimiters and + /// whitespace, at most 20. They do not count toward the 20 records above. + delimiter_only_counts: Vec, /// Whether every counted record had coherent quoted fields. coherent: bool, reached_record_limit: bool, @@ -117,10 +142,21 @@ struct DelimiterScan { open_quote: Option, } +impl DelimiterScan { + /// Keeps the open record's delimiter count when the record has no other text and at least + /// one delimiter. + fn push_delimiter_only_record(&mut self) { + if !self.record_has_content && self.count > 0 && self.delimiter_only_counts.len() < 20 { + self.delimiter_only_counts.push(self.count); + } + } +} + fn scan_delimiter(sample: &str, delimiter: u8, quote: char) -> DelimiterScan { let mut scan = DelimiterScan { delimiter, counts: Vec::new(), + delimiter_only_counts: Vec::new(), coherent: true, reached_record_limit: false, count: 0, @@ -158,6 +194,8 @@ fn scan_delimiter(sample: &str, delimiter: u8, quote: char) -> DelimiterScan { scan.reached_record_limit = true; break; } + } else { + scan.push_delimiter_only_record(); } scan.count = 0; after_quote = false; @@ -403,6 +441,64 @@ mod tests { assert_eq!(sniff_delimiter(&format!("a,b,c;\"hello,\";d\n{}", "x;y;z\n".repeat(12_000)), '"'), b';'); } + // A sheet whose only value is far down exports rows of empty cells that fill the whole sample. + #[test] + fn delimiter_sniffing_reads_a_sparse_semicolon_export() { + assert_eq!(sniff_delimiter(&format!("{};7\n", ";\n".repeat(40_000)), '"'), b';'); + } + + #[test] + fn delimiter_sniffing_reads_a_sparse_semicolon_export_with_crlf() { + assert_eq!(sniff_delimiter(&format!("{};7\r\n", ";\r\n".repeat(40_000)), '"'), b';'); + } + + #[test] + fn delimiter_sniffing_reads_a_sparse_tab_export() { + assert_eq!(sniff_delimiter(&format!("{}\t7\r\n", "\t\r\n".repeat(40_000)), '"'), b'\t'); + } + + #[test] + fn delimiter_sniffing_reads_a_short_file_of_empty_semicolon_cells() { + assert_eq!(sniff_delimiter(";;\n;;\n", '"'), b';'); + assert_eq!(sniff_delimiter(";;\r\n;;", '"'), b';'); + } + + #[test] + fn delimiter_sniffing_reads_empty_semicolon_cells_padded_with_whitespace() { + assert_eq!(sniff_delimiter(&"; ; \n".repeat(20_000), '"'), b';'); + } + + #[test] + fn delimiter_sniffing_reads_a_first_record_of_empty_cells_longer_than_the_sample() { + assert_eq!(sniff_delimiter(&format!("{}\n1;2\n", ";".repeat(70_000)), '"'), b';'); + } + + #[test] + fn delimiter_sniffing_leaves_out_a_cut_record_after_a_row_of_empty_cells() { + assert_eq!(sniff_delimiter(&format!(";\n{};7\n", "x".repeat(70_000)), '"'), b';'); + } + + #[test] + fn delimiter_sniffing_counts_a_long_record_after_a_row_of_empty_cells() { + // Delimiters inside the long record's quoted field are text for every candidate. + assert_eq!(sniff_delimiter(&format!("\t\nname\t\"{}\"\n", "x,y".repeat(30_000)), '"'), b'\t'); + assert_eq!(sniff_delimiter(&format!(";\nname;\"{}\"\n", "x,y\t".repeat(20_000)), '"'), b';'); + } + + #[test] + fn delimiter_sniffing_lets_records_with_text_outweigh_records_of_delimiters_alone() { + // Rows of tabs alone are blank to the other candidates and do not outweigh them. + assert_eq!(sniff_delimiter(&format!("{}a;b\nc;d\n", "\t\n".repeat(25)), '"'), b';'); + assert_eq!(sniff_delimiter(&format!("{}a;b\nc;d\n", "\t\t\n".repeat(25)), '"'), b';'); + // The same holds for a record with text cut off at the end of the sample. + assert_eq!(sniff_delimiter(&format!("\t\n{}", "x;".repeat(40_000)), '"'), b';'); + // A candidate with a record of other text is judged on those records alone. + assert_eq!(sniff_delimiter(&format!("title\n{}", ";\n".repeat(25)), '"'), b','); + // Rows of empty cells in a comma file; comma is also the fallback. + assert_eq!(sniff_delimiter("a,b,c,d\n,,,\n,,,\n1,2,3,4\n", '"'), b','); + assert_eq!(sniff_delimiter(&format!("{}x;y\n", ",,,\n".repeat(20_000)), '"'), b','); + } + #[test] fn parser_stops_collecting_fields_at_the_cap() { let (max, extra) = (16_384usize, 50); From 8334fd3c838f212ee55a3618ef0db7f4725afaa8 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 4 Nov 2026 09:35:49 -0500 Subject: [PATCH 009/183] craft-cloud: cut-down contract plus ui pages --- Cargo.toml | 2 + crates/cloud-local/Cargo.toml | 19 + crates/cloud-local/src/lib.rs | 256 +++++ crates/cloud-local/tests/backend.rs | 241 +++++ crates/cloud/Cargo.toml | 15 + crates/cloud/src/error.rs | 68 ++ crates/cloud/src/lib.rs | 189 ++++ crates/cloud/src/types.rs | 216 ++++ crates/ui/Cargo.toml | 11 + crates/ui/README.md | 60 ++ crates/ui/src/account.rs | 449 ++++++++ crates/ui/src/buttons/mod.rs | 15 + crates/ui/src/cloud/app.rs | 255 +++++ crates/ui/src/cloud/backend.rs | 195 ++++ crates/ui/src/cloud/mod.rs | 852 ++++++++++++++++ crates/ui/src/cloud/pages.rs | 511 ++++++++++ crates/ui/src/cloud/tests.rs | 573 +++++++++++ crates/ui/src/cloud/title.rs | 173 ++++ crates/ui/src/lib.rs | 8 + crates/ui/src/menu.rs | 222 ++++ crates/ui/src/presence.rs | 424 ++++++++ crates/ui/src/share/backend.rs | 170 ++++ crates/ui/src/share/mod.rs | 1465 +++++++++++++++++++++++++++ crates/ui/src/share/tests.rs | 527 ++++++++++ crates/ui/tests/renders.rs | 343 +++++++ crates/ui/tests/share_dialog.rs | 589 +++++++++++ 26 files changed, 7848 insertions(+) create mode 100644 crates/cloud-local/Cargo.toml create mode 100644 crates/cloud-local/src/lib.rs create mode 100644 crates/cloud-local/tests/backend.rs create mode 100644 crates/cloud/Cargo.toml create mode 100644 crates/cloud/src/error.rs create mode 100644 crates/cloud/src/lib.rs create mode 100644 crates/cloud/src/types.rs create mode 100644 crates/ui/src/account.rs create mode 100644 crates/ui/src/cloud/app.rs create mode 100644 crates/ui/src/cloud/backend.rs create mode 100644 crates/ui/src/cloud/mod.rs create mode 100644 crates/ui/src/cloud/pages.rs create mode 100644 crates/ui/src/cloud/tests.rs create mode 100644 crates/ui/src/cloud/title.rs create mode 100644 crates/ui/src/menu.rs create mode 100644 crates/ui/src/presence.rs create mode 100644 crates/ui/src/share/backend.rs create mode 100644 crates/ui/src/share/mod.rs create mode 100644 crates/ui/src/share/tests.rs create mode 100644 crates/ui/tests/renders.rs create mode 100644 crates/ui/tests/share_dialog.rs diff --git a/Cargo.toml b/Cargo.toml index 2c0f4dfea..8b0f0eb21 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,6 +55,8 @@ craft-captions = { path = "crates/captions" } craft-cfb = { path = "crates/cfb" } craft-codepage = { path = "crates/codepage" } craft-cms = { path = "crates/cms" } +craft-cloud = { path = "crates/cloud" } +craft-cloud-local = { path = "crates/cloud-local" } craft-color = { path = "crates/color" } craft-frame = { path = "crates/frame" } craft-crs = { path = "crates/crs" } diff --git a/crates/cloud-local/Cargo.toml b/crates/cloud-local/Cargo.toml new file mode 100644 index 000000000..6b58b2bfd --- /dev/null +++ b/crates/cloud-local/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "craft-cloud-local" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true +description = "A reference CloudBackend over a local folder, proving the contract needs no specific provider" + +[lints] +workspace = true + +[dependencies] +craft-cloud = { workspace = true } +craft-ui = { workspace = true, features = ["cloud"] } + +[dev-dependencies] +tempfile = "3" +egui = { workspace = true } diff --git a/crates/cloud-local/src/lib.rs b/crates/cloud-local/src/lib.rs new file mode 100644 index 000000000..c9c11c015 --- /dev/null +++ b/crates/cloud-local/src/lib.rs @@ -0,0 +1,256 @@ +#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] + +//! A reference [`CloudBackend`] that treats one folder on disk as the cloud. +//! +//! [`craft_ui::cloud::CloudBackend`] names a contract and nothing about who +//! answers it. This crate is the proof: a working implementation that reaches +//! no service, a vendor, or a personal repo anybody else has to trust. An app +//! wires [`LocalBackend`] the same way it would wire a provider's own client, +//! by calling [`craft_ui::cloud::CloudFiles::connect`]. Swapping one for the +//! other is the whole point; nothing above the [`CloudBackend`] seam can tell +//! the difference. +//! +//! What this is not: a sync engine, a sharing service, or a place to keep a +//! credential. A folder has no concept of another account, so +//! [`Job::SharedWithMe`] answers empty and [`Job::Conversation`] answers with +//! a [`Fault`], and [`Account::capabilities`] claims neither. Reporting a +//! capability this backend cannot honour would be the broken window the +//! contract's own docs warn about. +//! +//! Every job answers on its own [`std::thread`]. [`CloudBackend::submit`] +//! must return before the file is opened, let alone read, or a twenty +//! megabyte document would freeze the window that called it. + +use std::fs; +use std::path::{Path, PathBuf}; + +use craft_cloud::{Capability, Entry, EntryKind}; +use craft_ui::cloud::{Account, CloudBackend, Event, Fault, Job, Post}; + +/// Where "the cloud" lives for this backend: one directory on disk. +/// +/// `Entry::id` and `Entry::path` are the same slash-separated path relative to +/// `root`, always starting with `/` below the root itself (the root's own +/// path is the empty string, matching [`Job::List`]'s contract). Neither is +/// an OS path; both go through [`resolve`] before anything touches a +/// filesystem, so a name containing `..` can never walk out of `root`. +pub struct LocalBackend { + root: PathBuf, + /// Shown in the account badge. Nothing else reads it. + display: String, +} + +impl LocalBackend { + /// Treat `root` as the cloud. The directory is not created here; a + /// listing of a root that does not exist yet answers with a [`Fault`] + /// the same way a real provider's missing folder would. + pub fn new(root: PathBuf) -> LocalBackend { + LocalBackend { root, display: "Local disk".to_owned() } + } + + /// Name shown in the account badge, in place of the default "Local disk". + pub fn named(mut self, display: impl Into) -> LocalBackend { + self.display = display.into(); + self + } +} + +impl CloudBackend for LocalBackend { + fn submit(&self, job: Job, post: Post) { + let root = self.root.clone(); + match job { + // Nothing is saved between runs and nothing was ever signed into, + // so there is nothing to forget. The trait states no answer for + // this job; CloudFiles::sign_out clears its own state regardless + // of whether anything ever arrives. + Job::SignOut => {} + Job::Account | Job::SignIn => { + let display = self.display.clone(); + std::thread::spawn(move || post.send(Event::Account(Ok(account(display))))); + } + // There is no browser round trip: a local folder is already + // "linked" the moment it exists. Reporting that immediately, + // rather than inventing a URL nobody needs to visit, is what the + // contract calls honest. + Job::LinkStart | Job::LinkPoll(_) => { + std::thread::spawn(move || post.send(Event::Linked(Ok(true)))); + } + Job::List(path) => { + std::thread::spawn(move || post.send(Event::Listed { entries: list(&root, &path), path })); + } + Job::SharedWithMe => { + std::thread::spawn(move || post.send(Event::Shared(Ok(Vec::new())))); + } + Job::Read { entry, into } => { + std::thread::spawn(move || { + let bytes = read(&root, &entry); + post.send(Event::Read { entry, into, bytes }); + }); + } + Job::Write { uid, entry, bytes } => { + std::thread::spawn(move || post.send(Event::Saved { uid, entry: write(&root, &entry, &bytes) })); + } + Job::Create { uid, folder, name, bytes } => { + std::thread::spawn(move || post.send(Event::Saved { uid, entry: create(&root, &folder, &name, &bytes) })); + } + // No sharing, no accounts beyond this one, and so nowhere for a + // conversation to live. A reference backend that invented one + // would be lying about what a folder on disk can do. + Job::Conversation(_) => { + std::thread::spawn(move || { + post.send(Event::Conversation(Err(Fault::Refused("this reference backend has no shared workspace to converse in".to_owned())))) + }); + } + } + } +} + +fn account(display: String) -> Account { + Account { display, capabilities: vec![Capability::Files, Capability::Etags], provider_linked: true } +} + +/// Turns a [`Job`]'s slash-separated path into a real filesystem path under +/// `root`, refusing anything that would walk back out of it. +/// +/// `..` is the only way out, so `..` is the only segment refused. `.` and +/// repeated or leading slashes are just an empty segment and are skipped, +/// the same way a browser's address bar collapses them. +fn resolve(root: &Path, path: &str) -> Result { + let mut real = root.to_path_buf(); + for segment in path.split('/') { + if segment.is_empty() || segment == "." { + continue; + } + if segment == ".." { + return Err(Fault::Refused(format!("{path} reaches outside this folder"))); + } + real.push(segment); + } + Ok(real) +} + +/// The path a listed child gets, given the folder it was found in. +fn child_path(folder: &str, name: &str) -> String { + format!("{}/{name}", folder.trim_end_matches('/')) +} + +/// An opaque version token for a file's current bytes. +/// +/// Not a timestamp for a person to read (that would go through `chrono`, per +/// this workspace's rule); just enough to tell "the file I read" from "the +/// file as it is now" apart, which is all a conditional write needs. +fn etag_of(meta: &fs::Metadata) -> String { + let stamp = meta.modified().ok().and_then(|time| time.duration_since(std::time::UNIX_EPOCH).ok()).map(|d| d.as_nanos()).unwrap_or(0); + format!("{}-{stamp}", meta.len()) +} + +fn io_fault(error: &std::io::Error) -> Fault { + use std::io::ErrorKind; + match error.kind() { + ErrorKind::NotFound => Fault::Refused("no such file or folder".to_owned()), + ErrorKind::PermissionDenied => Fault::Refused("permission denied".to_owned()), + _ => Fault::Unreachable(error.to_string()), + } +} + +fn list(root: &Path, path: &str) -> Result, Fault> { + let dir = resolve(root, path)?; + let read = fs::read_dir(&dir).map_err(|error| io_fault(&error))?; + let mut entries = Vec::new(); + for item in read { + let item = item.map_err(|error| io_fault(&error))?; + let meta = item.metadata().map_err(|error| io_fault(&error))?; + let name = item.file_name().to_string_lossy().into_owned(); + let id = child_path(path, &name); + entries.push(Entry { + room: format!("local:{id}"), + name, + kind: if meta.is_dir() { EntryKind::Folder } else { EntryKind::File }, + size: if meta.is_dir() { None } else { Some(meta.len()) }, + modified: None, + mime: None, + etag: if meta.is_dir() { None } else { Some(etag_of(&meta)) }, + writable: true, + shared_by: None, + path: id.clone(), + id, + }); + } + entries.sort_by(|a, b| (a.kind != EntryKind::Folder, &a.name).cmp(&(b.kind != EntryKind::Folder, &b.name))); + Ok(entries) +} + +fn read(root: &Path, entry: &Entry) -> Result, Fault> { + let file = resolve(root, &entry.id)?; + fs::read(&file).map_err(|error| io_fault(&error)) +} + +/// Saves back over `entry`, refusing the write when the file moved on since +/// `entry.etag` was read. A file that no longer exists has nothing to +/// conflict with, the same way a provider treats a deleted document. +fn write(root: &Path, entry: &Entry, bytes: &[u8]) -> Result { + let file = resolve(root, &entry.id)?; + if let Ok(meta) = fs::metadata(&file) { + if Some(etag_of(&meta)) != entry.etag { + return Err(Fault::Conflict); + } + } + if let Some(parent) = file.parent() { + fs::create_dir_all(parent).map_err(|error| io_fault(&error))?; + } + fs::write(&file, bytes).map_err(|error| io_fault(&error))?; + let meta = fs::metadata(&file).map_err(|error| io_fault(&error))?; + Ok(Entry { size: Some(meta.len()), etag: Some(etag_of(&meta)), ..entry.clone() }) +} + +fn create(root: &Path, folder: &str, name: &str, bytes: &[u8]) -> Result { + let dir = resolve(root, folder)?; + fs::create_dir_all(&dir).map_err(|error| io_fault(&error))?; + let file = dir.join(name); + if file.exists() { + return Err(Fault::Refused(format!("{name} already exists"))); + } + fs::write(&file, bytes).map_err(|error| io_fault(&error))?; + let meta = fs::metadata(&file).map_err(|error| io_fault(&error))?; + let id = child_path(folder, name); + Ok(Entry { + room: format!("local:{id}"), + name: name.to_owned(), + kind: EntryKind::File, + size: Some(meta.len()), + modified: None, + mime: None, + etag: Some(etag_of(&meta)), + writable: true, + shared_by: None, + path: id.clone(), + id, + }) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn a_parent_segment_cannot_walk_out_of_root() { + let root = PathBuf::from("/cloud/root"); + assert!(resolve(&root, "../secrets").is_err()); + assert!(resolve(&root, "Archive/../../../etc/passwd").is_err()); + } + + #[test] + fn repeated_and_trailing_slashes_collapse_like_a_browser_address_bar() { + let root = PathBuf::from("/cloud/root"); + assert_eq!(resolve(&root, "//Archive//2026/").unwrap(), root.join("Archive").join("2026")); + assert_eq!(resolve(&root, "").unwrap(), root); + } + + #[test] + fn a_folder_announces_no_capability_this_backend_cannot_honour() { + let reported = account("Local disk".to_owned()).capabilities; + for absent in [Capability::SharedWithMe, Capability::Sharing, Capability::Conversation, Capability::Contacts] { + assert!(!reported.contains(&absent), "a folder has no {absent:?}"); + } + } +} diff --git a/crates/cloud-local/tests/backend.rs b/crates/cloud-local/tests/backend.rs new file mode 100644 index 000000000..4176672f1 --- /dev/null +++ b/crates/cloud-local/tests/backend.rs @@ -0,0 +1,241 @@ +//! Drives [`craft_cloud_local::LocalBackend`] the way an app does: through +//! `craft_ui::cloud`'s own public functions, never by calling the backend +//! directly. That is the seam this crate exists to prove, so the tests stay +//! on the application's side of it. + +use std::sync::{Arc, Mutex}; +use std::time::{Duration, Instant}; + +use craft_cloud::{Entry, EntryKind}; +use craft_cloud_local::LocalBackend; +use craft_ui::cloud::{self, Account, CloudApp, CloudFiles, Destination, DocumentKind, Job}; + +const NOTE: DocumentKind = DocumentKind { extensions: &["txt"], mimes: &["text/plain"], noun: "note", default_extension: "txt" }; + +/// The least a [`CloudApp`] can be. What it was told to open is recorded, so a +/// round trip can be checked by content and not only by the entry metadata +/// `craft_ui` itself remembers. +struct Harness { + cloud: CloudFiles, + share: craft_ui::share::ShareDialog, + presence: craft_ui::presence::PresenceBar, + opened: Arc)>>>, + said: Arc>>, +} + +impl Harness { + fn new() -> Harness { + Harness { + cloud: CloudFiles::new(), + share: craft_ui::share::ShareDialog::new(), + presence: craft_ui::presence::PresenceBar::new(), + opened: Arc::new(Mutex::new(Vec::new())), + said: Arc::new(Mutex::new(Vec::new())), + } + } +} + +impl CloudApp for Harness { + fn cloud(&self) -> &CloudFiles { + &self.cloud + } + + fn cloud_mut(&mut self) -> &mut CloudFiles { + &mut self.cloud + } + + fn kind(&self) -> DocumentKind { + NOTE + } + + fn active(&self) -> Option { + None + } + + fn title(&self, _uid: u64) -> String { + String::new() + } + + fn open_bytes(&mut self, name: &str, bytes: Vec) -> Result, String> { + self.opened.lock().unwrap().push((name.to_owned(), bytes)); + Ok(Some(1)) + } + + fn encode(&mut self, _uid: u64, _into: Destination<'_>) -> Result, String> { + Ok(Vec::new()) + } + + fn close(&mut self, _uid: u64) {} + + fn sharing(&mut self) -> &mut craft_ui::share::ShareDialog { + &mut self.share + } + + fn presence(&mut self) -> &mut craft_ui::presence::PresenceBar { + &mut self.presence + } + + fn paint_icon(&self, _painter: &egui::Painter, _rect: egui::Rect, _kind: EntryKind, _colour: egui::Color32) {} + + fn open_url(&self, _url: &str) {} + + fn say(&mut self, text: String) { + self.said.lock().unwrap().push(text); + } + + fn app_name(&self) -> &str { + "Harness" + } +} + +fn wired(root: std::path::PathBuf) -> (Harness, egui::Context) { + let mut app = Harness::new(); + app.cloud.connect(LocalBackend::new(root)); + (app, egui::Context::default()) +} + +/// Drains whatever the backend's worker threads have sent so far, until +/// `done` says the state the test is waiting for arrived or five seconds pass. +/// Five seconds is far more than a thread doing local file IO ever needs; it +/// only guards against a real bug leaving the test to hang forever. +fn settle(app: &mut Harness, ctx: &egui::Context, mut done: impl FnMut(&Harness) -> bool) { + let start = Instant::now(); + loop { + ctx.begin_pass(Default::default()); + cloud::pump(app, ctx); + ctx.end_pass().textures_delta.clear(); + if done(app) { + return; + } + assert!(start.elapsed() < Duration::from_secs(5), "timed out waiting for the backend's worker thread"); + std::thread::sleep(Duration::from_millis(5)); + } +} + +#[test] +fn account_and_sign_in_report_the_same_fixed_identity_with_no_browser_round_trip() { + let dir = tempfile::tempdir().unwrap(); + let (mut app, ctx) = wired(dir.path().to_path_buf()); + + cloud::start(&mut app); + settle(&mut app, &ctx, |app| app.cloud().account.is_some()); + + assert_eq!( + app.cloud().account, + Some(Account { + display: "Local disk".to_owned(), + capabilities: vec![craft_cloud::Capability::Files, craft_cloud::Capability::Etags], + provider_linked: true + }) + ); + // There was never an account to link, so nothing was ever offered. + assert!(app.cloud().link.is_none()); +} + +#[test] +fn creating_a_document_writes_real_bytes_a_read_gets_back() { + let dir = tempfile::tempdir().unwrap(); + let (mut app, ctx) = wired(dir.path().to_path_buf()); + + cloud::submit(&app, Job::Create { uid: 1, folder: String::new(), name: "Minutes.txt".to_owned(), bytes: b"first draft".to_vec() }); + settle(&mut app, &ctx, |app| app.cloud().origins.contains_key(&1)); + + let entry = app.cloud().origins.get(&1).unwrap().entry.clone(); + assert_eq!(entry.name, "Minutes.txt"); + assert_eq!(entry.id, "/Minutes.txt"); + assert_eq!(fs_read(dir.path(), "Minutes.txt"), b"first draft"); + + cloud::submit(&app, Job::Read { entry, into: None }); + settle(&mut app, &ctx, |app| !app.opened.lock().unwrap().is_empty()); + + let opened = app.opened.lock().unwrap().clone(); + assert_eq!(opened, vec![("Minutes.txt".to_owned(), b"first draft".to_vec())], "the read got back exactly what the create wrote"); +} + +#[test] +fn a_write_under_a_stale_version_is_refused_and_never_overwrites_the_newer_file() { + let dir = tempfile::tempdir().unwrap(); + let (mut app, ctx) = wired(dir.path().to_path_buf()); + + cloud::submit(&app, Job::Create { uid: 1, folder: String::new(), name: "Minutes.txt".to_owned(), bytes: b"v1".to_vec() }); + settle(&mut app, &ctx, |app| app.cloud().origins.contains_key(&1)); + let stale = app.cloud().origins.get(&1).unwrap().entry.clone(); + + // Somebody else saves first, changing the file's etag without going + // through this window at all. + std::fs::write(dir.path().join("Minutes.txt"), b"somebody else's edit").unwrap(); + + cloud::submit(&app, Job::Write { uid: 1, entry: stale, bytes: b"this window's edit".to_vec() }); + settle(&mut app, &ctx, |app| app.cloud().conflict.is_some()); + + assert_eq!(app.cloud().conflict.as_ref().unwrap().uid, 1); + assert_eq!(fs_read(dir.path(), "Minutes.txt"), b"somebody else's edit", "the refused write never touched the file"); +} + +#[test] +fn listing_the_root_reflects_a_file_nobody_went_through_this_backend_to_write() { + let dir = tempfile::tempdir().unwrap(); + std::fs::write(dir.path().join("Agenda.txt"), b"1. roll call").unwrap(); + std::fs::create_dir(dir.path().join("Archive")).unwrap(); + let (mut app, ctx) = wired(dir.path().to_path_buf()); + + cloud::browse(&mut app, ""); + settle(&mut app, &ctx, |app| app.cloud().mine.loaded); + + let names: Vec<_> = app.cloud().mine.entries.iter().map(|entry| entry.name.clone()).collect(); + assert_eq!(names, vec!["Archive".to_owned(), "Agenda.txt".to_owned()], "folders first, then files, each alphabetised"); + let folder = app.cloud().mine.entries.iter().find(|entry| entry.name == "Archive").unwrap(); + assert_eq!(folder.kind, EntryKind::Folder); + assert!(folder.size.is_none()); +} + +#[test] +fn nobody_has_shared_anything_with_a_folder() { + let dir = tempfile::tempdir().unwrap(); + let (mut app, ctx) = wired(dir.path().to_path_buf()); + + cloud::load_shared(&mut app); + settle(&mut app, &ctx, |app| app.cloud().shared.loaded); + + assert_eq!(app.cloud().shared.entries, Vec::new()); + assert!(app.cloud().shared.error.is_none(), "an empty share list is not a failure"); +} + +#[test] +fn a_conversation_is_a_fault_this_backend_is_honest_about() { + let dir = tempfile::tempdir().unwrap(); + let (mut app, ctx) = wired(dir.path().to_path_buf()); + + cloud::submit(&app, Job::Conversation("/Minutes.txt".to_owned())); + settle(&mut app, &ctx, |app| app.cloud().status.is_some()); + + assert_eq!(app.cloud().status, Some("this reference backend has no shared workspace to converse in".to_owned())); +} + +#[test] +fn a_read_of_a_document_that_is_not_there_is_put_to_the_user_not_silently_dropped() { + let dir = tempfile::tempdir().unwrap(); + let (mut app, ctx) = wired(dir.path().to_path_buf()); + + let ghost = Entry { + id: "/ghost.txt".to_owned(), + room: "local:/ghost.txt".to_owned(), + name: "ghost.txt".to_owned(), + path: "/ghost.txt".to_owned(), + kind: EntryKind::File, + size: None, + modified: None, + mime: None, + etag: None, + writable: true, + shared_by: None, + }; + cloud::submit(&app, Job::Read { entry: ghost, into: None }); + settle(&mut app, &ctx, |app| !app.said.lock().unwrap().is_empty()); + + assert!(app.said.lock().unwrap()[0].contains("ghost.txt"), "the message names the document, not just that something failed"); +} + +fn fs_read(root: &std::path::Path, name: &str) -> Vec { + std::fs::read(root.join(name)).unwrap() +} diff --git a/crates/cloud/Cargo.toml b/crates/cloud/Cargo.toml new file mode 100644 index 000000000..055feff39 --- /dev/null +++ b/crates/cloud/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "craft-cloud" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true +description = "What a cloud provider offers the Craft apps: files, sharing, contacts, notifications and mail as contracts, with no vendor and no IO" + +[lints] +workspace = true + +[dependencies] +serde = { workspace = true } +thiserror = { workspace = true } diff --git a/crates/cloud/src/error.rs b/crates/cloud/src/error.rs new file mode 100644 index 000000000..ede71ac0c --- /dev/null +++ b/crates/cloud/src/error.rs @@ -0,0 +1,68 @@ +//! One error type for every contract. +//! +//! The cases are the ones a caller acts on differently. A UI shows a different +//! thing for "you may not" than for "the server is unreachable", and a save +//! retries on a conflict where it would not on a refusal. + +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum Error { + /// The provider could not be reached. Worth retrying. + #[error("the provider could not be reached: {0}")] + Unreachable(String), + + /// The credential was rejected. The user has to sign in again. + #[error("the provider rejected the credential")] + Unauthenticated, + + /// Authenticated, and not allowed to do this. Signing in again will not + /// help, so a UI must not offer it. + #[error("not permitted: {0}")] + Forbidden(String), + + /// No such document, folder or share. + #[error("{what} not found: {id}")] + NotFound { what: &'static str, id: String }, + + /// The document changed since the caller last read it. A save that would + /// have overwritten somebody else's work lands here. + #[error("{0} changed since you opened it")] + Conflict(String), + + /// The provider does not offer this at all. + /// + /// Distinct from [`Error::Forbidden`]: there is nothing to grant. A UI + /// hides the feature rather than explaining it. + #[error("this provider does not support {0}")] + Unsupported(&'static str), + + /// The answer did not match the protocol. + #[error("malformed {what}: {detail}")] + Malformed { what: &'static str, detail: String }, + + /// A name or path could not be used safely. Carried, never panicked. + #[error("invalid {what}: {detail}")] + Invalid { what: &'static str, detail: String }, +} + +impl Error { + pub fn not_found(what: &'static str, id: impl Into) -> Error { + Error::NotFound { what, id: id.into() } + } + + pub fn malformed(what: &'static str, detail: impl Into) -> Error { + Error::Malformed { what, detail: detail.into() } + } + + pub fn invalid(what: &'static str, detail: impl Into) -> Error { + Error::Invalid { what, detail: detail.into() } + } + + /// Whether trying again could succeed without the user doing anything. + pub fn is_transient(&self) -> bool { + matches!(self, Error::Unreachable(_)) + } +} + +pub type Result = std::result::Result; diff --git a/crates/cloud/src/lib.rs b/crates/cloud/src/lib.rs new file mode 100644 index 000000000..7f02dd468 --- /dev/null +++ b/crates/cloud/src/lib.rs @@ -0,0 +1,189 @@ +//! What a cloud provider has to offer the Craft apps, and nothing about who +//! provides it. +//! +//! Every capability here is an RFC or an ordinary HTTP API that many systems +//! implement. Files are WebDAV. Contacts are CardDAV. Calendars are CalDAV. +//! Sharing and notification are the only genuinely vendor-shaped parts, and +//! they are small. So there is no reason for an app to know which server it is +//! talking to, and no reason to write the same logic again for the next one. +//! +//! Nothing in this crate opens a socket. Each trait is implemented by a +//! provider crate that brings its own transport, which keeps this testable +//! with no server and keeps the contracts honest about what they need. +//! +//! No type here names a vendor. If a field only makes sense for one product, +//! it belongs in that provider's crate. +//! +//! Nothing here says where an implementation runs. A local adapter may +//! implement these traits against a provider directly, and an application may +//! consume them that way. The contracts do not care. +//! +//! CollabCraft chooses otherwise for its own apps. They reach one service, and +//! that service is the single place a provider is configured, a credential is +//! held and a permission is decided. A desktop binary carrying a provider +//! credential leaks one the moment somebody copies the file, which is what +//! that arrangement exists to prevent. It is a deployment policy, and this +//! crate imposes it on nobody. + +#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] + +mod error; +mod types; + +pub use error::{Error, Result}; +pub use types::{ + Capability, Contact, Conversation, Entry, EntryKind, Identity, MailMessage, Notification, Permission, Share, ShareOptions, ShareTarget, +}; + +/// Reading and writing documents. +/// +/// `list` and `shared_with_me` are separate because they answer different +/// questions. One is a folder's contents, the other is everything another +/// person has given this user access to, which has no single parent folder. +pub trait Files { + /// One folder's contents. An empty path means the user's root. + fn list(&self, path: &str) -> Result>; + + /// Everything shared with this user, wherever it lives. + /// + /// A provider with no concept of this returns an empty list rather than an + /// error, because "nobody has shared anything with you" and "this server + /// cannot tell you" look the same to a file picker. + fn shared_with_me(&self) -> Result>; + + /// One document's bytes. + fn read(&self, id: &str) -> Result>; + + /// A byte range of one document. + /// + /// Defaulted to a full [`read`] and a slice, so providers that have no + /// ranged GET still satisfy the trait. A provider with real range support + /// overrides this. + fn read_range(&self, id: &str, offset: u64, length: u64) -> Result> { + let bytes = self.read(id)?; + let start = usize::try_from(offset).unwrap_or(usize::MAX); + if start >= bytes.len() { + return Ok(Vec::new()); + } + let take = usize::try_from(length).unwrap_or(usize::MAX); + let end = start.saturating_add(take).min(bytes.len()); + Ok(bytes[start..end].to_vec()) + } + + /// Replace one document's bytes. + /// + /// `if_match` carries the etag the caller last saw. A provider that + /// supports conditional writes uses it to refuse a save that would + /// overwrite somebody else's, returning [`Error::Conflict`]. Passing + /// `None` means "write regardless", which is what a Save As does. + fn write(&self, id: &str, bytes: &[u8], if_match: Option<&str>) -> Result; + + /// Create a document and return it. + fn create(&self, folder: &str, name: &str, bytes: &[u8]) -> Result; + + /// One document's metadata, without its bytes. + fn stat(&self, id: &str) -> Result; +} + +/// Giving other people access to a document. +/// +/// Persisting a share through the provider matters more than it looks. A share +/// recorded only by the caller would be invisible in the provider's own file +/// manager, so the two would disagree about who can open what. The provider +/// stays the authority. +pub trait Sharing { + /// Share a document. + /// + /// A link share has no recipient, so [`ShareTarget::Link`] is how a caller + /// asks for one. The returned [`Share::url`] is what to hand out. + fn share(&self, id: &str, with: &ShareTarget, permission: Permission, options: &ShareOptions) -> Result; + + /// Who currently has access. + fn shares(&self, id: &str) -> Result>; + + /// Withdraw one share. + fn unshare(&self, share_id: &str) -> Result<()>; +} + +/// Looking people up, for a share dialog's autocomplete. +/// +/// This is the only thing the share dialog needs, so it is the only thing the +/// contract exposes. A full address book API would be a bigger surface for no +/// gain. +pub trait Contacts { + /// People matching a partial name or address. + /// + /// `limit` exists because this runs on every keystroke. A provider is free + /// to return fewer. + fn search(&self, query: &str, limit: usize) -> Result>; +} + +/// Telling somebody something happened. +/// +/// Separate from [`Mail`] on purpose. An in-app notification is cheap, arrives +/// instantly and is read in context. An email is none of those and is the +/// right choice for somebody who is not currently in the app. A share usually +/// wants both. +pub trait Notifications { + fn notify(&self, user: &str, notification: &Notification) -> Result<()>; +} + +/// Sending mail as the provider. +pub trait Mail { + fn send(&self, message: &MailMessage) -> Result<()>; +} + +/// Who the caller is, according to the provider. +pub trait Accounts { + /// Resolve the signed-in user. + fn me(&self) -> Result; +} + +/// Working together on a document, through whatever the provider calls it. +/// +/// Defaulted throughout. A provider without the feature writes an empty +/// `impl` and reports [`Capability::Conversation`] as absent. The caller +/// then draws no control at all. +pub trait Conversations { + /// What this provider calls the feature. `None` where it has none. + /// + /// Separate from the capability on purpose. The name is a property of + /// the provider. Whether it is available is a property of the + /// instance, and an administrator decides that one. + fn conversation_name(&self) -> Option { + None + } + + /// Start a conversation about a document, or join the one already there. + /// + /// Two people pressing the same control have to arrive in the same + /// place, so this is expected to be idempotent for a given document. + /// + /// `id` is the provider's own handle and means nothing outside the + /// account it came from. A conversation is therefore keyed on the + /// provider, the account and the document together, and `self` carries + /// the first two. A document copied into another account is a different + /// document to its provider, so it gets a conversation of its own. + /// Nothing here can attach one account's thread to another's. + fn conversation(&self, _id: &str, _title: &str) -> Result { + Err(Error::Unsupported("conversations")) + } +} + +/// Everything one provider can do. +/// +/// A provider implements the capabilities it has and reports the rest as +/// absent, so a caller can hide a share button on a server with no sharing +/// rather than offering a feature that will fail. +pub trait Provider: Files + Sharing + Contacts + Notifications + Mail + Accounts + Conversations { + /// A stable identifier, such as `nextcloud`. Used in configuration and + /// logs, never shown to a user. + fn id(&self) -> &str; + + /// What this provider actually supports. + fn capabilities(&self) -> Vec; + + fn supports(&self, capability: Capability) -> bool { + self.capabilities().contains(&capability) + } +} diff --git a/crates/cloud/src/types.rs b/crates/cloud/src/types.rs new file mode 100644 index 000000000..ab8c005a1 --- /dev/null +++ b/crates/cloud/src/types.rs @@ -0,0 +1,216 @@ +//! The data the contracts pass around. +//! +//! Every type here is plain and vendor-neutral. A field that only means +//! something to one product belongs in that provider's crate. + +use serde::{Deserialize, Serialize}; + +/// What a provider can do. +/// +/// Reported rather than assumed, so a caller hides a share button on a +/// server without sharing instead of offering a feature that fails on use. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum Capability { + Files, + SharedWithMe, + Sharing, + Contacts, + Notifications, + Mail, + /// Conditional writes, so a save can refuse to clobber a newer version. + Etags, + /// Public links. Absent on a server that forbids them, and the dialog then + /// offers no Copy link rather than a button that fails. + LinkShares, + /// A key on a public link. This is what most places mean when they talk + /// about sharing with somebody who has no account. + LinkPassword, + /// The server requires that key, so a link cannot be made without one. + LinkPasswordRequired, + /// An expiry date on a share. + ShareExpiry, + /// The provider can tell a recipient that something was shared with them. + /// + /// Distinct from [`Capability::Mail`], which is about sending arbitrary + /// mail. A provider commonly has this and not that: it will notify the + /// person a share names without offering any way to send mail in general. + ShareNotify, + /// A conversation about a document, such as a call or a chat room. + /// + /// Every provider that has this calls it something else, so the name + /// comes from [`crate::Conversations::conversation_name`]. Reported + /// separately from that name: a provider knows what it would call the + /// feature whether or not an administrator installed it. + Conversation, +} + +/// A file or folder. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct Entry { + /// An opaque handle for reading, writing and sharing this entry. + /// + /// Only the provider that issued it may interpret it. A caller passes it + /// back and never parses it. + pub id: String, + /// The stable identity used for a collaboration room. + /// + /// Separate from `id` on purpose. A provider's read and write handle is + /// often a path, and a path changes when somebody renames or moves the + /// file. A room keyed on that would silently split in two mid-session, + /// with each half seeing only its own edits. This one survives a rename. + pub room: String, + /// What to show the user. + pub name: String, + /// Where it sits, for a breadcrumb. Never a handle. + pub path: String, + pub kind: EntryKind, + /// Bytes, absent for a folder. + pub size: Option, + /// RFC 3339. Absent when the provider does not say. + pub modified: Option, + /// For matching a document to the app that opens it. + pub mime: Option, + /// The version the caller last saw, for a conditional write. + pub etag: Option, + /// Whether this user may change it. A read-only share still lists. + pub writable: bool, + /// Who shared it, when it came from somebody else. + pub shared_by: Option, +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum EntryKind { + File, + Folder, +} + +/// A person, as a share dialog needs them. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct Contact { + /// What the provider wants back when sharing with this person. + pub id: String, + /// How to share with them, decided by the provider and never guessed. + /// + /// The distinction is not cosmetic. A contact with an account is a user + /// share. One known only by address is an email share. Sharing an address + /// as though it were a user id fails with "not found", because no such + /// user exists, and nothing in `id` alone says which case this is. + pub target: ShareTarget, + /// What to show. A display name where there is one. + pub name: String, + pub email: Option, + /// An avatar, as a URL the client may fetch. Never image bytes: a search + /// returning ten people would otherwise carry ten pictures nobody asked + /// for yet. + pub avatar: Option, + /// A group rather than a person. Shown differently and shared differently. + pub is_group: bool, +} + +/// Who to share with. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case", tag = "kind", content = "id")] +pub enum ShareTarget { + User(String), + Group(String), + /// Somebody with no account, reached by address. + Email(String), + /// Anybody holding the link. + Link, +} + +/// What a share allows. +/// +/// Deliberately coarse. Providers disagree on the fine detail, and a dialog +/// offering a distinction the server cannot keep is worse than one that does +/// not. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum Permission { + /// Open and read. No edits reach the document. + View, + /// Open and edit. + Edit, +} + +/// Everything optional about a share. +/// +/// A struct rather than more positional arguments. The list grew past the +/// point where a call site reads correctly, and a provider that cannot honour +/// one of these needs to see which it was given. +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] +pub struct ShareOptions { + /// Shown to the recipient. + pub note: Option, + /// Send mail where the provider can. + pub notify: bool, + /// A key the recipient must present. Only meaningful for a link, and + /// refused by a server that does not allow one. + pub password: Option, + /// `YYYY-MM-DD`. After this the share stops working. + pub expires: Option, +} + +/// Where to go to work together on a document. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct Conversation { + /// Where to join. Handed to a browser, or to the provider's own app. + pub url: String, + /// What the provider calls the feature, for the control's wording. A + /// menu item reading "Work together in Talk" is built from this. + pub name: String, +} + +/// A share that exists. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct Share { + pub id: String, + pub target: ShareTarget, + /// What to call the recipient, where the provider says. + /// + /// A share carries the handle the server wants back, which for a user is + /// an account id. People are not known to each other by account id. A + /// provider that knows the difference says so here. + pub display: Option, + pub permission: Permission, + /// Present for a link share, absent otherwise. + pub url: Option, + pub note: Option, + /// RFC 3339. + pub created: Option, +} + +/// Something worth telling a user about, in the app. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct Notification { + /// A short machine-readable kind, such as `document_shared`. Lets a client + /// decide how to render without parsing prose. + pub kind: String, + pub subject: String, + pub body: Option, + /// Where to go when it is clicked. + pub link: Option, +} + +/// An email to send. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct MailMessage { + pub to: Vec, + pub subject: String, + pub body: String, + /// Whether `body` is HTML. Plain text otherwise. + pub html: bool, +} + +/// The signed-in user, as the provider sees them. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct Identity { + /// The provider's identifier for this account. + pub id: String, + /// What to show. Never an identity: two people can share a display name. + pub display: String, + pub email: Option, + pub avatar: Option, +} diff --git a/crates/ui/Cargo.toml b/crates/ui/Cargo.toml index 29d7f29f2..ac5085cd9 100644 --- a/crates/ui/Cargo.toml +++ b/crates/ui/Cargo.toml @@ -19,6 +19,12 @@ log = "0.4" serde = { version = "1", features = ["derive"], optional = true } # Same version as epaint's, for reading a face's character map. skrifa = { version = "0.44", default-features = false, features = ["std"] } +# The vendor-neutral vocabulary the share dialog speaks. No IO and no +# vendor, so this stays buildable for the web. +craft-cloud = { workspace = true, optional = true } +# The control channel's report of the cloud state. One serialiser here +# rather than one per application. No IO and no vendor. +serde_json = { workspace = true, optional = true } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # Screenshot and input tests of an app's screens (the screen-testing feature). @@ -54,6 +60,11 @@ testing = [] # craft_ui::testing: per-language screenshot tests, IME smoke tests, input steps and review # screenshots with egui_kittest (desktop only). screen-testing = ["dep:egui_kittest"] +# The share dialog and the backend contract it states its work through. +share = ["dep:craft-cloud"] +# Open and Save against cloud storage. Needs the share dialog, which a +# document's overflow menu and the Share split button both open. +cloud = ["share", "dep:serde_json"] [dev-dependencies] # serde: the IME tests read events that only the suite's egui fork has from JSON. diff --git a/crates/ui/README.md b/crates/ui/README.md index a48e49476..1ad05ad54 100644 --- a/crates/ui/README.md +++ b/crates/ui/README.md @@ -705,6 +705,66 @@ verify the actual pixels as well as callback routing. `text::align_galley_rows` positions already shaped rows inside a fixed-width reading area without changing glyphs or logical text. Supply a per-row alignment, for example the paragraph direction from the application shaper. The helper uses stock egui APIs and keeps cached glyph meshes shared. Its logical rectangle is the requested width; ink may overflow, so clip the painter when drawing cards. Use it for read-only painting, keeping the original galley for editable hit testing. +## Sharing + +`share::ShareDialog` is a whole dialog. It holds a recipient picker with autocomplete and +removable chips. It offers a view-or-edit choice, a note and a notify-by-email box. Under those it +lists who already has access, with a withdrawal beside each entry. Every Craft app gets the same +dialog. An application's own part comes to three lines. + +```rust +// Once, at startup. The host supplies the half that reaches the service. +app.share.connect(my_backend); + +// Every frame, open or shut. This is also where answers are collected. +app.share.show(ctx); + +// From the app's Share control, drawn only while `available()` is true. +if app.share.available() && share_button.clicked() { + app.share.open(entry.id.clone(), entry.name.clone()); +} +``` + +The dialog opens no socket, names no provider and holds no credential. It states each piece of +work as a `share::Request` and hands it to a `share::ShareBackend`. That backend answers through a +`share::Replier` whenever it is ready. Nothing in this crate implements that trait. A host writes +the half that opens a socket, and this crate never learns what it reaches. The interface half +therefore builds for the web, and every flow is testable with no server running. + +Autocomplete waits `share::DEBOUNCE` after the last keystroke before it asks anything. An answer +to a query the user has already typed past is dropped before it reaches the list. A list that +flickers back to stale matches is worse than one that arrives late. + +Partial success is rendered as partial success. A share aimed at five people with one wrong +address reaches four. The dialog names the fifth with the reason the service gave. It keeps that +one recipient in the picker. A correction then takes one edit. `outcome()` hands back both halves. + +Capability is reported and never assumed. `available()` stays false until the service says the +provider supports sharing and an account is linked. `open` does nothing while it is false. An +application draws no Share control in that state. A hidden feature beats a button that fails on +use. Contacts and mail are reported separately. A server with no address book accepts typed +addresses only. A server that cannot send mail disables the notify box and says why. +`ShareLabels` holds every string the dialog shows. The defaults are English. A localized +application replaces them without touching this crate. + +A contact's `avatar` is a URL. The dialog asks for the bytes through the same backend, as the row +that needs the picture is painted and only while that row is on screen. A search answering with +ten people costs no pictures until somebody looks at them. Each URL is asked about once. A refusal +is remembered, with initials painted in its place. The host decides whether a picture may be +fetched at all. A backend that refuses `share::Request::Avatar` gets initials painted instead, and +a host that would rather not have an application reach a provider's avatar URL directly can say +so by refusing it. A host that relays pictures answers it. Nothing else changes. + +### The account + +`account::AccountMenu` is the badge every suite puts in the top right. It shows who is signed in, +where they are signed in, and whether storage is linked. It holds no credential. It asks the +service who the caller is, through the application. It reports what the user asked for through +`take_action`. The application owns what signing in means. + +Without linked storage, Open and Save have nowhere to go. The menu says so at rest. A failure at +the moment of saving arrives too late to be useful. + ## Compatibility and checks The crate uses egui 0.37 and Rust 1.95 or later. Its production dependency disables egui's default diff --git a/crates/ui/src/account.rs b/crates/ui/src/account.rs new file mode 100644 index 000000000..d83214500 --- /dev/null +++ b/crates/ui/src/account.rs @@ -0,0 +1,449 @@ +//! Who is signed in, which account is in use, and how to stop being signed in. +//! +//! Every office suite puts this in the same place, for the same reason. A +//! document is about to be saved somewhere and shared with somebody. The +//! account decides both the destination and the identity. An application that +//! never shows it leaves the user guessing which of their identities is in +//! play. +//! +//! A person commonly holds more than one. A work account and a personal one +//! are two different places to save, with two different sets of colleagues to +//! share with, and confusing them is the expensive mistake this control exists +//! to prevent. So the control holds a list and marks which one is in use. +//! +//! This holds no credential. It asks the service who the caller is and shows +//! the answer. A sign-out makes the service forget the session. + +use std::sync::mpsc::{Receiver, Sender, channel}; + +use egui::{Align, Context, Layout, RichText, Ui}; + +/// One account the user is signed in to. +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub struct Account { + /// How the service names this account. Never shown. + pub id: String, + /// What to show. A display name, never an identity. + pub display: String, + pub email: Option, + /// Where they are signed in, such as the service's host. Shown because + /// somebody with accounts on two deployments needs to tell them apart. + pub service: String, + /// Whether storage is linked. Without it Open and Save have nowhere to go, + /// and saying so here is kinder than a failure at the moment of saving. + pub linked: bool, +} + +impl Account { + pub fn new(id: impl Into, display: impl Into) -> Account { + Account { id: id.into(), display: display.into(), ..Account::default() } + } + + /// The letter on the badge. The first character of the display name, which + /// is what every suite uses and what people recognise at that size. + pub fn initial(&self) -> String { + self.display.chars().next().map(|c| c.to_uppercase().to_string()).unwrap_or_else(|| "?".to_owned()) + } +} + +/// What the menu asks the application to do. +/// +/// Each one names the account it is about. A control that said only "sign out" +/// would be ambiguous the moment somebody held two. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum AccountAction { + /// Begin a sign-in with nobody signed in yet. + SignIn, + /// Add another account alongside the ones already here. + AddAccount, + /// Work as this account from now on. + Use(String), + /// End this account's session, at the service and here. + SignOut(String), + /// Connect storage for an account that has none. + Link(String), + /// Open the service's own page for this account. + Manage(String), +} + +/// Strings, so an application can translate them. +#[derive(Clone, Debug)] +pub struct AccountLabels { + pub signed_out: String, + pub sign_in: String, + pub sign_out: String, + pub add_account: String, + pub other_accounts: String, + pub link: String, + pub linked: String, + pub not_linked: String, + pub manage: String, + pub working: String, + /// The badge's accessible name. `{name}` is replaced. + /// + /// A button announcing only a person's name says nothing about what + /// pressing it does, and collides with every other place that name is + /// written. + pub badge: String, + /// Shown when accounts are signed in and none is in use. + pub choose: String, + /// Why that happened, since a person who did not sign out needs telling. + pub choose_why: String, +} + +impl Default for AccountLabels { + fn default() -> AccountLabels { + AccountLabels { + signed_out: "Not signed in".into(), + sign_in: "Sign in".into(), + sign_out: "Sign out".into(), + add_account: "Add an account".into(), + other_accounts: "Other accounts".into(), + link: "Connect storage".into(), + linked: "Storage connected".into(), + not_linked: "No storage connected".into(), + manage: "Account settings".into(), + working: "Working\u{2026}".into(), + badge: "Account, {name}".into(), + choose: "Choose an account".into(), + choose_why: "The account you were using is no longer signed in.".into(), + } + } +} + +/// The account badge and its menu. +pub struct AccountMenu { + accounts: Vec, + /// Which account the application is working as. Held by id rather than by + /// index, since the list is replaced wholesale whenever the service answers. + active: Option, + labels: AccountLabels, + /// Set while a sign-in or sign-out is in flight, so the control says so + /// rather than looking unresponsive. + busy: bool, + /// Whether the host can hold more than one account at once. + /// + /// Off until a host says otherwise. An application that keeps one + /// session would otherwise draw an Add an account that signs the user + /// in again as the account they are already using, which reads as a + /// button that does nothing. + more_allowed: bool, + actions: (Sender, Receiver), +} + +impl Default for AccountMenu { + fn default() -> AccountMenu { + AccountMenu::new() + } +} + +impl AccountMenu { + pub fn new() -> AccountMenu { + AccountMenu { accounts: Vec::new(), active: None, labels: AccountLabels::default(), busy: false, more_allowed: false, actions: channel() } + } + + pub fn with_labels(mut self, labels: AccountLabels) -> AccountMenu { + self.labels = labels; + self + } + + /// Say that this host can hold more than one account at once. + /// + /// Until a host says so, the menu offers no way to add one. Signing in + /// again as the account already in use is not an action worth drawing. + pub fn allowing_more(mut self) -> AccountMenu { + self.more_allowed = true; + self + } + + /// Replace the whole set of accounts. + /// + /// Wholesale rather than one at a time. A session that missed a sign-out + /// elsewhere would otherwise keep offering an account that is gone. + /// + /// The account in use is kept when it is still in the list. + /// + /// When it has gone, nothing takes its place. A work session that expires + /// would otherwise hand the next save, share and open to a personal + /// account without saying so, and sending a document to the wrong tenant + /// is not a mistake a person can take back. The control asks instead. + /// + /// The first account is chosen only when none was in use at all, which is + /// the first sign-in. + pub fn set(&mut self, accounts: Vec) { + let chose_before = self.active.is_some(); + let kept = self.active.take().filter(|id| accounts.iter().any(|a| a.id == *id)); + self.active = match kept { + Some(id) => Some(id), + None if chose_before => None, + None => accounts.first().map(|a| a.id.clone()), + }; + self.accounts = accounts; + self.busy = false; + } + + /// Work as this account. Ignored for an account that is not here. + pub fn set_active(&mut self, id: &str) { + if self.accounts.iter().any(|a| a.id == id) { + self.active = Some(id.to_owned()); + } + } + + pub fn active(&self) -> Option<&Account> { + let id = self.active.as_deref()?; + self.accounts.iter().find(|a| a.id == id) + } + + pub fn accounts(&self) -> &[Account] { + &self.accounts + } + + pub fn is_signed_in(&self) -> bool { + !self.accounts.is_empty() + } + + /// Mark something as in flight. Cleared by the next [`AccountMenu::set`]. + pub fn working(&mut self) { + self.busy = true; + } + + /// What the user asked for since the last call, if anything. + /// + /// Drained rather than handed a callback, so the application acts on its + /// own thread and this stays free of any notion of what signing in means. + pub fn take_action(&mut self) -> Option { + self.actions.1.try_recv().ok() + } + + /// Draw the badge. Put it where the window's own controls are. + pub fn show(&mut self, ui: &mut Ui) { + let tx = self.actions.0.clone(); + let labels = self.labels.clone(); + let busy = self.busy; + + let Some(account) = self.active().cloned() else { + // Nobody signed in, or signed in with the account that was in use + // now gone. The two read differently. One offers a sign-in. The + // other has accounts to offer and must say so, since saving has + // nowhere to go until somebody picks one. + if self.accounts.is_empty() { + let label = if busy { labels.working.as_str() } else { labels.sign_in.as_str() }; + if ui.add_enabled(!busy, egui::Button::new(label).small()).clicked() { + let _ = tx.send(AccountAction::SignIn); + } + return; + } + let waiting = self.accounts.clone(); + let hit = ui.add_enabled(!busy, egui::Button::new(labels.choose.as_str()).small()); + egui::Popup::menu(&hit).show(|ui| { + ui.set_min_width(240.0); + ui.label(RichText::new(labels.choose_why.as_str()).small().color(ui.visuals().warn_fg_color)); + ui.separator(); + for one in &waiting { + let label = format!("{}\n{}", one.display, one.service); + let row = ui.add(egui::Button::new(label).wrap_mode(egui::TextWrapMode::Extend)); + let name = one.display.clone(); + row.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + if row.clicked() { + let _ = tx.send(AccountAction::Use(one.id.clone())); + ui.close(); + } + } + ui.add_space(4.0); + if ui.button(labels.sign_in.as_str()).clicked() { + let _ = tx.send(AccountAction::SignIn); + ui.close(); + } + }); + return; + }; + + let others: Vec = self.accounts.iter().filter(|a| a.id != account.id).cloned().collect(); + let more_allowed = self.more_allowed; + let badge = egui::Button::new(RichText::new(account.initial()).strong()).min_size(egui::vec2(26.0, 26.0)).corner_radius(13.0); + let hit = ui.add(badge); + let spoken = labels.badge.replace("{name}", &account.display); + hit.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, spoken.as_str())); + let hit = hit.on_hover_text(account.display.as_str()); + + egui::Popup::menu(&hit).show(|ui| { + ui.set_min_width(260.0); + // The deployment first, because somebody with an account on two of + // them needs to know which one this is before reading anything + // else. + ui.horizontal(|ui| { + ui.label(RichText::new(account.service.as_str()).small().color(ui.visuals().weak_text_color())); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + if ui.small_button(labels.sign_out.as_str()).clicked() { + let _ = tx.send(AccountAction::SignOut(account.id.clone())); + ui.close(); + } + }); + }); + ui.separator(); + + ui.horizontal(|ui| { + ui.label(RichText::new(account.initial()).size(26.0).strong()); + ui.vertical(|ui| { + ui.label(RichText::new(account.display.as_str()).strong().size(15.0)); + if let Some(email) = &account.email { + ui.label(RichText::new(email.as_str()).small().color(ui.visuals().weak_text_color())); + } + }); + }); + + ui.add_space(6.0); + + // Storage, which is the thing that actually stops working when it + // is missing. Said here rather than discovered at the moment of + // saving. + if account.linked { + ui.label(RichText::new(labels.linked.as_str()).small().color(ui.visuals().weak_text_color())); + } else { + ui.label(RichText::new(labels.not_linked.as_str()).small().color(ui.visuals().warn_fg_color)); + if ui.button(labels.link.as_str()).clicked() { + let _ = tx.send(AccountAction::Link(account.id.clone())); + ui.close(); + } + } + + if !others.is_empty() { + ui.add_space(6.0); + ui.separator(); + ui.label(RichText::new(labels.other_accounts.as_str()).small().color(ui.visuals().weak_text_color())); + for other in &others { + // Both lines in one control. A name above a subtitle, where + // only the name answers a press, makes half the row look + // broken to anybody who aims at the wrong half. The + // deployment is on the second line because two accounts + // both reading "Will Dunn" tell nobody which is the work + // one. + let label = format!("{}\n{}", other.display, other.service); + let row = ui.add(egui::Button::new(label).wrap_mode(egui::TextWrapMode::Extend)); + let name = other.display.clone(); + row.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + if row.clicked() { + let _ = tx.send(AccountAction::Use(other.id.clone())); + ui.close(); + } + } + } + + if more_allowed { + ui.add_space(6.0); + if ui.button(labels.add_account.as_str()).clicked() { + let _ = tx.send(AccountAction::AddAccount); + ui.close(); + } + } + + ui.add_space(4.0); + if ui.link(labels.manage.as_str()).clicked() { + let _ = tx.send(AccountAction::Manage(account.id.clone())); + ui.close(); + } + }); + } + + /// Draw the badge in a context that has no `Ui` to hand. + pub fn show_in_ctx(&mut self, ctx: &Context) { + egui::Area::new(egui::Id::new("craft-ui/account")).anchor(egui::Align2::RIGHT_TOP, egui::vec2(-8.0, 8.0)).show(ctx, |ui| { + self.show(ui); + }); + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn account(id: &str, display: &str) -> Account { + Account { id: id.into(), display: display.into(), service: "one.example.com".into(), ..Account::default() } + } + + #[test] + fn nobody_signed_in_has_no_active_account() { + let menu = AccountMenu::new(); + assert!(!menu.is_signed_in()); + assert_eq!(menu.active(), None); + } + + #[test] + fn the_first_account_becomes_the_active_one() { + let mut menu = AccountMenu::new(); + menu.set(vec![account("a", "Work"), account("b", "Personal")]); + assert_eq!(menu.active().map(|a| a.id.as_str()), Some("a")); + } + + #[test] + fn replacing_the_list_keeps_the_account_in_use() { + let mut menu = AccountMenu::new(); + menu.set(vec![account("a", "Work"), account("b", "Personal")]); + menu.set_active("b"); + menu.set(vec![account("a", "Work"), account("b", "Personal"), account("c", "Lab")]); + assert_eq!(menu.active().map(|a| a.id.as_str()), Some("b"), "an unrelated refresh must not switch accounts"); + } + + #[test] + fn an_account_that_signed_out_elsewhere_leaves_nobody_in_use() { + let mut menu = AccountMenu::new(); + menu.set(vec![account("a", "Work"), account("b", "Personal")]); + menu.set_active("b"); + menu.set(vec![account("a", "Work")]); + // Not account a. A work session that expires must not hand the next + // save to a personal account without anybody saying so. + assert_eq!(menu.active(), None, "the one that is gone cannot be replaced in silence"); + assert!(menu.is_signed_in(), "there is still an account here to choose"); + } + + #[test] + fn choosing_again_after_one_disappeared_works() { + let mut menu = AccountMenu::new(); + menu.set(vec![account("a", "Work"), account("b", "Personal")]); + menu.set_active("b"); + menu.set(vec![account("a", "Work")]); + menu.set_active("a"); + assert_eq!(menu.active().map(|a| a.id.as_str()), Some("a")); + } + + #[test] + fn a_refresh_that_keeps_the_account_keeps_it_in_use() { + let mut menu = AccountMenu::new(); + menu.set(vec![account("a", "Work"), account("b", "Personal")]); + menu.set_active("b"); + menu.set(vec![account("b", "Personal"), account("c", "Lab")]); + assert_eq!(menu.active().map(|a| a.id.as_str()), Some("b")); + } + + #[test] + fn the_last_account_leaving_signs_everybody_out() { + let mut menu = AccountMenu::new(); + menu.set(vec![account("a", "Work")]); + menu.set(Vec::new()); + assert!(!menu.is_signed_in()); + assert_eq!(menu.active(), None); + } + + #[test] + fn switching_to_an_account_that_is_not_here_changes_nothing() { + let mut menu = AccountMenu::new(); + menu.set(vec![account("a", "Work")]); + menu.set_active("nobody"); + assert_eq!(menu.active().map(|a| a.id.as_str()), Some("a")); + } + + #[test] + fn the_badge_says_what_it_is_as_well_as_who() { + let labels = AccountLabels::default(); + let spoken = labels.badge.replace("{name}", "Ada Lovelace"); + assert_eq!(spoken, "Account, Ada Lovelace"); + assert_ne!(spoken, "Ada Lovelace", "a bare name collides with every other place it is written"); + } + + #[test] + fn an_initial_survives_a_name_that_starts_oddly() { + assert_eq!(account("1", "ann").initial(), "A"); + assert_eq!(account("1", "").initial(), "?"); + assert_eq!(account("1", "\u{e9}lodie").initial(), "\u{c9}"); + } +} diff --git a/crates/ui/src/buttons/mod.rs b/crates/ui/src/buttons/mod.rs index 6865daa82..1405f6943 100644 --- a/crates/ui/src/buttons/mod.rs +++ b/crates/ui/src/buttons/mod.rs @@ -120,3 +120,18 @@ fn bounded_stroke(stroke: Stroke, rect: Rect) -> Stroke { #[cfg(test)] mod tests; + +/// A downward triangle at the right-hand end of a control. +/// +/// Painted rather than typed. The chevron character is absent from the default +/// font set, where it renders as a missing-glyph box. A caller leaves room for +/// it by padding the label, then paints it over the response. +pub fn chevron(ui: &Ui, rect: egui::Rect, colour: egui::Color32) { + let middle = rect.right_center() - egui::vec2(9.0, 0.0); + let half = 3.5; + ui.painter().add(egui::Shape::convex_polygon( + vec![middle + egui::vec2(-half, -half * 0.6), middle + egui::vec2(half, -half * 0.6), middle + egui::vec2(0.0, half * 0.9)], + colour, + egui::Stroke::NONE, + )); +} diff --git a/crates/ui/src/cloud/app.rs b/crates/ui/src/cloud/app.rs new file mode 100644 index 000000000..b98e91ba5 --- /dev/null +++ b/crates/ui/src/cloud/app.rs @@ -0,0 +1,255 @@ +//! What this module needs from the application around it. +//! +//! Two operations here belong to the application alone. One turns bytes into an +//! open document. The other turns an open document into bytes. Both need the +//! application's own mutable state. That state is what holds the +//! [`CloudFiles`](crate::cloud::CloudFiles) this module keeps its own state in. +//! The pages are therefore free functions over this trait. An application +//! reaches its cloud state back through [`CloudApp::cloud_mut`]. +//! +//! Every method here is something only the application can answer. The ones +//! with a body are the ones a plain application can leave alone. + +use egui::{Color32, FontFamily, Painter, Rect, Ui}; + +use craft_cloud::EntryKind; + +/// What one of the application's documents is, as a file list needs to know. +/// +/// Four pieces of static data, usually one `const` in the application. These +/// four are the whole of what an application has to say about its own +/// documents. They are data because every one of them as a trait method would +/// have been a pure function of nothing. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct DocumentKind { + /// Extensions this application opens, lower case and without a dot. The + /// same set its desktop file picker offers. + pub extensions: &'static [&'static str], + /// Content types it opens, matched against the start of what the provider + /// said. The match is a prefix. A provider commonly appends a profile to a + /// type it is otherwise right about. + pub mimes: &'static [&'static str], + /// What one is called in a sentence a user reads. "workbook", "document", + /// "drawing". + pub noun: &'static str, + /// The extension a typed name without a known one gets. + pub default_extension: &'static str, +} + +/// The colours and faces these pages draw in. +/// +/// The Open and Save pages sit inside the application's own Backstage view and +/// have to match the surface around them. `ui.visuals()` alone cannot say what +/// that surface is. An application with a palette of its own passes it in. One +/// without takes [`CloudStyle::from_visuals`] and writes nothing. +#[derive(Clone, Debug)] +pub struct CloudStyle { + /// Behind a bordered column. + pub surface: Color32, + pub border: Color32, + pub text: Color32, + /// Second lines, hints and the status line. + pub dim: Color32, + /// Behind a file row the pointer is over. + pub hover: Color32, + /// Behind the panel that offers to link an account. Tinted and never + /// alarming. No account yet is a state with an obvious next step. + pub soft: Color32, + pub family: FontFamily, + pub bold: FontFamily, +} + +impl CloudStyle { + /// Colours from egui's own visuals, for an application with no palette. + pub fn from_visuals(visuals: &egui::Visuals) -> CloudStyle { + CloudStyle { + surface: visuals.faint_bg_color, + border: visuals.widgets.noninteractive.bg_stroke.color, + text: visuals.text_color(), + dim: visuals.weak_text_color(), + hover: visuals.widgets.hovered.bg_fill, + soft: visuals.faint_bg_color, + family: FontFamily::Proportional, + bold: FontFamily::Proportional, + } + } +} + +/// One of the application's own Save a Copy formats, for the second half of +/// the Share menu. +/// +/// The application's own. What a spreadsheet exports and what a page layout +/// application exports have nothing in common. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct CopyFormat { + /// Handed back untouched when this one is chosen. + pub id: String, + pub label: String, +} + +impl CopyFormat { + pub fn new(id: impl Into, label: impl Into) -> CopyFormat { + CopyFormat { id: id.into(), label: label.into() } + } +} + +/// An application that opens and saves documents in cloud storage. +/// Where a save is going. +/// +/// Carried as a pair because neither half is reliable alone. A provider hands +/// back `application/octet-stream` for a perfectly good document, and a file +/// exported by a web application often has a correct content type and no +/// extension at all. The same reasoning as [`DocumentKind`], which reads both +/// when deciding whether a document opens. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct Destination<'a> { + /// The file name the bytes are going to. + pub name: &'a str, + /// What the provider says is already there, where it says anything. Absent + /// for a document that does not exist yet. + pub mime: Option<&'a str>, +} + +impl<'a> Destination<'a> { + pub fn new(name: &'a str) -> Destination<'a> { + Destination { name, mime: None } + } + + /// The extension the name carries, lower cased, when it carries one. + /// + /// Empty for a bare name. A caller that gets nothing here has the content + /// type left to read. + pub fn extension(&self) -> String { + self.name.rsplit_once('.').map(|(_, ext)| ext.to_ascii_lowercase()).filter(|ext| !ext.is_empty()).unwrap_or_default() + } +} + +pub trait CloudApp { + // ---- the state these pages keep ------------------------------------- + + fn cloud(&self) -> &crate::cloud::CloudFiles; + fn cloud_mut(&mut self) -> &mut crate::cloud::CloudFiles; + + // ---- its documents --------------------------------------------------- + + fn kind(&self) -> DocumentKind; + + /// The document in this window, when there is one. + fn active(&self) -> Option; + + /// What to call one, for the Save As name field. + fn title(&self, uid: u64) -> String; + + /// Turn bytes into an open document, answering with the one it opened as. + /// + /// `Ok(None)` when the application took the bytes somewhere else, such as + /// a prompt for a password. Nothing is said about them yet. `Err` is put + /// to the user. + fn open_bytes(&mut self, name: &str, bytes: Vec) -> Result, String>; + + /// Turn one open document into the bytes to save, for `into`. + /// + /// [`Destination`] is where the bytes are going. A document opened from + /// the cloud as `figures.csv` has to go back as a CSV. Encoding it in the + /// application's own format under that name hands the user a file no other + /// application can read, and nothing tells them it happened. + /// + /// The name is the first answer. A provider that issued no extension at + /// all still says what the thing is, so the content type is the second. + /// Both appear often: a file exported by a web application commonly has a + /// correct content type and a bare name. + /// + /// An application that cannot write what the destination asks for should + /// refuse and say which formats it can write. A refusal a person can act + /// on beats a file that silently is not what it claims. + /// + /// Takes `&mut self` so the application can record which version of the + /// document these bytes were. A save that lands clears the dirty flag for + /// exactly that version. An edit made while the bytes were on the wire + /// stays unsaved. [`CloudApp::mark_saved`] and [`CloudApp::drop_pending`] + /// say which happened. + fn encode(&mut self, uid: u64, into: Destination<'_>) -> Result, String>; + + /// Close a document a reload replaced. Called only once the replacement is + /// open. A read that failed leaves the user's work where it was. + fn close(&mut self, uid: u64); + + /// The bytes [`CloudApp::encode`] made reached the service. + fn mark_saved(&mut self, _uid: u64) {} + + /// They did not. Forget the version it recorded. + fn drop_pending(&mut self, _uid: u64) {} + + /// Finish whatever the user is still typing. False stops the save. + fn ready_to_save(&mut self) -> bool { + true + } + + // ---- the window around them ------------------------------------------ + + /// The share dialog this window holds. Opened from a document's overflow + /// menu and from the Share button. Refreshed when who is signed in + /// changes. + fn sharing(&mut self) -> &mut crate::share::ShareDialog; + + /// Who else is in the document. Drawn beside the account badge. + fn presence(&mut self) -> &mut crate::presence::PresenceBar; + + /// Paint the icon for one row of a file list. Every application already + /// owns an icon set. None of them agree on how it is reached. + fn paint_icon(&self, painter: &Painter, rect: Rect, kind: EntryKind, colour: Color32); + + /// Open a URL in the user's browser. A browser is the application's + /// business. This crate opens nothing. + fn open_url(&self, url: &str); + + /// Open the provider's conversation for this document. + /// + /// Desktop hosts may hand this to the operating system so a registered + /// chat application can claim it. Browser hosts may navigate the current + /// tab, which remains reliable after an asynchronous provider lookup. + fn open_conversation(&self, url: &str) { + self.open_url(url); + } + + /// Say something that needs the user's attention, in the application's own + /// message box. + fn say(&mut self, text: String); + + /// Say something that does not, in passing. + fn toast(&mut self, _text: String) {} + + /// Take the user to the application's own Save As page, with the name + /// [`CloudFiles::save_name`](crate::cloud::CloudFiles::save_name) now + /// holding. Called when a refused save is answered with Save as a copy. + fn go_to_save_as(&mut self) {} + + // ---- its words ------------------------------------------------------- + + /// What the application is called, for the one sentence that names it. + fn app_name(&self) -> &str; + + /// Translate one English string. The default leaves it alone. An + /// application with no translation table writes nothing. + fn tr(&self, text: &str) -> String { + text.to_owned() + } + + /// The host part of the service address, for the account menu's first + /// line. Somebody with an account on two deployments needs to know which + /// one a document is about to land in. + fn service(&self) -> String { + String::new() + } + + /// A line under the Save page's name field, about the format this + /// application saves in. + fn save_note(&self) -> Option { + None + } + + /// The colours and faces to draw in. + fn style(&self, ui: &Ui) -> CloudStyle { + CloudStyle::from_visuals(ui.visuals()) + } +} diff --git a/crates/ui/src/cloud/backend.rs b/crates/ui/src/cloud/backend.rs new file mode 100644 index 000000000..b6da57960 --- /dev/null +++ b/crates/ui/src/cloud/backend.rs @@ -0,0 +1,195 @@ +//! Where Open and Save do their waiting. It is never on the frame. +//! +//! Every call a cloud provider needs is blocking. A blocking read of a twenty +//! megabyte document inside `update()` freezes the window for seconds. So this +//! module states a [`Job`] and reads an [`Event`]. Something behind +//! [`CloudBackend`] does the waiting. +//! +//! Nothing here opens a socket. That keeps the pages buildable for the web and +//! testable with no service running. A host supplies the half that does. This +//! crate never learns what it reaches. + +use std::sync::mpsc::Sender; + +use craft_cloud::{Capability, Conversation, Entry}; + +/// Work for a host's worker. Each one answers with one or more [`Event`]. +pub enum Job { + /// Who is signed in, and what the provider behind the service can do. + Account, + /// Begin signing in to the service through the browser or device flow. + SignIn, + /// Begin linking a cloud account. The answer carries a URL to open. + LinkStart, + /// Whether the user has finished in the browser yet. + LinkPoll(String), + /// One folder's contents. An empty path is the user's root. + List(String), + /// Everything other people have shared with this user. + SharedWithMe, + /// A document's bytes. `into` names the open document a reload replaces. + Read { entry: Entry, into: Option }, + /// Save back over `entry`, refusing to overwrite a newer version. + Write { uid: u64, entry: Entry, bytes: Vec }, + /// Save under a new name in `folder`. + Create { uid: u64, folder: String, name: String, bytes: Vec }, + /// End the session and forget the saved token. + SignOut, + /// Where to go to work together on a document. + Conversation(String), +} + +/// What a worker reports back. +pub enum Event { + /// Where to go to work together, or why there is nowhere. + Conversation(Result), + Account(Result), + /// A link or a sign-in needs the user's browser. `handle` is polled until + /// they are done, when the service gave one. + Browser { + url: String, + handle: Option, + }, + /// `Ok(true)` means the account is linked now. + Linked(Result), + Listed { + path: String, + entries: Result, Fault>, + }, + Shared(Result, Fault>), + Read { + entry: Entry, + into: Option, + bytes: Result, Fault>, + }, + Saved { + uid: u64, + entry: Result, + }, +} + +/// Where a worker's answers go. +/// +/// Handed to [`CloudBackend::submit`] with the job it belongs to. A worker is +/// free to keep it and send later, or to send several times. That is how a +/// sign-in reports the URL it wants a browser pointed at and then reports that +/// the user finished there. A send after the window closed is not a failure. +pub struct Post { + tx: Sender, +} + +impl Post { + pub(crate) fn new(tx: Sender) -> Post { + Post { tx } + } + + /// Another handle to the same place, for a worker that answers more than + /// once or hands the job on. + pub fn dup(&self) -> Post { + Post { tx: self.tx.clone() } + } + + pub fn send(&self, event: Event) { + let _ = self.tx.send(event); + } +} + +impl std::fmt::Debug for Post { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Post").finish() + } +} + +/// Somewhere a [`Job`] can run without blocking a frame. +/// +/// `submit` must return immediately. Answers arrive through `post` whenever +/// they are ready, or never. The pages survive either. +pub trait CloudBackend { + fn submit(&self, job: Job, post: Post); +} + +/// What the service said about the signed-in user. +/// +/// Capabilities are reported by the service and never assumed here. A provider +/// without incoming shares hides that side of the Open page. An empty list +/// where a feature should be reads to a user as a broken window. +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub struct Account { + pub display: String, + pub capabilities: Vec, + /// Until this is true, Open and Save have nowhere to go. + pub provider_linked: bool, +} + +impl Account { + pub fn can(&self, capability: Capability) -> bool { + self.capabilities.contains(&capability) + } +} + +/// A call that did not succeed, in the shapes the pages act on differently. +/// +/// One case is worth telling apart from every other refusal. A conditional +/// write the server refused means somebody else's work is in the stored copy. +/// That one must never be retried and must never be forced. That is why +/// [`Fault::Conflict`] has a shape of its own. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum Fault { + /// No cloud account is linked yet. This is a state with an obvious next + /// step. It is never drawn as an error. + NotLinked, + /// Somebody else saved while this user was editing. The save was refused + /// and their work is intact. + Conflict, + /// The session expired. The user signs in again. + Unauthenticated, + Unreachable(String), + Refused(String), +} + +impl Fault { + /// One sentence for a person to read. `noun` is what the application calls + /// one of its documents, from [`crate::cloud::DocumentKind::noun`]. + pub fn text(&self, noun: &str) -> String { + match self { + Fault::NotLinked => "No cloud account is linked yet.".to_owned(), + Fault::Conflict => format!("Somebody else saved this {noun} while you were editing it."), + Fault::Unauthenticated => "Your cloud session has expired. Sign in again.".to_owned(), + Fault::Unreachable(detail) => format!("The cloud service could not be reached. {detail}"), + Fault::Refused(detail) => detail.clone(), + } + } + + /// A short machine-readable name, for a control channel. + pub fn code(&self) -> &'static str { + match self { + Fault::NotLinked => "not_linked", + Fault::Conflict => "conflict", + Fault::Unauthenticated => "unauthenticated", + Fault::Unreachable(_) => "unreachable", + Fault::Refused(_) => "refused", + } + } +} + +/// The contract's own error, in the shapes the pages act on. +/// +/// For a host that reaches a provider through [`craft_cloud`] directly. A host +/// that reaches a service through its own client crate maps that crate's error +/// instead, since only it knows which code that service answers a refused +/// conditional write with. +/// +/// [`craft_cloud::Error::Conflict`] is the one case worth telling apart. It +/// means somebody else's work is in the stored copy. The save must never be +/// retried and never be forced. +impl From for Fault { + fn from(error: craft_cloud::Error) -> Fault { + use craft_cloud::Error; + match error { + Error::Unreachable(detail) => Fault::Unreachable(detail), + Error::Unauthenticated => Fault::Unauthenticated, + Error::Conflict(_) => Fault::Conflict, + other => Fault::Refused(other.to_string()), + } + } +} diff --git a/crates/ui/src/cloud/mod.rs b/crates/ui/src/cloud/mod.rs new file mode 100644 index 000000000..220afc04e --- /dev/null +++ b/crates/ui/src/cloud/mod.rs @@ -0,0 +1,852 @@ +//! Open and Save against cloud storage, the same pages in every Craft app. +//! +//! What this offers is what a person asks for when they say "open the one in +//! my cloud": a Backstage page with their own files on one side and what other +//! people shared with them on the other, folders to walk into, an account badge +//! that says whose storage this is, a Save As page that picks a folder and +//! names a file, and a save that refuses to overwrite somebody else's work. +//! +//! Three things shape the implementation. +//! +//! Nothing here opens a socket. Every call goes through [`CloudBackend`]. A +//! host writes that half. This module never learns what it reaches. That keeps +//! it buildable for the web and testable with no service running. +//! +//! Nothing here blocks. A job goes to a worker, the answer arrives on a +//! channel, and [`pump`] drains it on a later frame. A blocking read of a +//! twenty megabyte document inside a frame would freeze the window for seconds. +//! +//! Nothing here is assumed about the provider. Every side of the Open page is +//! drawn only where the service reported the capability behind it. An empty +//! list under a heading reads to a user as a broken window. A feature the +//! provider does not have is therefore absent, heading and all. +//! +//! The application supplies [`CloudApp`]. That is what it alone can answer. +//! What its documents are, how bytes become one and back, and the words it +//! shows them in. + +use std::collections::HashMap; +use std::sync::mpsc::{Receiver, Sender, channel}; +use std::time::Duration; + +use craft_cloud::{Capability, Entry, EntryKind}; +use egui::{Align2, Rect, RichText, Sense, Stroke, Ui, pos2, vec2}; +use serde_json::{Value as Json, json}; + +mod app; +mod backend; +mod pages; +#[cfg(test)] +mod tests; +mod title; + +pub use app::{CloudApp, CloudStyle, CopyFormat, Destination, DocumentKind}; +pub use backend::{Account, CloudBackend, Event, Fault, Job, Post}; +pub use pages::{conflict_modal, open_page, progress, save_page}; +pub use title::{destination_name, prefers_cloud, share_button, shares, who}; + +/// How long to wait between asking whether the user has finished linking an +/// account in their browser. +const LINK_POLL: f64 = 1.5; + +/// What a command says when no cloud service is configured. Not a failure of +/// the service: there is no service to fail. +pub const UNAVAILABLE: &str = "no cloud service is configured"; + +// ---------------------------------------------------------------- state + +/// One folder, as it is being browsed. +#[derive(Clone, Debug, Default)] +pub struct Folder { + pub path: String, + pub entries: Vec, + pub loading: bool, + pub error: Option, + /// Answered at least once. An empty folder then reads as empty. Without + /// this it would read as still loading. + pub loaded: bool, +} + +impl Folder { + fn begin(&mut self, path: &str) { + self.path = path.to_owned(); + self.entries.clear(); + self.loading = true; + self.loaded = false; + self.error = None; + } + + fn fill(&mut self, answer: Result, Fault>) { + self.loading = false; + self.loaded = true; + match answer { + Ok(entries) => { + self.entries = entries; + self.error = None; + } + Err(fault) => { + self.entries.clear(); + self.error = Some(fault); + } + } + } +} + +/// Where the document in this window came from, and the version it came at. +/// +/// `entry.id` is the opaque handle a save passes back. `entry.etag` is the +/// version the conditional write is made against. `entry.room` is neither of +/// those. It is the collaboration identity, and it survives a rename. +#[derive(Clone, Debug)] +pub struct Origin { + pub entry: Entry, +} + +/// What the pages are waiting for. Drawn as progress while they wait. +#[derive(Clone, Debug)] +pub enum Busy { + Opening { name: String }, + Saving { name: String, bytes: usize }, +} + +impl Busy { + pub fn text(&self) -> String { + match self { + Busy::Opening { name } => format!("Opening {name}…"), + Busy::Saving { name, bytes } => format!("Saving {name} ({})…", size_text(Some(*bytes as u64))), + } + } +} + +/// A save that was refused because the stored copy had moved on. +#[derive(Clone, Debug)] +pub struct Conflict { + /// The document that could not be saved. + pub uid: u64, + pub entry: Entry, +} + +/// Linking a cloud account, which takes a browser round trip. +#[derive(Clone, Debug)] +pub enum Link { + /// Offered and not started. Never drawn as an error. + Offered, + Starting, + /// The browser is open. `handle` is polled until the user is done. + Waiting { + url: String, + handle: Option, + next_poll: f64, + }, + Failed(Fault), +} + +/// Which side of the Open page a selection came from. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub enum Source { + #[default] + Mine, + Shared, +} + +/// Who a document was shared with, when nobody is signed in. +/// +/// Somebody who followed a keyed link has no account at the service and none +/// at the provider behind it. So there is nothing to sign out of, no second +/// account to switch to and no storage to connect. An account menu offered to +/// them would be a menu whose every item fails. +/// +/// This is what a title bar says instead. It names the address the link was +/// sent to, because that is the only identity a recipient has here, and it +/// offers nothing. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Guest { + /// The address the link was sent to. + pub recipient: String, + /// Whether the share opens the document for reading only. + pub read_only: bool, +} + +/// Everything these pages keep about cloud storage. +/// +/// One per window. The application declares a field of this type, hands it +/// back through [`CloudApp::cloud_mut`], and connects a backend once one +/// exists. +pub struct CloudFiles { + backend: Option>, + events: (Sender, Receiver), + /// The badge and its menu. Signing in is the only way into any of this. + /// The badge is the only control that offers it. It lives here. An + /// application declares no field for it. + accounts: crate::account::AccountMenu, + /// Frame time, in seconds, as of the last [`pump`]. Kept because a link + /// poll is scheduled from an answer that arrives with no frame in hand. + clock: f64, + pub account: Option, + pub account_fault: Option, + /// The account is asked for once per run. A frame never asks again. + asked_account: bool, + /// The folder being browsed. Shared by the Open and Save As pages, which + /// are never on screen together. + pub mine: Folder, + pub shared: Folder, + pub source: Source, + pub busy: Option, + pub link: Option, + pub conflict: Option, + /// Save As: the file name being typed. + pub save_name: String, + /// Documents that came from the cloud, by document uid. + pub origins: HashMap, + /// The last thing that happened, for the line under the page title. + pub status: Option, + /// Whether the transfer in flight was started by the share dialog, which + /// is waiting to be told how it went. + pub sharing_save: bool, + /// Set when this window belongs to somebody who followed a shared link + /// rather than to somebody signed in. + guest: Option, + /// Set when the account menu starts sign-in. Browser builds open a login + /// popup from this gesture instead of inferring it from `status`, which can + /// stay set after a failed sign-in. + sign_in_from_menu: bool, +} + +impl Default for CloudFiles { + fn default() -> CloudFiles { + CloudFiles::new() + } +} + +impl CloudFiles { + pub fn new() -> CloudFiles { + CloudFiles { + backend: None, + events: channel(), + accounts: crate::account::AccountMenu::new(), + clock: 0.0, + account: None, + account_fault: None, + asked_account: false, + mine: Folder::default(), + shared: Folder::default(), + source: Source::default(), + busy: None, + link: None, + conflict: None, + save_name: String::new(), + origins: HashMap::new(), + status: None, + sharing_save: false, + guest: None, + sign_in_from_menu: false, + } + } + + /// Whether the account menu just asked to sign in. Consumed by browser hosts + /// that need a user-gesture signal to open a login popup. + pub fn take_sign_in_from_menu(&mut self) -> bool { + std::mem::take(&mut self.sign_in_from_menu) + } + + /// Attach the thing that does the waiting. + /// + /// Until this is called nothing cloud-shaped is offered anywhere. That is + /// what a build with no service configured wants. + pub fn connect(&mut self, backend: impl CloudBackend + 'static) { + self.backend = Some(Box::new(backend)); + } + + /// Whether a service is wired at all. + pub fn available(&self) -> bool { + self.backend.is_some() + } + + /// Say that this window belongs to somebody who followed a shared link. + /// + /// Called once, before anything is drawn, by whatever landed them here. + /// It changes what the title bar says and nothing else: a recipient has no + /// file list and no account, so none of the pages here were ever offered + /// to them. + /// + /// An address of only spaces leaves no guest. A badge with nothing on it + /// reads as a fault, and saying nothing is better than that. + pub fn as_guest(&mut self, recipient: impl Into, read_only: bool) { + let recipient = recipient.into().trim().to_owned(); + self.guest = if recipient.is_empty() { None } else { Some(Guest { recipient, read_only }) }; + } + + /// Who this window's document was shared with, when nobody is signed in. + pub fn guest(&self) -> Option<&Guest> { + self.guest.as_ref() + } + + /// The account badge's own strings, for a localized application that + /// would rather translate them itself than through + /// [`CloudApp::tr`](crate::cloud::CloudApp::tr). + pub fn account_menu_mut(&mut self) -> &mut crate::account::AccountMenu { + &mut self.accounts + } + + /// Whether the provider offers somewhere to talk about a document. + pub fn can_converse(&self) -> bool { + self.can(Capability::Conversation) + } + + fn can(&self, capability: Capability) -> bool { + self.account.as_ref().is_some_and(|a| a.can(capability)) + } +} + +// ---------------------------------------------------------------- asking + +/// Whether the host wired a cloud service. When it did not, nothing +/// cloud-shaped is offered anywhere in the interface. +pub fn available(app: &A) -> bool { + app.cloud().available() +} + +/// Whether the provider offers somewhere to talk about a document. +pub fn can_converse(app: &A) -> bool { + app.cloud().can_converse() +} + +/// Hands a job to the host's worker. +pub fn submit(app: &A, job: Job) { + let cloud = app.cloud(); + if let Some(backend) = &cloud.backend { + backend.submit(job, Post::new(cloud.events.0.clone())); + } +} + +/// Asks who is signed in, once per run, and lists the root folder. +pub fn start(app: &mut A) { + if !available(app) { + return; + } + if !app.cloud().asked_account { + app.cloud_mut().asked_account = true; + submit(app, Job::Account); + } + if !app.cloud().mine.loaded && !app.cloud().mine.loading { + browse(app, ""); + } +} + +/// Begins signing in to the service. +/// +/// [`Job::SignIn`] is its own job so [`Job::Account`] can stay read-only on +/// cold start. The badge says it is working, because the worker then blocks +/// until the user finishes in the browser and a button that looks idle for a +/// minute reads as broken. +pub fn sign_in(app: &mut A) { + if !available(app) { + return; + } + let working = app.tr("Finish signing in, in your browser"); + let cloud = app.cloud_mut(); + cloud.accounts.working(); + cloud.account_fault = None; + // Cleared first. A sign-in that failed leaves this set, and a second press + // would then be swallowed by the guard that stops a frame asking twice. A + // button that does nothing the second time reads as a broken button. + cloud.asked_account = true; + cloud.link = None; + cloud.status = Some(working); + submit(app, Job::SignIn); +} + +/// Ends the session, here and at the service. +/// +/// The saved token goes too. Forgetting the account on screen while leaving the +/// token on disk would sign the user back in on the next run. +pub fn sign_out(app: &mut A) { + let signed_out = app.tr("Signed out"); + let cloud = app.cloud_mut(); + cloud.account = None; + cloud.account_fault = None; + cloud.asked_account = false; + cloud.link = None; + cloud.mine = Folder::default(); + cloud.shared = Folder::default(); + cloud.origins.clear(); + cloud.status = Some(signed_out); + submit(app, Job::SignOut); +} + +/// Lists one folder. An empty path is the user's root. +pub fn browse(app: &mut A, path: &str) { + if !available(app) { + return; + } + app.cloud_mut().mine.begin(path); + submit(app, Job::List(path.to_owned())); +} + +/// Lists what other people have shared with this user. +pub fn load_shared(app: &mut A) { + if !available(app) { + return; + } + app.cloud_mut().shared.begin(""); + submit(app, Job::SharedWithMe); +} + +/// Begins linking a cloud account. +pub fn link(app: &mut A) { + if !available(app) { + return; + } + app.cloud_mut().link = Some(Link::Starting); + submit(app, Job::LinkStart); +} + +/// Asks where to work together on the open document, then opens it. +/// +/// Only offered where the provider reports it. A document that has never been +/// in the cloud has no handle to key a room on, so there is nothing to ask +/// about either. +pub fn work_together(app: &mut A) { + if !available(app) { + return; + } + let Some(id) = origin(app).map(|o| o.entry.id.clone()) else { + let noun = app.kind().noun; + app.cloud_mut().status = Some(app.tr(&format!("Save this {noun} to the cloud first"))); + return; + }; + converse(app, id); +} + +/// Asks the provider where to work together on one document. +fn converse(app: &mut A, id: String) { + let opening = app.tr("Opening a conversation"); + app.cloud_mut().status = Some(opening); + submit(app, Job::Conversation(id)); +} + +/// The parent of a path. `None` at the root. +pub fn parent_of(path: &str) -> Option { + let trimmed = path.trim_end_matches('/'); + if trimmed.is_empty() { + return None; + } + match trimmed.rfind('/') { + Some(0) | None => Some(String::new()), + Some(cut) => Some(trimmed[..cut].to_owned()), + } +} + +/// Whether this application can open an entry, judged by its extension and by +/// what the provider says it is. +/// +/// Both signals are read because neither is reliable alone. A WebDAV server +/// hands back `application/octet-stream` for a perfectly good spreadsheet. A +/// file exported by a web application often has a correct content type and no +/// extension at all. +pub fn opens(entry: &Entry, kind: DocumentKind) -> bool { + if entry.kind == EntryKind::Folder { + return false; + } + let extension = entry.name.rsplit_once('.').map(|(_, e)| e.to_ascii_lowercase()); + let by_name = extension.is_some_and(|e| kind.extensions.contains(&e.as_str())); + by_name || entry.mime.as_deref().is_some_and(|mime| mime_opens(mime, kind)) +} + +fn mime_opens(mime: &str, kind: DocumentKind) -> bool { + let mime = mime.split(';').next().unwrap_or("").trim().to_ascii_lowercase(); + kind.mimes.iter().any(|known| mime.starts_with(known)) +} + +/// A typed name as a document file name. Any folder separators are dropped and +/// a missing or unknown extension becomes the application's own. +pub fn document_name(typed: &str, kind: DocumentKind) -> String { + let base = typed.rsplit(['/', '\\']).next().unwrap_or("").trim(); + if base.is_empty() { + return String::new(); + } + let known = base.rsplit_once('.').is_some_and(|(stem, ext)| !stem.is_empty() && kind.extensions.contains(&ext.to_ascii_lowercase().as_str())); + if known { base.to_owned() } else { format!("{base}.{}", kind.default_extension) } +} + +/// One sentence with a value in it, translated whole. +/// +/// The template reaches [`CloudApp::tr`] with its `{}` intact. A translator +/// sees the whole sentence and can put the value where their own language +/// wants it. A sentence assembled from translated fragments cannot be made to +/// read correctly in a language that orders them differently. +fn fill(app: &A, template: &str, value: &str) -> String { + app.tr(template).replacen("{}", value, 1) +} + +/// A file name without its extension. +fn stem_of(name: &str) -> String { + match name.rsplit_once('.') { + Some((stem, _)) if !stem.is_empty() => stem.to_owned(), + _ => name.to_owned(), + } +} + +// ---------------------------------------------------------------- opening + +/// Reads a document and opens it. `into` names an open document the bytes +/// replace, which is how a reload after a conflict works. +pub fn open_entry(app: &mut A, entry: Entry, into: Option) { + if !available(app) || app.cloud().busy.is_some() { + return; + } + let cloud = app.cloud_mut(); + cloud.status = None; + cloud.busy = Some(Busy::Opening { name: entry.name.clone() }); + submit(app, Job::Read { entry, into }); +} + +/// Reads the active document's stored copy again. Local edits are discarded. +pub fn reload_active(app: &mut A) -> Result { + let noun = app.kind().noun; + let Some(uid) = app.active() else { return Err(format!("no {noun} open")) }; + let Some(origin) = app.cloud().origins.get(&uid).cloned() else { return Err(format!("this {noun} did not come from the cloud")) }; + app.cloud_mut().conflict = None; + let name = origin.entry.name.clone(); + open_entry(app, origin.entry, Some(uid)); + Ok(json!({"reloading": name})) +} + +// ---------------------------------------------------------------- saving + +/// The cloud document the active one came from, when it came from one. +pub fn origin(app: &A) -> Option<&Origin> { + let uid = app.active()?; + app.cloud().origins.get(&uid) +} + +/// Whether Save has somewhere to go without asking. A Backstage view uses this +/// to choose between Save and the Save As page. +pub fn has_target(app: &A) -> bool { + origin(app).is_some_and(|o| o.entry.writable) +} + +/// Save: writes back over the entry this document came from. +/// +/// The etag the document was read at goes out as the condition. A server whose +/// copy has moved on refuses the write. That arrives as [`Fault::Conflict`] and +/// is put to the user. It is never retried. +pub fn save(app: &mut A) -> Result { + let noun = app.kind().noun; + let uid = app.active().ok_or(format!("no {noun} open"))?; + let origin = app.cloud().origins.get(&uid).cloned().ok_or(format!("this {noun} did not come from the cloud"))?; + if !origin.entry.writable { + return Err("this document was shared with you for reading only. Save As keeps a copy of your own.".to_owned()); + } + if app.cloud().busy.is_some() { + return Err("a cloud transfer is already running".to_owned()); + } + let bytes = app.encode(uid, Destination { name: &origin.entry.name, mime: origin.entry.mime.as_deref() })?; + let size = bytes.len(); + let cloud = app.cloud_mut(); + cloud.status = None; + cloud.busy = Some(Busy::Saving { name: origin.entry.name.clone(), bytes: size }); + let answer = json!({"saving": origin.entry.name, "bytes": size, "ifMatch": origin.entry.etag}); + submit(app, Job::Write { uid, entry: origin.entry, bytes }); + Ok(answer) +} + +/// Save As: writes a new document into `folder` under `name`. +pub fn save_as(app: &mut A, folder: &str, name: &str) -> Result { + let kind = app.kind(); + let uid = app.active().ok_or(format!("no {} open", kind.noun))?; + let name = document_name(name, kind); + if name.is_empty() { + return Err("type a file name".to_owned()); + } + if app.cloud().busy.is_some() { + return Err("a cloud transfer is already running".to_owned()); + } + // A document that does not exist yet has no content type to read. The + // name a person just typed is the whole of what was asked for. + let bytes = app.encode(uid, Destination::new(&name))?; + let size = bytes.len(); + let cloud = app.cloud_mut(); + cloud.status = None; + cloud.busy = Some(Busy::Saving { name: name.clone(), bytes: size }); + let answer = json!({"saving": name, "folder": folder, "bytes": size}); + submit(app, Job::Create { uid, folder: folder.to_owned(), name, bytes }); + Ok(answer) +} + +// ---------------------------------------------------------------- reading the answers + +/// Drains the host's answers and keeps a link or a transfer moving. Called +/// once a frame, before anything is drawn. +pub fn pump(app: &mut A, ctx: &egui::Context) { + if !available(app) { + return; + } + app.cloud_mut().clock = ctx.input(|i| i.time); + // Taken in one pass, then applied. An answer that arrives because of a job + // this frame sent belongs to the next frame. A worker on its own thread + // would have delivered it that way anyway. + let mut arrived = Vec::new(); + while let Ok(event) = app.cloud().events.1.try_recv() { + arrived.push(event); + } + for event in arrived { + apply(app, event); + } + poll_link(app); + // A worker answering is not a local event. Without this the progress line + // would sit frozen until the user moved the mouse. + if app.cloud().busy.is_some() || matches!(app.cloud().link, Some(Link::Starting | Link::Waiting { .. })) { + ctx.request_repaint_after(Duration::from_millis(120)); + } +} + +fn apply(app: &mut A, event: Event) { + let noun = app.kind().noun; + match event { + Event::Account(Ok(account)) => { + let linked = account.provider_linked; + // Who is signed in has changed, so what the provider can do may + // have changed with it. The dialog keeps its first answer, and on a + // cold start that answer is "nobody is signed in". + app.sharing().refresh(); + let cloud = app.cloud_mut(); + cloud.account = Some(account); + cloud.account_fault = None; + if linked { + cloud.link = None; + } else if cloud.link.is_none() { + cloud.link = Some(Link::Offered); + } + } + // No account linked yet is a state with an obvious next step. It is an + // offer to link, and never an error message. + Event::Account(Err(Fault::NotLinked)) => { + let cloud = app.cloud_mut(); + cloud.account_fault = None; + if cloud.link.is_none() { + cloud.link = Some(Link::Offered); + } + } + Event::Account(Err(fault)) => app.cloud_mut().account_fault = Some(fault), + Event::Conversation(Ok(conversation)) => { + let said = fill(app, "Opened in {}", &conversation.name); + app.cloud_mut().status = Some(said); + app.open_conversation(&conversation.url); + } + Event::Conversation(Err(fault)) => { + let text = fault.text(noun); + app.cloud_mut().status = Some(text); + } + Event::Browser { url, handle } => { + app.open_url(&url); + let next_poll = app.cloud().clock + LINK_POLL; + app.cloud_mut().link = Some(Link::Waiting { url, handle, next_poll }); + } + Event::Linked(Ok(true)) => { + // Storage just arrived, so ask what it can do. + app.sharing().refresh(); + let linked = app.tr("Cloud account linked."); + let cloud = app.cloud_mut(); + cloud.link = None; + cloud.status = Some(linked); + cloud.asked_account = false; + submit(app, Job::Account); + browse(app, ""); + app.cloud_mut().shared.loaded = false; + } + // The ordinary answer while the user is still in the browser. + Event::Linked(Ok(false)) | Event::Linked(Err(Fault::NotLinked)) => {} + Event::Linked(Err(fault)) => app.cloud_mut().link = Some(Link::Failed(fault)), + Event::Listed { path, entries } => { + let cloud = app.cloud_mut(); + if path == cloud.mine.path { + cloud.mine.fill(entries); + } + } + Event::Shared(entries) => app.cloud_mut().shared.fill(entries), + Event::Read { entry, into, bytes } => { + app.cloud_mut().busy = None; + match bytes { + Ok(bytes) => opened(app, entry, into, bytes), + Err(Fault::NotLinked) => app.cloud_mut().link = Some(Link::Offered), + Err(fault) => { + let text = format!("{}. {}", fill(app, "{} could not be opened", &entry.name), fault.text(noun)); + app.say(text); + } + } + } + Event::Saved { uid, entry } => { + app.cloud_mut().busy = None; + match entry { + Ok(entry) => { + app.mark_saved(uid); + stored(app, uid, entry); + } + // The one failure that must never be retried and never forced. + Err(Fault::Conflict) => { + app.drop_pending(uid); + match app.cloud().origins.get(&uid).cloned() { + Some(origin) => app.cloud_mut().conflict = Some(Conflict { uid, entry: origin.entry }), + None => app.say(Fault::Conflict.text(noun)), + } + } + Err(Fault::NotLinked) => { + app.drop_pending(uid); + app.cloud_mut().link = Some(Link::Offered); + } + Err(fault) => { + app.drop_pending(uid); + let text = format!("{} {}", app.tr(&format!("The {noun} was not saved.")), fault.text(noun)); + app.say(text); + } + } + } + } +} + +/// Bytes arrived. The application opens them. The document then remembers +/// where they came from. +fn opened(app: &mut A, entry: Entry, into: Option, bytes: Vec) { + let name = entry.name.clone(); + match app.open_bytes(&name, bytes) { + Ok(now) => { + if let Some(uid) = now { + app.cloud_mut().origins.insert(uid, Origin { entry }); + } + // A reload closes the document it replaced only once the new one is + // open. A read that fails leaves the user's work where it was. + if let (Some(old), Some(new)) = (into, now) + && old != new + { + let cloud = app.cloud_mut(); + cloud.origins.remove(&old); + app.drop_pending(old); + app.close(old); + } + if now.is_some() { + let said = fill(app, "Opened {} from the cloud.", &name); + app.cloud_mut().status = Some(said); + } + } + Err(reason) => app.say(reason), + } +} + +/// A save landed. The document now belongs to the entry the server returned, at +/// the version it returned. +fn stored(app: &mut A, uid: u64, entry: Entry) { + let name = entry.name.clone(); + let line = fill(app, "Saved {} to the cloud.", &name); + app.toast(fill(app, "Saved {} to the cloud", &name)); + let cloud = app.cloud_mut(); + cloud.conflict = None; + cloud.status = Some(line); + cloud.origins.insert(uid, Origin { entry }); +} + +/// Keeps asking whether the user has finished linking in their browser. +fn poll_link(app: &mut A) { + let now = app.cloud().clock; + let handle = { + let Some(Link::Waiting { handle: Some(handle), next_poll, .. }) = &mut app.cloud_mut().link else { return }; + if now < *next_poll { + return; + } + *next_poll = now + LINK_POLL; + handle.clone() + }; + submit(app, Job::LinkPoll(handle)); +} + +// ---------------------------------------------------------------- reporting + +/// The whole of the cloud state, for a control channel and for tests. +pub fn report(app: &A) -> Json { + let kind = app.kind(); + let cloud = app.cloud(); + let account = cloud.account.as_ref().map(|a| { + json!({ + "display": a.display, + "providerLinked": a.provider_linked, + "capabilities": a.capabilities.iter().map(|c| serde_json::to_value(c).unwrap_or_default()).collect::>(), + }) + }); + let came_from = origin(app) + .map(|o| json!({"id": o.entry.id, "room": o.entry.room, "name": o.entry.name, "etag": o.entry.etag, "writable": o.entry.writable})); + json!({ + "available": cloud.available(), + "account": account, + "accountError": cloud.account_fault.as_ref().map(Fault::code), + "folder": cloud.mine.path, + "entries": cloud.mine.entries.iter().map(|e| e.name.clone()).collect::>(), + "openable": cloud.mine.entries.iter().filter(|e| opens(e, kind)).map(|e| e.name.clone()).collect::>(), + "shared": cloud.shared.entries.iter().map(|e| json!({"name": e.name, "sharedBy": e.shared_by, "writable": e.writable, "openable": opens(e, kind)})).collect::>(), + "busy": cloud.busy.as_ref().map(Busy::text), + "link": match &cloud.link { + None => Json::Null, + Some(Link::Offered) => json!("offered"), + Some(Link::Starting) => json!("starting"), + Some(Link::Waiting { url, .. }) => json!({"waiting": url}), + Some(Link::Failed(fault)) => json!({"failed": fault.code()}), + }, + "conflict": cloud.conflict.as_ref().map(|c| json!({"name": c.entry.name})), + "origin": came_from, + "status": cloud.status, + "guest": cloud.guest.as_ref().map(|g| json!({"recipient": g.recipient, "readOnly": g.read_only})), + }) +} + +// ---------------------------------------------------------------- shared drawing + +/// Bytes as a person reads them. +pub fn size_text(bytes: Option) -> String { + let Some(bytes) = bytes else { return String::new() }; + const UNITS: [&str; 4] = ["bytes", "KB", "MB", "GB"]; + let mut size = bytes as f64; + let mut unit = 0; + while size >= 1024.0 && unit + 1 < UNITS.len() { + size /= 1024.0; + unit += 1; + } + match UNITS.get(unit) { + Some(name) if unit > 0 => format!("{size:.1} {name}"), + _ => format!("{bytes} bytes"), + } +} + +fn dim(ui: &mut Ui, style: &CloudStyle, text: &str) { + ui.label(RichText::new(text).font(egui::FontId::new(12.5, style.family.clone())).color(style.dim)); +} + +/// A bordered column with a heading. This is how the two Open sources sit side +/// by side. +fn column(ui: &mut Ui, style: &CloudStyle, heading: &str, body: impl FnOnce(&mut Ui)) { + egui::Frame::NONE.fill(style.surface).stroke(Stroke::new(1.0, style.border)).corner_radius(6.0).inner_margin(10).show(ui, |ui| { + ui.label(RichText::new(heading).font(egui::FontId::new(13.0, style.bold.clone())).color(style.text)); + ui.add_space(6.0); + egui::ScrollArea::vertical().id_salt(heading.to_owned()).max_height(300.0).auto_shrink([false, false]).show(ui, body); + }); +} + +/// One row in a file list, with a second line for the detail that matters on +/// that side of the page (a size for your own files, who shared it for +/// somebody else's). +fn entry_row(app: &A, ui: &mut Ui, entry: &Entry, detail: &str, reserve: f32) -> egui::Response { + let style = app.style(ui); + let width = (ui.available_width() - reserve).max(60.0); + let (rect, resp) = ui.allocate_exact_size(vec2(width, 40.0), Sense::click()); + let label = entry.name.clone(); + resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, &label)); + let p = ui.painter(); + if resp.hovered() { + p.rect_filled(rect, 4.0, style.hover); + } + app.paint_icon(p, Rect::from_center_size(pos2(rect.left() + 18.0, rect.center().y), vec2(18.0, 18.0)), entry.kind, style.text); + let (name_y, detail_y) = if detail.is_empty() { (rect.center().y, rect.center().y) } else { (rect.center().y - 8.0, rect.center().y + 9.0) }; + p.text(pos2(rect.left() + 38.0, name_y), Align2::LEFT_CENTER, &entry.name, egui::FontId::new(13.0, style.family.clone()), style.text); + if !detail.is_empty() { + p.text(pos2(rect.left() + 38.0, detail_y), Align2::LEFT_CENTER, detail, egui::FontId::new(11.0, style.family.clone()), style.dim); + } + resp +} diff --git a/crates/ui/src/cloud/pages.rs b/crates/ui/src/cloud/pages.rs new file mode 100644 index 000000000..fa1ead8be --- /dev/null +++ b/crates/ui/src/cloud/pages.rs @@ -0,0 +1,511 @@ +//! The Backstage pages: File › Open and File › Save As, and the modal a +//! refused save puts up. +//! +//! Every side of a page is drawn only where the service reported the +//! capability behind it. A list under a heading the provider cannot fill reads +//! to a user as a broken window, so the heading goes too. + +use craft_cloud::{Capability, Entry, EntryKind}; +use egui::{RichText, Ui}; + +use super::{ + CloudApp, Link, Source, browse, column, converse, dim, document_name, entry_row, fill, link, load_shared, open_entry, opens, parent_of, + reload_active, save_as, size_text, start, stem_of, +}; + +/// The character a label ends with when choosing it opens a dialog. +const ELLIPSIS: &str = "\u{2026}"; + +/// What an overflow menu asked for, deferred until the list is no longer being +/// drawn. Opening a dialog while borrowing the list is not possible. +enum Act { + Share(Entry), + Talk(Entry), +} + +/// The account line, or the reason there is nothing to show yet. +fn header(app: &mut A, ui: &mut Ui) { + let style = app.style(ui); + let mut retry = false; + match (&app.cloud().account, &app.cloud().account_fault) { + (_, Some(fault)) => { + let text = fault.text(app.kind().noun); + let again = app.tr("Try again"); + ui.horizontal(|ui| { + dim(ui, &style, &text); + if ui.button(again).clicked() { + retry = true; + } + }); + } + (Some(account), None) => { + let line = if account.display.is_empty() { app.tr("Signed in") } else { account.display.clone() }; + dim(ui, &style, &line); + } + (None, None) => { + let waiting = app.tr("Connecting to your cloud account…"); + dim(ui, &style, &waiting); + } + } + if retry { + let cloud = app.cloud_mut(); + cloud.account_fault = None; + cloud.asked_account = false; + start(app); + } +} + +/// The offer to link an account, and the wait while the browser is open. +/// Returns true when it drew, because there is nothing else to show until an +/// account exists. +/// +/// None of this is an error. The whole state means one thing: there is no +/// account yet, and linking one is a button away. +fn link_panel(app: &mut A, ui: &mut Ui) -> bool { + let Some(state) = app.cloud().link.clone() else { return false }; + let style = app.style(ui); + let noun = app.kind().noun; + let mut begin = false; + let mut cancel = false; + let mut browse_to: Option = None; + let words = LinkWords { + none_yet: app.tr("No cloud account is linked yet."), + why: app.tr(&format!("Link one to open and save {noun}s in your cloud storage.")), + link_one: app.tr("Link a cloud account"), + starting: app.tr("Starting…"), + finish: app.tr("Finish linking in your browser."), + waiting: app.tr("Waiting for your browser…"), + open_in_browser: app.tr("Open in browser"), + copy_link: app.tr("Copy link"), + cancel: app.tr("Cancel"), + again: app.tr("Try again"), + }; + egui::Frame::NONE.fill(style.soft).corner_radius(6.0).inner_margin(12).show(ui, |ui| match state { + Link::Offered => { + ui.label(RichText::new(&words.none_yet).font(egui::FontId::new(13.0, style.bold.clone())).color(style.text)); + dim(ui, &style, &words.why); + ui.add_space(8.0); + begin = ui.button(&words.link_one).clicked(); + } + Link::Starting => { + ui.horizontal(|ui| { + ui.add(egui::Spinner::new().size(14.0)); + dim(ui, &style, &words.starting); + }); + } + Link::Waiting { url, .. } => { + ui.label(RichText::new(&words.finish).font(egui::FontId::new(13.0, style.bold.clone())).color(style.text)); + ui.horizontal(|ui| { + ui.add(egui::Spinner::new().size(14.0)); + dim(ui, &style, &words.waiting); + }); + ui.add_space(6.0); + // A link alone is not enough. When the browser cannot be opened, + // or opens the wrong thing, the only way out is carrying the + // address across by hand, and a label cannot be selected. + ui.horizontal(|ui| { + if ui.button(&words.open_in_browser).clicked() { + browse_to = Some(url.clone()); + } + if ui.button(&words.copy_link).clicked() { + ui.ctx().copy_text(url.clone()); + } + }); + ui.add_space(4.0); + if ui.link(&url).clicked() { + browse_to = Some(url.clone()); + } + ui.add_space(8.0); + cancel = ui.button(&words.cancel).clicked(); + } + Link::Failed(fault) => { + ui.label(RichText::new(fault.text(noun)).font(egui::FontId::new(13.0, style.family.clone())).color(style.text)); + ui.add_space(8.0); + begin = ui.button(&words.again).clicked(); + } + }); + if let Some(url) = browse_to { + app.open_url(&url); + } + if begin { + link(app); + } else if cancel { + app.cloud_mut().link = Some(Link::Offered); + } + true +} + +/// The panel's strings, read before it is drawn. The application is borrowed +/// mutably inside the frame, so nothing can be asked of it there. +struct LinkWords { + none_yet: String, + why: String, + link_one: String, + starting: String, + finish: String, + waiting: String, + open_in_browser: String, + copy_link: String, + cancel: String, + again: String, +} + +/// The progress line for a read or a write in flight. +pub fn progress(app: &A, ui: &mut Ui) { + let Some(busy) = app.cloud().busy.clone() else { return }; + let style = app.style(ui); + ui.horizontal(|ui| { + ui.add(egui::Spinner::new().size(15.0)); + ui.label(RichText::new(busy.text()).font(egui::FontId::new(12.5, style.family.clone())).color(style.text)); + }); +} + +/// The `…` beside a document, and what a person chose from it. +/// +/// Only the actions the provider actually offers appear. A greyed-out item says +/// the action exists and is not possible right now. An absent one says this +/// provider does not do that at all, and those are different facts. +fn row_actions(app: &A, ui: &mut Ui, entry: &Entry) -> Option { + let can = |c: Capability| app.cloud().account.as_ref().is_some_and(|a| a.can(c)); + let mut items = vec![crate::menu::MenuItem::new("open", app.tr("Open"))]; + if can(Capability::Sharing) { + items.push( + crate::menu::MenuItem::new("share", format!("{}{}", app.tr("Share"), ELLIPSIS)) + .detail(app.tr("See who this is shared with, and invite somebody")) + .separated(), + ); + } + if can(Capability::Conversation) { + items.push(crate::menu::MenuItem::new("talk", app.tr("Work together")).detail(app.tr("Open a conversation about this document"))); + } + let labels = crate::menu::MenuLabels { more: app.tr("More options"), ..Default::default() }; + // Salted by the handle. Two rows drawing the same control need two menus, + // and the handle is the one thing that differs between them. + ui.push_id(entry.id.clone(), |ui| crate::menu::overflow(ui, &items, &labels)).inner +} + +/// File › Open, the cloud part. Your own files sit on one side and what other +/// people shared with you sits on the other. +pub fn open_page(app: &mut A, ui: &mut Ui) { + start(app); + header(app, ui); + ui.add_space(8.0); + if link_panel(app, ui) { + return; + } + progress(app, ui); + // Hidden where the provider has no incoming shares at all. An empty list + // under that heading would read as a broken feature. + let shared_offered = app.cloud().account.as_ref().is_some_and(|a| a.can(Capability::SharedWithMe)); + if shared_offered && !app.cloud().shared.loaded && !app.cloud().shared.loading { + load_shared(app); + } + let mut pick: Option<(Entry, Source)> = None; + let mut go: Option = None; + let mut act: Option = None; + if shared_offered { + ui.columns(2, |columns| { + if let Some(ui) = columns.get_mut(0) { + my_files(app, ui, &mut pick, &mut go, &mut act); + } + if let Some(ui) = columns.get_mut(1) { + shared_files(app, ui, &mut pick, &mut act); + } + }); + } else { + my_files(app, ui, &mut pick, &mut go, &mut act); + } + match act { + // Sharing a document in the list, which is not the one that happens to + // be open. The dialog is told which. + Some(Act::Share(entry)) => app.sharing().open(entry.id.clone(), entry.name.clone()), + Some(Act::Talk(entry)) => converse(app, entry.id.clone()), + None => {} + } + if let Some(path) = go { + browse(app, &path); + } else if let Some((entry, source)) = pick { + app.cloud_mut().source = source; + open_entry(app, entry, None); + } + if let Some(status) = app.cloud().status.clone() { + let style = app.style(ui); + ui.add_space(10.0); + dim(ui, &style, &status); + } +} + +/// Your own files: where you are, a way up, then the folders and the documents +/// this application can open. +fn my_files(app: &mut A, ui: &mut Ui, pick: &mut Option<(Entry, Source)>, go: &mut Option, act: &mut Option) { + let style = app.style(ui); + let kind = app.kind(); + let folder = app.cloud().mine.clone(); + let heading = app.tr("My files"); + let (home, up, loading) = (app.tr("Home"), app.tr("Up"), app.tr("Loading…")); + let nothing = app.tr(&format!("Nothing here that {} can open.", app.app_name())); + column(ui, &style, &heading, |ui| { + let here = if folder.path.is_empty() { home } else { folder.path.clone() }; + ui.horizontal(|ui| { + if let Some(parent) = parent_of(&folder.path) + && ui.button(&up).clicked() + { + *go = Some(parent); + } + dim(ui, &style, &here); + }); + ui.add_space(4.0); + if folder.loading { + ui.horizontal(|ui| { + ui.add(egui::Spinner::new().size(14.0)); + dim(ui, &style, &loading); + }); + return; + } + if let Some(fault) = &folder.error { + dim(ui, &style, &fault.text(kind.noun)); + return; + } + let mut shown = 0; + for entry in &folder.entries { + let is_folder = entry.kind == EntryKind::Folder; + if !is_folder && !opens(entry, kind) { + continue; + } + shown += 1; + let detail = if is_folder { String::new() } else { size_text(entry.size) }; + // A folder has nothing behind an ellipsis. Opening it is the only + // thing to do with one here. + let reserve = if is_folder { 0.0 } else { 26.0 }; + let (row, chose) = ui + .horizontal(|ui| { + let row = entry_row(app, ui, entry, &detail, reserve).clicked(); + let chose = if is_folder { None } else { row_actions(app, ui, entry) }; + (row, chose) + }) + .inner; + match chose.as_deref() { + Some("share") => *act = Some(Act::Share(entry.clone())), + Some("talk") => *act = Some(Act::Talk(entry.clone())), + Some("open") => *pick = Some((entry.clone(), Source::Mine)), + _ if row => { + if is_folder { + *go = Some(entry.path.clone()); + } else { + *pick = Some((entry.clone(), Source::Mine)); + } + } + _ => {} + } + } + if shown == 0 && folder.loaded { + dim(ui, &style, ¬hing); + } + }); +} + +/// What other people shared with you. One flat list, because an incoming share +/// has no folder of yours to sit in. Each row says who shared it. +fn shared_files(app: &mut A, ui: &mut Ui, pick: &mut Option<(Entry, Source)>, act: &mut Option) { + let style = app.style(ui); + let kind = app.kind(); + let shared = app.cloud().shared.clone(); + let heading = app.tr("Shared with me"); + let (loading, with_you, read_only) = (app.tr("Loading…"), app.tr("Shared with you"), app.tr("read-only")); + let nobody = app.tr(&format!("Nobody has shared a {} with you.", kind.noun)); + column(ui, &style, &heading, |ui| { + if shared.loading { + ui.horizontal(|ui| { + ui.add(egui::Spinner::new().size(14.0)); + dim(ui, &style, &loading); + }); + return; + } + if let Some(fault) = &shared.error { + dim(ui, &style, &fault.text(kind.noun)); + return; + } + let mut shown = 0; + for entry in shared.entries.iter().filter(|e| opens(e, kind)) { + shown += 1; + let who = entry.shared_by.clone().unwrap_or_else(|| with_you.clone()); + let detail = if entry.writable { who } else { format!("{who} ({read_only})") }; + let (row, chose) = ui + .horizontal(|ui| { + let row = entry_row(app, ui, entry, &detail, 26.0).clicked(); + (row, row_actions(app, ui, entry)) + }) + .inner; + match chose.as_deref() { + Some("share") => *act = Some(Act::Share(entry.clone())), + Some("talk") => *act = Some(Act::Talk(entry.clone())), + _ if row || chose.is_some() => *pick = Some((entry.clone(), Source::Shared)), + _ => {} + } + } + if shown == 0 && shared.loaded { + dim(ui, &style, &nobody); + } + }); +} + +/// File › Save As, the cloud destination. Pick a folder, name the file, save. +/// Returns true when a save started, so a Backstage view can return to the +/// document. +pub fn save_page(app: &mut A, ui: &mut Ui) -> bool { + let style = app.style(ui); + let kind = app.kind(); + start(app); + // The destination above already names the account. This line is here to + // say when something is wrong with it. + if app.cloud().account.is_none() || app.cloud().account_fault.is_some() { + header(app, ui); + ui.add_space(8.0); + } + if link_panel(app, ui) { + return false; + } + progress(app, ui); + if app.cloud().save_name.is_empty() { + let suggested = app.active().map(|uid| app.title(uid)).unwrap_or_default(); + app.cloud_mut().save_name = document_name(&suggested, kind); + } + let folder = app.cloud().mine.clone(); + let heading = app.tr("Folder"); + let (home, up, loading) = (app.tr("Home"), app.tr("Up"), app.tr("Loading…")); + let only_folder = app.tr(&format!("No folders here. The {} saves in this one.", kind.noun)); + let mut go: Option = None; + column(ui, &style, &heading, |ui| { + let here = if folder.path.is_empty() { home } else { folder.path.clone() }; + ui.horizontal(|ui| { + if let Some(parent) = parent_of(&folder.path) + && ui.button(&up).clicked() + { + go = Some(parent); + } + dim(ui, &style, &here); + }); + ui.add_space(4.0); + if folder.loading { + ui.horizontal(|ui| { + ui.add(egui::Spinner::new().size(14.0)); + dim(ui, &style, &loading); + }); + return; + } + if let Some(fault) = &folder.error { + dim(ui, &style, &fault.text(kind.noun)); + return; + } + let mut folders = 0; + for entry in folder.entries.iter().filter(|e| e.kind == EntryKind::Folder) { + folders += 1; + if entry_row(app, ui, entry, "", 0.0).clicked() { + go = Some(entry.path.clone()); + } + } + if folders == 0 && folder.loaded { + dim(ui, &style, &only_folder); + } + }); + if let Some(path) = go { + browse(app, &path); + } + ui.add_space(12.0); + let (file_name, save_label) = (app.tr("File name"), app.tr("Save to the cloud")); + let mut asked = false; + ui.horizontal(|ui| { + ui.label(file_name); + let typing = ui.add(egui::TextEdit::singleline(&mut app.cloud_mut().save_name).desired_width(280.0)); + asked = typing.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter)); + }); + ui.add_space(10.0); + let ready = app.cloud().busy.is_none() && !document_name(&app.cloud().save_name, kind).is_empty(); + if ui.add_enabled(ready, egui::Button::new(save_label)).clicked() { + asked = true; + } + if let Some(note) = app.save_note() { + ui.add_space(8.0); + dim(ui, &style, ¬e); + } + // A provider with no conditional writes cannot refuse one, so a save here + // can land on top of somebody else's. Said plainly, because the user is the + // only one who can decide whether that matters. + if app.cloud().account.as_ref().is_some_and(|a| !a.can(Capability::Etags)) { + let warning = app.tr("This cloud account cannot detect a save that would overwrite somebody else's changes."); + ui.add_space(4.0); + dim(ui, &style, &warning); + } + if asked && ready && app.ready_to_save() { + let (folder, name) = (app.cloud().mine.path.clone(), app.cloud().save_name.clone()); + match save_as(app, &folder, &name) { + Ok(_) => return true, + Err(error) => app.say(error), + } + } + false +} + +/// A save refused because the stored copy had moved on. +/// +/// Three ways out, and none of them throws anything away without saying so. +/// Reloading is the one a user usually wants, so it comes first. The text says +/// plainly that it discards their edits. +pub fn conflict_modal(app: &mut A, ctx: &egui::Context) { + let Some(conflict) = app.cloud().conflict.clone() else { return }; + let noun = app.kind().noun; + let words = ConflictWords { + title: app.tr(&format!("This {noun} was not saved")), + what: fill( + app, + "Somebody else saved {} while you were editing it. Nothing was written: saving now would overwrite their work.", + &conflict.entry.name, + ), + yours: app.tr("Your own changes are still open here. Reloading replaces them with the stored copy."), + reload: app.tr("Reload from the cloud"), + copy: app.tr(&format!("Save as a copy{ELLIPSIS}")), + keep: app.tr("Keep editing"), + }; + let mut reload = false; + let mut copy = false; + let mut dismiss = false; + egui::Modal::new(egui::Id::new("craft-ui/cloud/conflict")).show(ctx, |ui| { + let style = app.style(ui); + ui.set_width(430.0); + ui.label(RichText::new(&words.title).font(egui::FontId::new(15.0, style.bold.clone()))); + ui.add_space(8.0); + ui.add(egui::Label::new(&words.what).wrap()); + ui.add_space(6.0); + ui.add(egui::Label::new(&words.yours).wrap()); + ui.add_space(12.0); + ui.horizontal(|ui| { + reload = ui.button(&words.reload).clicked(); + copy = ui.button(&words.copy).clicked(); + dismiss = ui.button(&words.keep).clicked(); + }); + }); + if reload { + app.cloud_mut().conflict = None; + if let Err(error) = reload_active(app) { + app.say(error); + } + } else if copy { + let name = document_name(&format!("{} (copy)", stem_of(&conflict.entry.name)), app.kind()); + let cloud = app.cloud_mut(); + cloud.conflict = None; + cloud.save_name = name; + app.go_to_save_as(); + } else if dismiss { + app.cloud_mut().conflict = None; + } +} + +/// The modal's strings, read before it is drawn. +struct ConflictWords { + title: String, + what: String, + yours: String, + reload: String, + copy: String, + keep: String, +} diff --git a/crates/ui/src/cloud/tests.rs b/crates/ui/src/cloud/tests.rs new file mode 100644 index 000000000..875612144 --- /dev/null +++ b/crates/ui/src/cloud/tests.rs @@ -0,0 +1,573 @@ +//! The pages driven by an application that holds no documents. +//! +//! The point of these is the seam. A fake application answers every question +//! [`CloudApp`] asks and records what it was told to do, so what crosses the +//! boundary is visible without a spreadsheet, a service or a window. + +use std::sync::{Arc, Mutex}; + +use craft_cloud::{Capability, Entry, EntryKind}; + +use super::*; + +/// Everything the fake application was asked to do. +#[derive(Default)] +struct Did { + opened: Vec, + closed: Vec, + encoded: Vec, + /// The name each encode was asked for, which is where the bytes go. + encoded_as: Vec, + /// The content type beside it, where the provider gave one. + encoded_mime: Vec>, + marked_saved: Vec, + dropped: Vec, + said: Vec, + toasted: Vec, + urls: Vec, + conversations: Vec, + went_to_save_as: usize, +} + +const NOTES: DocumentKind = + DocumentKind { extensions: &["note", "txt"], mimes: &["text/plain", "application/x-note"], noun: "note", default_extension: "note" }; + +struct Notebook { + cloud: CloudFiles, + share: crate::share::ShareDialog, + presence: crate::presence::PresenceBar, + /// The document in the window, and what it is called. + open: Option<(u64, String)>, + /// What the next `open_bytes` answers with. + opens_as: Result, String>, + did: Arc>, +} + +impl Notebook { + fn new() -> Notebook { + Notebook { + cloud: CloudFiles::new(), + share: crate::share::ShareDialog::new(), + presence: crate::presence::PresenceBar::new(), + open: Some((1, "Untitled")).map(|(uid, name)| (uid, name.to_owned())), + opens_as: Ok(Some(1)), + did: Arc::new(Mutex::new(Did::default())), + } + } + + fn did(&self) -> std::sync::MutexGuard<'_, Did> { + self.did.lock().unwrap() + } +} + +impl CloudApp for Notebook { + fn cloud(&self) -> &CloudFiles { + &self.cloud + } + + fn cloud_mut(&mut self) -> &mut CloudFiles { + &mut self.cloud + } + + fn kind(&self) -> DocumentKind { + NOTES + } + + fn active(&self) -> Option { + self.open.as_ref().map(|(uid, _)| *uid) + } + + fn title(&self, _uid: u64) -> String { + self.open.as_ref().map(|(_, name)| name.clone()).unwrap_or_default() + } + + fn open_bytes(&mut self, name: &str, _bytes: Vec) -> Result, String> { + self.did().opened.push(name.to_owned()); + self.opens_as.clone() + } + + fn encode(&mut self, uid: u64, into: Destination<'_>) -> Result, String> { + self.did().encoded.push(uid); + self.did().encoded_as.push(into.name.to_owned()); + self.did().encoded_mime.push(into.mime.map(str::to_owned)); + Ok(b"a note".to_vec()) + } + + fn close(&mut self, uid: u64) { + self.did().closed.push(uid); + } + + fn mark_saved(&mut self, uid: u64) { + self.did().marked_saved.push(uid); + } + + fn drop_pending(&mut self, uid: u64) { + self.did().dropped.push(uid); + } + + fn sharing(&mut self) -> &mut crate::share::ShareDialog { + &mut self.share + } + + fn presence(&mut self) -> &mut crate::presence::PresenceBar { + &mut self.presence + } + + fn paint_icon(&self, _painter: &egui::Painter, _rect: egui::Rect, _kind: EntryKind, _colour: egui::Color32) {} + + fn open_url(&self, url: &str) { + self.did.lock().unwrap().urls.push(url.to_owned()); + } + + fn open_conversation(&self, url: &str) { + self.did.lock().unwrap().conversations.push(url.to_owned()); + } + + fn say(&mut self, text: String) { + self.did().said.push(text); + } + + fn toast(&mut self, text: String) { + self.did().toasted.push(text); + } + + fn go_to_save_as(&mut self) { + self.did().went_to_save_as += 1; + } + + fn app_name(&self) -> &str { + "Notes" + } +} + +/// A service that answers on the calling thread, so a job submitted during a +/// test is answered before the next line. +struct Service(Arc>>); + +impl CloudBackend for Service { + fn submit(&self, job: Job, post: Post) { + let answer = match &job { + Job::Account | Job::SignIn => Some(Event::Account(Ok(Account { + display: "Ada Lovelace".to_owned(), + capabilities: vec![Capability::Files, Capability::Etags], + provider_linked: true, + }))), + Job::List(path) => Some(Event::Listed { path: path.clone(), entries: Ok(vec![file("/Minutes.note"), folder("/Archive")]) }), + Job::Read { entry, into } => Some(Event::Read { entry: entry.clone(), into: *into, bytes: Ok(b"a note".to_vec()) }), + Job::Write { uid, entry, .. } => { + let mut stored = entry.clone(); + stored.etag = Some("v2".to_owned()); + Some(Event::Saved { uid: *uid, entry: Ok(stored) }) + } + _ => None, + }; + self.0.lock().unwrap().push(job); + if let Some(event) = answer { + post.send(event); + } + } +} + +fn file(path: &str) -> Entry { + Entry { + id: path.to_owned(), + room: format!("room:{path}"), + name: path.rsplit('/').next().unwrap_or(path).to_owned(), + path: path.to_owned(), + kind: EntryKind::File, + size: Some(2048), + modified: None, + mime: None, + etag: Some("v1".to_owned()), + writable: true, + shared_by: None, + } +} + +fn folder(path: &str) -> Entry { + Entry { kind: EntryKind::Folder, size: None, etag: None, ..file(path) } +} + +/// One frame's worth of draining, with no window. +fn pumped(app: &mut Notebook, ctx: &egui::Context) { + ctx.begin_pass(Default::default()); + pump(app, ctx); + // Nothing is painted here, so the pass's textures go nowhere. egui insists + // they are accounted for rather than dropped on the floor. + ctx.end_pass().textures_delta.clear(); +} + +fn wired() -> (Notebook, Arc>>, egui::Context) { + let mut app = Notebook::new(); + let jobs = Arc::new(Mutex::new(Vec::new())); + app.cloud.connect(Service(jobs.clone())); + (app, jobs, egui::Context::default()) +} + +#[test] +fn nothing_is_offered_until_a_service_is_wired() { + let app = Notebook::new(); + assert!(!available(&app), "a build with no service offers nothing cloud-shaped"); + assert_eq!(report(&app)["available"], false); +} + +#[test] +fn the_account_is_asked_for_once_per_run() { + let (mut app, jobs, ctx) = wired(); + start(&mut app); + start(&mut app); + let asked = jobs.lock().unwrap().iter().filter(|j| matches!(j, Job::Account)).count(); + assert_eq!(asked, 1, "a frame that asks again would ask on every frame"); + pumped(&mut app, &ctx); + assert_eq!(report(&app)["account"]["display"], "Ada Lovelace"); +} + +#[test] +fn only_the_documents_this_application_opens_are_offered() { + let (mut app, _jobs, ctx) = wired(); + start(&mut app); + pumped(&mut app, &ctx); + let listing = report(&app); + assert_eq!(listing["entries"], serde_json::json!(["Minutes.note", "Archive"])); + assert_eq!(listing["openable"], serde_json::json!(["Minutes.note"]), "a folder is not something to open"); +} + +#[test] +fn a_content_type_opens_a_document_with_no_extension() { + let mut exported = file("/exported"); + exported.mime = Some("text/plain; charset=utf-8".to_owned()); + assert!(opens(&exported, NOTES), "a provider that gives no extension still says what the bytes are"); + let mut picture = file("/holiday"); + picture.mime = Some("image/png".to_owned()); + assert!(!opens(&picture, NOTES)); + assert!(!opens(&folder("/Archive"), NOTES), "a folder opens nothing"); +} + +#[test] +fn a_typed_name_becomes_a_file_name_of_this_applications_own_kind() { + assert_eq!(document_name(" Minutes ", NOTES), "Minutes.note"); + assert_eq!(document_name("Minutes.txt", NOTES), "Minutes.txt", "an extension this application opens is kept"); + assert_eq!(document_name("Minutes.v2", NOTES), "Minutes.v2.note", "an unknown suffix is part of the name"); + assert_eq!(document_name("/a/b/Minutes", NOTES), "Minutes.note", "a pasted path cannot become a folder"); + assert_eq!(document_name(" ", NOTES), ""); +} + +#[test] +fn walking_up_from_the_root_has_nowhere_to_go() { + assert_eq!(parent_of(""), None); + assert_eq!(parent_of("/Archive"), Some(String::new())); + assert_eq!(parent_of("/Archive/2026"), Some("/Archive".to_owned())); +} + +#[test] +fn opening_hands_the_bytes_to_the_application_and_remembers_the_entry() { + let (mut app, _jobs, ctx) = wired(); + start(&mut app); + pumped(&mut app, &ctx); + open_entry(&mut app, file("/Minutes.note"), None); + pumped(&mut app, &ctx); + assert_eq!(app.did().opened, vec!["Minutes.note".to_owned()], "the application alone turns bytes into a document"); + let origin = report(&app)["origin"].clone(); + assert_eq!(origin["id"], "/Minutes.note", "the opaque handle is kept for the save"); + assert_eq!(origin["etag"], "v1", "so is the version it was read at"); + assert_eq!(origin["room"], "room:/Minutes.note", "and the collaboration identity, which is not the handle"); +} + +#[test] +fn a_reload_closes_the_document_it_replaced_only_once_the_new_one_is_open() { + let (mut app, _jobs, ctx) = wired(); + app.opens_as = Ok(Some(2)); + open_entry(&mut app, file("/Minutes.note"), Some(1)); + pumped(&mut app, &ctx); + assert_eq!(app.did().closed, vec![1], "the one it replaced is gone"); + assert_eq!(app.did().dropped, vec![1], "and so is whatever was recorded about saving it"); + + // A read the application could not use leaves the user's work where it was. + let (mut app, _jobs, ctx) = wired(); + app.opens_as = Err("these bytes are not a note".to_owned()); + open_entry(&mut app, file("/Minutes.note"), Some(1)); + pumped(&mut app, &ctx); + assert!(app.did().closed.is_empty(), "nothing was closed, because nothing opened"); + assert_eq!(app.did().said, vec!["these bytes are not a note".to_owned()]); +} + +#[test] +fn a_document_the_application_took_elsewhere_is_not_announced() { + let (mut app, _jobs, ctx) = wired(); + // What an application answers while it prompts for a password. + app.opens_as = Ok(None); + open_entry(&mut app, file("/Minutes.note"), None); + pumped(&mut app, &ctx); + assert_eq!(report(&app)["status"], serde_json::Value::Null); + assert_eq!(report(&app)["origin"], serde_json::Value::Null, "nothing came from the cloud yet"); +} + +#[test] +fn a_save_goes_out_under_the_version_the_document_was_read_at() { + let (mut app, jobs, ctx) = wired(); + open_entry(&mut app, file("/Minutes.note"), None); + pumped(&mut app, &ctx); + save(&mut app).unwrap(); + assert_eq!(app.did().encoded, vec![1], "the application alone turns a document into bytes"); + assert_eq!(app.did().encoded_as, vec!["Minutes.note".to_owned()], "the bytes are asked for under the name they are going to"); + let condition = jobs.lock().unwrap().iter().find_map(|j| match j { + Job::Write { entry, .. } => Some(entry.etag.clone()), + _ => None, + }); + assert_eq!(condition, Some(Some("v1".to_owned())), "the etag it was read at is the condition"); + pumped(&mut app, &ctx); + assert_eq!(app.did().marked_saved, vec![1], "the version that reached the service is the saved one"); + assert_eq!(report(&app)["origin"]["etag"], "v2", "and the document moves on to the version the service returned"); +} + +#[test] +fn a_read_only_share_is_never_saved_over() { + let (mut app, _jobs, ctx) = wired(); + let mut theirs = file("/Team.note"); + theirs.writable = false; + open_entry(&mut app, theirs, None); + pumped(&mut app, &ctx); + assert!(!has_target(&app), "Save has nowhere of its own to go"); + let refused = save(&mut app).unwrap_err(); + assert!(refused.contains("reading only"), "and saying why names the fix: {refused}"); +} + +#[test] +fn a_refused_save_is_put_to_the_user_and_never_retried() { + let (mut app, jobs, ctx) = wired(); + open_entry(&mut app, file("/Minutes.note"), None); + pumped(&mut app, &ctx); + jobs.lock().unwrap().clear(); + // What a service answers when somebody else saved first. + app.cloud.events.0.send(Event::Saved { uid: 1, entry: Err(Fault::Conflict) }).unwrap(); + pumped(&mut app, &ctx); + assert_eq!(report(&app)["conflict"]["name"], "Minutes.note", "the user is told, and asked what to do"); + assert_eq!(app.did().dropped, vec![1], "the version that did not land is forgotten"); + assert!(jobs.lock().unwrap().is_empty(), "nothing went out again on its own"); +} + +#[test] +fn no_account_yet_is_an_offer_to_link_and_never_an_error() { + let (mut app, _jobs, ctx) = wired(); + app.cloud.events.0.send(Event::Account(Err(Fault::NotLinked))).unwrap(); + pumped(&mut app, &ctx); + assert_eq!(report(&app)["link"], "offered"); + assert_eq!(report(&app)["accountError"], serde_json::Value::Null, "not having linked an account yet is not a failure"); + assert!(app.did().said.is_empty()); +} + +#[test] +fn a_browser_round_trip_is_polled_until_the_user_is_done() { + let (mut app, jobs, ctx) = wired(); + app.cloud.events.0.send(Event::Browser { url: "https://cloud.example/link/abc".to_owned(), handle: Some("abc".to_owned()) }).unwrap(); + pumped(&mut app, &ctx); + assert_eq!(app.did().urls, vec!["https://cloud.example/link/abc".to_owned()], "the browser is opened for them"); + assert_eq!(report(&app)["link"]["waiting"], "https://cloud.example/link/abc"); + + // The wait is not polled again until it is due. + jobs.lock().unwrap().clear(); + pumped(&mut app, &ctx); + assert!(jobs.lock().unwrap().iter().all(|j| !matches!(j, Job::LinkPoll(_))), "a poll every frame would be a poll every sixteen milliseconds"); + + if let Some(Link::Waiting { next_poll, .. }) = &mut app.cloud.link { + *next_poll = 0.0; + } + pumped(&mut app, &ctx); + assert!(jobs.lock().unwrap().iter().any(|j| matches!(j, Job::LinkPoll(_)))); +} + +#[test] +fn what_a_person_reads_is_about_their_own_kind_of_document() { + let app = Notebook::new(); + assert_eq!(Fault::Conflict.text(app.kind().noun), "Somebody else saved this note while you were editing it."); + assert_eq!(Fault::Conflict.code(), "conflict", "and the control channel reads the same fact as a word"); +} + +#[test] +fn working_together_needs_somewhere_for_the_room_to_be_keyed_on() { + let (mut app, jobs, ctx) = wired(); + app.cloud.account = Some(Account { display: "Ada".to_owned(), capabilities: vec![Capability::Conversation], provider_linked: true }); + assert!(can_converse(&app)); + // A document that has never been in the cloud has no handle. + work_together(&mut app); + assert_eq!(report(&app)["status"], "Save this note to the cloud first"); + assert!(jobs.lock().unwrap().iter().all(|j| !matches!(j, Job::Conversation(_)))); + + open_entry(&mut app, file("/Minutes.note"), None); + pumped(&mut app, &ctx); + work_together(&mut app); + let asked = jobs.lock().unwrap().iter().any(|j| matches!(j, Job::Conversation(id) if id == "/Minutes.note")); + assert!(asked, "the provider is asked about the handle it issued"); +} + +#[test] +fn a_conversation_uses_the_hosts_chat_opener() { + let (mut app, _, ctx) = wired(); + app.cloud + .events + .0 + .send(Event::Conversation(Ok(craft_cloud::Conversation { url: "https://cloud.example.net/call/room".to_owned(), name: "Talk".to_owned() }))) + .unwrap(); + + pumped(&mut app, &ctx); + + assert_eq!(app.did().conversations, ["https://cloud.example.net/call/room"]); + assert!(app.did().urls.is_empty(), "ordinary browser links and conversations remain separate host decisions"); +} + +#[test] +fn signing_out_forgets_everything_this_window_knew() { + let (mut app, jobs, ctx) = wired(); + start(&mut app); + pumped(&mut app, &ctx); + open_entry(&mut app, file("/Minutes.note"), None); + pumped(&mut app, &ctx); + sign_out(&mut app); + let state = report(&app); + assert_eq!(state["account"], serde_json::Value::Null); + assert_eq!(state["origin"], serde_json::Value::Null); + assert_eq!(state["entries"], serde_json::json!([])); + assert!(jobs.lock().unwrap().iter().any(|j| matches!(j, Job::SignOut)), "the service is told, so the saved token goes too"); +} + +#[test] +fn bytes_are_said_the_way_a_person_reads_them() { + assert_eq!(size_text(None), ""); + assert_eq!(size_text(Some(512)), "512 bytes"); + assert_eq!(size_text(Some(2048)), "2.0 KB"); + assert_eq!(size_text(Some(5 * 1024 * 1024)), "5.0 MB"); +} + +#[test] +fn a_destination_is_named_after_the_account_it_belongs_to() { + let mut app = Notebook::new(); + assert_eq!(destination_name(&app), "Cloud storage", "two entries reading the same tell nobody which account this is"); + app.cloud.account = Some(Account { display: "Ada Lovelace".to_owned(), capabilities: Vec::new(), provider_linked: true }); + assert_eq!(destination_name(&app), "Ada Lovelace"); +} + +#[test] +fn the_contracts_own_conflict_is_the_one_a_save_must_not_retry() { + assert_eq!(Fault::from(craft_cloud::Error::Conflict("Minutes.note".to_owned())), Fault::Conflict); + assert_eq!(Fault::from(craft_cloud::Error::Unauthenticated), Fault::Unauthenticated); + assert!(matches!(Fault::from(craft_cloud::Error::Unsupported("sharing")), Fault::Refused(_))); +} + +#[test] +fn a_save_asks_for_the_bytes_under_the_name_they_are_going_to() { + // A document opened as one format and saved in the application's own would + // hand the user a file no other application reads, under a name that says + // it is readable. The application cannot avoid that without being told + // where the bytes are going. + let (mut app, _jobs, ctx) = wired(); + let mut sheet = file("/figures.csv"); + sheet.mime = Some("text/csv".to_owned()); + open_entry(&mut app, sheet, None); + pumped(&mut app, &ctx); + save(&mut app).unwrap(); + assert_eq!(app.did().encoded_as, vec!["figures.csv".to_owned()]); + assert_eq!(app.did().encoded_mime, vec![Some("text/csv".to_owned())], "the provider's own word for it comes too"); + + // And Save As, where the name is the one just typed rather than the one + // the document arrived under. + let (mut app, _jobs, ctx) = wired(); + open_entry(&mut app, file("/figures.csv"), None); + pumped(&mut app, &ctx); + save_as(&mut app, "", "a copy.note").unwrap(); + assert_eq!(app.did().encoded_as, vec!["a copy.note".to_owned()]); + assert_eq!(app.did().encoded_mime, vec![None], "nothing is there yet, so nothing says what it is"); +} + +#[test] +fn a_destination_reads_its_own_extension() { + assert_eq!(Destination::new("figures.csv").extension(), "csv"); + assert_eq!(Destination::new("FIGURES.CSV").extension(), "csv", "a shouted name is the same name"); + assert_eq!(Destination::new("report.2026.xlsx").extension(), "xlsx", "the last one wins"); + // A bare name, which is what a web application's export commonly has. + // Everything an application can learn is in the content type instead. + assert_eq!(Destination::new("exported").extension(), ""); + assert_eq!(Destination::new("trailing.").extension(), ""); +} + +// ---- somebody who followed a shared link ---------------------------------- + +/// One frame of the title bar's right-hand end, as the accessibility tree +/// reported it. +/// +/// Read off the tree rather than out of the state, because the question is +/// what a recipient can reach. A field saying "no menu" proves nothing about +/// what was drawn. +fn title_bar(app: &mut Notebook) -> Vec<(egui::accesskit::Role, String)> { + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + let raw = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(400.0, 48.0))), ..Default::default() }; + let mut output = ctx.run_ui(raw, |ui| who(app, ui)); + output.textures_delta.clear(); + let Some(tree) = output.platform_output.accesskit_update.as_ref() else { return Vec::new() }; + tree.nodes + .iter() + .filter_map(|(_, node)| { + // egui puts a plain label's text in the accessibility value and a + // control's text in the label, so both are text on screen. + node.label().or_else(|| node.value()).map(|text| (node.role(), text.to_owned())) + }) + .collect() +} + +fn pressable(seen: &[(egui::accesskit::Role, String)]) -> Vec { + seen.iter().filter(|(role, _)| *role == egui::accesskit::Role::Button).map(|(_, text)| text.clone()).collect() +} + +fn reads(seen: &[(egui::accesskit::Role, String)], fragment: &str) -> bool { + seen.iter().any(|(_, text)| text.contains(fragment)) +} + +#[test] +fn a_recipient_is_named_and_offered_nothing() { + let mut app = Notebook::new(); + app.cloud.as_guest("outsider@example.org", false); + let seen = title_bar(&mut app); + assert!(reads(&seen, "outsider@example.org"), "a recipient has no account, so their own address is the identity to show: {seen:?}"); + // The whole point. Every item an account menu holds is a sign-out, a + // switch or a storage connection, and a recipient has none of those. + assert_eq!(pressable(&seen), Vec::::new(), "nothing here may be pressed: {seen:?}"); + for offer in ["Sign in", "Sign out", "Account", "Connect storage", "Add an account"] { + assert!(!reads(&seen, offer), "a recipient was offered {offer}"); + } +} + +#[test] +fn a_read_only_share_says_so_before_anybody_tries_to_save() { + let mut app = Notebook::new(); + app.cloud.as_guest("outsider@example.org", true); + assert!(reads(&title_bar(&mut app), "Reading only"), "finding out at the moment of saving means doing the work twice"); + + app.cloud.as_guest("outsider@example.org", false); + assert!(!reads(&title_bar(&mut app), "Reading only"), "a share that allows an edit must not say otherwise"); +} + +#[test] +fn an_address_of_only_spaces_leaves_no_badge() { + let mut app = Notebook::new(); + app.cloud.as_guest(" ", false); + assert!(app.cloud.guest().is_none(), "a badge with nothing on it reads as a fault"); + assert_eq!(title_bar(&mut app), Vec::new()); +} + +#[test] +fn a_signed_in_window_still_gets_its_account_badge() { + let (mut app, _jobs, ctx) = wired(); + start(&mut app); + pumped(&mut app, &ctx); + let seen = title_bar(&mut app); + assert!(!pressable(&seen).is_empty(), "somebody with an account still has a menu to reach: {seen:?}"); + assert!(reads(&seen, "Ada Lovelace")); +} + +#[test] +fn the_report_says_who_this_window_is_for() { + let mut app = Notebook::new(); + assert_eq!(report(&app)["guest"], serde_json::Value::Null, "most windows belong to nobody in particular yet"); + app.cloud.as_guest("outsider@example.org", true); + assert_eq!(report(&app)["guest"], serde_json::json!({"recipient": "outsider@example.org", "readOnly": true})); +} diff --git a/crates/ui/src/cloud/title.rs b/crates/ui/src/cloud/title.rs new file mode 100644 index 000000000..2535caf68 --- /dev/null +++ b/crates/ui/src/cloud/title.rs @@ -0,0 +1,173 @@ +//! The right-hand end of a title bar, plus the Save As destination. +//! +//! Who is signed in, who else is here, and Share. Every office suite puts +//! these three in the same corner, in that order. A person coming from one of +//! them looks there first. + +use egui::{RichText, Ui}; + +use super::{CloudApp, CopyFormat, Guest, available, fill, link, origin, sign_in, sign_out, work_together}; + +/// Who this window is for. Who else is in the document, beside them. +/// +/// Three cases, each a different person. Somebody signed in gets the account +/// badge and its menu. Somebody who followed a shared link gets their own +/// address and no menu, having no account to manage. A build with no service +/// configured gets neither. A badge that cannot sign anybody in would be a +/// control that fails on use. +/// +/// Nothing is asked for here. Drawing a badge must not begin a sign-in: a +/// worker signs in before any job it is given, and it then blocks polling the +/// browser for minutes. Starting that from a paint call pops a browser open at +/// launch and leaves every later job queued behind it. Signing in is a gesture, +/// so it waits for a press. +pub fn who(app: &mut A, ui: &mut Ui) { + match app.cloud().guest().cloned() { + Some(guest) => shared_with(app, ui, &guest), + None => account(app, ui), + } + // Who else is here, beside whoever this window belongs to. Nothing is + // drawn while a person is working alone, which keeps a solitary document + // looking like one. + if app.presence().shared() { + ui.add_space(6.0); + app.presence().show(ui); + } +} + +/// Who a shared link was sent to, for somebody with no account anywhere. +/// +/// A label and not a button. Every item an account menu holds is a sign-out, a +/// switch or a storage connection, and a recipient has none of those. A +/// control that opens a menu of failures is worse than no control. +fn shared_with(app: &mut A, ui: &mut Ui, guest: &Guest) { + let explained = fill(app, "This document was shared with {}", &guest.recipient); + let reading = app.tr("Reading only"); + let dim = ui.visuals().weak_text_color(); + if guest.read_only { + // Said where the account would be. Both answer what this window may + // do with the document in it. A recipient who finds out at the moment + // of saving has already done the work twice. + ui.label(RichText::new(reading).small().color(dim)); + ui.add_space(6.0); + } + ui.label(RichText::new(guest.recipient.as_str()).small().color(dim)).on_hover_text(explained); +} + +/// The account badge and its menu, for somebody signed in. +fn account(app: &mut A, ui: &mut Ui) { + if !available(app) { + return; + } + let service = app.service(); + let known = app.cloud().account.as_ref().map(|a| crate::account::Account { + // One account for now. The control already holds a list, so a second + // deployment is a second entry here and nothing else changes. + id: "default".to_owned(), + display: a.display.clone(), + email: None, + service, + linked: a.provider_linked, + }); + let new_accounts: Vec<_> = known.into_iter().collect(); + let cloud = app.cloud_mut(); + if cloud.accounts.accounts() != new_accounts.as_slice() { + cloud.accounts.set(new_accounts); + } + cloud.accounts.show(ui); + + while let Some(action) = app.cloud_mut().accounts.take_action() { + use crate::account::AccountAction as Act; + match action { + // Signing in and connecting storage are two different things. + // Signing in is the device flow against the service, which every + // job already triggers when there is no token. Asking who the + // account is therefore starts it. Linking storage comes after, and + // needs that session to exist first. + Act::SignIn | Act::AddAccount => { + app.cloud_mut().sign_in_from_menu = true; + sign_in(app); + } + Act::Link(_) => link(app), + Act::SignOut(_) => sign_out(app), + // One account, so there is nothing to switch to yet. + Act::Use(_) => {} + Act::Manage(_) => { + let host = app.service(); + if !host.is_empty() { + app.open_url(&format!("https://{host}/account")); + } + } + } + } +} + +/// Whether the Share split button can be drawn. +/// +/// False until the service says the provider supports sharing. An application +/// draws whatever it offered before. A button that fails on use is worse than +/// no button at all. +pub fn shares(app: &mut A) -> bool { + app.sharing().available() +} + +/// Share, as a split button. +/// +/// Pressing the label shares, which is what somebody wants most of the time. +/// The chevron carries the variations, and working together is one of them. +/// `copies` are the application's own Save a Copy formats. Those have nothing +/// in common between one application and the next. +/// +/// Answers with the identifier of a copy format, when that is what was chosen. +/// Everything else is carried out here. +pub fn share_button(app: &mut A, ui: &mut Ui, copies: &[CopyFormat]) -> Option { + let noun = app.kind().noun; + let mut items = Vec::new(); + if app.cloud().can_converse() { + let detail = app.tr(&format!("Open a chat about this {noun}")); + items.push(crate::menu::MenuItem::new("talk", app.tr("Open chat")).detail(detail)); + } + for (at, copy) in copies.iter().enumerate() { + let item = crate::menu::MenuItem::new(copy.id.clone(), copy.label.clone()); + // A rule above the first copy, so sharing and exporting read as two + // groups rather than one long list. + items.push(if at == 0 && !items.is_empty() { item.separated() } else { item }); + } + let labels = crate::menu::MenuLabels::default(); + let primary = app.tr("Share"); + match crate::menu::split(ui, &primary, &items, &labels)? { + crate::menu::SplitHit::Primary => { + // The handle the provider issued, which is what a share is about. + // A document that has never been in the cloud has none, and the + // dialog says so. + let (id, title) = match origin(app) { + Some(origin) => (origin.entry.id.clone(), origin.entry.name.clone()), + None => (String::new(), app.active().map(|uid| app.title(uid)).unwrap_or_default()), + }; + app.sharing().open(id, title); + None + } + crate::menu::SplitHit::Item(what) if what == "talk" => { + work_together(app); + None + } + crate::menu::SplitHit::Item(format) => Some(format), + } +} + +/// What to call the cloud destination on a Save As page. +/// +/// The account's own name. The destination then reads as the user's own +/// storage. Somebody with an account on two deployments needs to know which +/// one a document is about to land in. +pub fn destination_name(app: &A) -> String { + app.cloud().account.as_ref().map(|a| a.display.clone()).filter(|display| !display.is_empty()).unwrap_or_else(|| app.tr("Cloud storage")) +} + +/// Whether the cloud destination is the one to offer first. +/// +/// A document that came from the cloud is saved back there unless the user says +/// otherwise. One that came from this computer is not. +pub fn prefers_cloud(app: &A) -> bool { + available(app) && origin(app).is_some() +} diff --git a/crates/ui/src/lib.rs b/crates/ui/src/lib.rs index bbdd912ac..0c6d42740 100644 --- a/crates/ui/src/lib.rs +++ b/crates/ui/src/lib.rs @@ -5,9 +5,13 @@ //! Applications own their assets, themes, layouts, commands and document semantics. Components //! accept focused style values and return egui responses; no application engine is required. +#[cfg(feature = "share")] +pub mod account; pub mod backdrop; pub mod buttons; pub mod capture; +#[cfg(feature = "cloud")] +pub mod cloud; pub mod combo; pub mod direction; pub mod docking; @@ -17,9 +21,13 @@ pub mod icons; pub mod ime; pub mod layout; pub mod localized; +pub mod menu; pub mod panes; +pub mod presence; pub mod printing; pub mod shapes; +#[cfg(feature = "share")] +pub mod share; pub mod tabs; #[cfg(all(feature = "screen-testing", not(target_arch = "wasm32")))] pub mod testing; diff --git a/crates/ui/src/menu.rs b/crates/ui/src/menu.rs new file mode 100644 index 000000000..2b18340bf --- /dev/null +++ b/crates/ui/src/menu.rs @@ -0,0 +1,222 @@ +//! The two controls that offer more than one action. +//! +//! An overflow menu is the `…` that holds what did not earn a place on the +//! toolbar. A split button is a primary action with a chevron beside it, where +//! the chevron offers the variations. Share is the usual example. Most of the +//! time a person wants to share, and once in a while they want to copy a link +//! or start a call about the document instead. +//! +//! They are one module because they are the same control underneath. Building +//! them twice would mean getting the accessible naming right twice, and an +//! icon-only button that announces itself as an ellipsis character is useless +//! to anybody reading the screen rather than looking at it. +//! +//! Neither control knows what any item does. Each answers with the identifier +//! of the item a person chose. The application holds the meaning. + +use egui::{Response, RichText, Ui}; + +/// One line in a menu. +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub struct MenuItem { + /// What the caller recognises this by. Never shown. + pub id: String, + pub label: String, + /// A second line, smaller. Worth having where the label alone leaves a + /// person guessing what the action will do to their document. + pub detail: Option, + /// A leading glyph. Decoration only, so it is never the accessible name. + pub icon: Option, + pub enabled: bool, + /// Draw a rule above this item. A group of related actions reads as a + /// group only when something separates it from the last one. + pub separator_before: bool, +} + +impl MenuItem { + pub fn new(id: impl Into, label: impl Into) -> MenuItem { + MenuItem { id: id.into(), label: label.into(), enabled: true, ..MenuItem::default() } + } + + pub fn detail(mut self, detail: impl Into) -> MenuItem { + self.detail = Some(detail.into()); + self + } + + pub fn icon(mut self, icon: impl Into) -> MenuItem { + self.icon = Some(icon.into()); + self + } + + /// Present but unavailable, with a reason on hover. + /// + /// Greying an item out says the action exists and is not possible now. + /// Removing it says the action does not exist. They are different facts and + /// a person reads them differently. + pub fn disabled(mut self, why: impl Into) -> MenuItem { + self.enabled = false; + self.detail = Some(why.into()); + self + } + + pub fn separated(mut self) -> MenuItem { + self.separator_before = true; + self + } +} + +/// What a person did to a split button. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum SplitHit { + /// They pressed the button itself. + Primary, + /// They chose something from the chevron's menu. + Item(String), +} + +/// The accessible name of the chevron, and of the overflow button. +/// +/// Public so an application can translate them. A glyph is not a name, and +/// these two are the only strings in this module that are not supplied by the +/// caller. +#[derive(Clone, Debug)] +pub struct MenuLabels { + /// The `…` button. + pub more: String, + /// The chevron on a split button. `{action}` is replaced with the primary + /// action's own label, so a screen reader says "more share options" rather + /// than "more options" on a toolbar holding four of them. + pub more_for: String, +} + +impl Default for MenuLabels { + fn default() -> MenuLabels { + MenuLabels { more: "More options".into(), more_for: "More {action} options".into() } + } +} + +/// The `…` button and its menu. +/// +/// Answers with the identifier of the item chosen, if any. +pub fn overflow(ui: &mut Ui, items: &[MenuItem], labels: &MenuLabels) -> Option { + // A horizontal ellipsis, not three periods. Three periods are three + // characters to anything reading the screen aloud. + let button = egui::Button::new(RichText::new("\u{2026}").size(15.0)).frame(false); + let hit = ui.add(button); + let name = labels.more.clone(); + hit.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + let hit = hit.on_hover_text(labels.more.as_str()); + items_of(&hit, items) +} + +/// A primary action with a chevron beside it. +/// +/// The two halves are two controls. Pressing the label does the thing. Pressing +/// the chevron offers the variations. One control that did both would leave a +/// person guessing which half they had hit. +pub fn split(ui: &mut Ui, primary: &str, items: &[MenuItem], labels: &MenuLabels) -> Option { + let mut hit = None; + ui.horizontal(|ui| { + // The halves touch, so they read as one control with two parts. Square + // off the inside corners as well. Two default radii leave a pair of + // notches at the seam, which reads as two buttons that happen to abut. + ui.spacing_mut().item_spacing.x = 0.0; + let radius = ui.visuals().widgets.inactive.corner_radius; + // A toolbar that fills from its right edge hands this control a + // right-to-left layout, and whatever is added first lands furthest + // right. The label still belongs before the chevron, so the halves are + // added in the order that puts them there. + let backwards = ui.layout().main_dir() == egui::Direction::RightToLeft; + let (outer, inner) = if backwards { + (egui::CornerRadius { nw: 0, sw: 0, ..radius }, egui::CornerRadius { ne: 0, se: 0, ..radius }) + } else { + (egui::CornerRadius { ne: 0, se: 0, ..radius }, egui::CornerRadius { nw: 0, sw: 0, ..radius }) + }; + let label = |ui: &mut Ui, hit: &mut Option| { + if ui.add(egui::Button::new(primary).corner_radius(if backwards { inner } else { outer })).clicked() { + *hit = Some(SplitHit::Primary); + } + }; + let chevron = |ui: &mut Ui, hit: &mut Option| { + // Room for the triangle, which is painted rather than typed. + let more = ui.add(egui::Button::new(" ").corner_radius(if backwards { outer } else { inner })); + crate::buttons::chevron(ui, more.rect, ui.visuals().text_color()); + let name = labels.more_for.replace("{action}", &primary.to_lowercase()); + more.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + let more = more.on_hover_text(name.as_str()); + if let Some(id) = items_of(&more, items) { + *hit = Some(SplitHit::Item(id)); + } + }; + if backwards { + chevron(ui, &mut hit); + label(ui, &mut hit); + } else { + label(ui, &mut hit); + chevron(ui, &mut hit); + } + }); + hit +} + +/// The menu both controls open. +fn items_of(anchor: &Response, items: &[MenuItem]) -> Option { + let mut chosen = None; + egui::Popup::menu(anchor).show(|ui| { + ui.set_min_width(210.0); + let weak = ui.visuals().weak_text_color(); + for item in items { + if item.separator_before { + ui.separator(); + } + let label = match &item.icon { + Some(icon) => format!("{icon} {}", item.label), + None => item.label.clone(), + }; + let row = ui.add_enabled(item.enabled, egui::Button::new(label).frame(false)); + // The icon is decoration. The name is the label alone. + let name = item.label.clone(); + let enabled = item.enabled; + row.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, enabled, name.as_str())); + if row.clicked() { + chosen = Some(item.id.clone()); + ui.close(); + } + if let Some(detail) = &item.detail { + ui.label(RichText::new(detail.as_str()).small().color(weak)); + ui.add_space(2.0); + } + } + }); + chosen +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn an_item_is_enabled_until_it_is_not() { + assert!(MenuItem::new("copy", "Copy link").enabled); + let off = MenuItem::new("copy", "Copy link").disabled("this server forbids public links"); + assert!(!off.enabled); + assert_eq!(off.detail.as_deref(), Some("this server forbids public links")); + } + + #[test] + fn the_chevrons_name_says_which_action_it_belongs_to() { + let labels = MenuLabels::default(); + assert_eq!(labels.more_for.replace("{action}", "share"), "More share options"); + } + + #[test] + fn a_builder_keeps_what_it_was_given() { + let item = MenuItem::new("talk", "Work together").icon("\u{1f4de}").detail("Start a call").separated(); + assert_eq!(item.id, "talk"); + assert_eq!(item.label, "Work together"); + assert_eq!(item.icon.as_deref(), Some("\u{1f4de}")); + assert_eq!(item.detail.as_deref(), Some("Start a call")); + assert!(item.separator_before); + assert!(item.enabled); + } +} diff --git a/crates/ui/src/presence.rs b/crates/ui/src/presence.rs new file mode 100644 index 000000000..1da9327d9 --- /dev/null +++ b/crates/ui/src/presence.rs @@ -0,0 +1,424 @@ +//! Who else is in the document. +//! +//! A person editing alone and a person editing alongside three colleagues are +//! in very different situations. Only one of them has to worry about somebody +//! else changing the cell they are about to type in. An application that shows +//! nothing leaves them to find out by surprise. +//! +//! So this is a row of badges, one per person, with the count folded into a +//! final badge once the row would get long. It is the same control every +//! collaborative editor puts in the same corner, for the same reason. +//! +//! A peer's colour comes from the peer's own identifier. Two things need to +//! agree on it: the badge here, and whatever the document draws at that +//! person's cursor. Deriving it rather than assigning it means they agree with +//! no state passed between them, and the colour survives a reconnection. + +use egui::{Align, Color32, Layout, Response, RichText, Ui}; + +/// How wide a badge is, and how far the next one overlaps it. +const BADGE: f32 = 24.0; +const OVERLAP: f32 = 7.0; + +/// Somebody else in the document right now. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Peer { + /// The session's own identifier, stable for as long as they are connected. + pub id: String, + /// What to show. A display name, never an identity. + pub display: String, + /// Where they are working, when the document can say. A spreadsheet knows + /// the cell. A word processor knows the page. Shown on hover only. + pub at: Option, +} + +impl Peer { + pub fn new(id: impl Into, display: impl Into) -> Peer { + Peer { id: id.into(), display: display.into(), at: None } + } + + /// Where they are working, for the tooltip. + pub fn at(mut self, at: impl Into) -> Peer { + self.at = Some(at.into()); + self + } + + /// The letter on the badge. + pub fn initial(&self) -> String { + self.display.chars().next().map(|c| c.to_uppercase().to_string()).unwrap_or_else(|| "?".to_owned()) + } + + /// This peer's colour. + pub fn colour(&self) -> Color32 { + colour_for(&self.id) + } +} + +/// How many colours the wheel carries. +/// +/// Sixteen, spaced evenly. More than that and neighbouring slots stop being +/// distinguishable, which defeats the point of having them. +pub const SLOTS: usize = 16; + +/// The colour in one slot of the wheel. +pub fn slot(index: usize) -> Color32 { + let step = 360.0 / SLOTS as f32; + // Alternate the lightness as the wheel turns, so two neighbouring hues are + // also two different weights. Hue alone is not enough for anybody who sees + // colour differently from the person who chose it. + let dim = index % 2 == 1; + hsv((index % SLOTS) as f32 * step, if dim { 0.66 } else { 0.52 }, if dim { 0.68 } else { 0.84 }) +} + +/// Which slot an identifier would like. +fn preferred(id: &str) -> usize { + // FNV-1a, which is small and has no dependency. + let mut hash: u32 = 0x811c_9dc5; + for byte in id.as_bytes() { + hash ^= u32::from(*byte); + hash = hash.wrapping_mul(0x0100_0193); + } + // Then an avalanche. FNV alone leaves keys that differ in one byte close + // together, and session ids from one relay run in sequence. + hash ^= hash >> 16; + hash = hash.wrapping_mul(0x7feb_352d); + hash ^= hash >> 15; + hash = hash.wrapping_mul(0x846c_a68b); + hash ^= hash >> 16; + hash as usize % SLOTS +} + +/// A stable colour for one identifier, with nobody else to consider. +/// +/// Public because the badge is not the only thing that needs it. Use +/// [`colours_for`] wherever a whole room is on screen. This one cannot promise +/// anything about the other people in it. +pub fn colour_for(id: &str) -> Color32 { + slot(preferred(id)) +} + +/// Colours for a whole room, every one distinguishable from the others. +/// +/// Each peer prefers the slot its identifier hashes to. A peer whose slot is +/// already taken moves to the next free one, walking the list in a fixed order +/// so the answer does not depend on who connected first. +/// +/// A document drawing remote cursors calls this with the same identifiers and +/// gets the same answer, which is what makes a cursor and the badge above it +/// the same person. That holds on one screen whatever else is happening, +/// since both calls see that client's own list. +/// +/// Two clients mid-transition can disagree for a frame or two. One has seen +/// somebody join and the other has not, so the walk resolves differently +/// until both lists match. It settles by itself, and nobody is comparing two +/// screens while it does. The durable fix is for the relay to hand out slots +/// with the peer list, which takes a protocol change. +/// +/// Beyond [`SLOTS`] peers the wheel repeats, since there is no seventeenth +/// colour anybody could tell from the first sixteen. +pub fn colours_for(ids: &[String]) -> Vec { + let mut order: Vec = (0..ids.len()).collect(); + order.sort_by(|a, b| ids[*a].cmp(&ids[*b])); + + let mut taken = [false; SLOTS]; + let mut out = vec![Color32::BLACK; ids.len()]; + for position in order { + let want = preferred(&ids[position]); + let mut at = want; + for step in 0..SLOTS { + at = (want + step) % SLOTS; + if !taken[at] { + break; + } + } + taken[at] = true; + out[position] = slot(at); + } + out +} + +fn hsv(hue: f32, saturation: f32, value: f32) -> Color32 { + let c = value * saturation; + let h = hue / 60.0; + let x = c * (1.0 - ((h % 2.0) - 1.0).abs()); + let (r, g, b) = match h as u32 { + 0 => (c, x, 0.0), + 1 => (x, c, 0.0), + 2 => (0.0, c, x), + 3 => (0.0, x, c), + 4 => (x, 0.0, c), + _ => (c, 0.0, x), + }; + let m = value - c; + let to_byte = |f: f32| (f.clamp(0.0, 1.0) * 255.0).round() as u8; + Color32::from_rgb(to_byte(r + m), to_byte(g + m), to_byte(b + m)) +} + +/// Strings, so an application can translate them. +#[derive(Clone, Debug)] +pub struct PresenceLabels { + /// Said when nobody else is here. An application may leave this empty to + /// draw nothing at all in that case. + pub alone: String, + /// With one other person. `{name}` is replaced. + pub with_one: String, + /// With several. `{count}` is replaced. + pub with_many: String, + /// The badge that stands for the people who did not fit. `{count}` is + /// replaced. + pub and_more: String, + /// The accessible name of the whole row. + pub who: String, +} + +impl Default for PresenceLabels { + fn default() -> PresenceLabels { + PresenceLabels { + alone: String::new(), + with_one: "Editing with {name}".into(), + with_many: "Editing with {count} others".into(), + and_more: "{count} more".into(), + who: "Who is here".into(), + } + } +} + +/// The row of badges. +#[derive(Clone)] +pub struct PresenceBar { + peers: Vec, + /// How many badges to draw before folding the rest into a count. Four is + /// what fits beside a title bar without crowding it. + shown: usize, + labels: PresenceLabels, + /// Whether to write the sentence beside the badges. A narrow toolbar wants + /// the badges alone. + summary: bool, +} + +impl Default for PresenceBar { + fn default() -> PresenceBar { + PresenceBar::new() + } +} + +impl PresenceBar { + pub fn new() -> PresenceBar { + PresenceBar { peers: Vec::new(), shown: 4, labels: PresenceLabels::default(), summary: true } + } + + pub fn with_labels(mut self, labels: PresenceLabels) -> PresenceBar { + self.labels = labels; + self + } + + /// How many badges before the row folds into a count. + pub fn with_shown(mut self, shown: usize) -> PresenceBar { + self.shown = shown.max(1); + self + } + + /// Draw the badges only, with no sentence beside them. + pub fn badges_only(mut self) -> PresenceBar { + self.summary = false; + self + } + + /// Replace the set of people in the document. + /// + /// Takes the whole set rather than a change, because a session that missed + /// a departure would otherwise show somebody who left until the next + /// reconnection. + pub fn set(&mut self, peers: Vec) { + self.peers = peers; + } + + pub fn peers(&self) -> &[Peer] { + &self.peers + } + + /// Whether anybody else is here. An application draws nothing when this is + /// false, which keeps a solitary document looking like one. + pub fn shared(&self) -> bool { + !self.peers.is_empty() + } + + /// What the row says in words. Also the accessible summary. + pub fn summary(&self) -> String { + match self.peers.len() { + 0 => self.labels.alone.clone(), + 1 => self.peers.first().map(|p| self.labels.with_one.replace("{name}", &p.display)).unwrap_or_default(), + n => self.labels.with_many.replace("{count}", &n.to_string()), + } + } + + /// Draw it. Answers with the peer a person clicked, when they clicked one. + /// + /// A click is worth answering because a name is where "take me to what + /// they are editing" belongs. The application decides whether it can. + pub fn show(&mut self, ui: &mut Ui) -> Option { + if self.peers.is_empty() { + if !self.labels.alone.is_empty() { + ui.label(RichText::new(self.labels.alone.as_str()).small().color(ui.visuals().weak_text_color())); + } + return None; + } + + let mut clicked = None; + ui.horizontal(|ui| { + // Badges overlap, the way a stack of cards does. Without it four + // circles read as four separate controls instead of one group. + ui.spacing_mut().item_spacing.x = -OVERLAP; + // Right to left, so the first person sits on top of the stack. + // + // Allocated to just the width the badges need. A right-to-left + // layout given the whole container takes it, which pushes the row + // to the far edge of a toolbar and strands the sentence after it. + let shown = self.peers.len().min(self.shown); + let hidden = self.peers.len().saturating_sub(self.shown); + let count = shown + usize::from(hidden > 0); + let width = BADGE + (count.saturating_sub(1) as f32) * (BADGE - OVERLAP); + ui.allocate_ui_with_layout(egui::vec2(width, BADGE), Layout::right_to_left(Align::Center), |ui| { + if hidden > 0 { + let more = self.labels.and_more.replace("{count}", &hidden.to_string()); + let weak = ui.visuals().widgets.inactive.bg_fill; + let badge = badge(ui, &format!("+{hidden}"), weak, ui.visuals().text_color()); + badge.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, more.as_str())); + badge.on_hover_text(self.peers.iter().skip(self.shown).map(|p| p.display.as_str()).collect::>().join("\n")); + } + let ids: Vec = self.peers.iter().map(|p| p.id.clone()).collect(); + let colours = colours_for(&ids); + for (at, peer) in self.peers.iter().enumerate().take(self.shown).rev() { + let ink = colours.get(at).copied().unwrap_or_else(|| peer.colour()); + let hit = badge(ui, &peer.initial(), ink, Color32::WHITE); + let name = peer.display.clone(); + hit.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + let tip = match &peer.at { + Some(at) => format!("{}\n{at}", peer.display), + None => peer.display.clone(), + }; + if hit.on_hover_text(tip).clicked() { + clicked = Some(peer.id.clone()); + } + } + }); + if self.summary { + ui.spacing_mut().item_spacing.x = 8.0; + ui.label(RichText::new(self.summary()).small().color(ui.visuals().weak_text_color())); + } + }); + clicked + } +} + +/// One round badge. Painted as a button so it is focusable and announces +/// itself, which a bare circle would not. +fn badge(ui: &mut Ui, text: &str, fill: Color32, ink: Color32) -> Response { + let button = egui::Button::new(RichText::new(text).color(ink).size(11.0).strong()) + .fill(fill) + .corner_radius(BADGE / 2.0) + .min_size(egui::vec2(BADGE, BADGE)) + .stroke(egui::Stroke::new(1.5, ui.visuals().panel_fill)); + ui.add(button) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn a_colour_is_the_same_every_time_for_the_same_peer() { + assert_eq!(colour_for("session-a"), colour_for("session-a")); + } + + /// How far apart two colours are, summed over the channels. Crude, and + /// enough to tell "two different oranges" from "orange and teal". + fn apart(a: Color32, b: Color32) -> i32 { + (i32::from(a.r()) - i32::from(b.r())).abs() + (i32::from(a.g()) - i32::from(b.g())).abs() + (i32::from(a.b()) - i32::from(b.b())).abs() + } + + fn ids(of: &[&str]) -> Vec { + of.iter().map(|s| (*s).to_owned()).collect() + } + + #[test] + fn a_room_of_sequential_ids_is_a_room_of_distinguishable_colours() { + // The shape a relay actually hands out. A colour derived from one id + // alone cannot promise this, which is how six people came out looking + // like two. + let room = ids(&["s1", "s2", "s3", "s4", "s5", "s6"]); + let colours = colours_for(&room); + for (i, a) in colours.iter().enumerate() { + for (j, b) in colours.iter().enumerate().skip(i + 1) { + let distance = apart(*a, *b); + assert!(distance >= 60, "{} and {} are {distance} apart", room[i], room[j]); + } + } + } + + #[test] + fn a_full_wheel_is_still_all_distinct() { + let room: Vec = (0..SLOTS).map(|n| format!("session-{n}")).collect(); + let colours = colours_for(&room); + for (i, a) in colours.iter().enumerate() { + for (j, b) in colours.iter().enumerate().skip(i + 1) { + assert!(apart(*a, *b) > 0, "{} and {} share a colour", room[i], room[j]); + } + } + } + + #[test] + fn the_same_room_always_gets_the_same_colours() { + let room = ids(&["b", "a", "c"]); + assert_eq!(colours_for(&room), colours_for(&room)); + } + + #[test] + fn the_answer_does_not_depend_on_who_connected_first() { + let one = colours_for(&ids(&["a", "b", "c"])); + let other = colours_for(&ids(&["c", "b", "a"])); + // Same people, listed backwards. Each still gets the colour it had. + assert_eq!(one, other.into_iter().rev().collect::>()); + } + + #[test] + fn a_colour_is_dark_enough_to_hold_white_text() { + for id in ["a", "b", "zzz", "session-41", "", "\u{1f600}"] { + let c = colour_for(id); + // Rec. 601 luma, which is what readability of white ink tracks. + let luma = 0.299 * f32::from(c.r()) + 0.587 * f32::from(c.g()) + 0.114 * f32::from(c.b()); + assert!(luma < 200.0, "{id:?} gave a colour too pale for white text, luma {luma}"); + } + } + + #[test] + fn an_empty_room_is_not_shared_and_says_nothing() { + let bar = PresenceBar::new(); + assert!(!bar.shared()); + assert_eq!(bar.summary(), ""); + } + + #[test] + fn one_other_person_is_named_and_several_are_counted() { + let mut bar = PresenceBar::new(); + bar.set(vec![Peer::new("1", "Ann Reed")]); + assert_eq!(bar.summary(), "Editing with Ann Reed"); + bar.set(vec![Peer::new("1", "Ann Reed"), Peer::new("2", "Bob Vine")]); + assert_eq!(bar.summary(), "Editing with 2 others"); + } + + #[test] + fn a_departure_leaves_nobody_behind() { + let mut bar = PresenceBar::new(); + bar.set(vec![Peer::new("1", "Ann Reed"), Peer::new("2", "Bob Vine")]); + bar.set(vec![Peer::new("1", "Ann Reed")]); + assert_eq!(bar.peers().len(), 1, "the whole set replaces the old one"); + } + + #[test] + fn an_initial_survives_a_name_that_starts_oddly() { + assert_eq!(Peer::new("1", "ann").initial(), "A"); + assert_eq!(Peer::new("1", "").initial(), "?"); + assert_eq!(Peer::new("1", "\u{e9}lodie").initial(), "\u{c9}"); + } +} diff --git a/crates/ui/src/share/backend.rs b/crates/ui/src/share/backend.rs new file mode 100644 index 000000000..5c0981834 --- /dev/null +++ b/crates/ui/src/share/backend.rs @@ -0,0 +1,170 @@ +//! Where the share dialog's work happens, which is never on the frame. +//! +//! Every call a share needs is blocking, and a blocking call inside `update()` +//! freezes the window for as long as the server takes. So the dialog states +//! what it wants and reads answers off a channel, and something behind this +//! trait does the waiting. +//! +//! The dialog itself opens no socket, which keeps it buildable for the web +//! and testable with no server. A host supplies the half that does, and this +//! crate never learns what it reaches. + +use craft_cloud::{Capability, Contact, Permission, Share, ShareTarget}; + +/// One thing the dialog needs done. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum Request { + /// What the provider behind the service can actually do. + Capabilities, + /// People matching what has been typed so far. + Lookup { query: String, limit: usize }, + /// Who already has access to one document. + Access { id: String }, + /// Give several people access at once. + Grant(Grant), + /// Take one existing share away. + Withdraw { share_id: String }, + /// Where this document could be saved, so it can be shared. + /// + /// Asked for only when there is nothing to share yet. A list rather than a + /// single answer, because more than one provider may be configured and the + /// user picks. + Destinations, + /// Link an account for a destination that is configured but not connected. + Link { destination: String }, + /// One contact's picture, by the URL that contact carried. + /// + /// A separate request because a search answering with ten people must not + /// cost ten pictures before anybody has looked at them. The dialog asks + /// for a picture when it first paints the row that needs it, once per URL. + Avatar { url: String }, +} + +/// A share to create, as the dialog has it. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Grant { + /// A key the recipient must present. Only meaningful for a link share, and + /// refused by a server that does not allow one. + pub password: Option, + /// The document, as an opaque handle the app was given. + pub id: String, + pub targets: Vec, + pub permission: Permission, + pub note: Option, + pub notify: bool, +} + +/// What came back. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum Answer { + Capabilities { + capabilities: Vec, + /// Whether this user has a cloud account attached at all. + linked: bool, + }, + Lookup(Vec), + Access(Vec), + /// Partial success is the ordinary case, so both halves come back. + Granted { + shared: Vec, + failed: Vec, + }, + Withdrawn { + share_id: String, + }, + Destinations(Vec), + /// An account was linked, so the destinations are worth asking for again. + Linked, + Avatar { + url: String, + /// Encoded image bytes, in whatever format the server sent. Decoding + /// is egui's image loaders' job, which the application installs. + bytes: Vec, + }, +} + +/// Somewhere a document could be saved. +/// +/// `account` is what makes this choosable. Two entries reading "Cloud" tell +/// nobody which of their accounts a document is about to land in, which is the +/// one thing somebody needs to know before pressing it. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Destination { + /// Opaque to the dialog, handed back with the save. + pub id: String, + /// What to show, such as the service's own name. + pub name: String, + /// Which account, when one is linked. + pub account: Option, + /// False when the destination is configured but has no account yet. The + /// dialog offers a sign-in rather than a save. + pub linked: bool, +} + +/// One recipient a share did not reach. +/// +/// Named rather than counted. Sharing with five people where one address is +/// wrong shares with four and says which one failed. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Failure { + pub target: ShareTarget, + pub code: String, + pub detail: String, +} + +/// Where one answer goes. +/// +/// Carries the sequence number of the request it answers. Autocomplete fires +/// per keystroke, and a service is free to answer the third query before the +/// second, so the dialog keeps the newest sequence it asked for and drops +/// anything older. Without that the list flickers between a stale set of +/// matches and a current one. +pub struct Replier { + seq: u64, + tx: std::sync::mpsc::Sender<(u64, Result)>, +} + +impl Replier { + pub(crate) fn new(seq: u64, tx: std::sync::mpsc::Sender<(u64, Result)>) -> Replier { + Replier { seq, tx } + } + + /// Which request this answers. + pub fn seq(&self) -> u64 { + self.seq + } + + /// Another handle to the same answer slot, for a backend that has to give + /// up after moving the first one into a worker. + pub fn dup(&self) -> Replier { + Replier { seq: self.seq, tx: self.tx.clone() } + } + + pub fn answer(self, answer: Answer) { + self.deliver(Ok(answer)); + } + + /// Say why it could not be done, in words a user can read. + pub fn refuse(self, reason: impl Into) { + self.deliver(Err(reason.into())); + } + + /// A dropped receiver means the dialog closed, which is not a failure. + fn deliver(self, result: Result) { + let _ = self.tx.send((self.seq, result)); + } +} + +impl std::fmt::Debug for Replier { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Replier").field("seq", &self.seq).finish() + } +} + +/// Somewhere a [`Request`] can run without blocking a frame. +/// +/// `submit` must return immediately. The answer arrives through `reply` +/// whenever it is ready, or never, which the dialog survives. +pub trait ShareBackend { + fn submit(&self, request: Request, reply: Replier); +} diff --git a/crates/ui/src/share/mod.rs b/crates/ui/src/share/mod.rs new file mode 100644 index 000000000..5dbcf6c06 --- /dev/null +++ b/crates/ui/src/share/mod.rs @@ -0,0 +1,1465 @@ +//! One share dialog, the same one in every Craft app. +//! +//! What it offers is what a person asks for when they say "share this": pick +//! several people by typing a few letters of a name, choose whether they may +//! look or change, add a note, decide whether an email goes out, and see who +//! already has access so one of them can be taken away again. +//! +//! Three things shape the implementation. +//! +//! Nothing here opens a socket. Every call goes through [`ShareBackend`], and +//! nothing here reaches the network. A host writes the backend, and this +//! module never learns what it talks to. +//! this file. +//! +//! Nothing here blocks. Answers arrive on a channel and are read once per +//! frame. Autocomplete waits [`DEBOUNCE`] after the last keystroke before it +//! asks anything, and an answer to a query the user has already typed past is +//! dropped rather than painted, so the list cannot flicker backwards. +//! +//! Nothing here is assumed about the provider. [`ShareDialog::available`] is +//! false until the service says sharing exists, and an app hides its Share +//! control rather than offering a button that fails. Contacts and mail are +//! reported separately and are hidden the same way. + +use std::collections::HashMap; +use std::sync::mpsc::{Receiver, Sender}; +use std::time::Duration; + +use craft_cloud::{Capability, Contact, Permission, Share, ShareTarget}; +use egui::{Align, Align2, Color32, Context, CornerRadius, FontId, Id, Layout, Response, RichText, Sense, Ui, UiBuilder, Vec2}; + +mod backend; +#[cfg(test)] +mod tests; + +pub use backend::{Answer, Destination, Failure, Grant, Replier, Request, ShareBackend}; + +/// How long after the last keystroke the dialog asks for matches. +/// +/// A lookup per keystroke would ask five times for "annie" and paint whichever +/// answer happened to arrive last. +pub const DEBOUNCE: Duration = Duration::from_millis(200); + +/// How many matches one lookup asks for. +const MATCHES: usize = 8; + +/// Shortest query worth asking about. One letter matches most of an address +/// book and tells the user nothing. +const MIN_QUERY: usize = 2; + +/// Contact pictures held at once. Reached only by a long session of searching; +/// the whole cache is dropped rather than evicted one entry at a time. +const AVATARS: usize = 256; + +/// How long before an unanswered capability question is asked again, so one +/// unreachable moment does not hide Share for the rest of the session. +const RETRY: f64 = 20.0; + +const AVATAR: f32 = 20.0; +const AVATAR_RADIUS: u8 = 10; + +/// The id of the recipient field, for an app that wants to focus it. +const QUERY: &str = "craft-ui/share/query"; + +type Inbox = (u64, Result); + +/// Every string the dialog shows, so an application can translate it. +/// +/// The defaults are English. Nothing else in `craft-ui` localizes, and this +/// does not change that: the dialog holds the strings an app gives it and +/// translates nothing itself. +#[derive(Clone, Debug)] +pub struct ShareLabels { + pub title: String, + pub recipients: String, + pub recipient_hint: String, + pub searching: String, + pub no_matches: String, + pub add_address: String, + pub group: String, + pub permission: String, + pub can_view: String, + pub can_edit: String, + pub note: String, + pub notify: String, + pub no_mail: String, + pub share: String, + pub sharing: String, + pub close: String, + pub remove: String, + pub shared_with: String, + pub not_shared_with: String, + pub access: String, + pub access_empty: String, + pub loading: String, + pub withdraw: String, + pub withdrawing: String, + pub copy_link: String, + pub anyone_with_link: String, + pub save_first: String, + /// Shown under "Can edit", the way an office suite explains a permission + /// rather than leaving a bare radio button to carry the meaning. + pub can_edit_detail: String, + pub can_view_detail: String, + pub message_hint: String, + pub send: String, + pub manage_access: String, + pub upload_first: String, + pub name_hint: String, + pub saving: String, + pub save_and_share: String, + pub sign_in: String, + pub attach_instead: String, + pub create_link: String, + pub key_hint: String, + pub key_required_note: String, + pub link_copied: String, +} + +impl Default for ShareLabels { + fn default() -> ShareLabels { + ShareLabels { + title: "Share".into(), + recipients: "Share with".into(), + recipient_hint: "Add a name, group, or email".into(), + searching: "Looking…".into(), + no_matches: "No matches".into(), + add_address: "Press Return to share with this address".into(), + group: "group".into(), + permission: "They may".into(), + can_view: "View".into(), + can_edit: "Edit".into(), + note: "Note (optional)".into(), + notify: "Notify by email".into(), + no_mail: "This server cannot send mail".into(), + share: "Share".into(), + sharing: "Sharing…".into(), + close: "Close".into(), + remove: "Remove".into(), + shared_with: "Shared with".into(), + not_shared_with: "Not shared with".into(), + access: "Who has access".into(), + access_empty: "Nobody else yet".into(), + loading: "Loading…".into(), + withdraw: "Withdraw".into(), + withdrawing: "Withdrawing…".into(), + copy_link: "Copy link".into(), + anyone_with_link: "Anyone with the link".into(), + save_first: "Save this document to the cloud before sharing it.".into(), + can_edit_detail: "Make any changes".into(), + can_view_detail: "Cannot make changes".into(), + message_hint: "Add a message".into(), + send: "Send".into(), + manage_access: "Who has access".into(), + upload_first: "Save this document somewhere to share it.".into(), + name_hint: "Name this document".into(), + saving: "Saving\u{2026}".into(), + save_and_share: "Save and share".into(), + sign_in: "Sign in".into(), + attach_instead: "Attach a copy instead".into(), + create_link: "Get a link".into(), + key_hint: "Key (optional)".into(), + key_required_note: "This server requires a key on a link.".into(), + link_copied: "Link copied".into(), + } + } +} + +/// What the provider behind the service actually does. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +struct Provider { + sharing: bool, + contacts: bool, + mail: bool, + /// Public links at all. An administrator can forbid them. + links: bool, + /// A key on a link. + key: bool, + /// The server insists on one, so a link cannot be made without it. + key_required: bool, +} + +/// One contact picture, asked for at most once. +#[derive(Clone, Debug, PartialEq, Eq)] +enum Avatar { + /// Asked for under this sequence number; nothing to paint yet. + Pending(u64), + /// Bytes handed to egui under this URI, for the application's image + /// loaders to decode. + Ready(String), + /// Asked once and refused. Initials are painted instead, and it is never + /// asked for again. + Missing, +} + +/// Somebody the user has picked. +#[derive(Clone, Debug, PartialEq, Eq)] +struct Chosen { + target: ShareTarget, + label: String, + detail: Option, + avatar: Option, +} + +/// The dialog's state while it is open on one document. +struct Sheet { + id: String, + title: String, + query: String, + /// When the query last changed, for the debounce. `None` when settled. + typed: Option, + /// The newest lookup asked for. An answer to anything older is dropped. + lookup: Option, + searching: bool, + matches: Vec, + chosen: Vec, + permission: Permission, + note: String, + notify: bool, + /// Who already has access. `None` until the answer arrives. + access: Option>, + access_seq: Option, + /// Withdrawals in flight, as (request, share). + withdrawing: Vec<(u64, String)>, + granting: Option, + /// Where it could be saved. `None` until the answer arrives. + destinations: Option>, + destinations_seq: Option, + link_seq: Option, + /// Which one is selected, by id. + destination: Option, + /// The name typed while the document still has nowhere to live. + save_as: String, + /// The save in flight, if one is. + saving: Option, + save_error: Option, + /// The key to put on a link, while one is being made. + link_key: String, + /// The last share's outcome, kept on screen until the next one. + shared: Vec, + failed: Vec, + /// A refusal that stopped a whole call, as opposed to one recipient. + error: Option, +} + +impl Sheet { + fn new(id: String, title: String) -> Sheet { + Sheet { + destinations: None, + destinations_seq: None, + link_seq: None, + destination: None, + save_as: title.clone(), + saving: None, + save_error: None, + link_key: String::new(), + id, + title, + query: String::new(), + typed: None, + lookup: None, + searching: false, + matches: Vec::new(), + chosen: Vec::new(), + permission: Permission::View, + note: String::new(), + notify: true, + access: None, + access_seq: None, + withdrawing: Vec::new(), + granting: None, + shared: Vec::new(), + failed: Vec::new(), + error: None, + } + } +} + +/// Something the drawing pass decided and the dialog carries out afterwards. +/// +/// Drawing holds the open sheet, so it cannot also reach the request channel. +/// Collecting intentions and acting on them once the frame is painted keeps +/// both honest. +enum Act { + Lookup(String), + /// Save a document that has nowhere to live yet, into one destination. + SaveAs { + destination: String, + name: String, + }, + /// Connect an account for a destination that has none. + Link(String), + Grant(Grant), + Withdraw(String), + Avatar(String), + Close, +} + +/// A save the dialog is waiting on the application to do. +/// +/// Taken once. The application serialises the open document, puts it where +/// `destination` says, and reports back with [`ShareDialog::saved`] or +/// [`ShareDialog::save_failed`]. Prefer [`ShareDialog::saved_if`] / +/// [`ShareDialog::save_failed_if`] with [`SaveRequest::generation`] when the +/// save is asynchronous, so a completion for a closed or replaced sheet is +/// dropped without the application inventing its own epoch. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct SaveRequest { + /// Which destination, as the dialog was told by [`Destination::id`]. + pub destination: String, + /// What the user called it. + pub name: String, + /// Open-sheet generation when this request was taken. Pass to + /// [`ShareDialog::saved_if`] / [`ShareDialog::save_failed_if`]. + pub generation: u64, +} + +/// What the dialog may offer this frame. +#[derive(Clone, Copy)] +struct Allowed { + contacts: bool, + mail: bool, + links: bool, + key: bool, + key_required: bool, +} + +/// A share dialog. +/// +/// Create one per window, call [`ShareDialog::connect`] once a backend exists, +/// call [`ShareDialog::show`] every frame, and open it from a Share control +/// that is drawn only while [`ShareDialog::available`] is true. +pub struct ShareDialog { + backend: Option>, + tx: Sender, + rx: Receiver, + seq: u64, + provider: Option, + /// When the capability question was last asked. + asked: Option, + open: Option, + /// Keyed by the URL the contact carried, so reopening the dialog does not + /// fetch the same faces again. + avatars: HashMap, + /// A save the application has not picked up yet. + wants_save: Option, + /// Bumped on every [`ShareDialog::open`] and [`ShareDialog::close`]. A save + /// completion from an earlier open is ignored when this no longer matches + /// [`ShareDialog::pending_save_generation`]. + sheet_generation: u64, + /// Generation of the open sheet when [`ShareDialog::take_save_request`] + /// last handed a save to the application. + pending_save_generation: Option, + labels: ShareLabels, +} + +impl Default for ShareDialog { + fn default() -> ShareDialog { + ShareDialog::new() + } +} + +impl ShareDialog { + pub fn new() -> ShareDialog { + let (tx, rx) = std::sync::mpsc::channel(); + ShareDialog { + backend: None, + tx, + rx, + seq: 0, + provider: None, + asked: None, + open: None, + avatars: HashMap::new(), + wants_save: None, + sheet_generation: 0, + pending_save_generation: None, + labels: ShareLabels::default(), + } + } + + /// Attach the thing that does the waiting. + /// + /// The first frame after this asks what the provider can do, which is what + /// decides whether sharing is offered at all. + pub fn connect(&mut self, backend: impl ShareBackend + 'static) { + self.backend = Some(Box::new(backend)); + self.provider = None; + self.asked = None; + } + + pub fn connected(&self) -> bool { + self.backend.is_some() + } + + /// Replace the dialog's strings, for a localized application. + pub fn with_labels(mut self, labels: ShareLabels) -> ShareDialog { + self.labels = labels; + self + } + + pub fn labels_mut(&mut self) -> &mut ShareLabels { + &mut self.labels + } + + /// Whether sharing can be offered. + /// + /// False until the service says the provider supports it and an account is + /// linked. An application draws no Share control while this is false: a + /// hidden feature is better than a button that fails on use. + /// Ask the provider again what it can do. + /// + /// The answer is kept once it arrives, so a host that signs somebody + /// in after the first answer has to say so. Without this the dialog + /// keeps the answer it got while nobody was signed in, and Share + /// stays unavailable for the rest of the run. + pub fn refresh(&mut self) { + self.provider = None; + self.asked = None; + } + + pub fn available(&self) -> bool { + self.provider.is_some_and(|p| p.sharing) + } + + /// Open on one document. + /// + /// `id` is the handle the application was given for it, passed back + /// untouched. An empty one means the document has never been saved to the + /// cloud, which the dialog says rather than failing on Share. Does nothing + /// while sharing is unavailable. + pub fn open(&mut self, id: impl Into, title: impl Into) { + if !self.available() { + return; + } + self.sheet_generation = self.sheet_generation.wrapping_add(1); + self.wants_save = None; + let id = id.into(); + self.open = Some(Sheet::new(id.clone(), title.into())); + if id.is_empty() { + // Nothing to share yet, so the dialog opens on the places it could + // go. Asked for here rather than on the first frame, so the list is + // usually there by the time anybody looks. + let seq = self.issue(Request::Destinations); + if let Some(sheet) = &mut self.open { + sheet.destinations_seq = Some(seq); + } + } + if !id.is_empty() { + let seq = self.issue(Request::Access { id }); + if let Some(sheet) = &mut self.open { + sheet.access_seq = Some(seq); + } + } + } + + /// A save the application should perform, if one was asked for. + /// + /// Taken, so it is handled once. Stamps [`SaveRequest::generation`] with + /// the open sheet's generation. Call [`ShareDialog::saved`] / + /// [`ShareDialog::save_failed`] (dialog-side pending guard) or + /// [`ShareDialog::saved_if`] / [`ShareDialog::save_failed_if`] with that + /// generation when the work finishes; otherwise the dialog waits. + pub fn take_save_request(&mut self) -> Option { + let mut request = self.wants_save.take()?; + request.generation = self.sheet_generation; + self.pending_save_generation = Some(request.generation); + Some(request) + } + + /// The document was saved, and this is the handle the provider issued. + /// + /// Ignored when the dialog has closed, reopened on another document, or + /// taken a newer save since [`ShareDialog::take_save_request`]. + pub fn saved(&mut self, id: impl Into, name: impl Into) { + if !self.save_completion_applies() { + return; + } + self.pending_save_generation = None; + self.finish_saved(id, name); + } + + /// Like [`ShareDialog::saved`], but applies only when `generation` matches + /// the open sheet's generation. + pub fn saved_if(&mut self, generation: u64, id: impl Into, name: impl Into) { + if self.open.is_none() || self.sheet_generation != generation { + return; + } + self.pending_save_generation = None; + self.finish_saved(id, name); + } + + /// The save did not happen, and this is why. + /// + /// Ignored under the same conditions as [`ShareDialog::saved`]. + pub fn save_failed(&mut self, reason: impl Into) { + if !self.save_completion_applies() { + return; + } + self.pending_save_generation = None; + if let Some(sheet) = &mut self.open { + sheet.saving = None; + sheet.save_error = Some(reason.into()); + } + } + + /// Like [`ShareDialog::save_failed`], but applies only when `generation` + /// matches the open sheet's generation. + pub fn save_failed_if(&mut self, generation: u64, reason: impl Into) { + if self.open.is_none() || self.sheet_generation != generation { + return; + } + self.pending_save_generation = None; + if let Some(sheet) = &mut self.open { + sheet.saving = None; + sheet.save_error = Some(reason.into()); + } + } + + /// Generation of the sheet currently open, for callers that track their + /// own save epoch. Zero when the dialog is closed. + pub fn sheet_generation(&self) -> u64 { + if self.open.is_some() { self.sheet_generation } else { 0 } + } + + fn save_completion_applies(&self) -> bool { + self.pending_save_generation.is_some_and(|g| g == self.sheet_generation) + } + + fn finish_saved(&mut self, id: impl Into, name: impl Into) { + if self.open.is_none() { + return; + } + let id = id.into(); + if let Some(sheet) = &mut self.open { + sheet.saving = None; + sheet.save_error = None; + sheet.id = id.clone(); + sheet.title = name.into(); + } + // The document exists now, so ask who already has access, exactly as + // opening on a saved document would. + let seq = self.issue(Request::Access { id }); + if let Some(sheet) = &mut self.open { + sheet.access_seq = Some(seq); + } + } + + pub fn is_open(&self) -> bool { + self.open.is_some() + } + + pub fn close(&mut self) { + self.open = None; + self.sheet_generation = self.sheet_generation.wrapping_add(1); + self.wants_save = None; + } + + /// Who the last share reached, and who it did not. + pub fn outcome(&self) -> (&[Share], &[Failure]) { + match &self.open { + Some(sheet) => (&sheet.shared, &sheet.failed), + None => (&[], &[]), + } + } + + /// The recipient field's id, for an application that wants to focus it. + pub fn query_field_id() -> Id { + Id::new(QUERY) + } + + /// One frame, as a modal over the window. Call this unconditionally: + /// answers are collected here whether the dialog is open or not. + pub fn show(&mut self, ctx: &Context) { + self.collect(ctx); + if self.open.is_none() { + return; + } + let modal = egui::Modal::new(Id::new("craft-ui/share")).show(ctx, |ui| { + ui.set_min_width(440.0); + ui.set_max_width(560.0); + self.contents(ui); + }); + if modal.should_close() { + self.close(); + } + } + + /// One frame's contents without the modal chrome, for an application that + /// hosts the dialog in its own panel. + pub fn show_in(&mut self, ui: &mut Ui) { + self.collect(ui.ctx()); + if self.open.is_some() { + self.contents(ui); + } + } + + fn contents(&mut self, ui: &mut Ui) { + let allowed = match self.provider { + Some(p) => Allowed { contacts: p.contacts, mail: p.mail, links: p.links, key: p.key, key_required: p.key_required }, + None => Allowed { contacts: false, mail: false, links: false, key: false, key_required: false }, + }; + let mut acts = Vec::new(); + { + let Some(sheet) = self.open.as_mut() else { return }; + draw(ui, sheet, &self.avatars, &self.labels, allowed, &mut acts); + } + self.apply(ui.ctx(), acts); + } + + // ---- the channel ------------------------------------------------------ + + fn issue(&mut self, request: Request) -> u64 { + self.seq += 1; + let seq = self.seq; + if let Some(backend) = &self.backend { + backend.submit(request, Replier::new(seq, self.tx.clone())); + } + seq + } + + fn collect(&mut self, ctx: &Context) { + while let Ok((seq, result)) = self.rx.try_recv() { + self.receive(ctx, seq, result); + } + let now = ctx.input(|i| i.time); + if self.backend.is_some() && self.provider.is_none() && self.asked.is_none_or(|at| now - at >= RETRY) { + self.asked = Some(now); + self.issue(Request::Capabilities); + } + } + + fn receive(&mut self, ctx: &Context, seq: u64, result: Result) { + let answer = match result { + Ok(answer) => answer, + Err(reason) => return self.refused(seq, reason), + }; + // Set while an answer leaves something else worth asking for; issued + // once the open sheet is no longer borrowed. + let mut reload = None; + match answer { + Answer::Capabilities { capabilities, linked } => { + self.provider = Some(Provider { + sharing: linked && capabilities.contains(&Capability::Sharing), + contacts: capabilities.contains(&Capability::Contacts), + // ShareNotify, not Mail. Mail means "can send arbitrary + // mail"; this box only asks the provider to tell the + // person being shared with, which is a far smaller claim + // and one most providers can honour. + mail: capabilities.contains(&Capability::ShareNotify), + links: capabilities.contains(&Capability::LinkShares), + key: capabilities.contains(&Capability::LinkPassword), + key_required: capabilities.contains(&Capability::LinkPasswordRequired), + }); + // A provider that cannot share must not leave a dialog up that + // was opened while the answer was still outstanding. + if !self.available() { + self.close(); + } + } + Answer::Lookup(found) => { + if let Some(sheet) = &mut self.open + && sheet.lookup == Some(seq) + { + sheet.matches = found; + sheet.searching = false; + } + } + Answer::Access(list) => { + if let Some(sheet) = &mut self.open + && sheet.access_seq == Some(seq) + { + sheet.access = Some(list); + sheet.access_seq = None; + } + } + Answer::Granted { shared, failed } => { + // A link was asked for in order to be handed out, so it goes + // to the clipboard without a second click. + if let Some(url) = shared.iter().find_map(|s| s.url.clone()) { + ctx.copy_text(url); + } + if let Some(sheet) = &mut self.open + && sheet.granting == Some(seq) + { + sheet.granting = None; + sheet.error = None; + // Recipients that went through leave the picker. The ones + // that did not stay in it, so a corrected retry is one + // press rather than a retyped list. + sheet.chosen.retain(|c| failed.iter().any(|f| f.target == c.target)); + sheet.shared = shared; + sheet.failed = failed; + if !sheet.shared.is_empty() { + reload = Some(sheet.id.clone()); + } + } + } + Answer::Destinations(list) => { + if let Some(sheet) = &mut self.open + && sheet.destinations_seq == Some(seq) + { + // One destination and nothing to choose between: pick it, + // so the only linked account is not a click somebody has + // to make for no reason. + if sheet.destination.is_none() + && let [only] = list.as_slice() + && only.linked + { + sheet.destination = Some(only.id.clone()); + } + sheet.destinations = Some(list); + sheet.destinations_seq = None; + } + } + Answer::Linked => { + // An account arrived, so the list is stale. + if let Some(sheet) = &mut self.open { + sheet.destinations = None; + } + let seq = self.issue(Request::Destinations); + if let Some(sheet) = &mut self.open { + sheet.destinations_seq = Some(seq); + } + } + Answer::Withdrawn { share_id } => { + if let Some(sheet) = &mut self.open { + sheet.withdrawing.retain(|(_, id)| *id != share_id); + if let Some(access) = &mut sheet.access { + access.retain(|s| s.id != share_id); + } + sheet.shared.retain(|s| s.id != share_id); + } + } + Answer::Avatar { url, bytes } => { + let uri = avatar_uri(&url); + ctx.include_bytes(uri.clone(), bytes); + self.avatars.insert(url, Avatar::Ready(uri)); + } + } + if let Some(id) = reload { + let seq = self.issue(Request::Access { id }); + if let Some(sheet) = &mut self.open { + sheet.access_seq = Some(seq); + } + } + } + + /// One request came back with a reason instead of an answer. + fn refused(&mut self, seq: u64, reason: String) { + // A picture nobody can fetch is not worth telling the user about, and + // is never asked for again. + if let Some(url) = self.avatars.iter().find(|(_, a)| **a == Avatar::Pending(seq)).map(|(url, _)| url.clone()) { + self.avatars.insert(url, Avatar::Missing); + return; + } + let Some(sheet) = &mut self.open else { return }; + if sheet.lookup == Some(seq) { + sheet.searching = false; + sheet.matches.clear(); + sheet.error = Some(reason); + } else if sheet.access_seq == Some(seq) { + sheet.access_seq = None; + sheet.access = Some(Vec::new()); + sheet.error = Some(reason); + } else if sheet.granting == Some(seq) { + sheet.granting = None; + sheet.error = Some(reason); + } else if sheet.withdrawing.iter().any(|(s, _)| *s == seq) { + sheet.withdrawing.retain(|(s, _)| *s != seq); + sheet.error = Some(reason); + } else if sheet.destinations_seq == Some(seq) { + sheet.destinations_seq = None; + sheet.destinations = Some(Vec::new()); + sheet.save_error = Some(reason); + } else if sheet.link_seq == Some(seq) { + sheet.link_seq = None; + sheet.save_error = Some(reason); + } + } + + fn apply(&mut self, ctx: &Context, acts: Vec) { + for act in acts { + match act { + Act::Close => self.close(), + Act::Lookup(query) => { + let seq = self.issue(Request::Lookup { query, limit: MATCHES }); + if let Some(sheet) = &mut self.open { + sheet.lookup = Some(seq); + sheet.searching = true; + } + } + Act::Grant(grant) => { + let seq = self.issue(Request::Grant(grant)); + if let Some(sheet) = &mut self.open { + sheet.granting = Some(seq); + sheet.shared.clear(); + sheet.failed.clear(); + sheet.error = None; + } + } + Act::SaveAs { destination, name } => { + // Handed to the application rather than the backend. Only + // it can turn the open document into bytes, and a share + // transport is the wrong place to pass a workbook through. + // `generation` is filled when taken; zero here is a placeholder. + self.wants_save = Some(SaveRequest { destination, name, generation: 0 }); + if let Some(sheet) = &mut self.open { + sheet.saving = Some(0); + sheet.save_error = None; + } + } + Act::Link(destination) => { + // The answer to this is usually a refusal carrying the URL + // to open, because launching a browser is the host + // application's business and not this crate's. + let seq = self.issue(Request::Link { destination }); + if let Some(sheet) = &mut self.open { + sheet.link_seq = Some(seq); + sheet.error = None; + } + } + Act::Withdraw(share_id) => { + let seq = self.issue(Request::Withdraw { share_id: share_id.clone() }); + if let Some(sheet) = &mut self.open { + sheet.withdrawing.push((seq, share_id)); + } + } + Act::Avatar(url) => { + if self.avatars.contains_key(&url) { + continue; + } + if self.avatars.len() >= AVATARS { + for (_, avatar) in self.avatars.drain() { + if let Avatar::Ready(uri) = avatar { + ctx.forget_image(&uri); + } + } + } + let seq = self.issue(Request::Avatar { url: url.clone() }); + self.avatars.insert(url, Avatar::Pending(seq)); + } + } + } + } +} + +// ---- drawing -------------------------------------------------------------- + +fn draw(ui: &mut Ui, sheet: &mut Sheet, avatars: &HashMap, labels: &ShareLabels, allowed: Allowed, acts: &mut Vec) { + let weak = ui.visuals().weak_text_color(); + let danger = ui.visuals().error_fg_color; + + // The document is named in the title, in quotes. This dialog gives other + // people access to one specific thing, and sharing the wrong one is the + // mistake it exists to prevent. + ui.horizontal(|ui| { + let heading = if sheet.title.is_empty() { labels.title.clone() } else { format!("{} \u{201c}{}\u{201d}", labels.title, sheet.title) }; + ui.label(RichText::new(heading).strong().size(15.0)); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + let close = egui::Button::new(RichText::new("\u{00d7}").size(18.0)).frame(false); + if ui.add(close).on_hover_text(labels.close.as_str()).clicked() { + acts.push(Act::Close); + } + }); + }); + ui.add_space(8.0); + + // Nothing to share yet. The old build stopped here with a sentence and a + // Close button, naming the obstacle and leaving somebody to deal with it + // elsewhere. Saving is the first step of sharing now. + if sheet.id.is_empty() { + save_first(ui, sheet, labels, acts); + return; + } + + // Who, and what they may do, on one row. The permission applies to these + // recipients, so it belongs beside them. A separate pair of radio buttons + // further down reads as an unrelated setting. + ui.horizontal_top(|ui| { + let width = (ui.available_width() - 104.0).max(160.0); + ui.allocate_ui(egui::vec2(width, 0.0), |ui| { + recipients(ui, sheet, avatars, labels, allowed, acts); + }); + permission_menu(ui, sheet, labels); + }); + // Only once something has actually been asked. "No matches" under an + // untouched field reads as a failure before any search ran. + if sheet.searching || !sheet.matches.is_empty() || sheet.query.trim().chars().count() >= MIN_QUERY { + matches(ui, sheet, avatars, labels, allowed, acts); + } + + ui.add_space(6.0); + + // The message, as a bordered area with its own placeholder. People write a + // sentence here, not a value, and a label above a one-line field invites + // neither. + // TextEdit draws its own border, so no group around it. Wrapping one in a + // Frame::group gives two nested borders. + ui.add( + egui::TextEdit::multiline(&mut sheet.note) + .hint_text(labels.message_hint.as_str()) + .desired_width(f32::INFINITY) + .desired_rows(3) + .char_limit(500), + ); + + ui.add_space(8.0); + + // One primary action, on the right where the eye finishes. Notify sits + // beside it rather than loose in the middle of the form. + // A link, for anybody who has no account. Drawn only where the server + // allows public links, because an administrator can forbid them and a + // button that always fails is worse than no button. + if allowed.links { + ui.horizontal(|ui| { + if allowed.key { + ui.add(egui::TextEdit::singleline(&mut sheet.link_key).hint_text(labels.key_hint.as_str()).password(true).desired_width(150.0)); + } + // A key the server insists on cannot be skipped, so the control + // stays disabled until one is typed. + let keyed = !sheet.link_key.trim().is_empty(); + let ready = keyed || !allowed.key_required; + if ui.add_enabled(ready, egui::Button::new(labels.create_link.as_str())).clicked() { + acts.push(Act::Grant(Grant { + id: sheet.id.clone(), + targets: vec![ShareTarget::Link], + permission: sheet.permission, + note: Some(sheet.note.trim().to_owned()).filter(|n| !n.is_empty()), + notify: false, + password: Some(sheet.link_key.trim().to_owned()).filter(|k| !k.is_empty()), + })); + } + if allowed.key_required && !keyed { + ui.label(RichText::new(labels.key_required_note.as_str()).small().color(weak)); + } + }); + ui.add_space(6.0); + } + + ui.horizontal(|ui| { + if allowed.mail { + ui.checkbox(&mut sheet.notify, labels.notify.as_str()); + } else { + // Reported, never assumed. A server with no mail is said to have + // none, instead of being given a box that quietly does nothing. + sheet.notify = false; + ui.add_enabled(false, egui::Checkbox::new(&mut sheet.notify, labels.notify.as_str())).on_disabled_hover_text(labels.no_mail.as_str()); + } + + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + let busy = sheet.granting.is_some(); + let ready = !sheet.chosen.is_empty() && !busy; + let label = if busy { labels.sharing.clone() } else { labels.send.clone() }; + let send = egui::Button::new(RichText::new(label).strong()).fill(ui.visuals().selection.bg_fill).min_size(egui::vec2(88.0, 26.0)); + if ui.add_enabled(ready, send).clicked() { + acts.push(Act::Grant(Grant { + id: sheet.id.clone(), + password: None, + targets: sheet.chosen.iter().map(|c| c.target.clone()).collect(), + permission: sheet.permission, + note: Some(sheet.note.trim().to_owned()).filter(|n| !n.is_empty()), + notify: sheet.notify, + })); + } + if ui.button(labels.close.as_str()).clicked() { + acts.push(Act::Close); + } + }); + }); + + outcome(ui, sheet, labels, danger); + + // Who already holds the document, open. Folding it hid the one fact + // a person needs before adding anybody else. It still folds on request. + ui.add_space(4.0); + egui::CollapsingHeader::new(RichText::new(labels.manage_access.as_str()).color(weak)) + .id_salt("craft-ui/share/manage-access") + .default_open(true) + .show(ui, |ui| { + access(ui, sheet, labels, weak, acts); + }); +} + +/// Where to put it, then what to call it. +/// +/// A document with no handle cannot be shared. Rather than saying so and +/// stopping, this offers the places it could go, each naming the account it +/// would land in, with a sign-in for any that is configured without one. +/// +/// A list, because there is rarely only one answer. A second provider is an +/// implementation of the contracts, and this is where it shows up. +fn save_first(ui: &mut Ui, sheet: &mut Sheet, labels: &ShareLabels, acts: &mut Vec) { + let weak = ui.visuals().weak_text_color(); + ui.label(labels.upload_first.as_str()); + ui.add_space(8.0); + + let Some(destinations) = sheet.destinations.clone() else { + ui.horizontal(|ui| { + ui.spinner(); + ui.label(RichText::new(labels.loading.as_str()).color(weak)); + }); + return; + }; + + for destination in &destinations { + let chosen = sheet.destination.as_deref() == Some(destination.id.as_str()); + let stroke = if chosen { ui.visuals().selection.stroke } else { ui.visuals().widgets.noninteractive.bg_stroke }; + let row = egui::Frame::group(ui.style()) + .stroke(stroke) + .show(ui, |ui| { + ui.set_width(ui.available_width()); + ui.horizontal(|ui| { + ui.vertical(|ui| { + ui.label(RichText::new(destination.name.as_str()).strong()); + // The account, because two entries both reading + // "Cloud" tell nobody which one a document is about to + // land in. + let under = if destination.linked { destination.account.clone().unwrap_or_default() } else { labels.sign_in.clone() }; + ui.label(RichText::new(under).small().color(weak)); + }); + }); + }) + .response + .interact(egui::Sense::click()); + if row.clicked() { + if destination.linked { + sheet.destination = Some(destination.id.clone()); + } else { + acts.push(Act::Link(destination.id.clone())); + } + } + ui.add_space(4.0); + } + + if let Some(problem) = &sheet.save_error { + ui.add_space(4.0); + ui.label(RichText::new(problem).color(ui.visuals().error_fg_color)); + } + + let Some(into) = sheet.destination.clone() else { return }; + + ui.add_space(8.0); + let saving = sheet.saving.is_some(); + ui.add_enabled(!saving, egui::TextEdit::singleline(&mut sheet.save_as).hint_text(labels.name_hint.as_str()).desired_width(f32::INFINITY)); + + ui.add_space(8.0); + ui.horizontal(|ui| { + let named = !sheet.save_as.trim().is_empty(); + let label = if saving { labels.saving.clone() } else { labels.save_and_share.clone() }; + let button = egui::Button::new(RichText::new(label).strong()).fill(ui.visuals().selection.bg_fill).min_size(egui::vec2(124.0, 26.0)); + if ui.add_enabled(named && !saving, button).clicked() { + acts.push(Act::SaveAs { destination: into.clone(), name: sheet.save_as.trim().to_owned() }); + } + if ui.button(labels.close.as_str()).clicked() { + acts.push(Act::Close); + } + }); +} + +/// The permission picker, as a menu with a line of explanation under each +/// choice. +/// +/// Two radio buttons reading View and Edit leave the difference to be guessed. +/// Only the permissions the contracts can actually keep are offered: a choice +/// the server cannot honour is worse than one fewer choice. +fn permission_menu(ui: &mut Ui, sheet: &mut Sheet, labels: &ShareLabels) { + let current = match sheet.permission { + Permission::Edit => labels.can_edit.as_str(), + Permission::View => labels.can_view.as_str(), + }; + // A triangle, so it reads as something that opens. Painted rather than + // typed: the character is missing from the default font set, where it + // renders as a box. + let button = ui.button(format!("{current} ")); + crate::buttons::chevron(ui, button.rect, ui.visuals().text_color()); + // The padding makes room for the triangle. It is layout, so it must not + // reach anybody reading the screen aloud. + button.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, current)); + egui::Popup::menu(&button).show(|ui| { + ui.set_min_width(190.0); + for (value, name, detail) in [ + (Permission::Edit, labels.can_edit.as_str(), labels.can_edit_detail.as_str()), + (Permission::View, labels.can_view.as_str(), labels.can_view_detail.as_str()), + ] { + let chosen = sheet.permission == value; + if ui.selectable_label(chosen, RichText::new(name).strong()).clicked() { + sheet.permission = value; + ui.close(); + } + ui.label(RichText::new(detail).small().color(ui.visuals().weak_text_color())); + ui.add_space(2.0); + } + }); +} + +/// The chips, and the field that adds another. +fn recipients(ui: &mut Ui, sheet: &mut Sheet, avatars: &HashMap, labels: &ShareLabels, allowed: Allowed, acts: &mut Vec) { + let now = ui.input(|i| i.time); + egui::Frame::group(ui.style()).show(ui, |ui| { + ui.horizontal_wrapped(|ui| { + let mut remove = None; + for (i, chosen) in sheet.chosen.iter().enumerate() { + if chip(ui, avatars, chosen, labels, acts).clicked() { + remove = Some(i); + } + } + if let Some(i) = remove.filter(|i| *i < sheet.chosen.len()) { + sheet.chosen.remove(i); + } + + let field = ui.add( + egui::TextEdit::singleline(&mut sheet.query) + .id(ShareDialog::query_field_id()) + .hint_text(labels.recipient_hint.as_str()) + // Fills whatever the chips left. A fixed width leaves a + // short field floating in a frame twice as wide. + .desired_width(ui.available_width().max(120.0)), + ); + if field.changed() { + sheet.typed = Some(now); + } + // Backspace on an empty field takes the last chip back, which is + // what every other recipient field does. + if field.has_focus() && sheet.query.is_empty() && ui.input(|i| i.key_pressed(egui::Key::Backspace)) { + sheet.chosen.pop(); + } + if field.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter)) { + commit(sheet); + } + }); + }); + + // The debounce. Asking per keystroke asks five times for "annie" and + // paints whichever answer happens to arrive last. + if let Some(at) = sheet.typed { + let wait = DEBOUNCE.as_secs_f64(); + if now - at >= wait { + sheet.typed = None; + let query = sheet.query.trim().to_owned(); + if allowed.contacts && query.chars().count() >= MIN_QUERY { + // Set here rather than when the request is issued, so the + // frame that fires it does not read as "no matches". + sheet.searching = true; + acts.push(Act::Lookup(query)); + } else { + sheet.matches.clear(); + sheet.searching = false; + } + } else { + // Without this the frame that fires the lookup only arrives when + // something else happens to ask for a repaint. + ui.ctx().request_repaint_after(Duration::from_secs_f64((wait - (now - at)).clamp(0.0, wait))); + } + } +} + +/// Take whatever has been typed as a recipient: the first match if there is +/// one, otherwise an address if it looks like one. +fn commit(sheet: &mut Sheet) { + let typed = sheet.query.trim().to_lowercase(); + + // An exact match wins. Somebody who typed a whole address that belongs to + // an account should get the account, because a share to an account appears + // in their files rather than only in their inbox. + if let Some(exact) = sheet + .matches + .iter() + .find(|c| c.id.to_lowercase() == typed || c.email.as_deref().is_some_and(|e| e.to_lowercase() == typed) || c.name.to_lowercase() == typed) + .cloned() + { + choose(sheet, &exact); + return; + } + + // Then whatever was typed, if it is an address. The list is a convenience + // and not the set of permitted answers: taking its first row here would + // share with whoever happened to match the opening characters of an + // address somebody typed out in full. + if let Some(address) = address(&sheet.query) { + add(sheet, ShareTarget::Email(address.clone()), address, None, None); + return; + } + + // Otherwise the best the list has, which is what a partial name means. + if let Some(contact) = sheet.matches.first().cloned() { + choose(sheet, &contact); + } +} + +fn matches(ui: &mut Ui, sheet: &mut Sheet, avatars: &HashMap, labels: &ShareLabels, allowed: Allowed, acts: &mut Vec) { + let weak = ui.visuals().weak_text_color(); + // Somebody with no account on this server is reached by address or not at + // all, so the one way to do that is said out loud. A dialog that hides it + // leaves the user guessing which keys work. + if sheet.matches.is_empty() + && address(&sheet.query).is_some() + && !sheet.chosen.iter().any(|c| c.target == ShareTarget::Email(sheet.query.trim().to_owned())) + { + ui.label(RichText::new(labels.add_address.as_str()).color(weak)); + } + if !allowed.contacts { + return; + } + if sheet.searching && sheet.matches.is_empty() { + ui.label(RichText::new(labels.searching.as_str()).color(weak)); + return; + } + if sheet.matches.is_empty() { + if sheet.typed.is_none() && sheet.query.trim().chars().count() >= MIN_QUERY && address(&sheet.query).is_none() { + ui.label(RichText::new(labels.no_matches.as_str()).color(weak)); + } + return; + } + let mut pick = None; + egui::ScrollArea::vertical().max_height(150.0).id_salt("craft-ui/share/matches").show(ui, |ui| { + for (i, contact) in sheet.matches.iter().enumerate() { + if row(ui, avatars, contact, labels, acts).clicked() { + pick = Some(i); + } + } + }); + if let Some(contact) = pick.and_then(|i| sheet.matches.get(i).cloned()) { + choose(sheet, &contact); + } +} + +fn outcome(ui: &mut Ui, sheet: &Sheet, labels: &ShareLabels, danger: Color32) { + if let Some(error) = &sheet.error { + ui.colored_label(danger, error.as_str()); + } + if !sheet.shared.is_empty() { + let who: Vec = sheet.shared.iter().map(|s| share_label(s, labels)).collect(); + ui.label(format!("{}: {}", labels.shared_with, who.join(", "))); + } + // One line each. Five recipients with one bad address shares with four and + // names the one that failed; collapsing that into a single error would + // hide both halves. + for failure in &sheet.failed { + ui.colored_label(danger, format!("{} {}: {}", labels.not_shared_with, target_label(&failure.target, labels), describe(failure))); + } +} + +fn describe(failure: &Failure) -> String { + if failure.detail.trim().is_empty() { failure.code.clone() } else { failure.detail.clone() } +} + +fn access(ui: &mut Ui, sheet: &Sheet, labels: &ShareLabels, weak: Color32, acts: &mut Vec) { + // The header above already names this list. Naming it twice reads as + // two headings for one thing. + let Some(list) = &sheet.access else { + ui.label(RichText::new(labels.loading.as_str()).color(weak)); + return; + }; + if list.is_empty() { + ui.label(RichText::new(labels.access_empty.as_str()).color(weak)); + return; + } + egui::ScrollArea::vertical().max_height(160.0).id_salt("craft-ui/share/access").show(ui, |ui| { + for share in list { + ui.horizontal(|ui| { + ui.label(share_label(share, labels)); + let permission = match share.permission { + Permission::View => labels.can_view.as_str(), + Permission::Edit => labels.can_edit.as_str(), + }; + ui.label(RichText::new(permission).color(weak)); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + let busy = sheet.withdrawing.iter().any(|(_, id)| *id == share.id); + // A bin, with the word on hover. The row is already a + // line of text; a second word on it reads as more content + // rather than as the control it is. + let glyph = if busy { "\u{22ef}" } else { "\u{1f5d1}" }; + let bin = egui::Button::new(RichText::new(glyph).size(15.0)).frame(false); + let hint = if busy { labels.withdrawing.as_str() } else { labels.withdraw.as_str() }; + let pressed = ui.add_enabled(!busy, bin); + // A glyph is not a name. Left alone this button announces itself + // to a screen reader as a wastebasket character, so the word goes + // on explicitly. + pressed.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, !busy, hint)); + if pressed.on_hover_text(hint).clicked() { + acts.push(Act::Withdraw(share.id.clone())); + } + if let Some(url) = &share.url + && ui.small_button(labels.copy_link.as_str()).clicked() + { + ui.ctx().copy_text(url.clone()); + } + }); + }); + if let Some(note) = &share.note + && !note.trim().is_empty() + { + ui.label(RichText::new(note.as_str()).color(weak).small()); + } + } + }); +} + +// ---- pieces --------------------------------------------------------------- + +/// One picked recipient. The whole chip is the remove control. +fn chip(ui: &mut Ui, avatars: &HashMap, chosen: &Chosen, labels: &ShareLabels, acts: &mut Vec) -> Response { + let background = ui.painter().add(egui::Shape::Noop); + let inner = ui.scope_builder(UiBuilder::new().sense(Sense::click()), |ui| { + // A selectable label senses click and drag of its own, and one drawn + // inside a clickable row wins the hit test over the row itself. For + // narrow rows like a chip the pointer lands on the text nearly always, + // so the press would be swallowed and the chip never removed. + ui.style_mut().interaction.selectable_labels = false; + ui.horizontal(|ui| { + ui.add_space(3.0); + picture(ui, avatars, chosen.avatar.as_deref(), &chosen.label, acts); + ui.label(chosen.label.as_str()); + // The same cross the dialog closes with. U+2715 is absent from + // the default font set, where it renders as a box. + ui.label(RichText::new("×").color(ui.visuals().weak_text_color())); + ui.add_space(1.0); + }); + }); + let response = inner.response; + let fill = if response.hovered() { ui.visuals().widgets.hovered.bg_fill } else { ui.visuals().widgets.inactive.bg_fill }; + ui.painter().set(background, egui::Shape::rect_filled(response.rect, CornerRadius::same(AVATAR_RADIUS), fill)); + let label = format!("{} {}", labels.remove, chosen.label); + response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), label.clone())); + // The address, where there is one. Two colleagues share a display name + // often enough that a chip reading "Ann Reed" is not an identity. + let hint = match &chosen.detail { + Some(detail) if !detail.is_empty() => format!("{} · {detail}", labels.remove), + _ => labels.remove.clone(), + }; + response.on_hover_text(hint) +} + +/// One match in the autocomplete list. +fn row(ui: &mut Ui, avatars: &HashMap, contact: &Contact, labels: &ShareLabels, acts: &mut Vec) -> Response { + let background = ui.painter().add(egui::Shape::Noop); + let width = ui.available_width(); + let inner = ui.scope_builder(UiBuilder::new().sense(Sense::click()), |ui| { + // A selectable label senses click and drag of its own, and one drawn + // inside a clickable row wins the hit test over the row itself. For + // narrow rows like a chip the pointer lands on the text nearly always, + // so the press would be swallowed and the chip never removed. + ui.style_mut().interaction.selectable_labels = false; + ui.set_min_width(width); + ui.horizontal(|ui| { + ui.add_space(3.0); + picture(ui, avatars, contact.avatar.as_deref(), &contact.name, acts); + ui.label(contact.name.as_str()); + let detail = if contact.is_group { format!("({})", labels.group) } else { contact.email.clone().unwrap_or_default() }; + if !detail.is_empty() { + ui.label(RichText::new(detail).color(ui.visuals().weak_text_color())); + } + }); + }); + let response = inner.response; + if response.hovered() { + ui.painter().set(background, egui::Shape::rect_filled(response.rect, CornerRadius::same(4), ui.visuals().widgets.hovered.bg_fill)); + } + let label = contact.name.clone(); + response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), label.clone())); + response +} + +/// A contact picture, or initials while there is none. +/// +/// A picture is asked for here, as the row that needs it is painted, and only +/// when that row is actually on screen. A search answering with ten people +/// therefore costs no pictures at all until they are looked at, and the ones +/// scrolled past below the fold cost nothing either. `avatars` holds every URL +/// ever asked about, the refusals included, so nothing is asked for twice. +fn picture(ui: &mut Ui, avatars: &HashMap, url: Option<&str>, label: &str, acts: &mut Vec) { + let size = Vec2::splat(AVATAR); + let (rect, _) = ui.allocate_exact_size(size, Sense::hover()); + match url.and_then(|u| avatars.get(u)) { + Some(Avatar::Ready(uri)) => { + let image = egui::Image::from_uri(uri.clone()).fit_to_exact_size(size).corner_radius(CornerRadius::same(AVATAR_RADIUS)); + if image.load_for_size(ui.ctx(), size).is_ok() { + image.paint_at(ui, rect); + return; + } + } + Some(_) => {} + None => { + if let Some(url) = url.filter(|_| ui.is_rect_visible(rect)) { + acts.push(Act::Avatar(url.to_owned())); + } + } + } + ui.painter().circle_filled(rect.center(), AVATAR / 2.0, ui.visuals().widgets.inactive.bg_fill); + ui.painter().text(rect.center(), Align2::CENTER_CENTER, initials(label), FontId::proportional(AVATAR * 0.42), ui.visuals().text_color()); +} + +fn initials(label: &str) -> String { + label.split_whitespace().filter_map(|word| word.chars().next()).take(2).flat_map(|c| c.to_uppercase()).collect() +} + +/// A stable URI for one avatar's bytes. egui caches by URI, so two contacts +/// must never share one. +fn avatar_uri(url: &str) -> String { + use std::hash::{Hash as _, Hasher as _}; + let mut hasher = std::hash::DefaultHasher::new(); + url.hash(&mut hasher); + format!("bytes://craft-ui/share/avatar/{:016x}", hasher.finish()) +} + +fn choose(sheet: &mut Sheet, contact: &Contact) { + // What the provider said, never a guess from the id. A contact with no + // account is reachable only by address, and sharing that address as a user + // id fails with "not found", because no such user exists. + let target = contact.target.clone(); + add(sheet, target, contact.name.clone(), contact.email.clone(), contact.avatar.clone()); +} + +/// Add one recipient, unless it is already there. +fn add(sheet: &mut Sheet, target: ShareTarget, label: String, detail: Option, avatar: Option) { + if !sheet.chosen.iter().any(|c| c.target == target) { + sheet.chosen.push(Chosen { target, label, detail, avatar }); + } + sheet.query.clear(); + sheet.matches.clear(); + sheet.typed = None; + sheet.searching = false; + sheet.lookup = None; +} + +/// What the user typed, when it is an address and not a name. +/// +/// Deliberately shallow. The server decides whether an address exists, and a +/// strict local check would refuse valid addresses it had not heard of. +fn address(typed: &str) -> Option { + let typed = typed.trim(); + if typed.chars().any(char::is_whitespace) { + return None; + } + let (user, host) = typed.split_once('@')?; + if user.is_empty() || host.len() < 3 || !host.contains('.') || host.starts_with('.') || host.ends_with('.') || host.contains('@') { + return None; + } + Some(typed.to_owned()) +} + +/// What to call the person or group a share is with. +/// +/// The handle is the fallback. Showing an account id to somebody who knows +/// that person by name tells them nothing, and two colleagues with similar +/// ids are indistinguishable. +fn share_label(share: &Share, labels: &ShareLabels) -> String { + match share.display.as_deref().filter(|name| !name.trim().is_empty()) { + Some(name) => match share.target { + ShareTarget::Group(_) => format!("{name} ({})", labels.group), + _ => name.to_owned(), + }, + None => target_label(&share.target, labels), + } +} + +fn target_label(target: &ShareTarget, labels: &ShareLabels) -> String { + match target { + ShareTarget::User(id) => id.clone(), + ShareTarget::Group(id) => format!("{id} ({})", labels.group), + ShareTarget::Email(address) => address.clone(), + ShareTarget::Link => labels.anyone_with_link.clone(), + } +} diff --git a/crates/ui/src/share/tests.rs b/crates/ui/src/share/tests.rs new file mode 100644 index 000000000..dfdb3eb1e --- /dev/null +++ b/crates/ui/src/share/tests.rs @@ -0,0 +1,527 @@ +//! The dialog's state machine, with no server and no window. +//! +//! What matters here is what the dialog does with answers: that it offers +//! nothing until the service says sharing exists, that an answer the user has +//! typed past is thrown away rather than painted, that a share reaching four +//! of five people says which one it missed, and that a picture nobody can +//! fetch is asked for once. + +use std::sync::{Arc, Mutex}; + +use super::*; + +/// A backend that records what was asked and answers nothing, so a test +/// decides when each answer arrives and in which order. +#[derive(Clone, Default)] +struct Silent(Arc>>); + +impl Silent { + fn seen(&self) -> Vec { + self.0.lock().map(|seen| seen.clone()).unwrap_or_default() + } +} + +impl ShareBackend for Silent { + fn submit(&self, request: Request, _reply: Replier) { + if let Ok(mut seen) = self.0.lock() { + seen.push(request); + } + } +} + +fn can(capabilities: Vec) -> Answer { + Answer::Capabilities { capabilities, linked: true } +} + +fn everything() -> Answer { + can(vec![Capability::Sharing, Capability::Contacts, Capability::Mail]) +} + +/// A connected dialog that has been told sharing works, open on one document. +fn ready() -> (Context, ShareDialog, Silent) { + let ctx = Context::default(); + let backend = Silent::default(); + let mut dialog = ShareDialog::new(); + dialog.connect(backend.clone()); + dialog.collect(&ctx); + dialog.receive(&ctx, 1, Ok(everything())); + dialog.open("files/budget.xlsx", "Budget"); + (ctx, dialog, backend) +} + +fn person(id: &str, name: &str) -> Contact { + Contact { + id: id.into(), + target: ShareTarget::User(id.into()), + name: name.into(), + email: Some(format!("{id}@example.com")), + avatar: None, + is_group: false, + } +} + +fn share(id: &str, target: ShareTarget) -> Share { + Share { id: id.into(), target, display: None, permission: Permission::View, url: None, note: None, created: None } +} + +#[test] +fn a_share_is_labelled_with_the_name_the_provider_gave() { + let labels = ShareLabels::default(); + let mut one = share("s1", ShareTarget::User("adunn".to_owned())); + assert_eq!(super::share_label(&one, &labels), "adunn", "the handle is all there is"); + one.display = Some("Ada Lovelace".to_owned()); + assert_eq!(super::share_label(&one, &labels), "Ada Lovelace"); + // A provider that answers with an empty string has said nothing. + one.display = Some(" ".to_owned()); + assert_eq!(super::share_label(&one, &labels), "adunn"); + + let mut team = share("s2", ShareTarget::Group("eng".to_owned())); + team.display = Some("Engineering".to_owned()); + assert_eq!(super::share_label(&team, &labels), format!("Engineering ({})", labels.group)); + + // A link is not a person and never carries one. + assert_eq!(super::share_label(&share("s3", ShareTarget::Link), &labels), labels.anyone_with_link); +} + +#[test] +fn nothing_is_offered_until_the_service_says_sharing_exists() { + let ctx = Context::default(); + let backend = Silent::default(); + let mut dialog = ShareDialog::new(); + assert!(!dialog.available(), "an unconnected dialog cannot share"); + + dialog.connect(backend.clone()); + assert_eq!(backend.seen(), Vec::new(), "connecting alone asks nothing"); + dialog.collect(&ctx); + assert_eq!(backend.seen(), vec![Request::Capabilities]); + + // Still unanswered: the question is outstanding, so the answer is no. + assert!(!dialog.available()); + dialog.open("files/budget.xlsx", "Budget"); + assert!(!dialog.is_open(), "the dialog must not open before the answer"); + + // A provider with files but no sharing hides the feature rather than + // offering a button that fails. + dialog.receive(&ctx, 1, Ok(can(vec![Capability::Files, Capability::Contacts]))); + assert!(!dialog.available()); + dialog.open("files/budget.xlsx", "Budget"); + assert!(!dialog.is_open()); + + dialog.receive(&ctx, 1, Ok(everything())); + assert!(dialog.available()); + dialog.open("files/budget.xlsx", "Budget"); + assert!(dialog.is_open()); +} + +#[test] +fn an_unlinked_account_cannot_share_even_where_the_provider_can() { + let ctx = Context::default(); + let mut dialog = ShareDialog::new(); + dialog.connect(Silent::default()); + dialog.receive(&ctx, 1, Ok(Answer::Capabilities { capabilities: vec![Capability::Sharing], linked: false })); + assert!(!dialog.available()); +} + +#[test] +fn losing_sharing_closes_a_dialog_that_was_already_up() { + let (ctx, mut dialog, _) = ready(); + assert!(dialog.is_open()); + dialog.receive(&ctx, 1, Ok(can(vec![Capability::Files]))); + assert!(!dialog.is_open(), "a dialog that cannot do anything must not stay up"); +} + +#[test] +fn opening_asks_who_already_has_access() { + let (_ctx, dialog, backend) = ready(); + assert_eq!(backend.seen(), vec![Request::Capabilities, Request::Access { id: "files/budget.xlsx".into() }]); + assert!(dialog.is_open()); +} + +#[test] +fn an_unsaved_document_asks_where_it_could_go_and_never_about_a_handle() { + let ctx = Context::default(); + let backend = Silent::default(); + let mut dialog = ShareDialog::new(); + dialog.connect(backend.clone()); + dialog.collect(&ctx); + dialog.receive(&ctx, 1, Ok(everything())); + dialog.open("", "Book1"); + assert!(dialog.is_open()); + // Sharing an unsaved document means saving it first. The dialog therefore + // needs somewhere to offer. It asks nothing about a handle. There is none. + assert_eq!(backend.seen(), vec![Request::Capabilities, Request::Destinations]); + assert!(!backend.seen().iter().any(|r| matches!(r, Request::Access { .. })), "there is no handle to ask about"); +} + +#[test] +fn an_answer_the_user_has_typed_past_is_dropped() { + let (ctx, mut dialog, _) = ready(); + let early = dialog.issue(Request::Lookup { query: "an".into(), limit: MATCHES }); + let late = dialog.issue(Request::Lookup { query: "ann".into(), limit: MATCHES }); + if let Some(sheet) = &mut dialog.open { + sheet.lookup = Some(late); + sheet.searching = true; + } + + // The first query answers second, which is what a service under load + // does. Painting it would show matches for "an" under the text "ann". + dialog.receive(&ctx, late, Ok(Answer::Lookup(vec![person("ann", "Ann Reed")]))); + dialog.receive(&ctx, early, Ok(Answer::Lookup(vec![person("andy", "Andy Shaw"), person("anna", "Anna Beck")]))); + + let sheet = dialog.open.as_ref().expect("still open"); + assert_eq!(sheet.matches.len(), 1); + assert_eq!(sheet.matches.first().map(|c| c.name.as_str()), Some("Ann Reed")); + assert!(!sheet.searching); +} + +#[test] +fn several_recipients_can_be_picked_and_each_only_once() { + let (_ctx, mut dialog, _) = ready(); + let sheet = dialog.open.as_mut().expect("open"); + for contact in [person("ann", "Ann Reed"), person("bob", "Bob Vine"), person("ann", "Ann Reed")] { + choose(sheet, &contact); + } + choose( + sheet, + &Contact { + id: "finance".into(), + target: ShareTarget::Group("finance".into()), + name: "Finance".into(), + email: None, + avatar: None, + is_group: true, + }, + ); + + let picked: Vec<&ShareTarget> = sheet.chosen.iter().map(|c| &c.target).collect(); + assert_eq!( + picked, + vec![&ShareTarget::User("ann".into()), &ShareTarget::User("bob".into()), &ShareTarget::Group("finance".into())], + "a group shares as a group, and picking the same person twice adds one chip" + ); + assert!(sheet.query.is_empty(), "picking clears what was typed"); +} + +#[test] +fn a_share_reaching_four_of_five_names_the_fifth() { + let (ctx, mut dialog, _) = ready(); + let sheet = dialog.open.as_mut().expect("open"); + for who in ["ann", "bob", "cal", "dee"] { + choose(sheet, &person(who, who)); + } + add(sheet, ShareTarget::Email("nobody@@".into()), "nobody@@".into(), None, None); + let granting = dialog.issue(Request::Grant(Grant { + id: "files/budget.xlsx".into(), + password: None, + targets: Vec::new(), + permission: Permission::Edit, + note: None, + notify: true, + })); + if let Some(sheet) = &mut dialog.open { + sheet.granting = Some(granting); + } + + let shared: Vec = + ["ann", "bob", "cal", "dee"].iter().enumerate().map(|(i, who)| share(&format!("s{i}"), ShareTarget::User((*who).into()))).collect(); + let failed = + vec![Failure { target: ShareTarget::Email("nobody@@".into()), code: "invalid_address".into(), detail: "nobody@@ is not an address".into() }]; + dialog.receive(&ctx, granting, Ok(Answer::Granted { shared, failed })); + + let (shared, failed) = dialog.outcome(); + assert_eq!(shared.len(), 4); + assert_eq!(failed.len(), 1, "a wrong address is named, not folded into one error"); + assert_eq!(failed.first().map(|f| f.detail.as_str()), Some("nobody@@ is not an address")); + + // The four that went through leave the picker; the one that did not stays, + // so correcting it is one edit rather than a retyped list. + let left = dialog.open.as_ref().expect("open"); + assert_eq!(left.chosen.len(), 1); + assert_eq!(left.chosen.first().map(|c| &c.target), Some(&ShareTarget::Email("nobody@@".into()))); +} + +#[test] +fn a_refusal_that_stopped_the_whole_call_is_not_a_failed_recipient() { + let (ctx, mut dialog, _) = ready(); + let granting = dialog.issue(Request::Grant(Grant { + id: "files/budget.xlsx".into(), + password: None, + targets: vec![ShareTarget::User("ann".into())], + permission: Permission::View, + note: None, + notify: false, + })); + if let Some(sheet) = &mut dialog.open { + sheet.granting = Some(granting); + } + dialog.receive(&ctx, granting, Err("sign in again".into())); + + let sheet = dialog.open.as_ref().expect("open"); + assert_eq!(sheet.error.as_deref(), Some("sign in again")); + assert!(sheet.failed.is_empty()); + assert!(sheet.granting.is_none(), "the button must come back"); +} + +#[test] +fn a_successful_share_reloads_who_has_access() { + let (ctx, mut dialog, backend) = ready(); + let granting = dialog.issue(Request::Grant(Grant { + id: "files/budget.xlsx".into(), + password: None, + targets: vec![ShareTarget::User("ann".into())], + permission: Permission::View, + note: None, + notify: false, + })); + if let Some(sheet) = &mut dialog.open { + sheet.granting = Some(granting); + } + dialog.receive(&ctx, granting, Ok(Answer::Granted { shared: vec![share("s1", ShareTarget::User("ann".into()))], failed: Vec::new() })); + let asked = backend.seen().iter().filter(|r| **r == Request::Access { id: "files/budget.xlsx".into() }).count(); + assert_eq!(asked, 2, "the list is stale the moment a share succeeds"); +} + +#[test] +fn withdrawing_takes_it_off_the_list_and_only_then() { + let (ctx, mut dialog, backend) = ready(); + let access = dialog.open.as_ref().and_then(|s| s.access_seq).expect("asked"); + dialog.receive( + &ctx, + access, + Ok(Answer::Access(vec![share("s1", ShareTarget::User("ann".into())), share("s2", ShareTarget::Group("finance".into()))])), + ); + dialog.apply(&ctx, vec![Act::Withdraw("s1".into())]); + + let waiting = dialog.open.as_ref().expect("open"); + assert_eq!(waiting.access.as_ref().map(Vec::len), Some(2), "it stays until the server agrees"); + assert_eq!(waiting.withdrawing.len(), 1); + assert!(backend.seen().contains(&Request::Withdraw { share_id: "s1".into() })); + + let seq = waiting.withdrawing.first().map(|(seq, _)| *seq).expect("in flight"); + dialog.receive(&ctx, seq, Ok(Answer::Withdrawn { share_id: "s1".into() })); + let after = dialog.open.as_ref().expect("open"); + assert_eq!(after.access.as_ref().map(|a| a.iter().map(|s| s.id.as_str()).collect::>()), Some(vec!["s2"])); + assert!(after.withdrawing.is_empty()); +} + +#[test] +fn a_refused_withdrawal_leaves_the_share_and_says_why() { + let (ctx, mut dialog, _) = ready(); + let access = dialog.open.as_ref().and_then(|s| s.access_seq).expect("asked"); + dialog.receive(&ctx, access, Ok(Answer::Access(vec![share("s1", ShareTarget::User("ann".into()))]))); + dialog.apply(&ctx, vec![Act::Withdraw("s1".into())]); + let seq = dialog.open.as_ref().and_then(|s| s.withdrawing.first().map(|(seq, _)| *seq)).expect("in flight"); + dialog.receive(&ctx, seq, Err("you do not own this share".into())); + + let sheet = dialog.open.as_ref().expect("open"); + assert_eq!(sheet.access.as_ref().map(Vec::len), Some(1)); + assert!(sheet.withdrawing.is_empty(), "the button must come back"); + assert_eq!(sheet.error.as_deref(), Some("you do not own this share")); +} + +#[test] +fn a_picture_is_asked_for_once_and_a_refusal_is_remembered() { + let (ctx, mut dialog, backend) = ready(); + let url = "https://cloud.example.com/avatar/ann/64"; + dialog.apply(&ctx, vec![Act::Avatar(url.into()), Act::Avatar(url.into())]); + let asked = backend.seen().iter().filter(|r| **r == Request::Avatar { url: url.into() }).count(); + assert_eq!(asked, 1, "one row painted twice is one picture"); + + let seq = match dialog.avatars.get(url) { + Some(Avatar::Pending(seq)) => *seq, + other => panic!("expected a pending picture, got {other:?}"), + }; + dialog.receive(&ctx, seq, Err("this build does not fetch contact pictures".into())); + assert_eq!(dialog.avatars.get(url), Some(&Avatar::Missing)); + + // Refused once is refused. Painting the row again must not ask again. + dialog.apply(&ctx, vec![Act::Avatar(url.into())]); + let asked = backend.seen().iter().filter(|r| **r == Request::Avatar { url: url.into() }).count(); + assert_eq!(asked, 1); + + // And a refused picture is the dialog's business, not the user's. + assert_eq!(dialog.open.as_ref().and_then(|s| s.error.clone()), None); +} + +#[test] +fn an_unanswered_capability_question_is_asked_again_later() { + let ctx = Context::default(); + let backend = Silent::default(); + let mut dialog = ShareDialog::new(); + dialog.connect(backend.clone()); + dialog.collect(&ctx); + dialog.collect(&ctx); + assert_eq!(backend.seen().len(), 1, "a question already outstanding is not asked every frame"); + + dialog.asked = Some(-RETRY); + dialog.collect(&ctx); + assert_eq!(backend.seen().len(), 2, "one unreachable moment must not hide Share for the session"); + + dialog.receive(&ctx, 2, Ok(everything())); + dialog.asked = Some(-RETRY); + dialog.collect(&ctx); + assert_eq!(backend.seen().len(), 2, "an answered question is not asked again"); +} + +#[test] +fn what_counts_as_an_address() { + for typed in ["ann@example.com", " ann.reed+tag@mail.example.co.uk "] { + assert!(address(typed).is_some(), "{typed} is an address"); + } + for typed in ["ann", "ann@", "@example.com", "ann@example", "ann reed@example.com", "ann@.com", "a@b@c.com", ""] { + assert!(address(typed).is_none(), "{typed} is not an address"); + } + assert_eq!(address(" ann@example.com "), Some("ann@example.com".to_owned()), "the trim is kept"); +} + +#[test] +fn initials_come_from_the_name_and_never_from_an_index() { + assert_eq!(initials("Ann Reed"), "AR"); + assert_eq!(initials("ann"), "A"); + assert_eq!(initials("Ann Marie Reed"), "AM"); + assert_eq!(initials(""), ""); + assert_eq!(initials(" "), ""); + assert_eq!(initials("Ærø Ødegård"), "ÆØ"); + assert_eq!(initials("张 伟"), "张伟"); +} + +#[test] +fn every_kind_of_recipient_reads_as_something() { + let labels = ShareLabels::default(); + assert_eq!(target_label(&ShareTarget::User("ann".into()), &labels), "ann"); + assert_eq!(target_label(&ShareTarget::Group("finance".into()), &labels), "finance (group)"); + assert_eq!(target_label(&ShareTarget::Email("ann@example.com".into()), &labels), "ann@example.com"); + assert_eq!(target_label(&ShareTarget::Link, &labels), "Anyone with the link"); +} + +#[test] +fn a_failure_with_no_detail_still_says_something() { + let bare = Failure { target: ShareTarget::Link, code: "forbidden".into(), detail: " ".into() }; + assert_eq!(describe(&bare), "forbidden"); + let told = Failure { target: ShareTarget::Link, code: "forbidden".into(), detail: "link shares are off".into() }; + assert_eq!(describe(&told), "link shares are off"); +} + +#[test] +fn two_contacts_never_share_one_picture_cache_entry() { + let one = avatar_uri("https://cloud.example.com/avatar/ann/64"); + let two = avatar_uri("https://cloud.example.com/avatar/anna/64"); + assert_ne!(one, two); + assert_eq!(one, avatar_uri("https://cloud.example.com/avatar/ann/64"), "the same URL is the same entry"); + assert!(one.starts_with("bytes://"), "egui's own loaders have to recognize it"); +} + +fn ready_unsaved() -> (Context, ShareDialog, Silent) { + let ctx = Context::default(); + let backend = Silent::default(); + let mut dialog = ShareDialog::new(); + dialog.connect(backend.clone()); + dialog.collect(&ctx); + dialog.receive(&ctx, 1, Ok(everything())); + dialog.open("", "Book1"); + (ctx, dialog, backend) +} + +fn start_save(dialog: &mut ShareDialog, ctx: &Context, destination: &str, name: &str) -> u64 { + dialog.apply(ctx, vec![Act::SaveAs { destination: destination.into(), name: name.into() }]); + let request = dialog.take_save_request().expect("save was handed to the application"); + assert_ne!(request.generation, 0, "taken saves carry the open sheet generation"); + request.generation +} + +#[test] +fn a_stale_save_completion_after_close_does_nothing() { + let (ctx, mut dialog, backend) = ready_unsaved(); + let generation = start_save(&mut dialog, &ctx, "cloud", "Budget"); + dialog.close(); + assert!(!dialog.is_open()); + + dialog.saved("files/wrong.xlsx", "Wrong"); + dialog.saved_if(generation, "files/wrong.xlsx", "Wrong"); + assert!(!dialog.is_open()); + assert!( + !backend.seen().iter().any(|r| matches!(r, Request::Access { id } if id == "files/wrong.xlsx")), + "a completion after close must not ask about the saved handle" + ); +} + +#[test] +fn a_stale_save_completion_after_reopening_another_document_does_nothing() { + let (ctx, mut dialog, backend) = ready_unsaved(); + let generation = start_save(&mut dialog, &ctx, "cloud", "Budget"); + dialog.close(); + dialog.open("files/other.xlsx", "Other"); + assert_eq!(dialog.open.as_ref().map(|s| s.id.as_str()), Some("files/other.xlsx")); + + dialog.saved("files/budget.xlsx", "Budget"); + dialog.saved_if(generation, "files/budget.xlsx", "Budget"); + let sheet = dialog.open.as_ref().expect("still open on the other document"); + assert_eq!(sheet.id, "files/other.xlsx"); + assert_eq!(sheet.title, "Other"); + assert!(sheet.saving.is_none()); + assert!( + !backend.seen().iter().any(|r| matches!(r, Request::Access { id } if id == "files/budget.xlsx")), + "the first document's completion must not rebind the second" + ); +} + +#[test] +fn a_save_completion_on_the_same_open_updates_the_sheet() { + let (ctx, mut dialog, backend) = ready_unsaved(); + let generation = start_save(&mut dialog, &ctx, "cloud", "Budget"); + + dialog.saved_if(generation, "files/budget.xlsx", "Budget"); + let sheet = dialog.open.as_ref().expect("open"); + assert_eq!(sheet.id, "files/budget.xlsx"); + assert_eq!(sheet.title, "Budget"); + assert!(sheet.saving.is_none()); + assert!(backend.seen().iter().any(|r| matches!(r, Request::Access { id } if id == "files/budget.xlsx"))); +} + +#[test] +fn take_save_request_returns_the_open_sheet_generation() { + let (ctx, mut dialog, _) = ready_unsaved(); + let before = dialog.sheet_generation(); + assert_ne!(before, 0); + dialog.apply(&ctx, vec![Act::SaveAs { destination: "cloud".into(), name: "Budget".into() }]); + let request = dialog.take_save_request().expect("taken"); + assert_eq!(request.generation, before); + assert_eq!(request.destination, "cloud"); + assert_eq!(request.name, "Budget"); +} + +#[test] +fn a_closed_dialog_still_collects_and_reports_nothing() { + let (ctx, mut dialog, _) = ready(); + dialog.close(); + assert!(!dialog.is_open()); + dialog.receive(&ctx, 99, Ok(Answer::Lookup(vec![person("ann", "Ann Reed")]))); + dialog.receive(&ctx, 99, Err("gone".into())); + let (shared, failed) = dialog.outcome(); + assert!(shared.is_empty() && failed.is_empty()); +} + +#[test] +fn pressing_return_takes_the_first_match_or_an_address() { + let (_ctx, mut dialog, _) = ready(); + let sheet = dialog.open.as_mut().expect("open"); + + // With matches on screen, Return takes the one at the top. + sheet.query = "an".into(); + sheet.matches = vec![person("ann", "Ann Reed"), person("andy", "Andy Shaw")]; + commit(sheet); + assert_eq!(sheet.chosen.first().map(|c| &c.target), Some(&ShareTarget::User("ann".into()))); + + // With none, an address is taken as itself. Somebody with no account on + // this server is reached by address or not at all. + sheet.query = "outside@example.com".into(); + commit(sheet); + assert_eq!(sheet.chosen.len(), 2); + assert_eq!(sheet.chosen.last().map(|c| &c.target), Some(&ShareTarget::Email("outside@example.com".into()))); + + // A name that matched nothing is not a recipient. + sheet.query = "nobody".into(); + commit(sheet); + assert_eq!(sheet.chosen.len(), 2); + assert_eq!(sheet.query, "nobody", "and what was typed is left alone to be corrected"); +} diff --git a/crates/ui/tests/renders.rs b/crates/ui/tests/renders.rs new file mode 100644 index 000000000..9f1f5a37c --- /dev/null +++ b/crates/ui/tests/renders.rs @@ -0,0 +1,343 @@ +//! Gated on the `share` feature, which is off by default. +#![cfg(feature = "share")] + +//! Renders of the shared controls, for review. +//! +//! The other suites read the accessibility tree and never look at pixels. That +//! catches wrong wording and missing names. It cannot show whether a dialog +//! looks like it belongs in an office suite, and these two controls will sit in +//! every Craft app, so somebody has to be able to see them. +//! +//! Writes nothing unless `CRAFT_UI_RENDERS` names a directory. A suite that +//! wrote files on every run would turn a checkout dirty by testing it. +//! +//! ```sh +//! CRAFT_UI_RENDERS=/tmp/renders cargo test -p craft-ui --all-features --test renders +//! ``` + +use std::cell::RefCell; +use std::path::PathBuf; +use std::rc::Rc; +use std::sync::{Arc, Mutex}; + +use craft_cloud::{Capability, Contact, Permission, Share, ShareTarget}; +use craft_ui::account::{Account, AccountMenu}; +use craft_ui::presence::{Peer, PresenceBar}; +use craft_ui::share::{Answer, Failure, Replier, Request, ShareBackend, ShareDialog}; +use egui::{Context, Event, FullOutput, PointerButton, Pos2, RawInput, Rect, Theme, Visuals, accesskit, pos2, vec2}; +use egui_kittest::{TestRenderer, wgpu::WgpuTestRenderer}; + +const DOCUMENT: &str = "files/Budget 2026.xlsx"; + +/// A backend that answers what a control needs and parks the rest. +#[derive(Clone, Default)] +struct Fake { + capabilities: Vec, + access: Vec, + parked: Arc>>, +} + +impl ShareBackend for Fake { + fn submit(&self, request: Request, reply: Replier) { + match &request { + Request::Capabilities => { + reply.answer(Answer::Capabilities { capabilities: self.capabilities.clone(), linked: true }); + } + Request::Access { .. } => reply.answer(Answer::Access(self.access.clone())), + _ => { + if let Ok(mut parked) = self.parked.lock() { + parked.push((request, reply)); + } + } + } + } +} + +impl Fake { + fn answer(&self, answer: Answer) { + let taken = self.parked.lock().ok().and_then(|mut p| if p.is_empty() { None } else { Some(p.remove(0)) }); + if let Some((_, reply)) = taken { + reply.answer(answer); + } + } +} + +/// One control, driven frame by frame, with the pixels kept. +struct Shot { + ctx: Context, + /// One renderer per context. A renderer shared between two contexts + /// takes a texture id from the first and is then asked by the second + /// to free one it never registered. + renderer: WgpuTestRenderer, + time: f64, + size: [f32; 2], + typing: bool, + /// The ground the control is painted on. Without it the render carries a + /// transparent background, which reads as a rendering fault. + fill: egui::Color32, +} + +impl Shot { + fn new(theme: Theme, size: [f32; 2]) -> Shot { + let ctx = Context::default(); + ctx.enable_accesskit(); + let visuals = if theme == Theme::Dark { Visuals::dark() } else { Visuals::light() }; + let fill = visuals.panel_fill; + ctx.set_visuals(visuals); + ctx.all_styles_mut(|style| { + style.animation_time = 0.0; + style.visuals.text_cursor.blink = false; + }); + Shot { ctx, renderer: WgpuTestRenderer::new(), time: 0.0, size, typing: false, fill } + } + + fn frame(&mut self, events: Vec, mut draw: impl FnMut(&mut egui::Ui)) -> FullOutput { + self.time += 1.0 / 60.0; + let raw = RawInput { + screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(self.size[0], self.size[1]))), + time: Some(self.time), + events, + ..Default::default() + }; + let ctx = self.ctx.clone(); + if self.typing { + ctx.memory_mut(|m| m.request_focus(ShareDialog::query_field_id())); + } + let fill = self.fill; + let size = self.size; + let mut output = ctx.run_ui(raw, |ui| { + let screen = Rect::from_min_size(Pos2::ZERO, vec2(size[0], size[1])); + ui.painter().rect_filled(screen, 0.0, fill); + draw(ui); + }); + // Every frame's delta has to reach the renderer. The font atlas arrives + // on the first frame, and a renderer that saw only the last one paints + // no text at all. + self.renderer.handle_delta(&mut output.textures_delta); + output + } + + /// Write what the last frame drew. + fn save(&mut self, into: &std::path::Path, name: &str, theme: Theme, output: &FullOutput) { + let image = self.renderer.render(&self.ctx, output).expect("an offscreen renderer is required to write renders"); + let suffix = if theme == Theme::Dark { "dark" } else { "light" }; + let path = into.join(format!("{name}-{suffix}.png")); + image.save(&path).expect("the render directory must be writable"); + println!("wrote {}", path.display()); + } + + /// Press the control carrying this exact accessible name. + fn click(&mut self, label: &str, draw: &mut impl FnMut(&mut egui::Ui)) { + let output = self.frame(Vec::new(), &mut *draw); + let Some(at) = control(&output, label) else { panic!("nothing to click named {label:?}; on screen are {:?}", controls(&output)) }; + self.frame(vec![Event::PointerMoved(at)], &mut *draw); + self.frame(vec![press(at, true)], &mut *draw); + self.frame(vec![press(at, false)], &mut *draw); + } +} + +fn press(at: Pos2, down: bool) -> Event { + Event::PointerButton { pos: at, button: PointerButton::Primary, pressed: down, modifiers: egui::Modifiers::default() } +} + +struct Seen { + role: accesskit::Role, + label: String, + bounds: Option, + disabled: bool, +} + +impl Seen { + fn interactive(&self) -> bool { + matches!(self.role, accesskit::Role::Button | accesskit::Role::TextInput | accesskit::Role::CheckBox | accesskit::Role::Link) + } + + fn at(&self) -> Option { + self.bounds.map(|b| pos2(((b.x0 + b.x1) / 2.0) as f32, ((b.y0 + b.y1) / 2.0) as f32)) + } +} + +fn seen(output: &FullOutput) -> Vec { + let Some(update) = &output.platform_output.accesskit_update else { return Vec::new() }; + update + .nodes + .iter() + .filter_map(|(_, node)| { + node.label().or_else(|| node.value()).map(|text| Seen { + role: node.role(), + label: text.to_owned(), + bounds: node.bounds(), + disabled: node.is_disabled(), + }) + }) + .collect() +} + +fn control(output: &FullOutput, label: &str) -> Option { + seen(output).iter().find(|s| s.interactive() && !s.disabled && s.label == label).and_then(Seen::at) +} + +fn controls(output: &FullOutput) -> Vec { + seen(output).into_iter().filter(Seen::interactive).map(|s| s.label).collect() +} + +fn person(id: &str, name: &str) -> Contact { + Contact { + id: id.into(), + target: ShareTarget::User(id.into()), + name: name.into(), + email: Some(format!("{id}@example.com")), + avatar: None, + is_group: false, + } +} + +fn existing(id: &str, target: ShareTarget, permission: Permission) -> Share { + Share { id: id.into(), target, display: None, permission, url: None, note: None, created: None } +} + +fn ordinary() -> Vec { + vec![Capability::Files, Capability::Sharing, Capability::Contacts, Capability::ShareNotify, Capability::LinkShares] +} + +#[test] +fn renders_of_every_state_in_both_themes() { + let Ok(directory) = std::env::var("CRAFT_UI_RENDERS") else { + println!("set CRAFT_UI_RENDERS to a directory to write renders"); + return; + }; + let into = PathBuf::from(directory); + std::fs::create_dir_all(&into).expect("the render directory must be creatable"); + for theme in [Theme::Light, Theme::Dark] { + // ---- the account control ------------------------------------------- + let mut shot = Shot::new(theme, [320.0, 300.0]); + // A fresh menu is a signed-out one, which is the first state. + let mut draw = { + let mut menu = AccountMenu::new(); + move |ui: &mut egui::Ui| menu.show(ui) + }; + let output = shot.frame(Vec::new(), &mut draw); + shot.save(&into, "account-signed-out", theme, &output); + + for (name, linked) in [("account-no-storage", false), ("account-linked", true)] { + let mut shot = Shot::new(theme, [320.0, 300.0]); + let mut draw = { + let mut menu = AccountMenu::new(); + menu.set(vec![ + Account { + id: "work".into(), + display: "Will Dunn".into(), + email: Some("will@example.com".into()), + service: "collabcraft.example.com".into(), + linked, + }, + Account { + id: "personal".into(), + display: "Will at home".into(), + email: Some("will@example.net".into()), + service: "cloud.example.net".into(), + linked: true, + }, + ]); + move |ui: &mut egui::Ui| menu.show(ui) + }; + // The menu is behind the badge, so it takes a press to show. + shot.click("Account, Will Dunn", &mut draw); + let output = shot.frame(Vec::new(), &mut draw); + shot.save(&into, name, theme, &output); + } + + // ---- who else is here ---------------------------------------------- + let mut shot = Shot::new(theme, [420.0, 80.0]); + let mut bar = PresenceBar::new(); + bar.set(vec![ + Peer::new("s1", "Ann Reed").at("editing B4"), + Peer::new("s2", "Bob Vine").at("editing D12"), + Peer::new("s3", "Cal Nye"), + Peer::new("s4", "Dee Shaw"), + Peer::new("s5", "Eve Marsh"), + Peer::new("s6", "Fay Orr"), + ]); + let mut draw = move |ui: &mut egui::Ui| { + ui.add_space(24.0); + bar.show(ui); + }; + let output = shot.frame(Vec::new(), &mut draw); + shot.save(&into, "presence", theme, &output); + + // ---- the share dialog ---------------------------------------------- + let cases: Vec<(&str, Vec, Vec, &str)> = vec![ + ("dialog-fresh", ordinary(), Vec::new(), DOCUMENT), + ( + "dialog-who-has-access", + ordinary(), + vec![ + existing("s1", ShareTarget::User("ann".into()), Permission::Edit), + existing("s2", ShareTarget::Group("finance".into()), Permission::View), + ], + DOCUMENT, + ), + ("dialog-no-link-shares", vec![Capability::Sharing, Capability::Contacts], Vec::new(), DOCUMENT), + ("dialog-unsaved", ordinary(), Vec::new(), ""), + ]; + + for (name, capabilities, access, id) in cases { + let mut shot = Shot::new(theme, [620.0, 560.0]); + let fake = Fake { capabilities, access, parked: Arc::default() }; + let mut dialog = ShareDialog::new(); + dialog.connect(fake.clone()); + let held = Rc::new(RefCell::new(dialog)); + let mut draw = { + let held = Rc::clone(&held); + move |ui: &mut egui::Ui| held.borrow_mut().show_in(ui) + }; + // One frame asks what the provider can do, the next reads the answer. + shot.frame(Vec::new(), &mut draw); + shot.frame(Vec::new(), &mut draw); + held.borrow_mut().open(id.to_owned(), "Budget 2026"); + shot.frame(Vec::new(), &mut draw); + let output = shot.frame(Vec::new(), &mut draw); + shot.save(&into, name, theme, &output); + } + + // ---- recipients picked, then one of them refused ------------------- + let fake = Fake { capabilities: ordinary(), access: Vec::new(), parked: Arc::default() }; + let mut dialog = ShareDialog::new(); + dialog.connect(fake.clone()); + let held = Rc::new(RefCell::new(dialog)); + let mut draw = { + let held = Rc::clone(&held); + move |ui: &mut egui::Ui| held.borrow_mut().show_in(ui) + }; + let mut shot = Shot::new(theme, [620.0, 560.0]); + // One frame asks what the provider can do, the next reads the answer. + // Opening before that answer arrives does nothing, which is the point + // of a control that refuses to appear when it cannot work. + shot.frame(Vec::new(), &mut draw); + shot.frame(Vec::new(), &mut draw); + held.borrow_mut().open(DOCUMENT.to_owned(), "Budget 2026"); + shot.frame(Vec::new(), &mut draw); + shot.typing = true; + shot.frame(vec![Event::Text("an".to_owned())], &mut draw); + shot.time += 0.25; + shot.frame(Vec::new(), &mut draw); + fake.answer(Answer::Lookup(vec![person("ann", "Ann Reed")])); + shot.frame(Vec::new(), &mut draw); + shot.click("Ann Reed", &mut draw); + shot.typing = false; + let output = shot.frame(Vec::new(), &mut draw); + shot.save(&into, "dialog-recipients", theme, &output); + + shot.click("Send", &mut draw); + fake.answer(Answer::Granted { + shared: vec![existing("s1", ShareTarget::User("ann".into()), Permission::View)], + failed: vec![Failure { + target: ShareTarget::User("bob".into()), + code: "invalid_address".into(), + detail: "bob@example.con was rejected".into(), + }], + }); + let output = shot.frame(Vec::new(), &mut draw); + shot.save(&into, "dialog-partial-failure", theme, &output); + } +} diff --git a/crates/ui/tests/share_dialog.rs b/crates/ui/tests/share_dialog.rs new file mode 100644 index 000000000..50dd60df4 --- /dev/null +++ b/crates/ui/tests/share_dialog.rs @@ -0,0 +1,589 @@ +//! Gated on the `share` feature, which is off by default. +#![cfg(feature = "share")] + +//! The share dialog driven through its real widgets, offscreen. +//! +//! Every assertion here reads the accessibility tree the dialog actually +//! produced, or the requests it actually sent, rather than its private state. +//! No window is opened, no GPU is touched and no server is contacted: the +//! backend is a fake that parks each request until a test answers it, which is +//! also how answers are made to arrive late or in the wrong order. + +use std::sync::{Arc, Mutex}; + +use craft_cloud::{Capability, Contact, Permission, Share, ShareTarget}; +use craft_ui::share::{Answer, Failure, Replier, Request, ShareBackend, ShareDialog}; +use egui::{Context, Event, FullOutput, Modifiers, PointerButton, Pos2, RawInput, Rect, accesskit, pos2, vec2}; + +const SCREEN: [f32; 2] = [620.0, 900.0]; +const DOCUMENT: &str = "files/Budget 2026.xlsx"; + +#[derive(Default)] +struct Log { + seen: Vec, + parked: Vec<(Request, Replier)>, +} + +/// A backend that answers what the dialog needs to get going and parks the +/// rest, so a test decides when each answer arrives. +#[derive(Clone)] +struct Fake { + log: Arc>, + capabilities: Vec, + access: Vec, +} + +impl Fake { + fn new(capabilities: Vec, access: Vec) -> Fake { + Fake { log: Arc::new(Mutex::new(Log::default())), capabilities, access } + } + + fn seen(&self) -> Vec { + self.log.lock().map(|log| log.seen.clone()).unwrap_or_default() + } + + fn parked(&self) -> Vec { + self.log.lock().map(|log| log.parked.iter().map(|(r, _)| r.clone()).collect()).unwrap_or_default() + } + + /// Answer the request that has waited longest, which is the ordinary case. + fn answer(&self, answer: Answer) { + self.answer_nth(0, answer); + } + + /// Answer the request parked at `index`, oldest first, so a test can + /// deliver a late answer after a newer one. + fn answer_nth(&self, index: usize, answer: Answer) { + let Some((_, reply)) = self.take(index) else { panic!("nothing is waiting at {index}") }; + reply.answer(answer); + } + + /// Take one parked request back, to refuse it or inspect its contents. + fn take(&self, index: usize) -> Option<(Request, Replier)> { + self.log.lock().ok().and_then(|mut log| if index < log.parked.len() { Some(log.parked.remove(index)) } else { None }) + } +} + +impl ShareBackend for Fake { + fn submit(&self, request: Request, reply: Replier) { + let Ok(mut log) = self.log.lock() else { return }; + log.seen.push(request.clone()); + match &request { + Request::Capabilities => { + reply.answer(Answer::Capabilities { capabilities: self.capabilities.clone(), linked: true }); + } + Request::Access { .. } => reply.answer(Answer::Access(self.access.clone())), + _ => log.parked.push((request, reply)), + } + } +} + +struct Harness { + ctx: Context, + dialog: ShareDialog, + time: f64, + typing: bool, +} + +impl Harness { + fn new(capabilities: Vec, access: Vec) -> (Harness, Fake) { + let ctx = Context::default(); + ctx.enable_accesskit(); + ctx.all_styles_mut(|style| { + style.animation_time = 0.0; + style.visuals.text_cursor.blink = false; + }); + let fake = Fake::new(capabilities, access); + let mut dialog = ShareDialog::new(); + dialog.connect(fake.clone()); + let mut harness = Harness { ctx, dialog, time: 0.0, typing: false }; + // One frame asks what the provider can do, the next reads the answer. + harness.frame(Vec::new()); + harness.frame(Vec::new()); + (harness, fake) + } + + /// An ordinary deployment: files, sharing, contacts and mail. + fn everything() -> (Harness, Fake) { + Harness::new( + // Everything, which has to include ShareNotify. Notifying a + // recipient of a share is a separate ability from sending + // arbitrary mail, and the box is gated on the former. + vec![Capability::Files, Capability::Sharing, Capability::Contacts, Capability::Mail, Capability::ShareNotify], + Vec::new(), + ) + } + + fn frame(&mut self, events: Vec) -> FullOutput { + self.time += 1.0 / 60.0; + let raw = RawInput { + screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(SCREEN[0], SCREEN[1]))), + time: Some(self.time), + events, + ..Default::default() + }; + let ctx = self.ctx.clone(); + if self.typing { + // Keeping the recipient field focused is what a user holding the + // caret there does; nothing else in the dialog wants focus. + ctx.memory_mut(|m| m.request_focus(ShareDialog::query_field_id())); + } + let dialog = &mut self.dialog; + let mut output = ctx.run_ui(raw, |ui| dialog.show_in(ui)); + output.textures_delta.clear(); + output + } + + /// Let the clock run, for the debounce. + fn wait(&mut self, seconds: f64) -> FullOutput { + self.time += seconds; + self.frame(Vec::new()) + } + + fn open(&mut self) { + self.dialog.open(DOCUMENT, "Budget 2026.xlsx"); + assert!(self.dialog.is_open(), "the dialog should have opened"); + self.frame(Vec::new()); + } + + /// Type into the recipient field, then let the debounce elapse. + fn type_and_settle(&mut self, text: &str) { + self.typing = true; + self.frame(vec![Event::Text(text.to_owned())]); + self.wait(0.25); + } + + fn click(&mut self, label: &str) { + let output = self.frame(Vec::new()); + let Some(at) = control(&output, label) else { + panic!("nothing to click labelled {label:?}; the controls on screen are {:?}", controls(&output)) + }; + self.frame(vec![Event::PointerMoved(at)]); + self.frame(vec![press(at, true)]); + self.frame(vec![press(at, false)]); + self.frame(Vec::new()); + } +} + +fn press(at: Pos2, pressed: bool) -> Event { + Event::PointerButton { pos: at, button: PointerButton::Primary, pressed, modifiers: Modifiers::NONE } +} + +fn key(key: egui::Key) -> Event { + Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE } +} + +/// One widget as the accessibility tree reported it. +struct Seen { + role: accesskit::Role, + label: String, + bounds: Option, + disabled: bool, +} + +impl Seen { + /// Something a pointer can act on, as opposed to a piece of text. + fn interactive(&self) -> bool { + matches!(self.role, accesskit::Role::Button | accesskit::Role::RadioButton | accesskit::Role::CheckBox) + } + + fn at(&self) -> Option { + self.bounds.map(|b| pos2(((b.x0 + b.x1) / 2.0) as f32, ((b.y0 + b.y1) / 2.0) as f32)) + } +} + +fn seen(output: &FullOutput) -> Vec { + let Some(tree) = output.platform_output.accesskit_update.as_ref() else { return Vec::new() }; + tree.nodes + .iter() + .filter_map(|(_, node)| { + // egui puts a plain label's text in the accessibility value and a + // control's text in the label, so both are text on screen. + node.label().or_else(|| node.value()).map(|text| Seen { + role: node.role(), + label: text.to_owned(), + bounds: node.bounds(), + disabled: node.is_disabled(), + }) + }) + .collect() +} + +/// Where to click the control carrying this exact label. +fn control(output: &FullOutput, label: &str) -> Option { + seen(output).iter().find(|s| s.interactive() && !s.disabled && s.label == label).and_then(Seen::at) +} + +fn controls(output: &FullOutput) -> Vec { + seen(output).into_iter().filter(Seen::interactive).map(|s| s.label).collect() +} + +/// The buttons alone, which is what a chip and a match row are. +fn buttons(output: &FullOutput) -> Vec { + seen(output).into_iter().filter(|s| s.role == accesskit::Role::Button).map(|s| s.label).collect() +} + +/// Every piece of text on screen, for asserting what the user was told. +fn text(output: &FullOutput) -> Vec { + seen(output).into_iter().map(|s| s.label).collect() +} + +/// The primary action, taken from the defaults the dialog actually draws. +/// A literal here drifts the moment the wording changes. +const SEND: &str = "Send"; + +/// The permission dropdown, chevron included. It is a menu, not a toggle. +const PERMISSION: &str = "View"; + +fn says(output: &FullOutput, fragment: &str) -> bool { + text(output).iter().any(|line| line.contains(fragment)) +} + +fn person(id: &str, name: &str) -> Contact { + Contact { + id: id.into(), + target: ShareTarget::User(id.into()), + name: name.into(), + email: Some(format!("{id}@example.com")), + avatar: None, + is_group: false, + } +} + +fn group(id: &str, name: &str) -> Contact { + Contact { id: id.into(), target: ShareTarget::Group(id.into()), name: name.into(), email: None, avatar: None, is_group: true } +} + +fn existing(id: &str, target: ShareTarget, permission: Permission) -> Share { + Share { id: id.into(), target, display: None, permission, url: None, note: None, created: None } +} + +fn lookup(found: Vec) -> Answer { + Answer::Lookup(found) +} + +// ---- the picker ----------------------------------------------------------- + +#[test] +fn typing_a_few_letters_offers_matches_and_picking_them_builds_chips() { + let (mut h, fake) = Harness::everything(); + h.open(); + + h.type_and_settle("an"); + h.frame(Vec::new()); + assert_eq!( + fake.parked(), + vec![Request::Lookup { query: "an".into(), limit: 8 }], + "one lookup for the whole burst of typing, not one per keystroke" + ); + + fake.answer(lookup(vec![person("ann", "Ann Reed"), person("andy", "Andy Shaw"), group("finance", "Finance")])); + let output = h.frame(Vec::new()); + for name in ["Ann Reed", "Andy Shaw", "Finance"] { + assert!(buttons(&output).iter().any(|b| b == name), "{name} should be offered; saw {:?}", buttons(&output)); + } + + // Three recipients, picked one after another. Each lands as a chip whose + // whole body is the control that takes it back again. + h.click("Ann Reed"); + h.type_and_settle("an"); + fake.answer(lookup(vec![person("andy", "Andy Shaw")])); + h.frame(Vec::new()); + h.click("Andy Shaw"); + h.type_and_settle("fin"); + fake.answer(lookup(vec![group("finance", "Finance")])); + h.frame(Vec::new()); + h.click("Finance"); + + let output = h.frame(Vec::new()); + for name in ["Remove Ann Reed", "Remove Andy Shaw", "Remove Finance"] { + assert!(buttons(&output).iter().any(|b| b == name), "{name} should be a chip; saw {:?}", buttons(&output)); + } +} + +#[test] +fn a_chip_takes_one_recipient_back_and_leaves_the_others() { + let (mut h, fake) = Harness::everything(); + h.open(); + for (query, found) in [("an", person("ann", "Ann Reed")), ("bo", person("bob", "Bob Vine")), ("ca", person("cal", "Cal Nye"))] { + h.type_and_settle(query); + fake.answer(lookup(vec![found.clone()])); + h.frame(Vec::new()); + h.click(&found.name); + } + h.typing = false; + + h.click("Remove Bob Vine"); + let output = h.frame(Vec::new()); + assert!(buttons(&output).iter().any(|b| b == "Remove Ann Reed")); + assert!(buttons(&output).iter().any(|b| b == "Remove Cal Nye")); + assert!(!buttons(&output).iter().any(|b| b == "Remove Bob Vine"), "the removed chip is gone; saw {:?}", buttons(&output)); + + // And the share that follows carries the two that are left. + h.click(SEND); + let parked = fake.parked(); + let Some(Request::Grant(grant)) = parked.first() else { panic!("expected a share, saw {parked:?}") }; + assert_eq!(grant.targets, vec![ShareTarget::User("ann".into()), ShareTarget::User("cal".into())]); +} + +#[test] +fn an_answer_the_user_has_typed_past_never_reaches_the_list() { + let (mut h, fake) = Harness::everything(); + h.open(); + + // Two bursts of typing, so two lookups are outstanding at once. + h.type_and_settle("an"); + h.frame(Vec::new()); + h.type_and_settle("ann"); + h.frame(Vec::new()); + assert_eq!(fake.parked().len(), 2); + + // The newer one answers first and the older one arrives late, which is + // what a service under load does. + fake.answer_nth(1, lookup(vec![person("ann", "Ann Reed")])); + h.frame(Vec::new()); + fake.answer_nth(0, lookup(vec![person("andy", "Andy Shaw"), person("anna", "Anna Beck")])); + let output = h.frame(Vec::new()); + + assert!(buttons(&output).iter().any(|b| b == "Ann Reed"), "the current answer stays"); + assert!(!says(&output, "Andy Shaw"), "the stale answer must not flicker in"); + assert!(!says(&output, "Anna Beck")); +} + +#[test] +fn one_letter_is_not_worth_asking_about() { + let (mut h, fake) = Harness::everything(); + h.open(); + h.type_and_settle("a"); + h.frame(Vec::new()); + assert!(fake.parked().is_empty(), "a single letter matches most of an address book"); + + h.frame(vec![Event::Text("n".to_owned())]); + h.wait(0.25); + h.frame(Vec::new()); + assert_eq!(fake.parked(), vec![Request::Lookup { query: "an".into(), limit: 8 }]); +} + +#[test] +fn nothing_is_asked_until_the_typing_stops() { + let (mut h, fake) = Harness::everything(); + h.open(); + h.typing = true; + // Five keystrokes inside the debounce window. + for letter in ["a", "n", "n", "i", "e"] { + h.frame(vec![Event::Text(letter.to_owned())]); + h.wait(0.03); + } + assert!(fake.parked().is_empty(), "nothing asked while the user is still typing"); + + h.wait(0.25); + h.frame(Vec::new()); + assert_eq!(fake.parked(), vec![Request::Lookup { query: "annie".into(), limit: 8 }], "one question for the whole word"); +} + +// ---- what a share says ---------------------------------------------------- + +#[test] +fn sharing_with_five_where_one_address_is_wrong_names_the_one_that_failed() { + let (mut h, fake) = Harness::everything(); + h.open(); + for (query, found) in [("an", person("ann", "Ann Reed")), ("bo", person("bob", "Bob Vine"))] { + h.type_and_settle(query); + fake.answer(lookup(vec![found.clone()])); + h.frame(Vec::new()); + h.click(&found.name); + } + h.typing = false; + h.click(SEND); + + fake.answer(Answer::Granted { + shared: vec![existing("s1", ShareTarget::User("ann".into()), Permission::View)], + failed: vec![Failure { + target: ShareTarget::User("bob".into()), + code: "invalid_address".into(), + detail: "bob@example.con was rejected".into(), + }], + }); + let output = h.frame(Vec::new()); + + assert!(says(&output, "Shared with"), "the ones that went through are named"); + assert!(says(&output, "ann")); + assert!(says(&output, "Not shared with"), "and so is the one that did not"); + assert!(says(&output, "bob@example.con was rejected"), "with the reason, not a count; saw {:?}", text(&output)); + + // The failed recipient stays in the picker so a correction is one edit. + assert!(buttons(&output).iter().any(|b| b == "Remove Bob Vine")); + assert!(!buttons(&output).iter().any(|b| b == "Remove Ann Reed"), "the one that worked has left"); +} + +#[test] +fn a_refusal_that_stopped_everything_is_shown_as_itself() { + let (mut h, fake) = Harness::everything(); + h.open(); + h.type_and_settle("an"); + fake.answer(lookup(vec![person("ann", "Ann Reed")])); + h.frame(Vec::new()); + h.click("Ann Reed"); + h.typing = false; + h.click(SEND); + + let Some((_, reply)) = fake.take(0) else { panic!("expected a share in flight") }; + reply.refuse("sign in again"); + let output = h.frame(Vec::new()); + + assert!(says(&output, "sign in again")); + assert!(!says(&output, "Not shared with"), "a refusal is not a per-recipient failure"); + assert!(control(&output, SEND).is_some(), "the button comes back"); +} + +#[test] +fn a_note_and_a_permission_travel_with_the_share() { + let (mut h, fake) = Harness::everything(); + h.open(); + h.type_and_settle("an"); + fake.answer(lookup(vec![person("ann", "Ann Reed")])); + h.frame(Vec::new()); + h.click("Ann Reed"); + h.typing = false; + // The permission is a menu now, so it takes opening before choosing. + h.click(PERMISSION); + h.click("Edit"); + h.click(SEND); + + let parked = fake.parked(); + let Some(Request::Grant(grant)) = parked.first() else { panic!("expected a share, saw {parked:?}") }; + assert_eq!(grant.permission, Permission::Edit); + assert_eq!(grant.id, DOCUMENT, "the handle goes back untouched"); + assert!(grant.notify, "mail works here, and the box is ticked by default"); + assert_eq!(grant.note, None, "an empty note is no note"); +} + +#[test] +fn a_server_that_cannot_send_mail_is_never_promised_a_notification() { + let (mut h, fake) = Harness::new(vec![Capability::Sharing, Capability::Contacts], Vec::new()); + h.open(); + h.type_and_settle("an"); + fake.answer(lookup(vec![person("ann", "Ann Reed")])); + h.frame(Vec::new()); + h.click("Ann Reed"); + h.typing = false; + h.click(SEND); + + let parked = fake.parked(); + let Some(Request::Grant(grant)) = parked.first() else { panic!("expected a share, saw {parked:?}") }; + assert!(!grant.notify, "a checkbox for mail a server cannot send must not be honoured"); +} + +#[test] +fn a_server_without_contacts_asks_nobody_anything() { + let (mut h, fake) = Harness::new(vec![Capability::Sharing], Vec::new()); + h.open(); + h.type_and_settle("ann"); + h.frame(Vec::new()); + assert!(fake.parked().is_empty(), "there is no address book to search"); +} + +// ---- who already has access ---------------------------------------------- + +#[test] +fn who_has_access_is_listed_and_one_can_be_withdrawn() { + let (mut h, fake) = Harness::new( + vec![Capability::Sharing, Capability::Contacts, Capability::Mail], + vec![ + existing("s1", ShareTarget::User("ann".into()), Permission::Edit), + existing("s2", ShareTarget::Group("finance".into()), Permission::View), + ], + ); + h.open(); + let output = h.frame(Vec::new()); + assert!(says(&output, "Who has access")); + assert!(says(&output, "ann")); + assert!(says(&output, "finance (group)")); + assert_eq!(buttons(&output).iter().filter(|b| *b == "Withdraw").count(), 2); + + h.click("Withdraw"); + assert!(fake.seen().iter().any(|r| matches!(r, Request::Withdraw { share_id } if share_id == "s1" || share_id == "s2"))); + + // It stays on the list until the server agrees it is gone. + let output = h.frame(Vec::new()); + assert!(says(&output, "Withdrawing…")); + let Some((Request::Withdraw { share_id }, reply)) = fake.take(0) else { panic!("expected a withdrawal in flight") }; + reply.answer(Answer::Withdrawn { share_id: share_id.clone() }); + let output = h.frame(Vec::new()); + assert_eq!(buttons(&output).iter().filter(|b| *b == "Withdraw").count(), 1, "one left"); +} + +#[test] +fn a_document_nobody_has_been_given_says_so() { + let (mut h, _fake) = Harness::everything(); + h.open(); + let output = h.frame(Vec::new()); + assert!(says(&output, "Nobody else yet")); +} + +// ---- what the dialog refuses to offer ------------------------------------- + +#[test] +fn a_server_without_sharing_draws_no_dialog_at_all() { + let (mut h, fake) = Harness::new(vec![Capability::Files, Capability::Contacts], Vec::new()); + assert!(!h.dialog.available()); + h.dialog.open(DOCUMENT, "Budget 2026.xlsx"); + assert!(!h.dialog.is_open(), "a feature the provider lacks is hidden, not offered"); + let output = h.frame(Vec::new()); + assert!(buttons(&output).is_empty(), "nothing to click; saw {:?}", buttons(&output)); + assert!(!fake.seen().iter().any(|r| matches!(r, Request::Access { .. })), "and nothing was asked about the document"); +} + +#[test] +fn an_unsaved_document_is_told_to_save_rather_than_refused_by_the_server() { + let (mut h, fake) = Harness::everything(); + h.dialog.open("", "Book1"); + let output = h.frame(Vec::new()); + assert!(says(&output, "Save this document somewhere to share it.")); + assert!(control(&output, SEND).is_none(), "there is nothing to share yet"); + assert!(!fake.seen().iter().any(|r| matches!(r, Request::Access { .. }))); +} + +#[test] +fn closing_puts_the_dialog_away() { + let (mut h, _fake) = Harness::everything(); + h.open(); + h.click("Close"); + assert!(!h.dialog.is_open()); + let output = h.frame(Vec::new()); + assert!(buttons(&output).is_empty()); +} + +#[test] +fn a_typed_address_says_how_to_add_it_and_adding_it_works() { + let (mut h, fake) = Harness::everything(); + h.open(); + h.type_and_settle("outside@example.com"); + fake.answer(lookup(Vec::new())); + let output = h.frame(Vec::new()); + assert!(says(&output, "Press Return to share with this address"), "saw {:?}", text(&output)); + assert!(!says(&output, "No matches"), "an address that matched nobody is still a recipient"); + + // Return takes it, and the share carries it as an address. + h.frame(vec![key(egui::Key::Enter)]); + h.frame(Vec::new()); + h.typing = false; + let output = h.frame(Vec::new()); + assert!(buttons(&output).iter().any(|b| b == "Remove outside@example.com"), "saw {:?}", buttons(&output)); + + h.click(SEND); + let parked = fake.parked(); + let Some(Request::Grant(grant)) = parked.first() else { panic!("expected a share, saw {parked:?}") }; + assert_eq!(grant.targets, vec![ShareTarget::Email("outside@example.com".into())]); +} + +#[test] +fn a_name_that_matched_nobody_is_not_offered_as_an_address() { + let (mut h, fake) = Harness::everything(); + h.open(); + h.type_and_settle("nobody"); + fake.answer(lookup(Vec::new())); + let output = h.frame(Vec::new()); + assert!(says(&output, "No matches")); + assert!(!says(&output, "Press Return")); +} From b1fce2be7483d345e40d5f02e1ee66f3899e5d8e Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 11 Nov 2026 09:52:15 -0500 Subject: [PATCH 010/183] craft-ui cloud pages: move off deprecated egui aliases The current egui pin denies the deprecated egui::WidgetType alias and egui::Id::new. The slice's pages (account, cloud, share, presence, the menu helper) move to egui::Role::Button and egui::Id::unique, the same spellings main's craft-ui already uses. --- crates/ui/src/account.rs | 8 ++++---- crates/ui/src/cloud/mod.rs | 2 +- crates/ui/src/cloud/pages.rs | 2 +- crates/ui/src/menu.rs | 6 +++--- crates/ui/src/presence.rs | 4 ++-- crates/ui/src/share/mod.rs | 12 ++++++------ 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/crates/ui/src/account.rs b/crates/ui/src/account.rs index d83214500..9c8921064 100644 --- a/crates/ui/src/account.rs +++ b/crates/ui/src/account.rs @@ -243,7 +243,7 @@ impl AccountMenu { let label = format!("{}\n{}", one.display, one.service); let row = ui.add(egui::Button::new(label).wrap_mode(egui::TextWrapMode::Extend)); let name = one.display.clone(); - row.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + row.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, name.as_str())); if row.clicked() { let _ = tx.send(AccountAction::Use(one.id.clone())); ui.close(); @@ -263,7 +263,7 @@ impl AccountMenu { let badge = egui::Button::new(RichText::new(account.initial()).strong()).min_size(egui::vec2(26.0, 26.0)).corner_radius(13.0); let hit = ui.add(badge); let spoken = labels.badge.replace("{name}", &account.display); - hit.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, spoken.as_str())); + hit.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, spoken.as_str())); let hit = hit.on_hover_text(account.display.as_str()); egui::Popup::menu(&hit).show(|ui| { @@ -321,7 +321,7 @@ impl AccountMenu { let label = format!("{}\n{}", other.display, other.service); let row = ui.add(egui::Button::new(label).wrap_mode(egui::TextWrapMode::Extend)); let name = other.display.clone(); - row.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + row.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, name.as_str())); if row.clicked() { let _ = tx.send(AccountAction::Use(other.id.clone())); ui.close(); @@ -347,7 +347,7 @@ impl AccountMenu { /// Draw the badge in a context that has no `Ui` to hand. pub fn show_in_ctx(&mut self, ctx: &Context) { - egui::Area::new(egui::Id::new("craft-ui/account")).anchor(egui::Align2::RIGHT_TOP, egui::vec2(-8.0, 8.0)).show(ctx, |ui| { + egui::Area::new(egui::Id::unique("craft-ui/account")).anchor(egui::Align2::RIGHT_TOP, egui::vec2(-8.0, 8.0)).show(ctx, |ui| { self.show(ui); }); } diff --git a/crates/ui/src/cloud/mod.rs b/crates/ui/src/cloud/mod.rs index 220afc04e..a8d001a0b 100644 --- a/crates/ui/src/cloud/mod.rs +++ b/crates/ui/src/cloud/mod.rs @@ -837,7 +837,7 @@ fn entry_row(app: &A, ui: &mut Ui, entry: &Entry, detail: &str, res let width = (ui.available_width() - reserve).max(60.0); let (rect, resp) = ui.allocate_exact_size(vec2(width, 40.0), Sense::click()); let label = entry.name.clone(); - resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, &label)); + resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, &label)); let p = ui.painter(); if resp.hovered() { p.rect_filled(rect, 4.0, style.hover); diff --git a/crates/ui/src/cloud/pages.rs b/crates/ui/src/cloud/pages.rs index fa1ead8be..b8187cf67 100644 --- a/crates/ui/src/cloud/pages.rs +++ b/crates/ui/src/cloud/pages.rs @@ -469,7 +469,7 @@ pub fn conflict_modal(app: &mut A, ctx: &egui::Context) { let mut reload = false; let mut copy = false; let mut dismiss = false; - egui::Modal::new(egui::Id::new("craft-ui/cloud/conflict")).show(ctx, |ui| { + egui::Modal::new(egui::Id::unique("craft-ui/cloud/conflict")).show(ctx, |ui| { let style = app.style(ui); ui.set_width(430.0); ui.label(RichText::new(&words.title).font(egui::FontId::new(15.0, style.bold.clone()))); diff --git a/crates/ui/src/menu.rs b/crates/ui/src/menu.rs index 2b18340bf..70189a56f 100644 --- a/crates/ui/src/menu.rs +++ b/crates/ui/src/menu.rs @@ -104,7 +104,7 @@ pub fn overflow(ui: &mut Ui, items: &[MenuItem], labels: &MenuLabels) -> Option< let button = egui::Button::new(RichText::new("\u{2026}").size(15.0)).frame(false); let hit = ui.add(button); let name = labels.more.clone(); - hit.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + hit.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, name.as_str())); let hit = hit.on_hover_text(labels.more.as_str()); items_of(&hit, items) } @@ -142,7 +142,7 @@ pub fn split(ui: &mut Ui, primary: &str, items: &[MenuItem], labels: &MenuLabels let more = ui.add(egui::Button::new(" ").corner_radius(if backwards { outer } else { inner })); crate::buttons::chevron(ui, more.rect, ui.visuals().text_color()); let name = labels.more_for.replace("{action}", &primary.to_lowercase()); - more.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + more.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, name.as_str())); let more = more.on_hover_text(name.as_str()); if let Some(id) = items_of(&more, items) { *hit = Some(SplitHit::Item(id)); @@ -177,7 +177,7 @@ fn items_of(anchor: &Response, items: &[MenuItem]) -> Option { // The icon is decoration. The name is the label alone. let name = item.label.clone(); let enabled = item.enabled; - row.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, enabled, name.as_str())); + row.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, enabled, name.as_str())); if row.clicked() { chosen = Some(item.id.clone()); ui.close(); diff --git a/crates/ui/src/presence.rs b/crates/ui/src/presence.rs index 1da9327d9..f429691bc 100644 --- a/crates/ui/src/presence.rs +++ b/crates/ui/src/presence.rs @@ -283,7 +283,7 @@ impl PresenceBar { let more = self.labels.and_more.replace("{count}", &hidden.to_string()); let weak = ui.visuals().widgets.inactive.bg_fill; let badge = badge(ui, &format!("+{hidden}"), weak, ui.visuals().text_color()); - badge.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, more.as_str())); + badge.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, more.as_str())); badge.on_hover_text(self.peers.iter().skip(self.shown).map(|p| p.display.as_str()).collect::>().join("\n")); } let ids: Vec = self.peers.iter().map(|p| p.id.clone()).collect(); @@ -292,7 +292,7 @@ impl PresenceBar { let ink = colours.get(at).copied().unwrap_or_else(|| peer.colour()); let hit = badge(ui, &peer.initial(), ink, Color32::WHITE); let name = peer.display.clone(); - hit.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + hit.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, name.as_str())); let tip = match &peer.at { Some(at) => format!("{}\n{at}", peer.display), None => peer.display.clone(), diff --git a/crates/ui/src/share/mod.rs b/crates/ui/src/share/mod.rs index 5dbcf6c06..e38067411 100644 --- a/crates/ui/src/share/mod.rs +++ b/crates/ui/src/share/mod.rs @@ -566,7 +566,7 @@ impl ShareDialog { /// The recipient field's id, for an application that wants to focus it. pub fn query_field_id() -> Id { - Id::new(QUERY) + Id::unique(QUERY) } /// One frame, as a modal over the window. Call this unconditionally: @@ -576,7 +576,7 @@ impl ShareDialog { if self.open.is_none() { return; } - let modal = egui::Modal::new(Id::new("craft-ui/share")).show(ctx, |ui| { + let modal = egui::Modal::new(Id::unique("craft-ui/share")).show(ctx, |ui| { ui.set_min_width(440.0); ui.set_max_width(560.0); self.contents(ui); @@ -1076,7 +1076,7 @@ fn permission_menu(ui: &mut Ui, sheet: &mut Sheet, labels: &ShareLabels) { crate::buttons::chevron(ui, button.rect, ui.visuals().text_color()); // The padding makes room for the triangle. It is layout, so it must not // reach anybody reading the screen aloud. - button.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, current)); + button.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, current)); egui::Popup::menu(&button).show(|ui| { ui.set_min_width(190.0); for (value, name, detail) in [ @@ -1277,7 +1277,7 @@ fn access(ui: &mut Ui, sheet: &Sheet, labels: &ShareLabels, weak: Color32, acts: // A glyph is not a name. Left alone this button announces itself // to a screen reader as a wastebasket character, so the word goes // on explicitly. - pressed.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, !busy, hint)); + pressed.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, !busy, hint)); if pressed.on_hover_text(hint).clicked() { acts.push(Act::Withdraw(share.id.clone())); } @@ -1322,7 +1322,7 @@ fn chip(ui: &mut Ui, avatars: &HashMap, chosen: &Chosen, labels: let fill = if response.hovered() { ui.visuals().widgets.hovered.bg_fill } else { ui.visuals().widgets.inactive.bg_fill }; ui.painter().set(background, egui::Shape::rect_filled(response.rect, CornerRadius::same(AVATAR_RADIUS), fill)); let label = format!("{} {}", labels.remove, chosen.label); - response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), label.clone())); + response.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), label.clone())); // The address, where there is one. Two colleagues share a display name // often enough that a chip reading "Ann Reed" is not an identity. let hint = match &chosen.detail { @@ -1358,7 +1358,7 @@ fn row(ui: &mut Ui, avatars: &HashMap, contact: &Contact, labels ui.painter().set(background, egui::Shape::rect_filled(response.rect, CornerRadius::same(4), ui.visuals().widgets.hovered.bg_fill)); } let label = contact.name.clone(); - response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), label.clone())); + response.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), label.clone())); response } From 07d2747efcd1860e062bbd7a29f1efec07ab3a11 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 11 Nov 2026 10:02:58 -0500 Subject: [PATCH 011/183] craft-cloud-local: collapse the etag conflict check into one let chain The current clippy denies collapsible_if here. Behaviour is unchanged. A missing file still has nothing to conflict with. --- crates/cloud-local/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/cloud-local/src/lib.rs b/crates/cloud-local/src/lib.rs index c9c11c015..7f7f56590 100644 --- a/crates/cloud-local/src/lib.rs +++ b/crates/cloud-local/src/lib.rs @@ -190,10 +190,10 @@ fn read(root: &Path, entry: &Entry) -> Result, Fault> { /// conflict with, the same way a provider treats a deleted document. fn write(root: &Path, entry: &Entry, bytes: &[u8]) -> Result { let file = resolve(root, &entry.id)?; - if let Ok(meta) = fs::metadata(&file) { - if Some(etag_of(&meta)) != entry.etag { - return Err(Fault::Conflict); - } + if let Ok(meta) = fs::metadata(&file) + && Some(etag_of(&meta)) != entry.etag + { + return Err(Fault::Conflict); } if let Some(parent) = file.parent() { fs::create_dir_all(parent).map_err(|error| io_fault(&error))?; From a1703412251e11b215a05494feda6f5a4c05cdee Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 11 Nov 2026 10:07:25 -0500 Subject: [PATCH 012/183] craft-cloud-local test: name the opened-documents type The current clippy warns on the inline Arc Mutex tuple type in the test harness. A named OpenedDocs alias carries the same meaning. --- Cargo.lock | 19 +++++++++++++++++++ crates/cloud-local/tests/backend.rs | 5 ++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 1ac11475f..5b17106b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1616,6 +1616,24 @@ dependencies = [ "craft-media-testkit", ] +[[package]] +name = "craft-cloud" +version = "0.1.0" +dependencies = [ + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-cloud-local" +version = "0.1.0" +dependencies = [ + "craft-cloud", + "craft-ui", + "egui", + "tempfile", +] + [[package]] name = "craft-cms" version = "0.1.0" @@ -3191,6 +3209,7 @@ dependencies = [ name = "craft-ui" version = "0.1.0" dependencies = [ + "craft-cloud", "craft-fonts-build", "craft-i18n", "eframe", diff --git a/crates/cloud-local/tests/backend.rs b/crates/cloud-local/tests/backend.rs index 4176672f1..d2a9fd4e5 100644 --- a/crates/cloud-local/tests/backend.rs +++ b/crates/cloud-local/tests/backend.rs @@ -12,6 +12,9 @@ use craft_ui::cloud::{self, Account, CloudApp, CloudFiles, Destination, Document const NOTE: DocumentKind = DocumentKind { extensions: &["txt"], mimes: &["text/plain"], noun: "note", default_extension: "txt" }; +/// A document the harness was told to open: its name and its bytes. +type OpenedDocs = Arc)>>>; + /// The least a [`CloudApp`] can be. What it was told to open is recorded, so a /// round trip can be checked by content and not only by the entry metadata /// `craft_ui` itself remembers. @@ -19,7 +22,7 @@ struct Harness { cloud: CloudFiles, share: craft_ui::share::ShareDialog, presence: craft_ui::presence::PresenceBar, - opened: Arc)>>>, + opened: OpenedDocs, said: Arc>>, } From b49ac50ed5fede61562711419189714b4c13d98c Mon Sep 17 00:00:00 2001 From: William Dunn Date: Thu, 12 Nov 2026 23:28:02 -0500 Subject: [PATCH 013/183] craft-ui cloud: fix conflict modal and session identity bugs Reload from the conflict modal now acts on the conflicted document's uid. Save as a copy acts on that same uid too. Neither acts on the active tab anymore. A window with more than one document open keeps them separate. Sign-out bumps an account generation. Sign-in bumps it too. Each clears busy. A job's reply carries the generation it was issued under. A reply from an older generation gets dropped. A stale session cannot restore its account or its files over a newer one. A job that never answers cannot refuse every save afterward. Regression tests for both pairs of findings run through a held backend that answers jobs on the test's own schedule. --- crates/ui/src/cloud/backend.rs | 26 ++- crates/ui/src/cloud/conflict_tests.rs | 236 ++++++++++++++++++++++++++ crates/ui/src/cloud/mod.rs | 38 ++++- crates/ui/src/cloud/pages.rs | 16 +- 4 files changed, 305 insertions(+), 11 deletions(-) create mode 100644 crates/ui/src/cloud/conflict_tests.rs diff --git a/crates/ui/src/cloud/backend.rs b/crates/ui/src/cloud/backend.rs index b6da57960..f92328cef 100644 --- a/crates/ui/src/cloud/backend.rs +++ b/crates/ui/src/cloud/backend.rs @@ -9,6 +9,8 @@ //! testable with no service running. A host supplies the half that does. This //! crate never learns what it reaches. +use std::sync::Arc; +use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::mpsc::Sender; use craft_cloud::{Capability, Conversation, Entry}; @@ -76,20 +78,36 @@ pub enum Event { /// the user finished there. A send after the window closed is not a failure. pub struct Post { tx: Sender, + /// The window's account generation as of the moment the job this answers + /// was issued, beside a handle to what it is now. A sign-out or a new + /// sign-in bumps the live value; a reply that arrives after is for a + /// session that is gone, and must not land on the one that replaced it. + generation: Arc, + issued: u64, } impl Post { - pub(crate) fn new(tx: Sender) -> Post { - Post { tx } + pub(crate) fn new(tx: Sender, generation: Arc) -> Post { + let issued = generation.load(Ordering::Relaxed); + Post { tx, generation, issued } } /// Another handle to the same place, for a worker that answers more than - /// once or hands the job on. + /// once or hands the job on. Carries the same generation: every answer to + /// one job was issued at the same moment, however many of them there are. pub fn dup(&self) -> Post { - Post { tx: self.tx.clone() } + Post { tx: self.tx.clone(), generation: self.generation.clone(), issued: self.issued } } + /// Delivers the event, unless the window has signed out or signed in + /// again since the job this answers was issued. Silently dropping it + /// there, rather than delivering it, is what keeps a late reply from + /// restoring the previous session's account, files or busy state on top + /// of whatever replaced it. pub fn send(&self, event: Event) { + if self.generation.load(Ordering::Relaxed) != self.issued { + return; + } let _ = self.tx.send(event); } } diff --git a/crates/ui/src/cloud/conflict_tests.rs b/crates/ui/src/cloud/conflict_tests.rs new file mode 100644 index 000000000..29a83799d --- /dev/null +++ b/crates/ui/src/cloud/conflict_tests.rs @@ -0,0 +1,236 @@ +//! Two risks a tabbed host runs that a single-document test cannot see: a document other than +//! the one a conflict or a job is about can be active when the answer lands, and a session that +//! ended can still have a job outstanding. +//! +//! `Tabs` is a host with two open documents (a tabbed window) and `Held` is a backend that keeps +//! every job so the test decides when, and with what, the service answers. + +use std::sync::{Arc, Mutex}; + +use craft_cloud::{Capability, Entry, EntryKind}; +use egui_kittest::Harness; +use egui_kittest::kittest::Queryable; + +use super::*; + +const NOTES: DocumentKind = DocumentKind { extensions: &["note"], mimes: &["text/plain"], noun: "note", default_extension: "note" }; + +#[derive(Default)] +struct Log { + read: Vec, + encoded: Vec, + closed: Vec, + said: Vec, +} + +struct Tabs { + cloud: CloudFiles, + share: crate::share::ShareDialog, + presence: crate::presence::PresenceBar, + active: u64, + next_uid: u64, + log: Arc>, +} + +impl CloudApp for Tabs { + fn cloud(&self) -> &CloudFiles { + &self.cloud + } + fn cloud_mut(&mut self) -> &mut CloudFiles { + &mut self.cloud + } + fn kind(&self) -> DocumentKind { + NOTES + } + fn active(&self) -> Option { + Some(self.active) + } + fn title(&self, uid: u64) -> String { + format!("doc {uid}") + } + fn open_bytes(&mut self, name: &str, _bytes: Vec) -> Result, String> { + self.log.lock().unwrap().read.push(name.to_owned()); + self.next_uid += 1; + Ok(Some(self.next_uid)) + } + fn encode(&mut self, uid: u64, _into: Destination<'_>) -> Result, String> { + self.log.lock().unwrap().encoded.push(uid); + Ok(format!("bytes of {uid}").into_bytes()) + } + fn close(&mut self, uid: u64) { + self.log.lock().unwrap().closed.push(uid); + } + fn sharing(&mut self) -> &mut crate::share::ShareDialog { + &mut self.share + } + fn presence(&mut self) -> &mut crate::presence::PresenceBar { + &mut self.presence + } + fn paint_icon(&self, _p: &egui::Painter, _r: egui::Rect, _k: EntryKind, _c: egui::Color32) {} + fn open_url(&self, _url: &str) {} + fn say(&mut self, text: String) { + self.log.lock().unwrap().said.push(text); + } + fn app_name(&self) -> &str { + "Notes" + } +} + +#[derive(Clone, Default)] +struct Held(Arc>>); + +impl CloudBackend for Held { + fn submit(&self, job: Job, post: Post) { + self.0.lock().unwrap().push((job, post)); + } +} + +impl Held { + fn take(&self, pick: impl Fn(&Job) -> bool) -> Option<(Job, Post)> { + let mut held = self.0.lock().unwrap(); + let i = held.iter().position(|(j, _)| pick(j))?; + Some(held.remove(i)) + } +} + +fn entry(path: &str, etag: &str) -> Entry { + Entry { + id: path.to_owned(), + room: format!("room:{path}"), + name: path.trim_start_matches('/').to_owned(), + path: path.to_owned(), + kind: EntryKind::File, + size: Some(10), + modified: None, + mime: None, + etag: Some(etag.to_owned()), + writable: true, + shared_by: None, + } +} + +fn account(name: &str) -> Account { + Account { display: name.to_owned(), capabilities: vec![Capability::Files, Capability::Etags], provider_linked: true } +} + +fn drain(app: &mut Tabs, ctx: &egui::Context) { + ctx.begin_pass(Default::default()); + pump(app, ctx); + ctx.end_pass().textures_delta.clear(); +} + +/// Two cloud documents open: uid 1 = A.note, uid 2 = B.note (B has unsaved edits). +fn two_tabs() -> (Tabs, Held, Arc>) { + let held = Held::default(); + let log = Arc::new(Mutex::new(Log::default())); + let mut app = Tabs { + cloud: CloudFiles::new(), + share: crate::share::ShareDialog::new(), + presence: crate::presence::PresenceBar::new(), + active: 1, + next_uid: 10, + log: log.clone(), + }; + app.cloud.connect(held.clone()); + app.cloud.origins.insert(1, Origin { entry: entry("/A.note", "a1") }); + app.cloud.origins.insert(2, Origin { entry: entry("/B.note", "b1") }); + (app, held, log) +} + +/// Save A, the user moves to tab B while the write is on the wire, the service refuses A's write +/// (Conflict). Returns the app with the conflict modal pending, active tab = B. +fn conflict_on_a_while_b_is_active() -> (Tabs, Held, Arc>) { + let (mut app, held, log) = two_tabs(); + save(&mut app).unwrap(); + app.active = 2; + let (job, post) = held.take(|j| matches!(j, Job::Write { .. })).unwrap(); + let Job::Write { uid, .. } = job else { unreachable!() }; + post.send(Event::Saved { uid, entry: Err(Fault::Conflict) }); + let ctx = egui::Context::default(); + drain(&mut app, &ctx); + assert_eq!(app.cloud.conflict.as_ref().map(|c| (c.uid, c.entry.name.clone())), Some((1, "A.note".to_owned()))); + (app, held, log) +} + +fn click_in_conflict_modal(app: Tabs, label: &str) -> Tabs { + let mut harness = Harness::new_ui_state(|ui, app: &mut Tabs| conflict_modal(app, &ui.ctx().clone()), app); + harness.run(); + harness.get_by_label(label).click(); + harness.run(); + harness.into_state() +} + +/// The modal says A.note was not saved; clicking "Reload from the cloud" must reload A and +/// replace uid 1, the conflicted document, never whichever tab happens to be active. +#[test] +fn conflict_reload_acts_on_the_conflicted_document_even_when_another_tab_is_active() { + let (app, held, log) = conflict_on_a_while_b_is_active(); + let mut app = click_in_conflict_modal(app, "Reload from the cloud"); + let (job, post) = held.take(|j| matches!(j, Job::Read { .. })).expect("Reload submitted a read"); + let Job::Read { entry: read, into } = job else { unreachable!() }; + let read_name = read.name.clone(); + post.send(Event::Read { entry: read, into, bytes: Ok(b"stored".to_vec()) }); + drain(&mut app, &egui::Context::default()); + let log = log.lock().unwrap(); + assert!( + read_name == "A.note" && into == Some(1) && !log.closed.contains(&2), + "conflict was on uid 1 (A.note); Reload read {read_name:?} into {into:?}, then closed {:?}", + log.closed + ); +} + +/// "Save as a copy" from the conflict modal must encode the conflicted document, A, not +/// whichever tab happens to be active when the Save As page's own button is finally clicked. +#[test] +fn conflict_save_as_copy_encodes_the_conflicted_document_even_when_another_tab_is_active() { + let (app, held, log) = conflict_on_a_while_b_is_active(); + let mut app = click_in_conflict_modal(app, "Save as a copy…"); + let name = app.cloud.save_name.clone(); + save_as(&mut app, "", &name).unwrap(); // what the Save As page does with that name + let (job, _) = held.take(|j| matches!(j, Job::Create { .. })).unwrap(); + let Job::Create { uid, name, bytes, .. } = job else { unreachable!() }; + assert_eq!( + (uid, String::from_utf8_lossy(&bytes).into_owned()), + (1, "bytes of 1".to_owned()), + "copy of the conflicted A.note is created as {name:?} from uid {uid} (encoded uids {:?})", + log.lock().unwrap().encoded + ); +} + +/// A read the backend never answers (the trait allows "or never") must not leave every transfer +/// refused forever. Signing out and back in recovers Save. +#[test] +fn sign_out_recovers_save_after_a_backend_job_never_replies() { + let (mut app, held, _log) = two_tabs(); + open_entry(&mut app, entry("/C.note", "c1"), None); + held.take(|j| matches!(j, Job::Read { .. })).unwrap(); // dropped by the worker + sign_out(&mut app); + sign_in(&mut app); + let (_, post) = held.take(|j| matches!(j, Job::SignIn)).unwrap(); + post.send(Event::Account(Ok(account("Ada")))); + drain(&mut app, &egui::Context::default()); + app.cloud.origins.insert(1, Origin { entry: entry("/A.note", "a1") }); + let saved = save(&mut app); + assert!(saved.is_ok(), "after sign-out and sign-in, Save is still refused: {saved:?}; busy={:?}", app.cloud.busy.as_ref().map(Busy::text)); +} + +/// An account and a listing answer a job issued before sign-out. Landing after it, they must +/// not put the previous session's account and file names on screen with nobody signed in. +#[test] +fn a_late_reply_from_before_sign_out_is_dropped() { + let (mut app, held, _log) = two_tabs(); + start(&mut app); + let (_, account_post) = held.take(|j| matches!(j, Job::Account)).unwrap(); + let (_, list_post) = held.take(|j| matches!(j, Job::List(_))).unwrap(); + sign_out(&mut app); + account_post.send(Event::Account(Ok(account("Previous Person")))); + list_post.send(Event::Listed { path: String::new(), entries: Ok(vec![entry("/Payroll 2026.note", "p1")]) }); + drain(&mut app, &egui::Context::default()); + let r = report(&app); + assert!( + r["account"].is_null() && r["entries"].as_array().is_some_and(Vec::is_empty), + "signed out, yet account={} entries={}", + r["account"], + r["entries"] + ); +} diff --git a/crates/ui/src/cloud/mod.rs b/crates/ui/src/cloud/mod.rs index a8d001a0b..ca261d23d 100644 --- a/crates/ui/src/cloud/mod.rs +++ b/crates/ui/src/cloud/mod.rs @@ -26,6 +26,8 @@ //! shows them in. use std::collections::HashMap; +use std::sync::Arc; +use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::mpsc::{Receiver, Sender, channel}; use std::time::Duration; @@ -35,6 +37,8 @@ use serde_json::{Value as Json, json}; mod app; mod backend; +#[cfg(test)] +mod conflict_tests; mod pages; #[cfg(test)] mod tests; @@ -210,6 +214,16 @@ pub struct CloudFiles { /// popup from this gesture instead of inferring it from `status`, which can /// stay set after a failed sign-in. sign_in_from_menu: bool, + /// Bumped on sign-out and on a new sign-in. Stamped onto every [`Post`] + /// handed out by [`submit`] so a reply to a job issued before the bump is + /// dropped rather than applied to the session that replaced it. + account_generation: Arc, + /// The document Save As must act on, when it is not the active one. + /// + /// Set only by the conflict modal's "Save as a copy", so the copy it asks + /// for is made from the conflicted document even if the user has since + /// switched to another tab. Consumed by the next [`save_as`] call. + save_as_target: Option, } impl Default for CloudFiles { @@ -240,6 +254,8 @@ impl CloudFiles { sharing_save: false, guest: None, sign_in_from_menu: false, + account_generation: Arc::new(AtomicU64::new(0)), + save_as_target: None, } } @@ -315,7 +331,7 @@ pub fn can_converse(app: &A) -> bool { pub fn submit(app: &A, job: Job) { let cloud = app.cloud(); if let Some(backend) = &cloud.backend { - backend.submit(job, Post::new(cloud.events.0.clone())); + backend.submit(job, Post::new(cloud.events.0.clone(), cloud.account_generation.clone())); } } @@ -353,6 +369,12 @@ pub fn sign_in(app: &mut A) { cloud.asked_account = true; cloud.link = None; cloud.status = Some(working); + // A new session. A job the previous one left outstanding may never + // answer, and if it does, that answer is not about this account: see + // `Post::send`. Busy goes with it, or a stuck read from before this + // sign-in would leave Save refused for a session that never asked for it. + cloud.account_generation.fetch_add(1, Ordering::Relaxed); + cloud.busy = None; submit(app, Job::SignIn); } @@ -371,6 +393,13 @@ pub fn sign_out(app: &mut A) { cloud.shared = Folder::default(); cloud.origins.clear(); cloud.status = Some(signed_out); + // The session this window had ends here. A job it started may never + // answer, and a reply that does arrive late must not land on whatever + // comes next: see `Post::send`. Busy goes with it, so an open or a save + // that never heard back does not refuse every one after it forever. + cloud.account_generation.fetch_add(1, Ordering::Relaxed); + cloud.busy = None; + cloud.save_as_target = None; submit(app, Job::SignOut); } @@ -552,9 +581,14 @@ pub fn save(app: &mut A) -> Result { } /// Save As: writes a new document into `folder` under `name`. +/// +/// Acts on [`CloudFiles::save_as_target`] when the conflict modal's "Save as +/// a copy" set one, so the copy is made from the document that conflicted +/// even if another tab is active by the time this runs. Otherwise, the +/// active document, same as every other ordinary Save As. pub fn save_as(app: &mut A, folder: &str, name: &str) -> Result { let kind = app.kind(); - let uid = app.active().ok_or(format!("no {} open", kind.noun))?; + let uid = app.cloud_mut().save_as_target.take().or_else(|| app.active()).ok_or(format!("no {} open", kind.noun))?; let name = document_name(name, kind); if name.is_empty() { return Err("type a file name".to_owned()); diff --git a/crates/ui/src/cloud/pages.rs b/crates/ui/src/cloud/pages.rs index b8187cf67..665370952 100644 --- a/crates/ui/src/cloud/pages.rs +++ b/crates/ui/src/cloud/pages.rs @@ -9,8 +9,8 @@ use craft_cloud::{Capability, Entry, EntryKind}; use egui::{RichText, Ui}; use super::{ - CloudApp, Link, Source, browse, column, converse, dim, document_name, entry_row, fill, link, load_shared, open_entry, opens, parent_of, - reload_active, save_as, size_text, start, stem_of, + CloudApp, Link, Source, browse, column, converse, dim, document_name, entry_row, fill, link, load_shared, open_entry, opens, parent_of, save_as, + size_text, start, stem_of, }; /// The character a label ends with when choosing it opens a dialog. @@ -485,15 +485,21 @@ pub fn conflict_modal(app: &mut A, ctx: &egui::Context) { }); }); if reload { + // Reads the conflicted document back, never whichever tab happens to + // be active. `reload_active` acts on the active document, which is + // right for a host's own Reload command but wrong here: the window + // that triggered this modal may have moved on to another document + // while the refused save was on the wire. app.cloud_mut().conflict = None; - if let Err(error) = reload_active(app) { - app.say(error); - } + open_entry(app, conflict.entry, Some(conflict.uid)); } else if copy { let name = document_name(&format!("{} (copy)", stem_of(&conflict.entry.name)), app.kind()); let cloud = app.cloud_mut(); cloud.conflict = None; cloud.save_name = name; + // Save As must encode the conflicted document too, not whatever is + // active once the user actually clicks Save on that page. + cloud.save_as_target = Some(conflict.uid); app.go_to_save_as(); } else if dismiss { app.cloud_mut().conflict = None; From c5e9e87309230c989a52a6fcd4f98ebef778969c Mon Sep 17 00:00:00 2001 From: William Dunn Date: Thu, 12 Nov 2026 23:28:15 -0500 Subject: [PATCH 014/183] craft-cloud-local: fix stale etag and racing create Read now stats the file it just read. The returned entry reflects that read. It no longer echoes the etag of the entry passed in. A reload after a conflict used to carry the version that was just refused into the next save, conflicting it again. Create opens the file with exclusive creation. An exists check no longer precedes a separate write. Two creates of the same name can no longer both observe an empty slot and both report success. Regression tests drive both fixes through craft_ui::cloud's public functions against a real folder on disk. --- crates/cloud-local/src/lib.rs | 39 ++++- .../tests/save_path_regressions.rs | 160 ++++++++++++++++++ 2 files changed, 190 insertions(+), 9 deletions(-) create mode 100644 crates/cloud-local/tests/save_path_regressions.rs diff --git a/crates/cloud-local/src/lib.rs b/crates/cloud-local/src/lib.rs index 7f7f56590..c974a295e 100644 --- a/crates/cloud-local/src/lib.rs +++ b/crates/cloud-local/src/lib.rs @@ -22,6 +22,7 @@ //! megabyte document would freeze the window that called it. use std::fs; +use std::io::Write as _; use std::path::{Path, PathBuf}; use craft_cloud::{Capability, Entry, EntryKind}; @@ -82,9 +83,9 @@ impl CloudBackend for LocalBackend { std::thread::spawn(move || post.send(Event::Shared(Ok(Vec::new())))); } Job::Read { entry, into } => { - std::thread::spawn(move || { - let bytes = read(&root, &entry); - post.send(Event::Read { entry, into, bytes }); + std::thread::spawn(move || match read(&root, &entry) { + Ok((entry, bytes)) => post.send(Event::Read { entry, into, bytes: Ok(bytes) }), + Err(fault) => post.send(Event::Read { entry, into, bytes: Err(fault) }), }); } Job::Write { uid, entry, bytes } => { @@ -180,9 +181,19 @@ fn list(root: &Path, path: &str) -> Result, Fault> { Ok(entries) } -fn read(root: &Path, entry: &Entry) -> Result, Fault> { +/// Reads a file's bytes together with the entry for the version just read. +/// +/// The entry is built from a fresh [`fs::metadata`] call here, not handed back +/// unchanged from what the caller already believed. A reload after a conflict +/// hands in the stale entry it is trying to get past; echoing that back would +/// carry the old etag into the reloaded document, so the very next save would +/// conflict again on a copy that is actually current. +fn read(root: &Path, entry: &Entry) -> Result<(Entry, Vec), Fault> { let file = resolve(root, &entry.id)?; - fs::read(&file).map_err(|error| io_fault(&error)) + let bytes = fs::read(&file).map_err(|error| io_fault(&error))?; + let meta = fs::metadata(&file).map_err(|error| io_fault(&error))?; + let fresh = Entry { size: Some(meta.len()), etag: Some(etag_of(&meta)), ..entry.clone() }; + Ok((fresh, bytes)) } /// Saves back over `entry`, refusing the write when the file moved on since @@ -207,10 +218,20 @@ fn create(root: &Path, folder: &str, name: &str, bytes: &[u8]) -> Result handle, + Err(error) if error.kind() == std::io::ErrorKind::AlreadyExists => { + return Err(Fault::Refused(format!("{name} already exists"))); + } + Err(error) => return Err(io_fault(&error)), + }; + handle.write_all(bytes).map_err(|error| io_fault(&error))?; + drop(handle); let meta = fs::metadata(&file).map_err(|error| io_fault(&error))?; let id = child_path(folder, name); Ok(Entry { diff --git a/crates/cloud-local/tests/save_path_regressions.rs b/crates/cloud-local/tests/save_path_regressions.rs new file mode 100644 index 000000000..76cec678a --- /dev/null +++ b/crates/cloud-local/tests/save_path_regressions.rs @@ -0,0 +1,160 @@ +//! Two save-path defects that need a real backend to show: a reload after a conflict carrying a +//! stale etag into the next save, and two creates of the same name racing past an exists check. +//! Driven through craft_ui::cloud's public functions the way an application does. + +use std::sync::{Arc, Mutex}; +use std::time::{Duration, Instant}; + +use craft_cloud::{Entry, EntryKind}; +use craft_cloud_local::LocalBackend; +use craft_ui::cloud::{self, CloudApp, CloudFiles, Destination, DocumentKind}; + +const NOTE: DocumentKind = DocumentKind { extensions: &["txt"], mimes: &["text/plain"], noun: "note", default_extension: "txt" }; + +struct Window { + cloud: CloudFiles, + share: craft_ui::share::ShareDialog, + presence: craft_ui::presence::PresenceBar, + body: Vec, + said: Arc>>, +} + +impl Window { + fn new(root: std::path::PathBuf, body: &[u8]) -> Window { + let mut w = Window { + cloud: CloudFiles::new(), + share: craft_ui::share::ShareDialog::new(), + presence: craft_ui::presence::PresenceBar::new(), + body: body.to_vec(), + said: Arc::default(), + }; + w.cloud.connect(LocalBackend::new(root)); + w + } +} + +impl CloudApp for Window { + fn cloud(&self) -> &CloudFiles { + &self.cloud + } + fn cloud_mut(&mut self) -> &mut CloudFiles { + &mut self.cloud + } + fn kind(&self) -> DocumentKind { + NOTE + } + fn active(&self) -> Option { + Some(1) + } + fn title(&self, _uid: u64) -> String { + String::new() + } + fn open_bytes(&mut self, _name: &str, bytes: Vec) -> Result, String> { + self.body = bytes; + Ok(Some(1)) + } + fn encode(&mut self, _uid: u64, _into: Destination<'_>) -> Result, String> { + Ok(self.body.clone()) + } + fn close(&mut self, _uid: u64) {} + fn sharing(&mut self) -> &mut craft_ui::share::ShareDialog { + &mut self.share + } + fn presence(&mut self) -> &mut craft_ui::presence::PresenceBar { + &mut self.presence + } + fn paint_icon(&self, _p: &egui::Painter, _r: egui::Rect, _k: EntryKind, _c: egui::Color32) {} + fn open_url(&self, _url: &str) {} + fn say(&mut self, text: String) { + self.said.lock().unwrap().push(text); + } + fn app_name(&self) -> &str { + "Review" + } +} + +fn settle(app: &mut Window, ctx: &egui::Context, mut done: impl FnMut(&Window) -> bool) { + let start = Instant::now(); + loop { + ctx.begin_pass(Default::default()); + cloud::pump(app, ctx); + ctx.end_pass().textures_delta.clear(); + if done(app) { + return; + } + assert!(start.elapsed() < Duration::from_secs(5), "timed out"); + std::thread::sleep(Duration::from_millis(2)); + } +} + +fn listed(app: &mut Window, ctx: &egui::Context, name: &str) -> Entry { + cloud::browse(app, ""); + settle(app, ctx, |a| a.cloud.mine.loaded); + app.cloud.mine.entries.iter().find(|e| e.name == name).cloned().expect("listed") +} + +/// Open v1, another writer stores v2, Save conflicts, the user picks "Reload from the cloud" +/// (`reload_active`, what the modal calls). The window now shows v2's bytes, so the next Save +/// must go through rather than conflict again on the etag the reloaded copy was read at. +#[test] +fn reload_after_a_conflict_carries_the_freshly_read_etag_so_the_next_save_succeeds() { + let root = tempfile::tempdir().unwrap(); + std::fs::write(root.path().join("note.txt"), b"v1").unwrap(); + let ctx = egui::Context::default(); + let mut app = Window::new(root.path().to_owned(), b""); + let v1 = listed(&mut app, &ctx, "note.txt"); + cloud::open_entry(&mut app, v1.clone(), None); + settle(&mut app, &ctx, |a| a.cloud.busy.is_none() && a.body == b"v1"); + + std::thread::sleep(Duration::from_millis(20)); + std::fs::write(root.path().join("note.txt"), b"v2 by someone else").unwrap(); + + app.body = b"my edit".to_vec(); + cloud::save(&mut app).unwrap(); + settle(&mut app, &ctx, |a| a.cloud.busy.is_none()); + assert!(app.cloud.conflict.is_some(), "the first save is refused (correct)"); + + cloud::reload_active(&mut app).unwrap(); + settle(&mut app, &ctx, |a| a.cloud.busy.is_none()); + assert_eq!(app.body, b"v2 by someone else", "reload shows the stored bytes"); + let origin_etag = cloud::report(&app)["origin"]["etag"].clone(); + + cloud::save(&mut app).unwrap(); + settle(&mut app, &ctx, |a| a.cloud.busy.is_none()); + let on_disk = std::fs::read(root.path().join("note.txt")).unwrap(); + assert!( + app.cloud.conflict.is_none(), + "after reloading v2 the save conflicted again: origin etag after reload = {origin_etag} \ + (listing etag was {:?}); file on disk = {:?}", + v1.etag, + String::from_utf8_lossy(&on_disk) + ); +} + +/// Two windows Save As the same new name at once. At most one create may succeed; the other +/// must be refused ("already exists") rather than both reporting success while one silently +/// replaces the other on disk. +#[test] +fn concurrent_create_of_one_name_refuses_the_loser() { + let rounds = 300; + let (mut both_ok, mut example) = (0, String::new()); + for round in 0..rounds { + let root = tempfile::tempdir().unwrap(); + let ctx = egui::Context::default(); + let mut a = Window::new(root.path().to_owned(), format!("window A round {round}").as_bytes()); + let mut b = Window::new(root.path().to_owned(), format!("window B round {round}").as_bytes()); + cloud::save_as(&mut a, "", "Report.txt").unwrap(); + cloud::save_as(&mut b, "", "Report.txt").unwrap(); + settle(&mut a, &ctx, |w| w.cloud.busy.is_none()); + settle(&mut b, &ctx, |w| w.cloud.busy.is_none()); + let (a_ok, b_ok) = (cloud::origin(&a).is_some(), cloud::origin(&b).is_some()); + if a_ok && b_ok { + both_ok += 1; + if example.is_empty() { + let disk = std::fs::read_to_string(root.path().join("Report.txt")).unwrap(); + example = format!("round {round}: A status {:?}, B status {:?}, file holds {disk:?}", a.cloud.status, b.cloud.status); + } + } + } + assert_eq!(both_ok, 0, "{both_ok}/{rounds} rounds: both windows were told the new file was created; e.g. {example}"); +} From 658cc01501b09fd4984cd6dea29990f184dceb46 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Thu, 12 Nov 2026 23:32:45 -0500 Subject: [PATCH 015/183] craft-ui cloud: stop using unreachable in the conflict modal tests clippy::unreachable is denied at the crate root with no in-tests carve-out, unlike unwrap, expect and panic. The three let-else fallbacks in conflict_tests.rs now panic with a message instead, matching the pattern used everywhere else in this crate's tests. --- crates/ui/src/cloud/conflict_tests.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ui/src/cloud/conflict_tests.rs b/crates/ui/src/cloud/conflict_tests.rs index 29a83799d..c8e3d75cf 100644 --- a/crates/ui/src/cloud/conflict_tests.rs +++ b/crates/ui/src/cloud/conflict_tests.rs @@ -144,7 +144,7 @@ fn conflict_on_a_while_b_is_active() -> (Tabs, Held, Arc>) { save(&mut app).unwrap(); app.active = 2; let (job, post) = held.take(|j| matches!(j, Job::Write { .. })).unwrap(); - let Job::Write { uid, .. } = job else { unreachable!() }; + let Job::Write { uid, .. } = job else { panic!("expected Job::Write") }; post.send(Event::Saved { uid, entry: Err(Fault::Conflict) }); let ctx = egui::Context::default(); drain(&mut app, &ctx); @@ -167,7 +167,7 @@ fn conflict_reload_acts_on_the_conflicted_document_even_when_another_tab_is_acti let (app, held, log) = conflict_on_a_while_b_is_active(); let mut app = click_in_conflict_modal(app, "Reload from the cloud"); let (job, post) = held.take(|j| matches!(j, Job::Read { .. })).expect("Reload submitted a read"); - let Job::Read { entry: read, into } = job else { unreachable!() }; + let Job::Read { entry: read, into } = job else { panic!("expected Job::Read") }; let read_name = read.name.clone(); post.send(Event::Read { entry: read, into, bytes: Ok(b"stored".to_vec()) }); drain(&mut app, &egui::Context::default()); @@ -188,7 +188,7 @@ fn conflict_save_as_copy_encodes_the_conflicted_document_even_when_another_tab_i let name = app.cloud.save_name.clone(); save_as(&mut app, "", &name).unwrap(); // what the Save As page does with that name let (job, _) = held.take(|j| matches!(j, Job::Create { .. })).unwrap(); - let Job::Create { uid, name, bytes, .. } = job else { unreachable!() }; + let Job::Create { uid, name, bytes, .. } = job else { panic!("expected Job::Create") }; assert_eq!( (uid, String::from_utf8_lossy(&bytes).into_owned()), (1, "bytes of 1".to_owned()), From d93b55f7ff2c30cc0722f2c1eb4416f9ce9782c5 Mon Sep 17 00:00:00 2001 From: skylar taylor-barrick Date: Fri, 13 Nov 2026 18:47:51 -0600 Subject: [PATCH 016/183] fix(cloud): retain conflict-copy identity through retries --- crates/ui/src/cloud/app.rs | 3 + crates/ui/src/cloud/conflict_tests.rs | 79 +++++++++++++++++++++++++++ crates/ui/src/cloud/mod.rs | 19 ++++++- crates/ui/src/cloud/pages.rs | 4 +- 4 files changed, 102 insertions(+), 3 deletions(-) diff --git a/crates/ui/src/cloud/app.rs b/crates/ui/src/cloud/app.rs index b98e91ba5..cfb697935 100644 --- a/crates/ui/src/cloud/app.rs +++ b/crates/ui/src/cloud/app.rs @@ -222,6 +222,9 @@ pub trait CloudApp { /// Take the user to the application's own Save As page, with the name /// [`CloudFiles::save_name`](crate::cloud::CloudFiles::save_name) now /// holding. Called when a refused save is answered with Save as a copy. + /// Hosts call [`cancel_save_as`](crate::cloud::cancel_save_as) when leaving + /// that page without submitting, or before opening an ordinary Save As, + /// so the abandoned copy's document and suggested name cannot carry over. fn go_to_save_as(&mut self) {} // ---- its words ------------------------------------------------------- diff --git a/crates/ui/src/cloud/conflict_tests.rs b/crates/ui/src/cloud/conflict_tests.rs index c8e3d75cf..1e22e815f 100644 --- a/crates/ui/src/cloud/conflict_tests.rs +++ b/crates/ui/src/cloud/conflict_tests.rs @@ -234,3 +234,82 @@ fn a_late_reply_from_before_sign_out_is_dropped() { r["entries"] ); } + +/// Save as a copy, then the first click on the Save As page is refused (no name typed yet). The +/// second click, with a name, must still copy the conflicted document A, not the active tab B. +#[test] +fn conflict_copy_survives_a_refused_first_attempt() { + let (app, held, log) = conflict_on_a_while_b_is_active(); + let mut app = click_in_conflict_modal(app, "Save as a copy…"); + let refused = save_as(&mut app, "", ""); + assert!(refused.is_err(), "an empty name is refused: {refused:?}"); + let name = app.cloud.save_name.clone(); + save_as(&mut app, "", &name).unwrap(); + let (job, _) = held.take(|j| matches!(j, Job::Create { .. })).unwrap(); + let Job::Create { uid, bytes, .. } = job else { panic!("expected Job::Create") }; + assert_eq!( + (uid, String::from_utf8_lossy(&bytes).into_owned()), + (1, "bytes of 1".to_owned()), + "after one refused attempt the copy of A.note encodes uid {uid} (encoded uids {:?})", + log.lock().unwrap().encoded + ); +} + +/// Save as a copy, but the user leaves the Save As page without saving. Later, on tab B, an +/// ordinary Save As must save B, not the conflicted A from the abandoned copy. +#[test] +fn cancelled_conflict_copy_does_not_hijack_a_later_save_as() { + let (app, held, log) = conflict_on_a_while_b_is_active(); + let app = click_in_conflict_modal(app, "Save as a copy…"); + let mut app = app; + cancel_save_as(&mut app); // the host leaves the Save As page without submitting + assert!(app.cloud.save_name.is_empty()); + assert_eq!(app.active, 2); + save_as(&mut app, "", "B renamed").unwrap(); + let (job, _) = held.take(|j| matches!(j, Job::Create { .. })).unwrap(); + let Job::Create { uid, name, bytes, .. } = job else { panic!("expected Job::Create") }; + assert_eq!( + (uid, String::from_utf8_lossy(&bytes).into_owned()), + (2, "bytes of 2".to_owned()), + "an ordinary Save As of tab B as {name:?} encoded uid {uid} (encoded uids {:?})", + log.lock().unwrap().encoded + ); +} + +/// A successfully saved conflict copy must not redirect a later ordinary Save As. +#[test] +fn successful_conflict_copy_releases_its_document_target() { + let (app, held, _log) = conflict_on_a_while_b_is_active(); + let mut app = click_in_conflict_modal(app, "Save as a copy…"); + let name = app.cloud.save_name.clone(); + save_as(&mut app, "", &name).unwrap(); + let (job, post) = held.take(|job| matches!(job, Job::Create { .. })).unwrap(); + let Job::Create { uid, .. } = job else { panic!("expected Job::Create") }; + assert_eq!(uid, 1); + assert_eq!(app.cloud.save_as_target, Some(1)); + post.send(Event::Saved { uid, entry: Ok(entry("/A-copy.note", "a2")) }); + drain(&mut app, &egui::Context::default()); + assert_eq!(app.cloud.save_as_target, None); + save_as(&mut app, "", "B renamed").unwrap(); + let (job, _) = held.take(|job| matches!(job, Job::Create { .. })).unwrap(); + let Job::Create { uid, bytes, .. } = job else { panic!("expected Job::Create") }; + assert_eq!((uid, bytes), (2, b"bytes of 2".to_vec())); +} + +/// A refused create keeps the same document pinned while the user changes its name. +#[test] +fn conflict_copy_survives_a_backend_refusal() { + let (app, held, _log) = conflict_on_a_while_b_is_active(); + let mut app = click_in_conflict_modal(app, "Save as a copy…"); + let name = app.cloud.save_name.clone(); + save_as(&mut app, "", &name).unwrap(); + let (job, post) = held.take(|job| matches!(job, Job::Create { .. })).unwrap(); + let Job::Create { uid, .. } = job else { panic!("expected Job::Create") }; + assert_eq!(uid, 1); + post.send(Event::Saved { uid, entry: Err(Fault::Refused("exists".to_owned())) }); + drain(&mut app, &egui::Context::default()); + save_as(&mut app, "", "A another copy").unwrap(); + let (job, _) = held.take(|job| matches!(job, Job::Create { .. })).unwrap(); + let Job::Create { uid, bytes, .. } = job else { panic!("expected Job::Create") }; + assert_eq!((uid, bytes), (1, b"bytes of 1".to_vec())); +} diff --git a/crates/ui/src/cloud/mod.rs b/crates/ui/src/cloud/mod.rs index ca261d23d..3844c4f8f 100644 --- a/crates/ui/src/cloud/mod.rs +++ b/crates/ui/src/cloud/mod.rs @@ -222,7 +222,8 @@ pub struct CloudFiles { /// /// Set only by the conflict modal's "Save as a copy", so the copy it asks /// for is made from the conflicted document even if the user has since - /// switched to another tab. Consumed by the next [`save_as`] call. + /// switched to another tab. Cleared after a successful save or by + /// [`cancel_save_as`] when the interaction is abandoned. save_as_target: Option, } @@ -580,6 +581,17 @@ pub fn save(app: &mut A) -> Result { Ok(answer) } +/// Ends an unsubmitted Save As interaction. +/// +/// Hosts call this when leaving the Save As page without saving, and before +/// opening an unrelated Save As. It does not cancel a transfer already sent +/// to the backend. +pub fn cancel_save_as(app: &mut A) { + let cloud = app.cloud_mut(); + cloud.save_as_target = None; + cloud.save_name.clear(); +} + /// Save As: writes a new document into `folder` under `name`. /// /// Acts on [`CloudFiles::save_as_target`] when the conflict modal's "Save as @@ -588,7 +600,7 @@ pub fn save(app: &mut A) -> Result { /// active document, same as every other ordinary Save As. pub fn save_as(app: &mut A, folder: &str, name: &str) -> Result { let kind = app.kind(); - let uid = app.cloud_mut().save_as_target.take().or_else(|| app.active()).ok_or(format!("no {} open", kind.noun))?; + let uid = app.cloud().save_as_target.or_else(|| app.active()).ok_or(format!("no {} open", kind.noun))?; let name = document_name(name, kind); if name.is_empty() { return Err("type a file name".to_owned()); @@ -714,6 +726,9 @@ fn apply(app: &mut A, event: Event) { app.cloud_mut().busy = None; match entry { Ok(entry) => { + if app.cloud().save_as_target == Some(uid) { + app.cloud_mut().save_as_target = None; + } app.mark_saved(uid); stored(app, uid, entry); } diff --git a/crates/ui/src/cloud/pages.rs b/crates/ui/src/cloud/pages.rs index 665370952..86e71d1c8 100644 --- a/crates/ui/src/cloud/pages.rs +++ b/crates/ui/src/cloud/pages.rs @@ -351,7 +351,9 @@ fn shared_files(app: &mut A, ui: &mut Ui, pick: &mut Option<(Entry, /// File › Save As, the cloud destination. Pick a folder, name the file, save. /// Returns true when a save started, so a Backstage view can return to the -/// document. +/// document. Hosts call [`super::cancel_save_as`] when leaving without saving, +/// or before opening this page for an ordinary File › Save As, to discard any +/// abandoned conflict-copy target and suggested name. pub fn save_page(app: &mut A, ui: &mut Ui) -> bool { let style = app.style(ui); let kind = app.kind(); From e5e9433413afa0f25c93005b6cfc5c0dd6c659d9 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Mon, 16 Nov 2026 05:16:56 -0500 Subject: [PATCH 017/183] craft-cloud-local: confine list, read, write and create to the configured root FredApps' re-review found that resolve only split on slash and rejected a segment equal to parent-dir, with no constraint on a Windows backslash, a drive letter or UNC prefix, or a filesystem link, and that create joined the Job::Create name onto the resolved folder with no validation of the name at all. Every path segment, and a Create name on its own, now goes through one shared confine_segment check: accepted only when it parses as exactly one Component::Normal equal to the original text, with a backslash or colon refused outright first so a Windows-shaped escape cannot slip past a Linux build's narrower native parser. A second shared check, confine_to_root, canonicalises the nearest existing ancestor of a resolved path and confirms it still sits under the canonicalised root, refusing a symlink or a Windows junction that would otherwise redirect outside it. List, read, write and create all run both checks before touching disk. Regression tests cover the review's own examples (a parent segment, an absolute path, the three Windows-shaped forms) for Create, the same Windows-shaped escape for a List folder path, and a symlink (Unix) or junction (Windows) placed inside the root for list, read and write, each against a sibling sentinel file and directory that must stay untouched. --- crates/cloud-local/README.md | 21 ++ crates/cloud-local/src/lib.rs | 143 ++++++++- .../tests/confinement_regressions.rs | 289 ++++++++++++++++++ 3 files changed, 438 insertions(+), 15 deletions(-) create mode 100644 crates/cloud-local/README.md create mode 100644 crates/cloud-local/tests/confinement_regressions.rs diff --git a/crates/cloud-local/README.md b/crates/cloud-local/README.md new file mode 100644 index 000000000..d8f7cb3a7 --- /dev/null +++ b/crates/cloud-local/README.md @@ -0,0 +1,21 @@ +# craft-cloud-local + +A reference `CloudBackend` over one folder on disk, proving that `craft-cloud`'s contract needs +no specific provider behind it. + +## No-escape policy + +Every path this crate is handed, a `Job::List`/`Read`/`Write` path or a `Job::Create` name, is +confined to the configured root before anything touches a filesystem. + +A path's segments, and a `Create` name on its own, are accepted only when each one parses as a +single `Component::Normal`: no `..`, no `.`, no empty segment, no absolute form, and no Windows +drive letter, UNC path or backslash. That last group is refused on every platform this crate +builds for, not only on Windows, because a name reaches this backend from whatever platform the +UI runs on. + +Once a candidate path is built from nothing but checked names, it is still confirmed against a +symlink or (on Windows) a directory junction placed somewhere under the root: the nearest +ancestor that already exists is canonicalised and must stay under the canonicalised root. A path +that reaches outside the root this way is refused before any read, write, listing or creation +touches it. diff --git a/crates/cloud-local/src/lib.rs b/crates/cloud-local/src/lib.rs index c974a295e..c0caf5d45 100644 --- a/crates/cloud-local/src/lib.rs +++ b/crates/cloud-local/src/lib.rs @@ -23,7 +23,7 @@ use std::fs; use std::io::Write as _; -use std::path::{Path, PathBuf}; +use std::path::{Component, Path, PathBuf}; use craft_cloud::{Capability, Entry, EntryKind}; use craft_ui::cloud::{Account, CloudBackend, Event, Fault, Job, Post}; @@ -33,8 +33,16 @@ use craft_ui::cloud::{Account, CloudBackend, Event, Fault, Job, Post}; /// `Entry::id` and `Entry::path` are the same slash-separated path relative to /// `root`, always starting with `/` below the root itself (the root's own /// path is the empty string, matching [`Job::List`]'s contract). Neither is -/// an OS path; both go through [`resolve`] before anything touches a -/// filesystem, so a name containing `..` can never walk out of `root`. +/// an OS path; both go through [`resolve`] and then [`confine_to_root`] +/// before anything touches a filesystem. A [`Job::Create`] name is not a +/// path at all; it goes through the same per-segment check [`resolve`] uses, +/// [`confine_segment`], on its own. Together the two refuse `..`, an +/// absolute form, a Windows drive letter or UNC prefix, and a backslash, +/// regardless of which platform this crate is built for, since a name +/// reaches this backend from whatever platform the UI runs on. No-escape +/// through a symlink or a Windows junction is a separate policy, stated on +/// [`confine_to_root`] itself, and every one of [`list`], [`read`], +/// [`write`] and [`create`] applies it. pub struct LocalBackend { root: PathBuf, /// Shown in the account badge. Nothing else reads it. @@ -111,25 +119,81 @@ fn account(display: String) -> Account { } /// Turns a [`Job`]'s slash-separated path into a real filesystem path under -/// `root`, refusing anything that would walk back out of it. +/// `root`, refusing anything that is not a run of ordinary names. /// -/// `..` is the only way out, so `..` is the only segment refused. `.` and -/// repeated or leading slashes are just an empty segment and are skipped, -/// the same way a browser's address bar collapses them. +/// `.` and repeated or leading slashes are just an empty segment and are +/// skipped, the same way a browser's address bar collapses them. Every other +/// segment goes through [`confine_segment`], which is what actually refuses +/// `..`, an absolute form, a backslash or a drive letter, or anything else +/// that is not one ordinary name. This function never touches disk, so it +/// cannot see a symlink or a junction; [`confine_to_root`] is the other half +/// of the promise, and every caller of `resolve` runs both. fn resolve(root: &Path, path: &str) -> Result { let mut real = root.to_path_buf(); for segment in path.split('/') { if segment.is_empty() || segment == "." { continue; } - if segment == ".." { - return Err(Fault::Refused(format!("{path} reaches outside this folder"))); - } - real.push(segment); + real.push(confine_segment(segment)?); } Ok(real) } +/// Confines one path segment, or a whole [`Job::Create`] name, to a single +/// ordinary file or folder name. +/// +/// Accepted only when `segment` parses as exactly one [`Component::Normal`] +/// equal to `segment` itself: no empty name, no `.` or `..`, no absolute +/// form, and nothing left over for a second component to hide in. A +/// `std::path::Component` parse alone does not catch every one of those on +/// every platform; a Unix build's parser does not know what `C:` or +/// `\\server\share` mean, so it would wave a Windows drive letter or a UNC +/// prefix straight through as one ordinary name. A `:` or a `\` is refused +/// outright first, on every platform, for exactly that reason: a name +/// reaches this backend's public [`CloudBackend::submit`] from whatever +/// platform the UI happens to run on, and a Windows-shaped escape must not +/// slip past a Linux build's narrower native parser, or the reverse. +fn confine_segment(segment: &str) -> Result<&str, Fault> { + if segment.contains('\\') || segment.contains(':') { + return Err(Fault::Refused(format!("{segment} is not a plain file name"))); + } + let mut components = Path::new(segment).components(); + match (components.next(), components.next()) { + (Some(Component::Normal(name)), None) if name == std::ffi::OsStr::new(segment) => Ok(segment), + _ => Err(Fault::Refused(format!("{segment} is not a plain file name"))), + } +} + +/// Confirms a path already built from nothing but [`confine_segment`]-checked +/// names still cannot have reached outside `root` through a symlink or, on +/// Windows, a directory junction. +/// +/// The no-escape policy: `candidate` need not exist yet, since [`write`] and +/// [`create`] both route a path that may still be about to be created +/// through here. Starting at `candidate` and walking up through its +/// ancestors, the first one that does exist is canonicalised and compared +/// against the canonicalised `root`. Nothing below that ancestor exists +/// either, so a link cannot sit on any of the remaining components, and +/// every one of them is already known to be ordinary `Component::Normal` +/// text, never `..` or an absolute form, because [`confine_segment`] is what +/// built them. A canonical path that lands outside `root` is refused; +/// nothing here ever opens, reads or writes through it. +fn confine_to_root(root: &Path, candidate: &Path) -> Result { + let real_root = fs::canonicalize(root).map_err(|error| io_fault(&error))?; + let mut probe = candidate; + loop { + match fs::canonicalize(probe) { + Ok(real) if real == real_root || real.starts_with(&real_root) => return Ok(candidate.to_path_buf()), + Ok(_) => return Err(Fault::Refused("that path leaves this folder".to_owned())), + Err(error) if error.kind() == std::io::ErrorKind::NotFound => match probe.parent() { + Some(parent) => probe = parent, + None => return Err(io_fault(&error)), + }, + Err(error) => return Err(io_fault(&error)), + } + } +} + /// The path a listed child gets, given the folder it was found in. fn child_path(folder: &str, name: &str) -> String { format!("{}/{name}", folder.trim_end_matches('/')) @@ -155,7 +219,7 @@ fn io_fault(error: &std::io::Error) -> Fault { } fn list(root: &Path, path: &str) -> Result, Fault> { - let dir = resolve(root, path)?; + let dir = confine_to_root(root, &resolve(root, path)?)?; let read = fs::read_dir(&dir).map_err(|error| io_fault(&error))?; let mut entries = Vec::new(); for item in read { @@ -189,7 +253,7 @@ fn list(root: &Path, path: &str) -> Result, Fault> { /// carry the old etag into the reloaded document, so the very next save would /// conflict again on a copy that is actually current. fn read(root: &Path, entry: &Entry) -> Result<(Entry, Vec), Fault> { - let file = resolve(root, &entry.id)?; + let file = confine_to_root(root, &resolve(root, &entry.id)?)?; let bytes = fs::read(&file).map_err(|error| io_fault(&error))?; let meta = fs::metadata(&file).map_err(|error| io_fault(&error))?; let fresh = Entry { size: Some(meta.len()), etag: Some(etag_of(&meta)), ..entry.clone() }; @@ -200,7 +264,7 @@ fn read(root: &Path, entry: &Entry) -> Result<(Entry, Vec), Fault> { /// `entry.etag` was read. A file that no longer exists has nothing to /// conflict with, the same way a provider treats a deleted document. fn write(root: &Path, entry: &Entry, bytes: &[u8]) -> Result { - let file = resolve(root, &entry.id)?; + let file = confine_to_root(root, &resolve(root, &entry.id)?)?; if let Ok(meta) = fs::metadata(&file) && Some(etag_of(&meta)) != entry.etag { @@ -215,7 +279,11 @@ fn write(root: &Path, entry: &Entry, bytes: &[u8]) -> Result { } fn create(root: &Path, folder: &str, name: &str, bytes: &[u8]) -> Result { - let dir = resolve(root, folder)?; + // `name` is never a path: it is one [`Job::Create`] field that names the + // new file, so it goes through `confine_segment` directly rather than + // through `resolve`, which only ever splits and confines a slash path. + let name = confine_segment(name)?; + let dir = confine_to_root(root, &resolve(root, folder)?)?; fs::create_dir_all(&dir).map_err(|error| io_fault(&error))?; let file = dir.join(name); // Exclusive creation, not an `exists` check ahead of a separate write: two @@ -267,6 +335,51 @@ mod tests { assert_eq!(resolve(&root, "").unwrap(), root); } + #[test] + fn confine_segment_accepts_only_a_single_ordinary_name() { + for ordinary in ["Minutes.txt", "Archive", "2026", "a name with spaces.docx"] { + assert!(confine_segment(ordinary).is_ok(), "{ordinary} is an ordinary name"); + } + } + + #[test] + fn confine_segment_refuses_empty_dot_and_dot_dot() { + for bad in ["", ".", ".."] { + assert!(confine_segment(bad).is_err(), "{bad:?} is not a single ordinary name"); + } + } + + #[test] + fn confine_segment_refuses_a_slash_hidden_inside_a_create_name() { + assert!(confine_segment("folder/evil").is_err()); + assert!(confine_segment("../outside.txt").is_err()); + assert!(confine_segment("/outside.txt").is_err()); + } + + #[test] + fn confine_segment_refuses_windows_separators_and_prefixes_on_every_platform() { + for bad in ["..\\outside.txt", "C:\\x", "C:evil", "\\\\server\\share\\x"] { + assert!(confine_segment(bad).is_err(), "{bad:?} must be refused on every platform, not only on Windows"); + } + } + + #[test] + fn confine_to_root_accepts_a_path_that_does_not_exist_yet_under_an_existing_root() { + let root = tempfile::tempdir().unwrap(); + let candidate = root.path().join("not-written-yet.txt"); + assert!(confine_to_root(root.path(), &candidate).is_ok()); + } + + #[test] + fn confine_to_root_refuses_a_candidate_that_canonicalises_outside_root() { + let root = tempfile::tempdir().unwrap(); + let elsewhere = tempfile::tempdir().unwrap(); + // Built from a path that never went through `confine_segment` (this + // helper is tested on its own merits), standing in for whatever a + // symlink or junction would otherwise have redirected into `root`. + assert!(confine_to_root(root.path(), elsewhere.path()).is_err()); + } + #[test] fn a_folder_announces_no_capability_this_backend_cannot_honour() { let reported = account("Local disk".to_owned()).capabilities; diff --git a/crates/cloud-local/tests/confinement_regressions.rs b/crates/cloud-local/tests/confinement_regressions.rs new file mode 100644 index 000000000..d4bebd038 --- /dev/null +++ b/crates/cloud-local/tests/confinement_regressions.rs @@ -0,0 +1,289 @@ +//! The P1 from FredApps' re-review of #160: `resolve` only split on `/` and rejected a segment +//! equal to `..`; it did not constrain a Windows backslash, a drive letter or UNC prefix, or a +//! filesystem link, and `create` joined `name` onto the resolved folder with no validation of +//! `name` at all. Driven through `craft_ui::cloud`'s public functions the way an application +//! does, with a sentinel file and directory kept as a sibling of the configured root: every test +//! here must leave both untouched and unread. + +use std::path::PathBuf; +use std::sync::{Arc, Mutex}; +use std::time::{Duration, Instant}; + +use craft_cloud::{Entry, EntryKind}; +use craft_cloud_local::LocalBackend; +use craft_ui::cloud::{self, CloudApp, CloudFiles, Destination, DocumentKind, Job}; + +const NOTE: DocumentKind = DocumentKind { extensions: &["txt"], mimes: &["text/plain"], noun: "note", default_extension: "txt" }; + +/// A document the harness was told to open: its name and its bytes. +type OpenedDocs = Arc)>>>; + +struct Harness { + cloud: CloudFiles, + share: craft_ui::share::ShareDialog, + presence: craft_ui::presence::PresenceBar, + opened: OpenedDocs, + said: Arc>>, +} + +impl Harness { + fn new() -> Harness { + Harness { + cloud: CloudFiles::new(), + share: craft_ui::share::ShareDialog::new(), + presence: craft_ui::presence::PresenceBar::new(), + opened: Arc::new(Mutex::new(Vec::new())), + said: Arc::new(Mutex::new(Vec::new())), + } + } +} + +impl CloudApp for Harness { + fn cloud(&self) -> &CloudFiles { + &self.cloud + } + fn cloud_mut(&mut self) -> &mut CloudFiles { + &mut self.cloud + } + fn kind(&self) -> DocumentKind { + NOTE + } + fn active(&self) -> Option { + None + } + fn title(&self, _uid: u64) -> String { + String::new() + } + fn open_bytes(&mut self, name: &str, bytes: Vec) -> Result, String> { + self.opened.lock().unwrap().push((name.to_owned(), bytes)); + Ok(Some(1)) + } + fn encode(&mut self, _uid: u64, _into: Destination<'_>) -> Result, String> { + Ok(Vec::new()) + } + fn close(&mut self, _uid: u64) {} + fn sharing(&mut self) -> &mut craft_ui::share::ShareDialog { + &mut self.share + } + fn presence(&mut self) -> &mut craft_ui::presence::PresenceBar { + &mut self.presence + } + fn paint_icon(&self, _painter: &egui::Painter, _rect: egui::Rect, _kind: EntryKind, _colour: egui::Color32) {} + fn open_url(&self, _url: &str) {} + fn say(&mut self, text: String) { + self.said.lock().unwrap().push(text); + } + fn app_name(&self) -> &str { + "Harness" + } +} + +fn wired(root: PathBuf) -> (Harness, egui::Context) { + let mut app = Harness::new(); + app.cloud.connect(LocalBackend::new(root)); + (app, egui::Context::default()) +} + +/// Drains whatever the backend's worker threads have sent so far, until `done` says the state +/// the test is waiting for arrived or five seconds pass. Five seconds is far more than a thread +/// doing local file IO ever needs; it only guards against a real bug leaving the test to hang. +fn settle(app: &mut Harness, ctx: &egui::Context, mut done: impl FnMut(&Harness) -> bool) { + let start = Instant::now(); + loop { + ctx.begin_pass(Default::default()); + cloud::pump(app, ctx); + ctx.end_pass().textures_delta.clear(); + if done(app) { + return; + } + assert!(start.elapsed() < Duration::from_secs(5), "timed out waiting for the backend's worker thread"); + std::thread::sleep(Duration::from_millis(5)); + } +} + +fn said(app: &mut Harness, ctx: &egui::Context) -> Vec { + settle(app, ctx, |app| !app.said.lock().unwrap().is_empty()); + app.said.lock().unwrap().clone() +} + +/// A tempdir holding the cloud root, plus a sentinel file and a sentinel directory that sit +/// beside it rather than inside it. Every test below must leave both exactly as they start. +struct Sentinels { + // Kept only so the tempdir outlives every test that borrows the paths below; nothing reads + // it back once the paths it was built from are in hand. + _arena: tempfile::TempDir, + root: PathBuf, + sentinel_file: PathBuf, + sentinel_dir: PathBuf, +} + +fn sentinels() -> Sentinels { + let arena = tempfile::tempdir().unwrap(); + let root = arena.path().join("root"); + std::fs::create_dir(&root).unwrap(); + let sentinel_file = arena.path().join("sentinel.txt"); + std::fs::write(&sentinel_file, b"a sibling file this backend must never read or write").unwrap(); + let sentinel_dir = arena.path().join("sentinel-dir"); + std::fs::create_dir(&sentinel_dir).unwrap(); + std::fs::write(sentinel_dir.join("secret.txt"), b"a sibling directory this backend must never list").unwrap(); + Sentinels { _arena: arena, root, sentinel_file, sentinel_dir } +} + +fn assert_sentinels_untouched(sentinels: &Sentinels) { + assert_eq!( + std::fs::read(&sentinels.sentinel_file).unwrap(), + b"a sibling file this backend must never read or write", + "the sentinel file outside the root was changed" + ); + assert_eq!( + std::fs::read(sentinels.sentinel_dir.join("secret.txt")).unwrap(), + b"a sibling directory this backend must never list", + "the sentinel directory's file outside the root was changed" + ); +} + +/// Every one of these is a [`Job::Create`] `name` that must be refused before any byte reaches +/// disk: the review's own examples (a parent segment, an absolute path, and the three +/// Windows-shaped forms), none of which a Unix build's native parser alone would catch, and a +/// name that already is nothing but a Windows separator or drive prefix on top of that. +fn malicious_create_names() -> Vec<&'static str> { + vec!["../sentinel.txt", "/sentinel.txt", "..\\sentinel.txt", "C:\\x", "C:evil", "\\\\server\\share\\x"] +} + +#[test] +fn create_refuses_every_escaping_name_and_the_sentinels_stay_untouched() { + for name in malicious_create_names() { + let sentinels = sentinels(); + let (mut app, ctx) = wired(sentinels.root.clone()); + + cloud::submit(&app, Job::Create { uid: 1, folder: String::new(), name: name.to_owned(), bytes: b"pwned".to_vec() }); + let messages = said(&mut app, &ctx); + + assert!(cloud::origin(&app).is_none(), "{name:?} must not be reported as created"); + assert!(!messages.is_empty(), "{name:?} must be refused, not silently dropped"); + assert_sentinels_untouched(&sentinels); + } +} + +/// A folder path for `Job::List` can carry the same Windows-shaped escape a `Create` name can; +/// `resolve` must refuse it through the identical [`confine_segment`] check, not a weaker one. +#[test] +fn listing_a_windows_shaped_folder_path_is_refused_on_every_platform() { + let sentinels = sentinels(); + let (mut app, ctx) = wired(sentinels.root.clone()); + + cloud::browse(&mut app, "..\\sentinel-dir"); + settle(&mut app, &ctx, |app| app.cloud().mine.loaded); + + assert!(app.cloud().mine.error.is_some(), "a backslash-separated folder path must be refused"); + assert!(app.cloud().mine.entries.is_empty()); + assert_sentinels_untouched(&sentinels); +} + +// ------------------------------------------------------------------- link-based escapes +// +// `escape(&sentinels)` places one link named `escape` inside the cloud root, pointing out to +// `sentinels.sentinel_dir`: a symlink on Unix, a directory junction on Windows, which needs no +// elevated privilege, unlike a Windows symlink. The Linux gate runs the symlink half of every +// test below; CI's windows-latest lanes run the junction half. Either way `root/escape/secret.txt` +// is the same sentinel file reached through the link. + +/// Nothing to clean up on Unix: `tempfile`'s own recursive removal of the arena directory +/// removes a plain symlink entry without following it. This exists only so `escape` returns the +/// same shape of RAII handle on every platform, rather than a bare `()` some lint would flag. +#[cfg(unix)] +struct Linked; + +#[cfg(unix)] +fn escape(sentinels: &Sentinels) -> Linked { + std::os::unix::fs::symlink(&sentinels.sentinel_dir, sentinels.root.join("escape")).unwrap(); + Linked +} + +/// A directory junction, removed on drop before the tempdir it sits beside is cleaned up. +#[cfg(windows)] +struct Junction(PathBuf); + +#[cfg(windows)] +impl Drop for Junction { + fn drop(&mut self) { + let _ = std::fs::remove_dir(&self.0); + } +} + +#[cfg(windows)] +fn escape(sentinels: &Sentinels) -> Junction { + use std::os::windows::process::CommandExt as _; + let link = sentinels.root.join("escape"); + let target = &sentinels.sentinel_dir; + assert!(link.is_absolute() && target.is_absolute()); + let output = std::process::Command::new("cmd") + .args(["/C", "mklink", "/J"]) + .arg(&link) + .arg(target) + .creation_flags(0x0800_0000) // CREATE_NO_WINDOW + .output() + .unwrap(); + assert!(output.status.success(), "{}", String::from_utf8_lossy(&output.stderr)); + Junction(link) +} + +#[cfg(any(unix, windows))] +fn leaked_entry() -> Entry { + Entry { + id: "/escape/secret.txt".to_owned(), + room: "local:/escape/secret.txt".to_owned(), + name: "secret.txt".to_owned(), + path: "/escape/secret.txt".to_owned(), + kind: EntryKind::File, + size: None, + modified: None, + mime: None, + etag: None, + writable: true, + shared_by: None, + } +} + +#[cfg(any(unix, windows))] +#[test] +fn listing_a_linked_folder_cannot_see_outside_the_root() { + let sentinels = sentinels(); + let (mut app, ctx) = wired(sentinels.root.clone()); + let _escape = escape(&sentinels); + + cloud::browse(&mut app, "escape"); + settle(&mut app, &ctx, |app| app.cloud().mine.loaded); + + assert!(app.cloud().mine.error.is_some(), "listing through a symlink or junction out of the root must be refused"); + assert!(app.cloud().mine.entries.is_empty()); + assert_sentinels_untouched(&sentinels); +} + +#[cfg(any(unix, windows))] +#[test] +fn reading_through_a_linked_folder_cannot_return_bytes_from_outside_the_root() { + let sentinels = sentinels(); + let (mut app, ctx) = wired(sentinels.root.clone()); + let _escape = escape(&sentinels); + + cloud::submit(&app, Job::Read { entry: leaked_entry(), into: None }); + said(&mut app, &ctx); + + assert!(app.opened.lock().unwrap().is_empty(), "a read through a symlink or junction out of the root must not deliver bytes"); + assert_sentinels_untouched(&sentinels); +} + +#[cfg(any(unix, windows))] +#[test] +fn writing_through_a_linked_folder_cannot_change_a_file_outside_the_root() { + let sentinels = sentinels(); + let (mut app, ctx) = wired(sentinels.root.clone()); + let _escape = escape(&sentinels); + + cloud::submit(&app, Job::Write { uid: 1, entry: leaked_entry(), bytes: b"pwned".to_vec() }); + said(&mut app, &ctx); + + assert!(app.cloud().conflict.is_none(), "this must be refused outright, not treated as a stale-version conflict"); + assert_sentinels_untouched(&sentinels); +} From aa4647a77778687017c19006e23544d4426abe8d Mon Sep 17 00:00:00 2001 From: William Dunn Date: Tue, 17 Nov 2026 00:49:24 -0500 Subject: [PATCH 018/183] craft-cloud-local: confine every path through a Dir capability, not a path string benandez's re-review reproduced three escapes the first confinement fix still left open. A dangling symlink: canonicalize reported it as missing, so the old confine_to_root walked up to root and accepted it, and write created the symlink's target for real, outside root. A check-then-use race: confine_to_root checked one path string and a later fs::read or fs::write resolved that same string again, a second lookup a concurrently swapped link could land in between. A hard link: write truncated the shared inode in place, with nothing in a canonicalized path to show that another name pointed at the same file outside root. list, read, write and create now resolve every already segment-checked relative path through a cap_std::fs::Dir capability opened on root, instead of joining an absolute OS path and handing it to plain std::fs. cap_std resolves one path component at a time against real, already-open directory handles, so a symlink or a Windows junction cannot walk resolution above root, dangling or not, and there is no separate check with a window for the directory tree to change underneath it: the one resolution is the open. This is the same family of guarantee craft-font-store already depends on through cap-primitives, which cap_std is built on. write no longer truncates its target in place either way: it writes a new sibling file and renames it over the target, so a hard link's directory entry is replaced rather than its shared content being overwritten. Per that review's non-blocking notes: a name that already exists on disk with an ordinary ':' or '\' byte (macOS stores a typed '/' as ':') stays reachable by list and read, since neither character is a path separator on any platform's filesystem; the stricter refusal now applies only to a name being chosen by Create. Create also goes back to bringing a fresh root into existence, matching its behaviour before the first confinement fix. A Windows reserved device name (CON, COM1, CONIN$, with or without an extension) is refused in a chosen name on every platform. Regression tests reproduce all three escapes (dangling symlink, swapped-link race, hard link), plus the previously missing coverage: a link in the folder a Create targets, and a write test that actually reaches disk instead of being refused for an unrelated reason before confinement ever ran. Verified by hand that each of the three new write-path tests fails against the pre-fix pattern (an absolute OS path joined by string concatenation) before trusting them. --- Cargo.lock | 13 + crates/cloud-local/Cargo.toml | 6 + crates/cloud-local/README.md | 40 +- crates/cloud-local/src/lib.rs | 354 ++++++++++++------ .../tests/confinement_regressions.rs | 226 ++++++++--- 5 files changed, 469 insertions(+), 170 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5b17106b4..275144cc8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1074,6 +1074,18 @@ dependencies = [ "winx", ] +[[package]] +name = "cap-std" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ec78e242cfa2cfe276807ac2ecc00315a6c97786977414bcd1c3963b6c91b8" +dependencies = [ + "cap-primitives", + "io-extras", + "io-lifetimes 3.0.1", + "rustix 1.1.5", +] + [[package]] name = "cast" version = "0.3.0" @@ -1628,6 +1640,7 @@ dependencies = [ name = "craft-cloud-local" version = "0.1.0" dependencies = [ + "cap-std", "craft-cloud", "craft-ui", "egui", diff --git a/crates/cloud-local/Cargo.toml b/crates/cloud-local/Cargo.toml index 6b58b2bfd..39d6dfa6e 100644 --- a/crates/cloud-local/Cargo.toml +++ b/crates/cloud-local/Cargo.toml @@ -11,6 +11,12 @@ description = "A reference CloudBackend over a local folder, proving the contrac workspace = true [dependencies] +# Resolution-time confinement: every path this crate resolves goes through a `Dir` capability +# opened on the configured root, never through an absolute OS path this crate builds itself. +# `craft-font-store` already depends on the lower-level `cap-primitives` for the same family of +# guarantee; this crate uses the ergonomic `cap-std` built on top of it instead of hand-rolling +# the equivalent `Dir`-style API again. +cap-std = "4" craft-cloud = { workspace = true } craft-ui = { workspace = true, features = ["cloud"] } diff --git a/crates/cloud-local/README.md b/crates/cloud-local/README.md index d8f7cb3a7..a5006c2ca 100644 --- a/crates/cloud-local/README.md +++ b/crates/cloud-local/README.md @@ -6,16 +6,34 @@ no specific provider behind it. ## No-escape policy Every path this crate is handed, a `Job::List`/`Read`/`Write` path or a `Job::Create` name, is -confined to the configured root before anything touches a filesystem. +confined to the configured root before anything touches a filesystem, in two layers. -A path's segments, and a `Create` name on its own, are accepted only when each one parses as a -single `Component::Normal`: no `..`, no `.`, no empty segment, no absolute form, and no Windows -drive letter, UNC path or backslash. That last group is refused on every platform this crate -builds for, not only on Windows, because a name reaches this backend from whatever platform the -UI runs on. +A path's segments are accepted only when each one parses as a single `Component::Normal`: no +`..`, no `.`, no empty segment, and no absolute form. A `Create` name goes through a stricter +check of its own, since it is one chosen name and not a path: it additionally refuses a +backslash, a colon, or a Windows reserved device name (`CON`, `COM1`, `CONIN$`, and so on), on +every platform this crate builds for, not only on Windows, because a chosen name reaches this +backend from whatever platform the UI runs on. An existing name that already has one of those +characters, discovered through `list`, stays reachable: `:` and `\` are not path separators on +any platform's filesystem, so refusing to read a real file back because of a byte in its name +(macOS stores a `/` typed in Finder as `:` on disk) would be a usability bug with no matching +security benefit. -Once a candidate path is built from nothing but checked names, it is still confirmed against a -symlink or (on Windows) a directory junction placed somewhere under the root: the nearest -ancestor that already exists is canonicalised and must stay under the canonicalised root. A path -that reaches outside the root this way is refused before any read, write, listing or creation -touches it. +The second layer is the one that actually keeps resolution inside the root: every already +segment-checked relative path is handed to a [`cap-std`](https://docs.rs/cap-std) `Dir` +capability opened on the root, never joined onto the root as an absolute OS path this crate +builds itself. `cap-std` resolves one path component at a time against real, already-open +directory handles, so a symlink or (on Windows) a directory junction anywhere under the root, +dangling or already pointing outside, cannot walk resolution above the root. There is no separate +"does this still look like it is inside the root" check with a window for the directory tree to +change underneath it between the check and the actual read or write; the one resolution is the +open. + +## Hard links + +A hard link is not a symlink, and this backend does not refuse one: from inside the sandbox the +inode it names is an ordinary file. What it protects instead is the shared inode's content: a +write never truncates its target in place. It writes a new sibling file and renames that sibling +over the target, so the target's directory entry is replaced rather than its bytes being +overwritten. A rename only ever changes one name; it does not reach through to any other name, +inside the root or out, that happens to point at the same inode. diff --git a/crates/cloud-local/src/lib.rs b/crates/cloud-local/src/lib.rs index c0caf5d45..b3cf5cbe9 100644 --- a/crates/cloud-local/src/lib.rs +++ b/crates/cloud-local/src/lib.rs @@ -20,29 +20,55 @@ //! Every job answers on its own [`std::thread`]. [`CloudBackend::submit`] //! must return before the file is opened, let alone read, or a twenty //! megabyte document would freeze the window that called it. +//! +//! # The no-escape policy +//! +//! `Entry::id` and `Entry::path` are the same slash-separated path relative to +//! `root`, always starting with `/` below the root itself (the root's own +//! path is the empty string, matching [`Job::List`]'s contract), and a +//! [`Job::Create`] name is one plain file name, not a path at all. Neither is +//! an OS path string handed to `std::fs`. Confinement happens in two layers: +//! +//! 1. [`confine_segment`] (every path segment) and [`confine_name`] (a +//! `Create` name, stricter) reject `..`, `.`, an empty segment, an +//! absolute form, and anything that is not exactly one +//! [`std::path::Component::Normal`]. `confine_name` additionally refuses a +//! backslash, a colon, and a Windows reserved device name +//! (`CON`, `COM1`, `CONIN$`, ...) on every platform this crate builds for, +//! because a chosen name reaches this backend from whatever platform the +//! UI runs on. Browsing an *existing* name is more lenient: a literal `:` +//! or `\` already on disk (macOS stores a `/` typed in Finder as `:`) is +//! not itself a path separator on any platform's filesystem, so +//! `confine_segment` lets `list`, `read` and `write` keep such a name +//! reachable instead of discovering it and then refusing to open it. +//! 2. [`open_root`] opens `root` as a [`cap_std::fs::Dir`] capability once per +//! job. Every [`list`], [`read`], [`write`] and [`create`] routes its +//! already-segment-checked relative path through that one `Dir`, never +//! through an absolute OS path built by this crate. `cap_std` resolves one +//! component at a time against real, already-open directory handles, so a +//! symlink or a Windows junction anywhere under `root`, dangling or not, +//! cannot walk resolution above `root`: there is no separate "is this +//! still inside the root" check with a window for the directory tree to +//! change underneath it, because the one resolution *is* the open. +//! +//! A hard link is not a symlink and `cap_std` does not refuse one; the inode +//! it names is an ordinary file from inside the sandbox. [`write`] protects +//! it a different way: it always writes a sibling temporary file and renames +//! it over the target, rather than truncating the target in place. A rename +//! replaces one name's directory entry; it never reaches through to another +//! name that happens to point at the same inode outside `root`. +use std::ffi::OsStr; use std::fs; -use std::io::Write as _; +use std::io::{Read as _, Write as _}; use std::path::{Component, Path, PathBuf}; +use std::sync::atomic::{AtomicU64, Ordering}; +use cap_std::fs::{Dir, OpenOptions}; use craft_cloud::{Capability, Entry, EntryKind}; use craft_ui::cloud::{Account, CloudBackend, Event, Fault, Job, Post}; /// Where "the cloud" lives for this backend: one directory on disk. -/// -/// `Entry::id` and `Entry::path` are the same slash-separated path relative to -/// `root`, always starting with `/` below the root itself (the root's own -/// path is the empty string, matching [`Job::List`]'s contract). Neither is -/// an OS path; both go through [`resolve`] and then [`confine_to_root`] -/// before anything touches a filesystem. A [`Job::Create`] name is not a -/// path at all; it goes through the same per-segment check [`resolve`] uses, -/// [`confine_segment`], on its own. Together the two refuse `..`, an -/// absolute form, a Windows drive letter or UNC prefix, and a backslash, -/// regardless of which platform this crate is built for, since a name -/// reaches this backend from whatever platform the UI runs on. No-escape -/// through a symlink or a Windows junction is a separate policy, stated on -/// [`confine_to_root`] itself, and every one of [`list`], [`read`], -/// [`write`] and [`create`] applies it. pub struct LocalBackend { root: PathBuf, /// Shown in the account badge. Nothing else reads it. @@ -52,7 +78,10 @@ pub struct LocalBackend { impl LocalBackend { /// Treat `root` as the cloud. The directory is not created here; a /// listing of a root that does not exist yet answers with a [`Fault`] - /// the same way a real provider's missing folder would. + /// the same way a real provider's missing folder would. [`Job::Create`] + /// is the one exception, and always has been: it brings a fresh root + /// into existence itself, the same way a first Save As does not require + /// the destination folder to already be there. pub fn new(root: PathBuf) -> LocalBackend { LocalBackend { root, display: "Local disk".to_owned() } } @@ -118,80 +147,84 @@ fn account(display: String) -> Account { Account { display, capabilities: vec![Capability::Files, Capability::Etags], provider_linked: true } } -/// Turns a [`Job`]'s slash-separated path into a real filesystem path under -/// `root`, refusing anything that is not a run of ordinary names. +/// Turns a [`Job`]'s slash-separated path into a path relative to `root`, +/// refusing anything that is not a run of ordinary names. The result is +/// never joined onto `root` as an OS path; every caller hands it to a +/// [`cap_std::fs::Dir`] opened on `root` instead, which is the layer that +/// actually keeps resolution from leaving `root`. /// /// `.` and repeated or leading slashes are just an empty segment and are /// skipped, the same way a browser's address bar collapses them. Every other -/// segment goes through [`confine_segment`], which is what actually refuses -/// `..`, an absolute form, a backslash or a drive letter, or anything else -/// that is not one ordinary name. This function never touches disk, so it -/// cannot see a symlink or a junction; [`confine_to_root`] is the other half -/// of the promise, and every caller of `resolve` runs both. -fn resolve(root: &Path, path: &str) -> Result { - let mut real = root.to_path_buf(); +/// segment goes through [`confine_segment`]. +fn relative(path: &str) -> Result { + let mut rel = PathBuf::new(); for segment in path.split('/') { if segment.is_empty() || segment == "." { continue; } - real.push(confine_segment(segment)?); + rel.push(confine_segment(segment)?); } - Ok(real) + Ok(rel) } -/// Confines one path segment, or a whole [`Job::Create`] name, to a single -/// ordinary file or folder name. +/// Confines one path segment to a single ordinary file or folder name. /// /// Accepted only when `segment` parses as exactly one [`Component::Normal`] /// equal to `segment` itself: no empty name, no `.` or `..`, no absolute -/// form, and nothing left over for a second component to hide in. A -/// `std::path::Component` parse alone does not catch every one of those on -/// every platform; a Unix build's parser does not know what `C:` or -/// `\\server\share` mean, so it would wave a Windows drive letter or a UNC -/// prefix straight through as one ordinary name. A `:` or a `\` is refused -/// outright first, on every platform, for exactly that reason: a name -/// reaches this backend's public [`CloudBackend::submit`] from whatever -/// platform the UI happens to run on, and a Windows-shaped escape must not -/// slip past a Linux build's narrower native parser, or the reverse. +/// form, and nothing left over for a second component to hide in. +/// +/// This is deliberately lenient about an ordinary character such as `:` or +/// `\` that is not, on its own, a path separator on any platform's +/// filesystem: `list` discovers real names from disk, and a name containing +/// one of those (macOS stores a `/` typed in Finder as `:` on disk) must stay +/// reachable by a later `read` or `write`, not become visible-but-unopenable. +/// [`confine_name`] is the stricter check for a name being chosen new, where +/// refusing those characters costs nothing and closes a real escape. fn confine_segment(segment: &str) -> Result<&str, Fault> { - if segment.contains('\\') || segment.contains(':') { - return Err(Fault::Refused(format!("{segment} is not a plain file name"))); - } let mut components = Path::new(segment).components(); match (components.next(), components.next()) { - (Some(Component::Normal(name)), None) if name == std::ffi::OsStr::new(segment) => Ok(segment), + (Some(Component::Normal(name)), None) if name == OsStr::new(segment) => Ok(segment), _ => Err(Fault::Refused(format!("{segment} is not a plain file name"))), } } -/// Confirms a path already built from nothing but [`confine_segment`]-checked -/// names still cannot have reached outside `root` through a symlink or, on -/// Windows, a directory junction. +/// Windows device names that name a device rather than a file, with or +/// without a trailing extension (`CON`, `con.txt`, ...). Checked on every +/// platform: a name chosen here can end up read on a Windows client too. +const WINDOWS_RESERVED_NAMES: &[&str] = &[ + "CON", "PRN", "AUX", "NUL", "CONIN$", "CONOUT$", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", + "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9", +]; + +fn is_windows_reserved_name(name: &str) -> bool { + let stem = name.split('.').next().unwrap_or(name); + WINDOWS_RESERVED_NAMES.iter().any(|reserved| stem.eq_ignore_ascii_case(reserved)) +} + +/// Confines a [`Job::Create`] `name` to a single ordinary file name that is +/// safe to choose on any platform, not only the one this crate is built for. /// -/// The no-escape policy: `candidate` need not exist yet, since [`write`] and -/// [`create`] both route a path that may still be about to be created -/// through here. Starting at `candidate` and walking up through its -/// ancestors, the first one that does exist is canonicalised and compared -/// against the canonicalised `root`. Nothing below that ancestor exists -/// either, so a link cannot sit on any of the remaining components, and -/// every one of them is already known to be ordinary `Component::Normal` -/// text, never `..` or an absolute form, because [`confine_segment`] is what -/// built them. A canonical path that lands outside `root` is refused; -/// nothing here ever opens, reads or writes through it. -fn confine_to_root(root: &Path, candidate: &Path) -> Result { - let real_root = fs::canonicalize(root).map_err(|error| io_fault(&error))?; - let mut probe = candidate; - loop { - match fs::canonicalize(probe) { - Ok(real) if real == real_root || real.starts_with(&real_root) => return Ok(candidate.to_path_buf()), - Ok(_) => return Err(Fault::Refused("that path leaves this folder".to_owned())), - Err(error) if error.kind() == std::io::ErrorKind::NotFound => match probe.parent() { - Some(parent) => probe = parent, - None => return Err(io_fault(&error)), - }, - Err(error) => return Err(io_fault(&error)), - } +/// Stricter than [`confine_segment`]: a backslash or colon is refused +/// outright first, because a Unix build's [`Component`] parser does not +/// treat either as a separator and would wave a Windows drive letter or UNC +/// prefix (`C:`, `\\server\share`) straight through as one ordinary name. A +/// Windows reserved device name is refused the same way. None of this costs +/// anything here, unlike applying it to a name `list` merely discovered. +fn confine_name(name: &str) -> Result<&str, Fault> { + if name.contains('\\') || name.contains(':') { + return Err(Fault::Refused(format!("{name} is not a plain file name"))); } + if is_windows_reserved_name(name) { + return Err(Fault::Refused(format!("{name} is a reserved device name on Windows"))); + } + confine_segment(name) +} + +/// Opens `root` as the one ambient-authority capability this crate holds. +/// Every other path in this crate is resolved relative to the [`Dir`] this +/// returns, never as an absolute OS path built by string concatenation. +fn open_root(root: &Path) -> Result { + Dir::open_ambient_dir(root, cap_std::ambient_authority()).map_err(|error| io_fault(&error)) } /// The path a listed child gets, given the folder it was found in. @@ -204,8 +237,9 @@ fn child_path(folder: &str, name: &str) -> String { /// Not a timestamp for a person to read (that would go through `chrono`, per /// this workspace's rule); just enough to tell "the file I read" from "the /// file as it is now" apart, which is all a conditional write needs. -fn etag_of(meta: &fs::Metadata) -> String { - let stamp = meta.modified().ok().and_then(|time| time.duration_since(std::time::UNIX_EPOCH).ok()).map(|d| d.as_nanos()).unwrap_or(0); +fn etag_of(meta: &cap_std::fs::Metadata) -> String { + let stamp = + meta.modified().ok().and_then(|time| time.duration_since(cap_std::time::SystemClock::UNIX_EPOCH).ok()).map(|d| d.as_nanos()).unwrap_or(0); format!("{}-{stamp}", meta.len()) } @@ -219,8 +253,10 @@ fn io_fault(error: &std::io::Error) -> Fault { } fn list(root: &Path, path: &str) -> Result, Fault> { - let dir = confine_to_root(root, &resolve(root, path)?)?; - let read = fs::read_dir(&dir).map_err(|error| io_fault(&error))?; + let rel = relative(path)?; + let dir = open_root(root)?; + let read = if rel.as_os_str().is_empty() { dir.entries() } else { dir.read_dir(&rel) }; + let read = read.map_err(|error| io_fault(&error))?; let mut entries = Vec::new(); for item in read { let item = item.map_err(|error| io_fault(&error))?; @@ -247,15 +283,32 @@ fn list(root: &Path, path: &str) -> Result, Fault> { /// Reads a file's bytes together with the entry for the version just read. /// -/// The entry is built from a fresh [`fs::metadata`] call here, not handed back +/// The entry is built from a fresh metadata call here, not handed back /// unchanged from what the caller already believed. A reload after a conflict /// hands in the stale entry it is trying to get past; echoing that back would /// carry the old etag into the reloaded document, so the very next save would /// conflict again on a copy that is actually current. +/// +/// Refuses outright if `entry.id` names a symlink, the same policy `write` +/// uses: this backend never reports the bytes of whatever a link happens to +/// point at, inside `root` or out. fn read(root: &Path, entry: &Entry) -> Result<(Entry, Vec), Fault> { - let file = confine_to_root(root, &resolve(root, &entry.id)?)?; - let bytes = fs::read(&file).map_err(|error| io_fault(&error))?; - let meta = fs::metadata(&file).map_err(|error| io_fault(&error))?; + let rel = relative(&entry.id)?; + let dir = open_root(root)?; + // Stats without following only the last component; every component + // before it is still resolved, and sandboxed, normally, so a link + // earlier in `rel` is refused by `open_root`'s `Dir` itself when `open` + // below walks it, never silently followed here either way. + match dir.symlink_metadata(&rel) { + Ok(meta) if meta.is_symlink() => return Err(Fault::Refused("that path is a link, not a plain file".to_owned())), + Ok(_) => {} + Err(error) if error.kind() == std::io::ErrorKind::NotFound => {} + Err(error) => return Err(io_fault(&error)), + } + let mut file = dir.open(&rel).map_err(|error| io_fault(&error))?; + let mut bytes = Vec::new(); + file.read_to_end(&mut bytes).map_err(|error| io_fault(&error))?; + let meta = file.metadata().map_err(|error| io_fault(&error))?; let fresh = Entry { size: Some(meta.len()), etag: Some(etag_of(&meta)), ..entry.clone() }; Ok((fresh, bytes)) } @@ -263,35 +316,97 @@ fn read(root: &Path, entry: &Entry) -> Result<(Entry, Vec), Fault> { /// Saves back over `entry`, refusing the write when the file moved on since /// `entry.etag` was read. A file that no longer exists has nothing to /// conflict with, the same way a provider treats a deleted document. +/// +/// Never truncates `entry.id`'s current bytes in place. [`write_replacing`] +/// writes a sibling temporary file and renames it over the target instead, +/// so a hard link sharing the target's inode keeps its own, unmodified copy: +/// the rename replaces `entry.id`'s directory entry, and never reaches +/// through to any other name pointing at the same inode. fn write(root: &Path, entry: &Entry, bytes: &[u8]) -> Result { - let file = confine_to_root(root, &resolve(root, &entry.id)?)?; - if let Ok(meta) = fs::metadata(&file) - && Some(etag_of(&meta)) != entry.etag - { - return Err(Fault::Conflict); + let rel = relative(&entry.id)?; + let dir = open_root(root)?; + match dir.symlink_metadata(&rel) { + Ok(meta) if meta.is_symlink() => return Err(Fault::Refused("that path is a link, not a plain file".to_owned())), + Ok(meta) => { + if Some(etag_of(&meta)) != entry.etag { + return Err(Fault::Conflict); + } + } + Err(error) if error.kind() == std::io::ErrorKind::NotFound => {} + Err(error) => return Err(io_fault(&error)), } - if let Some(parent) = file.parent() { - fs::create_dir_all(parent).map_err(|error| io_fault(&error))?; + if let Some(parent) = rel.parent() { + dir.create_dir_all(parent).map_err(|error| io_fault(&error))?; } - fs::write(&file, bytes).map_err(|error| io_fault(&error))?; - let meta = fs::metadata(&file).map_err(|error| io_fault(&error))?; + write_replacing(&dir, &rel, bytes)?; + let meta = dir.metadata(&rel).map_err(|error| io_fault(&error))?; Ok(Entry { size: Some(meta.len()), etag: Some(etag_of(&meta)), ..entry.clone() }) } +/// The next in a run of sibling temporary names, unique within this process. +/// Not meant to resist a second process picking the same name; the create +/// this writes with is exclusive (`create_new`), so a collision there is +/// just retried under a new counter value rather than silently overwritten. +static TEMP_SEQUENCE: AtomicU64 = AtomicU64::new(0); + +/// Writes `bytes` to a new sibling of `rel` inside `dir`, then renames that +/// sibling over `rel`. See the module docs for why: a direct write would +/// truncate whatever `rel` currently names in place, and if that happens to +/// be a hard link to a file outside `root`, the outside copy would be +/// corrupted along with it. A rename only ever replaces `rel`'s own +/// directory entry. +fn write_replacing(dir: &Dir, rel: &Path, bytes: &[u8]) -> Result<(), Fault> { + let name = rel.file_name().ok_or_else(|| Fault::Refused("that path names no file".to_owned()))?; + let mut temp_name = OsStr::new(".").to_os_string(); + temp_name.push(name); + temp_name.push(format!(".tmp-{}-{}", std::process::id(), TEMP_SEQUENCE.fetch_add(1, Ordering::Relaxed))); + let temp_rel = match rel.parent() { + Some(parent) if !parent.as_os_str().is_empty() => parent.join(&temp_name), + _ => PathBuf::from(&temp_name), + }; + let mut options = OpenOptions::new(); + options.write(true).create_new(true); + let written = (|| -> Result<(), Fault> { + let mut handle = dir.open_with(&temp_rel, &options).map_err(|error| io_fault(&error))?; + handle.write_all(bytes).map_err(|error| io_fault(&error))?; + handle.sync_all().map_err(|error| io_fault(&error)) + })(); + if let Err(fault) = written { + let _ = dir.remove_file(&temp_rel); + return Err(fault); + } + if let Err(error) = dir.rename(&temp_rel, dir, rel) { + let _ = dir.remove_file(&temp_rel); + return Err(io_fault(&error)); + } + Ok(()) +} + fn create(root: &Path, folder: &str, name: &str, bytes: &[u8]) -> Result { - // `name` is never a path: it is one [`Job::Create`] field that names the - // new file, so it goes through `confine_segment` directly rather than - // through `resolve`, which only ever splits and confines a slash path. - let name = confine_segment(name)?; - let dir = confine_to_root(root, &resolve(root, folder)?)?; - fs::create_dir_all(&dir).map_err(|error| io_fault(&error))?; - let file = dir.join(name); + // `name` is never a path: it is one `Job::Create` field that names the + // new file, so it goes through `confine_name` directly rather than + // through `relative`, which only ever splits and confines a slash path. + let name = confine_name(name)?; + // `root` is the operator-configured boundary, never attacker input, so + // creating it directly with `std::fs` is safe; this is also the one + // place that has always brought a fresh root into existence (see + // `LocalBackend::new`'s docs), and `Dir::open_ambient_dir` below needs it + // to already exist. + fs::create_dir_all(root).map_err(|error| io_fault(&error))?; + let dir = open_root(root)?; + let rel_folder = relative(folder)?; + dir.create_dir_all(&rel_folder).map_err(|error| io_fault(&error))?; + let rel = rel_folder.join(name); // Exclusive creation, not an `exists` check ahead of a separate write: two // creates of the same name racing both see "not there yet" otherwise, and // the second write silently replaces the first with neither ever refused. // `create_new` asks the filesystem to open and create in one step, so the - // loser gets an error instead of a chance to overwrite the winner. - let mut handle = match fs::OpenOptions::new().write(true).create_new(true).open(&file) { + // loser gets an error instead of a chance to overwrite the winner. It also + // refuses outright when `name` already exists as a symlink, dangling or + // not: `O_EXCL` never follows one to decide whether it is "in the way". + let mut create_options = OpenOptions::new(); + create_options.write(true).create_new(true); + let mut handle = match dir.open_with(&rel, &create_options) { Ok(handle) => handle, Err(error) if error.kind() == std::io::ErrorKind::AlreadyExists => { return Err(Fault::Refused(format!("{name} already exists"))); @@ -300,7 +415,7 @@ fn create(root: &Path, folder: &str, name: &str, bytes: &[u8]) -> Result Vec { - settle(app, ctx, |app| !app.said.lock().unwrap().is_empty()); + app.opened.lock().unwrap().clear(); + app.said.lock().unwrap().clear(); + settle(app, ctx, |app| !app.said.lock().unwrap().is_empty() || !app.opened.lock().unwrap().is_empty()); app.said.lock().unwrap().clone() } @@ -117,27 +125,26 @@ struct Sentinels { sentinel_dir: PathBuf, } +const SENTINEL_FILE_BYTES: &[u8] = b"a sibling file this backend must never read or write"; +const SENTINEL_DIR_FILE_BYTES: &[u8] = b"a sibling directory this backend must never list"; + fn sentinels() -> Sentinels { let arena = tempfile::tempdir().unwrap(); let root = arena.path().join("root"); std::fs::create_dir(&root).unwrap(); let sentinel_file = arena.path().join("sentinel.txt"); - std::fs::write(&sentinel_file, b"a sibling file this backend must never read or write").unwrap(); + std::fs::write(&sentinel_file, SENTINEL_FILE_BYTES).unwrap(); let sentinel_dir = arena.path().join("sentinel-dir"); std::fs::create_dir(&sentinel_dir).unwrap(); - std::fs::write(sentinel_dir.join("secret.txt"), b"a sibling directory this backend must never list").unwrap(); + std::fs::write(sentinel_dir.join("secret.txt"), SENTINEL_DIR_FILE_BYTES).unwrap(); Sentinels { _arena: arena, root, sentinel_file, sentinel_dir } } fn assert_sentinels_untouched(sentinels: &Sentinels) { - assert_eq!( - std::fs::read(&sentinels.sentinel_file).unwrap(), - b"a sibling file this backend must never read or write", - "the sentinel file outside the root was changed" - ); + assert_eq!(std::fs::read(&sentinels.sentinel_file).unwrap(), SENTINEL_FILE_BYTES, "the sentinel file outside the root was changed"); assert_eq!( std::fs::read(sentinels.sentinel_dir.join("secret.txt")).unwrap(), - b"a sibling directory this backend must never list", + SENTINEL_DIR_FILE_BYTES, "the sentinel directory's file outside the root was changed" ); } @@ -165,28 +172,13 @@ fn create_refuses_every_escaping_name_and_the_sentinels_stay_untouched() { } } -/// A folder path for `Job::List` can carry the same Windows-shaped escape a `Create` name can; -/// `resolve` must refuse it through the identical [`confine_segment`] check, not a weaker one. -#[test] -fn listing_a_windows_shaped_folder_path_is_refused_on_every_platform() { - let sentinels = sentinels(); - let (mut app, ctx) = wired(sentinels.root.clone()); - - cloud::browse(&mut app, "..\\sentinel-dir"); - settle(&mut app, &ctx, |app| app.cloud().mine.loaded); - - assert!(app.cloud().mine.error.is_some(), "a backslash-separated folder path must be refused"); - assert!(app.cloud().mine.entries.is_empty()); - assert_sentinels_untouched(&sentinels); -} - // ------------------------------------------------------------------- link-based escapes // // `escape(&sentinels)` places one link named `escape` inside the cloud root, pointing out to // `sentinels.sentinel_dir`: a symlink on Unix, a directory junction on Windows, which needs no // elevated privilege, unlike a Windows symlink. The Linux gate runs the symlink half of every -// test below; CI's windows-latest lanes run the junction half. Either way `root/escape/secret.txt` -// is the same sentinel file reached through the link. +// test below; CI's windows-latest lanes run the junction half. Either way `root/escape/...` +// reaches into the sentinel directory through the link. /// Nothing to clean up on Unix: `tempfile`'s own recursive removal of the arena directory /// removes a plain symlink entry without following it. This exists only so `escape` returns the @@ -228,13 +220,14 @@ fn escape(sentinels: &Sentinels) -> Junction { Junction(link) } -#[cfg(any(unix, windows))] -fn leaked_entry() -> Entry { +/// An [`Entry`] stub naming `id`, for a [`Job::Read`] or [`Job::Write`] this file submits +/// directly rather than through an entry the backend itself handed back. +fn leaked_entry(id: &str, name: &str) -> Entry { Entry { - id: "/escape/secret.txt".to_owned(), - room: "local:/escape/secret.txt".to_owned(), - name: "secret.txt".to_owned(), - path: "/escape/secret.txt".to_owned(), + id: id.to_owned(), + room: format!("local:{id}"), + name: name.to_owned(), + path: id.to_owned(), kind: EntryKind::File, size: None, modified: None, @@ -267,23 +260,172 @@ fn reading_through_a_linked_folder_cannot_return_bytes_from_outside_the_root() { let (mut app, ctx) = wired(sentinels.root.clone()); let _escape = escape(&sentinels); - cloud::submit(&app, Job::Read { entry: leaked_entry(), into: None }); + cloud::submit(&app, Job::Read { entry: leaked_entry("/escape/secret.txt", "secret.txt"), into: None }); said(&mut app, &ctx); assert!(app.opened.lock().unwrap().is_empty(), "a read through a symlink or junction out of the root must not deliver bytes"); assert_sentinels_untouched(&sentinels); } +/// benandez's finding 4: the original version of this test targeted the pre-existing +/// `secret.txt`, with `etag: None`. `write` refused that for an unrelated reason, a version +/// mismatch, before confinement ever ran, so the test passed whether or not confinement worked. +/// Targeting a name that does not exist yet under the link reaches the code that actually +/// matters, and the oracle (the file must never be created) is one confinement failing would +/// actually flip. #[cfg(any(unix, windows))] #[test] -fn writing_through_a_linked_folder_cannot_change_a_file_outside_the_root() { +fn writing_through_a_linked_folder_cannot_create_a_file_outside_the_root() { let sentinels = sentinels(); let (mut app, ctx) = wired(sentinels.root.clone()); let _escape = escape(&sentinels); - cloud::submit(&app, Job::Write { uid: 1, entry: leaked_entry(), bytes: b"pwned".to_vec() }); + cloud::submit(&app, Job::Write { uid: 1, entry: leaked_entry("/escape/not-yet-created.txt", "not-yet-created.txt"), bytes: b"pwned".to_vec() }); said(&mut app, &ctx); - assert!(app.cloud().conflict.is_none(), "this must be refused outright, not treated as a stale-version conflict"); + assert!(!sentinels.sentinel_dir.join("not-yet-created.txt").exists(), "a write through a link must not create a file outside the root"); + assert_sentinels_untouched(&sentinels); +} + +/// benandez's finding 5: nothing previously exercised a link in the `folder` a `Create` targets. +#[cfg(any(unix, windows))] +#[test] +fn creating_through_a_linked_folder_cannot_create_a_file_outside_the_root() { + let sentinels = sentinels(); + let (mut app, ctx) = wired(sentinels.root.clone()); + let _escape = escape(&sentinels); + + cloud::submit(&app, Job::Create { uid: 1, folder: "escape".to_owned(), name: "new.txt".to_owned(), bytes: b"pwned".to_vec() }); + let messages = said(&mut app, &ctx); + + assert!(cloud::origin(&app).is_none(), "a create into a linked folder must not be reported as created"); + assert!(!messages.is_empty(), "a create into a linked folder must be refused, not silently dropped"); + assert!(!sentinels.sentinel_dir.join("new.txt").exists(), "a create through a link must not create a file outside the root"); + assert_sentinels_untouched(&sentinels); +} + +// ------------------------------------------------------------------- Unix-only reproductions +// +// Directory junctions cannot be dangling (`mklink /J` requires the target to exist) and the +// race and hard-link reproductions below are exactly benandez's own repros, run on Linux only, +// as stated in that review. The structural fix (resolving through a `cap_std::fs::Dir`, and +// writing through a temporary file and rename) is the same code on every platform; these three +// just do not have a Windows-shaped equivalent worth a separate repro. + +/// benandez's finding 1, reproduced exactly: `root/doc.txt` is a symlink to a file that does not +/// exist yet, outside the root. The old code's `confine_to_root` canonicalised the dangling link +/// to `NotFound`, walked up to `root`, accepted it, found no file to conflict with, and `write` +/// created the target for real, outside the root. +#[cfg(unix)] +#[test] +fn writing_through_a_dangling_symlink_cannot_create_a_file_outside_the_root() { + let sentinels = sentinels(); + let outside_target = sentinels._arena.path().join("outside-planted.txt"); + std::os::unix::fs::symlink(&outside_target, sentinels.root.join("doc.txt")).unwrap(); + let (mut app, ctx) = wired(sentinels.root.clone()); + + cloud::submit(&app, Job::Write { uid: 1, entry: leaked_entry("/doc.txt", "doc.txt"), bytes: b"pwned".to_vec() }); + said(&mut app, &ctx); + + assert!(!outside_target.exists(), "a write through a dangling symlink must not create its target outside the root"); + assert_sentinels_untouched(&sentinels); +} + +/// benandez's finding 3, reproduced exactly: `root/hl` is a hard link sharing an inode with a +/// file outside the root. Reading it through the backend is legitimate (it is, from inside the +/// sandbox, an ordinary file), which is also how this test gets a real, matching etag to write +/// with, the same way a real caller would after opening the document. The old code's `write` +/// truncated the shared inode in place; `write_replacing` must instead replace `hl`'s own +/// directory entry, leaving the sentinel file's inode, and its other name, untouched. +#[cfg(unix)] +#[test] +fn writing_through_a_hard_link_replaces_the_entry_without_touching_the_shared_file() { + let sentinels = sentinels(); + std::fs::hard_link(&sentinels.sentinel_file, sentinels.root.join("hl")).unwrap(); + let (mut app, ctx) = wired(sentinels.root.clone()); + + cloud::submit(&app, Job::Read { entry: leaked_entry("/hl", "hl"), into: None }); + settle(&mut app, &ctx, |app| !app.opened.lock().unwrap().is_empty()); + let real_entry = app.cloud().origins.get(&1).expect("the read registered an origin for uid 1").entry.clone(); + + // A successful write answers through `cloud.status`, not through `said` or `opened`, so it + // needs its own wait condition rather than the `said` helper used everywhere else in this + // file for a refusal. The read above already set `status` once (`Opened hl from the + // cloud.`), so that has to be cleared first or this would observe the read's own status and + // never actually wait for the write to finish. + app.cloud_mut().status = None; + cloud::submit(&app, Job::Write { uid: 1, entry: real_entry, bytes: b"replaced via rename, not truncated in place".to_vec() }); + settle(&mut app, &ctx, |app| app.cloud().status.is_some() || app.cloud().conflict.is_some() || !app.said.lock().unwrap().is_empty()); + assert!(app.cloud().conflict.is_none(), "the write through the hard-linked name should succeed, not conflict"); + assert!( + app.said.lock().unwrap().is_empty(), + "the write through the hard-linked name should succeed, not be refused: {:?}", + app.said.lock().unwrap() + ); + + assert_eq!( + std::fs::read(sentinels.root.join("hl")).unwrap(), + b"replaced via rename, not truncated in place", + "the write through the hard-linked name should still succeed" + ); + assert_sentinels_untouched(&sentinels); +} + +/// benandez's finding 2, reproduced at a smaller scale: a background thread swaps `root/d` +/// between a symlink into an inside folder and a symlink to the sentinel directory, as fast as +/// it can, with no coordination with the reads below. The old code's `confine_to_root` checked +/// one path string and then `fs::read` resolved that path again, a second, later lookup a swap +/// could land in between; out of 3000 such reads benandez's own run returned the outside file's +/// bytes 347 times. `cap_std::fs::Dir::open` resolves and opens `d` as one operation with no +/// such second lookup, so this must come back empty every time, not merely most of the time. +#[cfg(unix)] +#[test] +fn reading_through_a_link_being_swapped_never_observes_the_outside_target() { + use std::sync::atomic::{AtomicBool, Ordering}; + + let sentinels = sentinels(); + let inside = sentinels.root.join("inside"); + std::fs::create_dir(&inside).unwrap(); + std::fs::write(inside.join("secret.txt"), b"inside bytes, always safe to read").unwrap(); + let link = sentinels.root.join("d"); + std::os::unix::fs::symlink(&inside, &link).unwrap(); + + let stop = Arc::new(AtomicBool::new(false)); + let swapper = { + let stop = stop.clone(); + let link = link.clone(); + let outside = sentinels.sentinel_dir.clone(); + std::thread::spawn(move || { + let temp = link.with_extension("swap"); + let mut toward_outside = false; + while !stop.load(Ordering::Relaxed) { + let target = if toward_outside { &outside } else { &inside }; + // A stale `temp` from a rename that did not happen (should not occur, but a + // leftover `temp` would otherwise wedge every later iteration's `symlink` call, + // silently stopping the swap rather than failing the test loudly) is cleared + // first so this loop cannot get stuck. + let _ = std::fs::remove_file(&temp); + if std::os::unix::fs::symlink(target, &temp).is_ok() { + let _ = std::fs::rename(&temp, &link); + } + toward_outside = !toward_outside; + } + }) + }; + + let (mut app, ctx) = wired(sentinels.root.clone()); + let mut leaked = false; + for _ in 0..200 { + cloud::submit(&app, Job::Read { entry: leaked_entry("/d/secret.txt", "secret.txt"), into: None }); + said(&mut app, &ctx); + if let Some((_, bytes)) = app.opened.lock().unwrap().first() { + leaked |= bytes.as_slice() == SENTINEL_DIR_FILE_BYTES; + } + } + + stop.store(true, Ordering::Relaxed); + swapper.join().unwrap(); + + assert!(!leaked, "a read observed the outside target's bytes while the link was being swapped underneath it"); assert_sentinels_untouched(&sentinels); } From f32b47a1d4799269b7e4b99bb130161dcb7b312a Mon Sep 17 00:00:00 2001 From: Terra854 Date: Tue, 17 Nov 2026 19:00:14 +0800 Subject: [PATCH 019/183] Add opt-in checked SVG image validation --- Cargo.lock | 4 + crates/svg/Cargo.toml | 13 +- crates/svg/README.md | 55 +++ crates/svg/src/tree.rs | 23 +- crates/svg/src/tree/draw.rs | 8 + crates/svg/src/tree/draw/decoder_edges.rs | 127 ++++++ crates/svg/src/tree/draw/raster.rs | 140 +++++++ crates/svg/src/tree/image_href.rs | 428 +++++++++++++++++++++ crates/svg/src/tree/mime_header_tests.rs | 158 ++++++++ crates/svg/src/tree/validated.rs | 393 +++++++++++++++++++ crates/svg/src/tree/validated/tests.rs | 340 ++++++++++++++++ crates/svg/src/tree/validated/xml_tests.rs | 176 +++++++++ 12 files changed, 1861 insertions(+), 4 deletions(-) create mode 100644 crates/svg/src/tree/draw/decoder_edges.rs create mode 100644 crates/svg/src/tree/draw/raster.rs create mode 100644 crates/svg/src/tree/image_href.rs create mode 100644 crates/svg/src/tree/mime_header_tests.rs create mode 100644 crates/svg/src/tree/validated.rs create mode 100644 crates/svg/src/tree/validated/tests.rs create mode 100644 crates/svg/src/tree/validated/xml_tests.rs diff --git a/Cargo.lock b/Cargo.lock index a9290398b..4da6cf6c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3092,14 +3092,18 @@ dependencies = [ "craft-xml", "data-url", "flate2", + "gif", + "image-webp", "kurbo 0.13.1", "quick-xml 0.41.0", "resvg 0.48.1", "roxmltree 0.21.2", "thiserror 2.0.21", + "toml", "usvg 0.48.1", "vectorcraft-geom", "vectorcraft-pathops", + "zune-jpeg", ] [[package]] diff --git a/crates/svg/Cargo.toml b/crates/svg/Cargo.toml index b35c4de41..4b7e928a8 100644 --- a/crates/svg/Cargo.toml +++ b/crates/svg/Cargo.toml @@ -31,6 +31,13 @@ usvg = { version = "=0.48.1", default-features = false, optional = true } resvg = { version = "=0.48.1", default-features = false, features = ["text", "raster-images"], optional = true } data-url = { version = "0.3.2", optional = true } +# Renderer-specific validation uses the same resolved backends as resvg0.48.1. +# zune-jpeg is used under its MIT licence option. The locked edge-alignment +# regression must pass when changing this renderer/backend dependency group. +zune-jpeg = { version = "=0.5.15", optional = true } +gif = { version = "=0.14.2", optional = true } +image-webp = { version = "=0.2.4", optional = true } + [features] default = ["paths"] @@ -45,5 +52,9 @@ tree-text = ["tree", "usvg/text"] # The system's fonts in `usvg::fontdb`. tree-system-fonts = ["tree-text", "usvg/system-fonts"] # Bounded rendering of a parsed tree through the matching resvg/tiny-skia versions. -tree-render = ["tree", "dep:resvg"] +tree-render = ["tree", "dep:resvg", "dep:zune-jpeg", "dep:gif", "dep:image-webp"] tree-render-system-fonts = ["tree-render", "resvg/system-fonts"] + +[dev-dependencies] +# Already resolved in the workspace; test-only Cargo.lock edge inspection. +toml = "=1.1.8" diff --git a/crates/svg/README.md b/crates/svg/README.md index 508081367..0810b1217 100644 --- a/crates/svg/README.md +++ b/crates/svg/README.md @@ -16,3 +16,58 @@ The shared adapter adds an aggregate 64 MiB stylesheet-text limit and idempotent ### Transform compatibility `transform_compat::parse_transform` preserves EffectCraft transform-list recovery and exact composition. It retains six numeric arguments per operation; scanning is not time/byte capped and matrix overflow behavior is unchanged. The strict geometry reader is unchanged. Source: Brandon Thomas, EffectCraft94e1c86d89a866771f80ad1610afda9aa12e85d8; bounded safe argument matching by Altynzhan Karybai,4035d181329e847d7a57bf3d059502ea2c91b560. + + +### Opt-in validated embedded images + +With `tree-render`, `tree::ValidatedImageResolver` owns one drawing's immutable +`Limits`, original child-source work, data-URL normalization and renderer-specific +raster validation. Existing `ImageResolver::new`/`resolver` and legacy parse entry +points retain their behavior. Opt in explicitly: + +```rust +# #[cfg(feature = "tree-render")] +# fn example() -> Result<(), craft_svg::tree::Error> { +use craft_svg::tree::{self, Limits, ValidatedImageResolver, usvg}; +let images = ValidatedImageResolver::new(Limits::default()); +let checked = tree::preflight( + "", + &images.limits(), +)?; +let drawing = images.parse_preflight(checked, usvg::Options::default())?; +let usage = images.usage(); +// Importers disclose usage's invalid_* and *_limit_images; strict consumers refuse them. +# let _ = (drawing, usage); +# Ok(()) +# } +``` + +The caller supplies fonts and a sufficient stack/worker for its depth policy. +`parse_preflight` accepts only an opaque preflight made with exactly this context's +limits. It consumes options and installs its own data-only resolver, including for +all children; unrelated callbacks cannot fetch a linked file or bypass admission. +The full expanded root height and each child's expanded height share one depth +allowance. An overlapping root conversion on the same context is refused. + +Unchanged XML converts from its original checked DOM. A modified data URL requires +one checked replacement DOM. Invalid URLs become bounded resolver-visible image +failures; hidden, unused and foreign elements do not acquire omission counts. +Original UTF-8 child bytes are charged before XML conversion or shorter repairs, +with per-document and aggregate bounds. Failed inflation/text work is not refunded; +separate bounded retry-classification work never admits another child. Encoded +raster callbacks spend at most `limits.bytes + limits.embedded_bytes` cumulatively, +without retaining their sources. Pixel work and decoder allocation are admitted +before decoding; attempted failures keep their charge. An oversized unattempted +image does not prevent a later smaller image from fitting. + +`resolve_text` accepts an already-decoded child SVG through the same admission +context, rather than an unchecked DOM or a precharged-budget override. `usage()` +reports omissions and work after conversion. The context is for one drawing, not a +global rendering cache. + +The renderer has no public decoded-pixel or decode-result hook. Validation therefore +still decodes raster pixels before later renderer painting. The shared validator +owns the backend dependencies; locked dependency-edge tests in both the shared +workspace and consumers must keep them aligned with the selected resvg/usvg graph. +This is a fail-fast maintenance check, not automatic access to private renderer +code or a decode-once performance claim. Direct zune-jpeg use selects its MIT option. diff --git a/crates/svg/src/tree.rs b/crates/svg/src/tree.rs index ab04a3002..80feec75d 100644 --- a/crates/svg/src/tree.rs +++ b/crates/svg/src/tree.rs @@ -34,7 +34,13 @@ use crate::{guard, svgz}; pub mod document; pub mod draw; +#[cfg(feature = "tree-render")] +mod image_href; pub mod primitive; +#[cfg(feature = "tree-render")] +mod validated; +#[cfg(feature = "tree-render")] +pub use validated::ValidatedImageResolver; /// What one import may use. The defaults suit a desktop app that parses on a thread with a /// large stack (see the module text). @@ -161,6 +167,7 @@ pub fn root_unitless_size(svg: &str, limits: &Limits) -> Result { + limits: Limits, xml: roxmltree::Document<'s>, depth: usize, /// [`height`]: the nesting usvg converts, references followed. @@ -219,6 +226,8 @@ const UNSUPPORTED: &[&str] = &[ /// Checks already-decoded SVG text once, retaining the parsed XML for both depth policy and tree conversion. pub fn preflight<'s>(svg: &'s str, limits: &Limits) -> Result, Error> { + #[cfg(test)] + PREFLIGHT_PASSES.with(|count| count.set(count.get().saturating_add(1))); let preflight_limits = crate::preflight::Limits { bytes: limits.bytes, depth: limits.depth, @@ -239,7 +248,7 @@ pub fn preflight<'s>(svg: &'s str, limits: &Limits) -> Result, Err let Some(height) = height(&xml, limits.tree_depth)? else { return Err(Error::TooDeep(limits.tree_depth)); }; - Ok(Preflight { xml, depth, height }) + Ok(Preflight { limits: *limits, xml, depth, height }) } /// Dimensions of an SVG viewport in SVG user units. @@ -432,9 +441,12 @@ struct Used { /// What resolving one drawing's embedded images used or refused. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub struct ImageUsage { - /// Unique decoded raster pixels reserved before decode. + /// Decoded raster pixel work reserved before decode. The legacy resolver + /// shares a charge across repeated data; the validated context charges each + /// attempted decode, including failures. pub raster_pixels: u64, - /// Unpacked SVG bytes consumed by embedded SVG data URLs. + /// Decoded SVG text work charged to embedded data URLs, including the + /// remaining allowance consumed by a failed inflation attempt. pub embedded_svg_bytes: usize, /// Embedded SVG images parsed, including nested images. pub embedded_svg_count: usize, @@ -730,3 +742,8 @@ fn image_resolver_for(limits: Limits, used: Arc) -> usvg::ImageHrefResolve #[cfg(test)] mod tests; + +#[cfg(test)] +thread_local! { + static PREFLIGHT_PASSES: std::cell::Cell = const { std::cell::Cell::new(0) }; +} diff --git a/crates/svg/src/tree/draw.rs b/crates/svg/src/tree/draw.rs index f83653284..8a8bb1a7a 100644 --- a/crates/svg/src/tree/draw.rs +++ b/crates/svg/src/tree/draw.rs @@ -29,6 +29,11 @@ pub use resvg; #[cfg(feature = "tree-render")] pub use resvg::tiny_skia; +#[cfg(feature = "tree-render")] +mod raster; +#[cfg(feature = "tree-render")] +pub use raster::{RasterValidationFailure, validate_raster}; + /// Filter primitives per filter. A result of every primitive is kept; real filters have 1 to 12 /// (Inkscape's drop shadow has 5), and 64 leaves headroom for generated ones. const MAX_PRIMITIVES: usize = 64; @@ -546,3 +551,6 @@ fn deeper(cx: Cx) -> Result<(), Refusal> { } Ok(()) } + +#[cfg(all(test, feature = "tree-render"))] +mod decoder_edges; diff --git a/crates/svg/src/tree/draw/decoder_edges.rs b/crates/svg/src/tree/draw/decoder_edges.rs new file mode 100644 index 000000000..8258b5792 --- /dev/null +++ b/crates/svg/src/tree/draw/decoder_edges.rs @@ -0,0 +1,127 @@ +//! Test-only resolved-edge checks. No Cargo subprocess or global version count. +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::indexing_slicing)] + +#[derive(Clone, Debug, PartialEq, Eq)] +pub(crate) struct PackageId { + name: String, + version: String, + source: Option, +} +struct Package { + id: PackageId, + dependencies: Vec, +} +pub(crate) struct LockGraph { + packages: Vec, +} +impl LockGraph { + pub(crate) fn parse(text: &str) -> Self { + let lock: toml::Value = text.parse().unwrap(); + let packages = lock + .get("package") + .unwrap() + .as_array() + .unwrap() + .iter() + .map(|package| { + let string = |key| package.get(key).unwrap().as_str().unwrap().to_owned(); + Package { + id: PackageId { + name: string("name"), + version: string("version"), + source: package.get("source").map(|v| v.as_str().unwrap().to_owned()), + }, + dependencies: package + .get("dependencies") + .map(|d| d.as_array().unwrap().iter().map(|v| v.as_str().unwrap().to_owned()).collect()) + .unwrap_or_default(), + } + }) + .collect(); + Self { packages } + } + pub(crate) fn workspace_package(&self, name: &str) -> PackageId { + let found: Vec<_> = self.packages.iter().filter(|p| p.id.name == name && p.id.source.is_none()).collect(); + assert_eq!(found.len(), 1, "one exact workspace package required: {name}"); + found[0].id.clone() + } + pub(crate) fn dependency(&self, from: &PackageId, name: &str) -> PackageId { + let package = self.packages.iter().find(|p| &p.id == from).unwrap(); + let edges: Vec<_> = package.dependencies.iter().filter(|edge| edge.split_whitespace().next() == Some(name)).collect(); + assert_eq!(edges.len(), 1, "one {name} dependency edge required from {from:?}"); + let fields: Vec<_> = edges[0].split_whitespace().collect(); + let version = fields.get(1).copied(); + let source = fields.get(2).map(|s| s.trim_start_matches('(').trim_end_matches(')')); + let found: Vec<_> = self + .packages + .iter() + .filter(|p| p.id.name == name && version.is_none_or(|v| p.id.version == v) && source.is_none_or(|s| p.id.source.as_deref() == Some(s))) + .collect(); + assert_eq!(found.len(), 1, "ambiguous or absent resolved edge {} from {from:?}", edges[0]); + found[0].id.clone() + } +} + +pub(crate) fn assert_renderer_edges(graph: &LockGraph, svg: &PackageId) { + let renderer = graph.dependency(svg, "resvg"); + assert_eq!(graph.dependency(svg, "usvg"), graph.dependency(&renderer, "usvg"), "shared and renderer trees must be the same resolved package"); + for codec in ["gif", "image-webp", "zune-jpeg"] { + assert_eq!(graph.dependency(svg, codec), graph.dependency(&renderer, codec), "validator and selected renderer differ for {codec}"); + } +} + +#[test] +fn validated_renderer_dependency_edges_are_the_same_resolved_packages() { + let file = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../Cargo.lock"); + let graph = LockGraph::parse(&std::fs::read_to_string(file).unwrap()); + assert_renderer_edges(&graph, &graph.workspace_package("craft-svg")); +} + +#[test] +fn dependency_lookup_follows_the_selected_edge_and_rejects_ambiguity() { + let graph = LockGraph::parse( + r#" +[[package]] +name = "consumer" +version = "1" +dependencies = ["codec 1 (registry+one)"] +[[package]] +name = "codec" +version = "1" +source = "registry+one" +[[package]] +name = "codec" +version = "1" +source = "registry+two" +[[package]] +name = "other" +version = "1" +dependencies = ["codec"] +"#, + ); + let selected = graph.dependency(&graph.workspace_package("consumer"), "codec"); + assert_eq!(selected.source.as_deref(), Some("registry+one")); + assert!(std::panic::catch_unwind(|| graph.dependency(&graph.workspace_package("other"), "codec")).is_err()); +} + +#[test] +fn selected_renderer_graph_rejects_a_split_validator_backend() { + use std::fmt::Write; + let make = |split: bool| { + let mut text = String::from("[[package]]\nname='craft-svg'\nversion='1'\ndependencies=['resvg', 'usvg', 'gif', 'image-webp', '"); + text.push_str(if split { "zune-jpeg 2" } else { "zune-jpeg 1" }); + text.push_str( + "']\n[[package]]\nname='resvg'\nversion='1'\nsource='registry+one'\ndependencies=['usvg', 'gif', 'image-webp', 'zune-jpeg 1']\n", + ); + for name in ["usvg", "gif", "image-webp", "zune-jpeg"] { + write!(&mut text, "[[package]]\nname='{name}'\nversion='1'\nsource='registry+one'\n").unwrap(); + } + // An unrelated second codec version is valid; only the selected edges count. + text.push_str("[[package]]\nname='zune-jpeg'\nversion='2'\nsource='registry+one'\n"); + LockGraph::parse(&text) + }; + let matching = make(false); + assert_renderer_edges(&matching, &matching.workspace_package("craft-svg")); + let split = make(true); + assert!(std::panic::catch_unwind(|| assert_renderer_edges(&split, &split.workspace_package("craft-svg"))).is_err()); +} diff --git a/crates/svg/src/tree/draw/raster.rs b/crates/svg/src/tree/draw/raster.rs new file mode 100644 index 000000000..fe250259d --- /dev/null +++ b/crates/svg/src/tree/draw/raster.rs @@ -0,0 +1,140 @@ +//! Validate optional raster images with the same backends used by the SVG renderer. +//! +//! Header probing alone cannot detect damaged pixel data. Admit dimensions and +//! reserve work before decoding: even a failed decode keeps its charge. + +use std::io::Cursor; +use std::num::NonZeroU64; + +use crate::tree::{draw::tiny_skia, usvg}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum RasterValidationFailure { + /// The renderer cannot decode the encoded image. + Invalid, + /// Header dimensions, cumulative work or decoder allocation exceed admission. + Limit, +} + +/// Validate the renderer's first frame within per-image and remaining work limits. +/// Failed attempted decodes keep their pixel charge. No decoded pixels are retained. SVG +/// children use the same wrapped resolver and need no second recursive walk. +pub fn validate_raster(kind: &usvg::ImageKind, max_pixels: u64, pixels_left: &mut u64) -> Result<(), RasterValidationFailure> { + let data = match kind { + usvg::ImageKind::PNG(data) | usvg::ImageKind::JPEG(data) | usvg::ImageKind::GIF(data) | usvg::ImageKind::WEBP(data) => data, + usvg::ImageKind::SVG(_) => return Ok(()), + }; + // The allocation probe includes oversized GIF/WebP frames, not merely their + // canvas. Reserve before asking any rendering decoder to allocate pixels. + let (width, height) = craft_image_codecs::probe_allocation_size(data).map_err(|_| RasterValidationFailure::Invalid)?; + let pixels = area(width, height)?; + if pixels > max_pixels { + return Err(RasterValidationFailure::Limit); + } + *pixels_left = pixels_left.checked_sub(pixels).ok_or(RasterValidationFailure::Limit)?; + match kind { + usvg::ImageKind::PNG(data) => { + let decoded = tiny_skia::Pixmap::decode_png(data).map_err(|_| RasterValidationFailure::Invalid)?; + rgba_bytes(decoded.width(), decoded.height(), pixels)?; + Ok(()) + } + usvg::ImageKind::JPEG(data) => jpeg(data, pixels), + usvg::ImageKind::GIF(data) => gif(data, pixels), + usvg::ImageKind::WEBP(data) => webp(data, pixels), + usvg::ImageKind::SVG(_) => Ok(()), + } +} + +fn area(width: u32, height: u32) -> Result { + if width == 0 || height == 0 { + return Err(RasterValidationFailure::Invalid); + } + u64::from(width).checked_mul(u64::from(height)).ok_or(RasterValidationFailure::Limit) +} + +/// Decoder headers must not request more output than the allocation probe paid for. +fn rgba_bytes(width: u32, height: u32, admitted: u64) -> Result { + let pixels = area(width, height)?; + if pixels > admitted { + return Err(RasterValidationFailure::Limit); + } + usize::try_from(pixels.checked_mul(4).ok_or(RasterValidationFailure::Limit)?).map_err(|_| RasterValidationFailure::Limit) +} + +fn buffer(length: usize) -> Result, RasterValidationFailure> { + let mut output = Vec::new(); + output.try_reserve_exact(length).map_err(|_| RasterValidationFailure::Limit)?; + output.resize(length, 0); + Ok(output) +} + +fn jpeg(data: &[u8], admitted: u64) -> Result<(), RasterValidationFailure> { + use zune_jpeg::zune_core::colorspace::ColorSpace; + use zune_jpeg::zune_core::options::DecoderOptions; + + // Preserve the rendering decoder's default limits and RGBA conversion; a + // general photo decoder may accept formats the SVG renderer cannot draw. + let options = DecoderOptions::default().jpeg_set_out_colorspace(ColorSpace::RGBA); + let mut decoder = zune_jpeg::JpegDecoder::new_with_options(Cursor::new(data), options); + decoder.decode_headers().map_err(|_| RasterValidationFailure::Invalid)?; + let info = decoder.info().ok_or(RasterValidationFailure::Invalid)?; + let length = rgba_bytes(u32::from(info.width), u32::from(info.height), admitted)?; + if decoder.output_colorspace() != Some(ColorSpace::RGBA) || decoder.output_buffer_size() != Some(length) { + return Err(RasterValidationFailure::Invalid); + } + let mut output = buffer(length)?; + decoder.decode_into(&mut output).map_err(|_| RasterValidationFailure::Invalid) +} + +fn gif(data: &[u8], admitted: u64) -> Result<(), RasterValidationFailure> { + let bytes = admitted.checked_mul(4).ok_or(RasterValidationFailure::Limit)?; + // Do not loosen the renderer's default 50 MB GIF frame limit. Smaller + // imports also keep their own admitted allocation ceiling during decode. + let limit = NonZeroU64::new(bytes.min(50_000_000)).ok_or(RasterValidationFailure::Invalid)?; + let mut options = gif::DecodeOptions::new(); + options.set_color_output(gif::ColorOutput::RGBA); + options.set_memory_limit(gif::MemoryLimit::Bytes(limit)); + let mut decoder = options.read_info(data).map_err(gif_error)?; + let frame = decoder.read_next_frame().map_err(gif_error)?.ok_or(RasterValidationFailure::Invalid)?; + let expected = rgba_bytes(u32::from(frame.width), u32::from(frame.height), admitted)?; + if frame.buffer.len() != expected { + return Err(RasterValidationFailure::Invalid); + } + Ok(()) +} + +fn gif_error(error: gif::DecodingError) -> RasterValidationFailure { + match error { + gif::DecodingError::MemoryLimit | gif::DecodingError::OutOfMemory => RasterValidationFailure::Limit, + _ => RasterValidationFailure::Invalid, + } +} + +fn webp(data: &[u8], admitted: u64) -> Result<(), RasterValidationFailure> { + let mut decoder = image_webp::WebPDecoder::new(Cursor::new(data)).map_err(webp_error)?; + let (width, height) = decoder.dimensions(); + let rgba = rgba_bytes(width, height, admitted)?; + let channels = if decoder.has_alpha() { 4 } else { 3 }; + let expected = usize::try_from(area(width, height)?.checked_mul(channels).ok_or(RasterValidationFailure::Limit)?) + .map_err(|_| RasterValidationFailure::Limit)?; + if expected > rgba { + return Err(RasterValidationFailure::Limit); + } + if decoder.output_buffer_size() != Some(expected) { + return Err(RasterValidationFailure::Invalid); + } + // A small valid image can have a compressed chunk larger than its pixels. + // Bound decoder scratch without rejecting that ordinary encoding overhead. + let admitted_bytes = + usize::try_from(admitted.checked_mul(4).ok_or(RasterValidationFailure::Limit)?).map_err(|_| RasterValidationFailure::Limit)?; + decoder.set_memory_limit(admitted_bytes.max(data.len())); + let mut output = buffer(expected)?; + decoder.read_image(&mut output).map_err(webp_error) +} + +fn webp_error(error: image_webp::DecodingError) -> RasterValidationFailure { + match error { + image_webp::DecodingError::MemoryLimitExceeded | image_webp::DecodingError::ImageTooLarge => RasterValidationFailure::Limit, + _ => RasterValidationFailure::Invalid, + } +} diff --git a/crates/svg/src/tree/image_href.rs b/crates/svg/src/tree/image_href.rs new file mode 100644 index 000000000..d33388846 --- /dev/null +++ b/crates/svg/src/tree/image_href.rs @@ -0,0 +1,428 @@ +//! Bounded data-URL normalization over the shared checked XML document. +//! Only attribute values change; actual usvg callbacks decide image usage. +use super::Error; +#[cfg(test)] +use super::Limits; +use std::borrow::Cow; +use std::ops::Range; + +#[cfg(test)] +const SVG_NS: &str = "http://www.w3.org/2000/svg"; +const XLINK_NS: &str = "http://www.w3.org/1999/xlink"; +const INVALID_IMAGE: &str = "data:image/png,%00"; +const IGNORED_DATA: &str = "data:application/octet-stream,%00"; + +struct Patch { + range: Range, + replacement: Cow<'static, str>, +} + +fn invalid(message: &str) -> Error { + Error::Parse(message.into()) +} + +#[cfg(test)] +fn repair<'a>(text: &'a str, limits: &Limits) -> Result, Error> { + normalize(&super::preflight(text, limits)?) +} + +pub(super) fn normalize<'a>(checked: &super::Preflight<'a>) -> Result, Error> { + let text = checked.xml.input_text(); + let limits = &checked.limits; + let xml = &checked.xml; + if !text.contains("href") { + return Ok(Cow::Borrowed(text)); + } + // Expanded values fit source + entity work. Twelve linear passes cover URL + // scans/streaming decode, full attribute projection and worst-case XML escaping; + // parameter compaction never allocates one record per original parameter. + let mut work = text + .len() + .checked_add(limits.entity_bytes) + .and_then(|n| n.checked_mul(12)) + .ok_or_else(|| invalid("SVG data-URL validation work exceeds its limit"))?; + let max_patches = (limits.bytes / std::mem::size_of::()).min(usize::try_from(limits.xml_nodes).unwrap_or(usize::MAX)); + let mut patches: Vec = Vec::new(); + for node in xml.descendants().filter(|node| node.is_element()) { + if !matches!(node.tag_name().name(), "image" | "feImage") { + continue; + } + // Shared preflight inspects local image names in every namespace and + // checks XLink before plain href. Normalize both representations, even + // when one is inert or unselected. Only actual resolver callbacks count + // omissions, so this does not turn hidden/unused resources into warnings. + for href in node.attributes().filter(|a| a.name() == "href" && matches!(a.namespace(), None | Some(XLINK_NS))) { + let Some(replacement) = data_url_replacement(href.value(), &mut work)? else { continue }; + let range = verified_value_range(text, node.range(), href.range(), href.name(), &mut work)?; + if patches.len() == patches.capacity() { + if patches.len() >= max_patches { + return Err(invalid("SVG data-URL repair metadata exceeds its limit")); + } + let capacity = patches.capacity().max(8).saturating_mul(2).min(max_patches); + patches + .try_reserve_exact(capacity.saturating_sub(patches.len())) + .map_err(|_| invalid("could not allocate bounded SVG data-URL repairs"))?; + } + patches.push(Patch { range, replacement }); + } + } + if patches.is_empty() { + return Ok(Cow::Borrowed(text)); + } + patches.sort_unstable_by_key(|patch| (patch.range.start, patch.range.end)); + patches.dedup_by_key(|patch| (patch.range.start, patch.range.end)); + let mut end = 0; + let mut length = text.len(); + for patch in &patches { + let range = &patch.range; + if range.start < end { + return Err(invalid("SVG data-URL source ranges overlap")); + } + end = range.end; + length = length + .checked_sub(range.len()) + .and_then(|n| n.checked_add(patch.replacement.len())) + .ok_or_else(|| invalid("SVG data-URL repair size overflows"))?; + } + if length > limits.bytes { + return Err(invalid("repaired SVG exceeds the text byte limit")); + } + let mut result = String::new(); + result.try_reserve_exact(length).map_err(|_| invalid("could not allocate bounded repaired SVG text"))?; + let mut cursor = 0; + for patch in patches { + result.push_str(text.get(cursor..patch.range.start).ok_or_else(|| invalid("invalid SVG data-URL source range"))?); + result.push_str(&patch.replacement); + cursor = patch.range.end; + } + result.push_str(text.get(cursor..).ok_or_else(|| invalid("invalid SVG data-URL source range"))?); + Ok(Cow::Owned(result)) +} + +// The pinned MIME parser searches all earlier parameters for each new name. +// Cap even quoted semicolons before invoking it: source-byte work is already +// charged, so at most this constant times the bounded XML work reaches MIME +// parsing. Bodies can remain large without acquiring MIME parameter records. +const MAX_MIME_SEPARATORS: usize = 64; + +fn mime_header_admitted(value: &str) -> bool { + let trimmed = value.trim_start_matches(|ch| ch <= ' '); + let mut bytes = trimmed.bytes(); + for expected in b"data:" { + let Some(actual) = bytes.by_ref().find(|&byte| !matches!(byte, b'\t' | b'\n' | b'\r')) else { return true }; + if !actual.eq_ignore_ascii_case(expected) { + return true; // Not a data URL: preserve external/fragment handling. + } + } + let mut separators = 0; + for byte in bytes { + if matches!(byte, b',' | b'#') { + break; + } + if byte == b';' { + separators += 1; + if separators > MAX_MIME_SEPARATORS { + return false; + } + } + } + true +} + +/// A long parameter list must not reach the quadratic MIME parser, but its +/// essence, final base64 marker and body still determine the original image. +/// Compact only that header, then use the same parser/streaming decoder. Escape +/// the decoded attribute value once when projecting it back into XML. +fn data_url_replacement(value: &str, work: &mut usize) -> Result>, Error> { + if mime_header_admitted(value) { + return malformed_data_url_replacement(value, work).map(|replacement| replacement.map(Cow::Borrowed)); + } + *work = work.checked_sub(value.len()).ok_or_else(|| invalid("SVG data-URL validation work exceeds its limit"))?; + let normalized = value.trim_matches(|ch| ch <= ' '); + let delimiter = normalized.find([',', '#']); + let Some(comma) = delimiter.filter(|&at| normalized.as_bytes().get(at) == Some(&b',')) else { + return missing_comma_replacement(value, work).map(|replacement| Some(Cow::Borrowed(replacement))); + }; + let header = normalized.get(..comma).ok_or_else(|| invalid("invalid SVG data-URL header framing"))?; + let essence = header.split_once(';').map_or(header, |(essence, _)| essence); + // Retaining the final parameter lets the pinned parser decide whether its + // suffix is a base64 marker, including its case/ASCII-whitespace rules. + let suffix = header.rfind(';').and_then(|at| header.get(at..)).unwrap_or(""); + let body = normalized.get(comma..).ok_or_else(|| invalid("invalid SVG data-URL body framing"))?; + let length = essence + .len() + .checked_add(suffix.len()) + .and_then(|n| n.checked_add(body.len())) + .ok_or_else(|| invalid("SVG data-URL repair size overflows"))?; + let mut compact = String::new(); + compact.try_reserve_exact(length).map_err(|_| invalid("could not allocate bounded SVG data-URL header"))?; + compact.push_str(essence); + compact.push_str(suffix); + compact.push_str(body); + if let Some(replacement) = malformed_data_url_replacement(&compact, work)? { + return Ok(Some(Cow::Borrowed(replacement))); + } + let escaped_len = compact + .chars() + .try_fold(0usize, |n, ch| { + n.checked_add(match ch { + '&' | '\t' | '\n' | '\r' => 5, + '\'' | '"' => 6, + '<' | '>' => 4, + _ => ch.len_utf8(), + }) + }) + .ok_or_else(|| invalid("SVG data-URL repair size overflows"))?; + *work = work.checked_sub(escaped_len).ok_or_else(|| invalid("SVG data-URL validation work exceeds its limit"))?; + let mut escaped = String::new(); + escaped.try_reserve_exact(escaped_len).map_err(|_| invalid("could not allocate bounded SVG data-URL repair"))?; + for ch in compact.chars() { + match ch { + '&' => escaped.push_str("&"), + '\'' => escaped.push_str("'"), + '"' => escaped.push_str("""), + '<' => escaped.push_str("<"), + '>' => escaped.push_str(">"), + '\t' => escaped.push_str(" "), + '\n' => escaped.push_str(" "), + '\r' => escaped.push_str(" "), + _ => escaped.push(ch), + } + } + Ok(Some(Cow::Owned(escaped))) +} + +fn malformed_data_url_replacement(value: &str, work: &mut usize) -> Result, Error> { + malformed_data_url_replacement_with(value, work, data_url::DataUrl::process) +} + +fn malformed_data_url_replacement_with<'a>( + value: &'a str, + work: &mut usize, + parse: impl FnOnce(&'a str) -> Result, data_url::DataUrlError>, +) -> Result, Error> { + *work = work.checked_sub(value.len()).ok_or_else(|| invalid("SVG data-URL validation work exceeds its limit"))?; + if !mime_header_admitted(value) { + // Strip parameters before recovering MIME disposition; no original + // parameter list reaches either our parser or shared whole-DOM preflight. + return missing_comma_replacement(value, work).map(Some); + } + let url = match parse(value) { + Ok(url) => url, + Err(data_url::DataUrlError::NoComma) => return missing_comma_replacement(value, work).map(Some), + Err(data_url::DataUrlError::NotADataUrl) => return Ok(None), + }; + let mut exhausted = false; + let decoded = url.decode(|bytes| { + if let Some(left) = work.checked_sub(bytes.len()) { + *work = left; + Ok(()) + } else { + exhausted = true; + Err(()) + } + }); + if exhausted { + return Err(invalid("SVG data-URL validation work exceeds its limit")); + } + Ok(decoded.is_err().then(|| replacement_for_mime(url.mime_type()))) +} + +/// Preflight must see a valid URL, while the resolver must keep its original +/// disposition. Non-image MIME types are ignored even when their body is bad. +fn replacement_for_mime(mime: &data_url::mime::Mime) -> &'static str { + if mime.type_ == "image" || mime.matches("text", "plain") { INVALID_IMAGE } else { IGNORED_DATA } +} + +fn missing_comma_replacement(value: &str, work: &mut usize) -> Result<&'static str, Error> { + // NoComma does not expose its MIME type. Ask the same parser about a header + // with an empty body rather than guessing MIME defaults, case or parameters. + // Match its URL C0 trimming; fragments and MIME parameters cannot affect + // the image/text-plain essence. Do not allocate parameter bookkeeping for a + // hostile missing-comma header just to recover that disposition. + let normalized = value.trim_matches(|ch| ch <= ' '); + let header = normalized.split_once('#').map_or(normalized, |(header, _)| header); + let essence = header.split_once(';').map_or(header, |(essence, _)| essence); + *work = work.checked_sub(essence.len()).ok_or_else(|| invalid("SVG data-URL validation work exceeds its limit"))?; + let length = essence.len().checked_add(1).ok_or_else(|| invalid("SVG data-URL repair size overflows"))?; + let mut candidate = String::new(); + candidate.try_reserve_exact(length).map_err(|_| invalid("could not allocate bounded SVG data-URL header"))?; + candidate.push_str(essence); + candidate.push(','); + // This candidate has no MIME parameters, including for oversized original + // lists. Its byte scan/allocation is charged above before the linear parse. + if !mime_header_admitted(&candidate) { + return Err(invalid("SVG data-URL MIME header exceeds its limit")); + } + let url = data_url::DataUrl::process(&candidate).map_err(|_| invalid("invalid SVG data-URL header framing"))?; + Ok(replacement_for_mime(url.mime_type())) +} + +/// Use the complete source range rather than roxmltree's compact QName/equals +/// offsets (u16/u8). Scan only this validated attribute, never a DTD declaration +/// or another node. Charge the extra source scan before examining it. +fn verified_value_range(text: &str, owner: Range, attribute: Range, local_name: &str, work: &mut usize) -> Result, Error> { + let error = || invalid("SVG data-URL attribute source positions cannot be represented safely"); + if attribute.start < owner.start || attribute.end > owner.end { + return Err(error()); + } + *work = work.checked_sub(attribute.len()).ok_or_else(|| invalid("SVG data-URL validation work exceeds its limit"))?; + let source = text.get(attribute.clone()).ok_or_else(error)?; + let name_end = source.find([' ', '\t', '\r', '\n', '=']).ok_or_else(error)?; + let name = source.get(..name_end).ok_or_else(error)?; + if name.rsplit(':').next() != Some(local_name) { + return Err(error()); + } + let after_name = source.get(name_end..).ok_or_else(error)?.trim_start_matches([' ', '\t', '\r', '\n']); + let after_equals = after_name.strip_prefix('=').ok_or_else(error)?.trim_start_matches([' ', '\t', '\r', '\n']); + let quote = after_equals.chars().next().ok_or_else(error)?; + if !matches!(quote, '\'' | '"') || !after_equals.ends_with(quote) || after_equals.len() < 2 { + return Err(error()); + } + let start = attribute.end.checked_sub(after_equals.len()).and_then(|n| n.checked_add(1)).ok_or_else(error)?; + let end = attribute.end.checked_sub(1).ok_or_else(error)?; + if text.get(start..end).is_none_or(|value| value.contains(quote)) { + return Err(error()); + } + Ok(start..end) +} + +#[cfg(test)] +mod tests { + use super::*; + + fn limits() -> Limits { + Limits { bytes: 1 << 20, depth: 32, tree_depth: 32, entity_bytes: 65_536, ..Default::default() } + } + + #[test] + fn malformed_image_urls_are_repaired_in_both_svg_namespaces_and_filter_resources() { + for tag in ["image", "feImage"] { + for text in [ + format!("<{tag} href='data:image/png;base64,A'/>"), + format!("<{tag} href='data:image/png;base64,A'/>"), + format!(""), + ] { + let repaired = repair(&text, &limits()).unwrap(); + assert!(matches!(repaired, Cow::Owned(_))); + assert_eq!(repaired.matches(INVALID_IMAGE).count(), 1); + } + } + } + + #[test] + fn unselected_href_and_foreign_local_image_names_are_normalized_for_shared_preflight() { + for attrs in ["href='data:image/png,%00' x:href='data:image/png;base64,A'", "x:href='data:image/png;base64,A' href='data:image/png,%00'"] { + let text = format!(""); + let repaired = repair(&text, &limits()).unwrap(); + assert!(matches!(repaired, Cow::Owned(_))); + assert_eq!(repaired.matches(INVALID_IMAGE).count(), 2); + assert!(!repaired.contains("base64,A")); + } + let text = format!( + "" + ); + let repaired = repair(&text, &limits()).unwrap(); + assert_eq!(repaired.matches(INVALID_IMAGE).count(), 3); + assert!(repaired.contains("f:href='data:image/png;base64,A'"), "foreign href attributes remain inert and unchanged"); + } + + #[test] + fn both_href_forms_on_hidden_unused_and_foreign_resources_do_not_preflight_as_omissions() { + for tag in ["image", "feImage"] { + let text = format!( + "<{tag} id='unused' href='data:image/png;base64,A' x:href='data:image/png;base64,A'/><{tag} display='none' x:href='data:image/png;base64,A' href='data:image/png;base64,A'/>" + ); + let original = text.clone(); + let repaired = repair(&text, &limits()).unwrap(); + assert_eq!(text, original, "repair never mutates the original source"); + assert_eq!(repaired.matches(INVALID_IMAGE).count(), 6); + let resolver = crate::tree::ImageResolver::new(limits()); + resolver.check_document(&repaired).unwrap(); + let usage = resolver.usage(); + assert_eq!( + (usage.invalid_raster_images, usage.invalid_svg_images), + (0, 0), + "shared whole-document scanning cannot invent omissions before resolution" + ); + assert!(matches!(repair(&repaired, &limits()).unwrap(), Cow::Borrowed(_)), "normalization is idempotent"); + } + } + + #[test] + fn entity_expanded_urls_patch_the_owning_attributes_without_rewriting_the_doctype() { + let text = format!( + "]>" + ); + let repaired = repair(&text, &limits()).unwrap(); + assert!(repaired.contains("")); + assert_eq!(repaired.matches(INVALID_IMAGE).count(), 2); + assert!(!repaired.contains("href='&bad;'")); + assert!(matches!(repair(&repaired, &limits()).unwrap(), Cow::Borrowed(_))); + } + + #[test] + fn valid_data_and_external_urls_are_not_rewritten() { + for value in ["data:image/png;base64,AA==", "data:image/svg+xml,%3Csvg%2F%3E", "file.png", "#local"] { + let text = format!(""); + assert!(matches!(repair(&text, &limits()).unwrap(), Cow::Borrowed(_))); + } + let text = ""; + assert!(repair(text, &limits()).unwrap().contains(INVALID_IMAGE)); + } + + #[test] + fn malformed_non_image_urls_keep_ignored_replacements_even_without_a_comma() { + for value in [ + "data:application/octet-stream;base64,A", + "data:application/octet-stream;base64", + "data:APPLICATION/OCTET-STREAM;BASE64,A", + "data:text/css;base64,A", + "data:audio/ogg;base64,A", + "data:application/octet-stream;base64#fragment,not-the-delimiter", + ] { + let text = format!(""); + let repaired = repair(&text, &limits()).unwrap(); + assert!(repaired.contains(IGNORED_DATA), "{value}: {repaired}"); + assert!(!repaired.contains(INVALID_IMAGE)); + assert!(matches!(repair(&repaired, &limits()).unwrap(), Cow::Borrowed(_))); + let resolver = crate::tree::ImageResolver::new(limits()); + resolver.check_document(&repaired).unwrap(); + assert_eq!(resolver.usage().invalid_raster_images, 0); + } + } + + #[test] + fn image_and_default_plain_mime_failures_remain_disclosed() { + for value in [ + "data:IMAGE/PNG;base64,A", + "data:image/png;base64", + "data:text/plain;base64,A", + "data:;base64,A", + "data:;base64", + "data:not-a-mime;base64", + ] { + let text = format!(""); + assert!(repair(&text, &limits()).unwrap().contains(INVALID_IMAGE), "{value}"); + } + let value = "data:application/octet-stream;base64#fragment"; + let mut insufficient = value.len(); + assert!(malformed_data_url_replacement(value, &mut insufficient).is_err(), "the extra MIME-header parse has its own work charge"); + let mut sufficient = value.len() * 2; + assert_eq!(malformed_data_url_replacement(value, &mut sufficient).unwrap(), Some(IGNORED_DATA)); + } + + #[test] + fn long_equals_spacing_is_repaired_and_output_growth_stays_bounded() { + let text = format!("", " ".repeat(300)); + let repaired = repair(&text, &limits()).unwrap(); + assert!(repaired.contains(INVALID_IMAGE)); + assert!(repaired.contains(&format!("href{}=", " ".repeat(300)))); + let text = ""; + assert!(matches!(repair(text, &Limits { bytes: text.len(), ..limits() }), Err(Error::Parse(message)) if message.contains("byte limit"))); + } +} + +#[cfg(test)] +#[path = "mime_header_tests.rs"] +mod mime_header_tests; diff --git a/crates/svg/src/tree/mime_header_tests.rs b/crates/svg/src/tree/mime_header_tests.rs new file mode 100644 index 000000000..393a01729 --- /dev/null +++ b/crates/svg/src/tree/mime_header_tests.rs @@ -0,0 +1,158 @@ +use super::*; +use std::fmt::Write; + +fn parameters(count: usize) -> String { + let mut text = String::new(); + for index in 0..count { + write!(&mut text, ";p{index}=x").unwrap(); + } + text +} + +#[test] +fn a_hundred_thousand_unique_mime_parameters_are_refused_before_the_original_parser() { + let params = parameters(100_000); + for (essence, expected) in [ + ("image/png", INVALID_IMAGE), + ("text/plain", INVALID_IMAGE), + ("", INVALID_IMAGE), + ("not-a-mime", INVALID_IMAGE), + ("application/octet-stream", IGNORED_DATA), + ("audio/ogg", IGNORED_DATA), + ] { + for delimiter in [",AA==", "#fragment,AA==", ""] { + let value = format!("data:{essence}{params};base64{delimiter}"); + let mut work = value.len() * 2; + assert!(!mime_header_admitted(&value)); + let result = + malformed_data_url_replacement_with(&value, &mut work, |_| panic!("the original parameter flood must not reach DataUrl::process")) + .unwrap(); + assert_eq!(result, Some(expected), "{essence} {delimiter}"); + } + } +} + +#[test] +fn mime_parameter_admission_preserves_the_boundary_and_ignores_body_semicolons() { + let accepted = format!("data:image/png{};base64,AA==", parameters(MAX_MIME_SEPARATORS - 1)); + assert!(mime_header_admitted(&accepted)); + let called = std::cell::Cell::new(false); + let mut work = accepted.len() * 2; + assert_eq!( + malformed_data_url_replacement_with(&accepted, &mut work, |value| { + called.set(true); + data_url::DataUrl::process(value) + }) + .unwrap(), + None + ); + assert!(called.get(), "an admitted original URL still reaches the real parser"); + let refused = format!("data:image/png{};base64,AA==", parameters(MAX_MIME_SEPARATORS)); + assert!(!mime_header_admitted(&refused)); + let mut work = refused.len() * 2; + assert_eq!(malformed_data_url_replacement(&refused, &mut work).unwrap(), Some(INVALID_IMAGE)); + + for value in [format!("data:text/plain,{}", ";".repeat(100_000)), format!("external.png?{}", parameters(100_000))] { + assert!(mime_header_admitted(&value), "payloads/external URLs are not MIME parameters"); + let mut work = value.len() * 2; + assert_eq!(malformed_data_url_replacement(&value, &mut work).unwrap(), None); + } + let value = format!(" \td\ta\nt\ra:image/png{};base64,A", parameters(MAX_MIME_SEPARATORS)); + assert!(!mime_header_admitted(&value), "scheme normalization matches the pinned parser"); + let mut work = value.len() * 2; + assert_eq!(malformed_data_url_replacement(&value, &mut work).unwrap(), Some(INVALID_IMAGE)); +} + +#[test] +fn compacted_parameter_lists_preserve_both_hrefs_and_foreign_resources_without_preflight_warnings() { + let value = format!("data:image/png{};base64,AA==", parameters(MAX_MIME_SEPARATORS)); + let text = format!( + "" + ); + let limits = Limits { bytes: 1 << 20, ..Default::default() }; + let repaired = repair(&text, &limits).unwrap(); + assert_eq!(repaired.matches("data:image/png;base64,AA==").count(), 6); + assert!(!repaired.contains(";p0=")); + let resolver = crate::tree::ImageResolver::new(limits); + resolver.check_document(&repaired).unwrap(); + let usage = resolver.usage(); + assert_eq!((usage.invalid_raster_images, usage.invalid_svg_images), (0, 0)); + assert!(matches!(repair(&repaired, &Limits { bytes: 1 << 20, ..Default::default() }).unwrap(), Cow::Borrowed(_))); +} + +#[test] +fn duplicate_and_quoted_parameters_share_the_same_conservative_boundary() { + for (accepted, refused) in [ + ( + format!("data:image/png{},%00", ";p=x".repeat(MAX_MIME_SEPARATORS)), + format!("data:image/png{},%00", ";p=x".repeat(MAX_MIME_SEPARATORS + 1)), + ), + ( + format!("data:image/png;p=\"{}\",%00", ";".repeat(MAX_MIME_SEPARATORS - 1)), + format!("data:image/png;p=\"{}\",%00", ";".repeat(MAX_MIME_SEPARATORS)), + ), + ] { + assert!(mime_header_admitted(&accepted)); + let mut work = accepted.len() * 2; + assert_eq!(malformed_data_url_replacement(&accepted, &mut work).unwrap(), None); + assert!(!mime_header_admitted(&refused)); + let mut work = refused.len() * 2; + assert_eq!(malformed_data_url_replacement(&refused, &mut work).unwrap(), Some(INVALID_IMAGE)); + } + for value in ["external.png", "#local", "datx:image/png;param=x,body"] { + let mut work = value.len() * 2; + assert_eq!(malformed_data_url_replacement(value, &mut work).unwrap(), None); + } + let value = "data:image/png;base64"; + let mut work = value.len() * 2; + assert_eq!(malformed_data_url_replacement(value, &mut work).unwrap(), Some(INVALID_IMAGE)); +} + +#[test] +fn parameter_flood_scans_and_essence_classification_spend_one_shared_work_ledger() { + let value = format!("data:application/octet-stream{};base64,AA==", parameters(MAX_MIME_SEPARATORS)); + let essence_len = "data:application/octet-stream".len(); + let charge = value.len() + essence_len; + let mut work = charge * 2; + for remaining in [charge, 0] { + assert_eq!(malformed_data_url_replacement_with(&value, &mut work, |_| panic!("not admitted")).unwrap(), Some(IGNORED_DATA)); + assert_eq!(work, remaining, "the original header scan and parameter-free fallback each retain their charge"); + } + assert!(malformed_data_url_replacement_with(&value, &mut work, |_| panic!("no work remains")).is_err()); + assert_eq!(work, 0); + let mut not_enough_for_essence = value.len(); + assert!(malformed_data_url_replacement_with(&value, &mut not_enough_for_essence, |_| panic!("not admitted")).is_err()); + assert_eq!(not_enough_for_essence, 0); +} + +#[test] +fn many_parameter_urls_preserve_bodies_and_base64_disposition() { + let params = parameters(100_000); + for (suffix, body, expected) in [ + (";base64", "AA==", vec![0]), + ("; BASE64 ", "AA==", vec![0]), + (";p=last", "%00%26%27%22", vec![0, b'&', b'\'', b'"']), + (";p=last", "&'" z", b"&\'\"z".to_vec()), + ] { + let text = format!(""); + let repaired = repair(&text, &Limits { bytes: 2 << 20, ..Default::default() }).unwrap(); + let xml = checked_xml(&repaired, &Limits { bytes: 2 << 20, ..Default::default() }).unwrap(); + let value = xml.descendants().find(|node| node.has_tag_name("image")).unwrap().attribute("href").unwrap(); + assert!(!value.contains(";p0=")); + assert_eq!(data_url::DataUrl::process(value).unwrap().decode_to_vec().unwrap().0, expected); + assert!(matches!(repair(&repaired, &Limits { bytes: 2 << 20, ..Default::default() }).unwrap(), Cow::Borrowed(_))); + } + let malformed = format!(""); + assert!(repair(&malformed, &Limits { bytes: 2 << 20, ..Default::default() }).unwrap().contains(INVALID_IMAGE)); +} + +#[test] +fn header_compaction_has_a_shared_nonrefundable_work_charge() { + let value = format!("data:image/png{};base64,AA==", parameters(100)); + let mut work = value.len(); + assert!(data_url_replacement(&value, &mut work).is_err()); + assert_eq!(work, 0, "the original parameter scan stays spent on refusal"); + let mut work = value.len() * 12; + assert!(data_url_replacement(&value, &mut work).unwrap().is_some()); + assert!(work < value.len() * 12 - value.len(), "compact parse, streaming decode and XML projection are charged too"); +} diff --git a/crates/svg/src/tree/validated.rs b/crates/svg/src/tree/validated.rs new file mode 100644 index 000000000..cb1b6e8c3 --- /dev/null +++ b/crates/svg/src/tree/validated.rs @@ -0,0 +1,393 @@ +//! Opt-in complete image validation and checked-DOM normalization. +//! Legacy ImageResolver entry points retain their existing behavior. +use super::{Error, ImageUsage, Limits, Preflight, image_href, preflight, raster_format, usvg}; +use crate::svgz; +use std::sync::{Arc, Mutex, PoisonError}; + +struct State { + document_bytes: usize, + pixel_limit: u64, + pixels_left: u64, + svg_byte_limit: usize, + svg_bytes_left: usize, + svg_failure_exhausted: bool, + classification_bytes_left: usize, + classification_content_left: usize, + classification_text_bytes_left: usize, + encoded_left: usize, + invalid_raster: usize, + invalid_svg: usize, + raster_limits: usize, + svg_limits: usize, + svg_resource_limits: usize, + root_active: bool, + xml_depth: usize, + depth: usize, + svg_count: usize, + svg_depth: usize, +} + +impl State { + fn new(limits: Limits) -> Self { + Self { + document_bytes: limits.bytes, + pixel_limit: limits.embedded_raster_pixels, + pixels_left: limits.embedded_raster_pixels, + svg_byte_limit: limits.embedded_bytes, + svg_bytes_left: limits.embedded_bytes, + svg_failure_exhausted: false, + classification_bytes_left: limits.embedded_bytes, + classification_content_left: limits.embedded_bytes, + classification_text_bytes_left: limits.embedded_bytes, + encoded_left: limits.bytes.saturating_add(limits.embedded_bytes), + invalid_raster: 0, + invalid_svg: 0, + raster_limits: 0, + svg_limits: 0, + svg_resource_limits: 0, + root_active: false, + xml_depth: 0, + depth: 0, + svg_count: 0, + svg_depth: 0, + } + } + + fn usage(&self) -> ImageUsage { + ImageUsage { + raster_pixels: self.pixel_limit.saturating_sub(self.pixels_left), + embedded_svg_bytes: self.svg_byte_limit.saturating_sub(self.svg_bytes_left), + embedded_svg_count: self.svg_count, + embedded_svg_depth: self.svg_depth, + invalid_raster_images: self.invalid_raster, + raster_limit_images: self.raster_limits, + invalid_svg_images: self.invalid_svg, + svg_limit_images: self.svg_limits, + svg_resource_limit_images: self.svg_resource_limits, + } + } + + fn classify_after_svg_failure(&mut self, data: &[u8]) { + if self.svg_resource_limits != 0 { + self.svg_limits = self.svg_limits.saturating_add(1); + self.svg_resource_limits = self.svg_resource_limits.saturating_add(1); + return; + } + let compressed = data.starts_with(&[0x1f, 0x8b]); + let content_left = self.classification_content_left; + let limit = if compressed { content_left.min(self.classification_bytes_left) } else { content_left }.min(self.document_bytes); + if compressed && limit == 0 { + self.svg_limits = self.svg_limits.saturating_add(1); + self.svg_resource_limits = self.svg_resource_limits.saturating_add(1); + return; + } + let resource_refusal = match crate::svgz::inflate(data, limit) { + Ok(bytes) => { + if compressed { + self.classification_bytes_left = self.classification_bytes_left.saturating_sub(bytes.len()); + } + let Some(text_left) = self.classification_text_bytes_left.checked_sub(bytes.len()) else { + self.svg_limits = self.svg_limits.saturating_add(1); + self.svg_resource_limits = self.svg_resource_limits.saturating_add(1); + return; + }; + self.classification_text_bytes_left = text_left; + match crate::svgz::decode(&bytes) { + Ok(text) => text.len() > content_left || text.len() > self.document_bytes, + Err(_) => { + self.invalid_svg = self.invalid_svg.saturating_add(1); + return; + } + } + } + Err(crate::svgz::Error::TooLarge(_)) => { + if compressed { + self.classification_bytes_left = self.classification_bytes_left.saturating_sub(limit); + } + true + } + Err(error) => { + // Nested data was fully inflated before refusal. Other failures + // may have consumed the entire attempted inflation allowance. + if compressed { + let charged = match error { + crate::svgz::Error::Nested(bytes) => bytes, + _ => limit, + }; + self.classification_bytes_left = self.classification_bytes_left.saturating_sub(charged); + } + self.invalid_svg = self.invalid_svg.saturating_add(1); + return; + } + }; + self.svg_limits = self.svg_limits.saturating_add(1); + if resource_refusal { + self.svg_resource_limits = self.svg_resource_limits.saturating_add(1); + } + } + + fn raster(&mut self, kind: &usvg::ImageKind) -> bool { + let encoded = match kind { + usvg::ImageKind::SVG(_) => return true, + usvg::ImageKind::PNG(data) | usvg::ImageKind::JPEG(data) | usvg::ImageKind::GIF(data) | usvg::ImageKind::WEBP(data) => data, + }; + // usvg supplies a fresh Arc for every data-URL resolution, including + // repeated instances. Charge each actual validation, never retain + // encoded buffers in an address-keyed memo that cannot hit this boundary. + let Some(left) = self.encoded_left.checked_sub(encoded.len()) else { + self.raster_limits = self.raster_limits.saturating_add(1); + return false; + }; + self.encoded_left = left; + let result = super::draw::validate_raster(kind, self.pixel_limit, &mut self.pixels_left); + match result { + Ok(()) => true, + Err(super::draw::RasterValidationFailure::Invalid) => { + self.invalid_raster = self.invalid_raster.saturating_add(1); + false + } + Err(super::draw::RasterValidationFailure::Limit) => { + self.raster_limits = self.raster_limits.saturating_add(1); + false + } + } + } +} + +/// One opt-in drawing's image work, normalization and exact rendering validation. +/// +/// Unlike legacy ImageResolver, every attempted raster callback spends encoded +/// and decoded work, even on failure. Rendering still decodes pixels afterwards: +/// resvg does not expose a decoded-pixel injection or decode-result hook. +/// All root and child conversions install this same resolver themselves. +#[derive(Clone)] +pub struct ValidatedImageResolver { + limits: Limits, + state: Arc>, +} + +impl ValidatedImageResolver { + /// Create a separate budget for one drawing. Encoded raster work is bounded + /// by root text bytes plus aggregate child SVG bytes, without retaining data. + pub fn new(limits: Limits) -> Self { + Self { limits, state: Arc::new(Mutex::new(State::new(limits))) } + } + + /// The immutable admission policy captured by this instance. Remaining work + /// never changes these limits; use them for the matching opaque preflight. + pub fn limits(&self) -> Limits { + self.limits + } + + /// Snapshot admitted work and optional-image omissions. + pub fn usage(&self) -> ImageUsage { + self.state.lock().unwrap_or_else(PoisonError::into_inner).usage() + } + + /// Convert exactly the DOM checked under these limits, with this instance's + /// resolver. A caller-supplied image callback cannot bypass image admission. + /// The caller still supplies the stack/worker and font policy. + pub fn parse_preflight(&self, checked: Preflight<'_>, mut options: usvg::Options<'_>) -> Result { + if checked.limits != self.limits { + return Err(Error::Parse("checked SVG limits differ from the validated image resolver".into())); + } + // A shallow source can expand through use/paint references. Reserve the + // full checked converted height before any child callback, not source depth. + let _scope = self.root_scope(checked.height)?; + options.image_href_resolver = self.resolver(); + convert_checked(checked, &options) + } + + /// Resolve an already-decoded child SVG, charging original text before XML + /// parsing or repair. This is not an unchecked/precharged admission hook. + /// As with parse_preflight, unrelated image callbacks are replaced. + pub fn resolve_text(&self, text: &str, mut options: usvg::Options<'_>) -> Result, Error> { + let _scope = self.root_scope(0)?; + options.image_href_resolver = self.resolver(); + Ok(self.embedded_text(text, &options)) + } + + fn root_scope(&self, depth: usize) -> Result { + let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); + if state.root_active { + return Err(Error::Parse("the validated SVG resolver is already converting a drawing".into())); + } + let previous = state.xml_depth; + state.root_active = true; + state.xml_depth = depth; + Ok(Scope { state: Arc::clone(&self.state), previous, child: false }) + } + + fn resolver(&self) -> usvg::ImageHrefResolver<'static> { + let this = self.clone(); + usvg::ImageHrefResolver { + resolve_string: Box::new(|_, _| None), + resolve_data: Box::new(move |mime, data, options| { + let detected = raster_format(&data); + let format = match mime { + "image/jpg" | "image/jpeg" => (detected == Some(craft_image_codecs::Format::Jpeg)).then_some(craft_image_codecs::Format::Jpeg), + "image/png" => (detected == Some(craft_image_codecs::Format::Png)).then_some(craft_image_codecs::Format::Png), + "image/gif" => (detected == Some(craft_image_codecs::Format::Gif)).then_some(craft_image_codecs::Format::Gif), + "image/webp" => (detected == Some(craft_image_codecs::Format::WebP)).then_some(craft_image_codecs::Format::WebP), + "text/plain" => detected, + _ => None, + }; + if let Some(format) = format { + let kind = match format { + craft_image_codecs::Format::Png => usvg::ImageKind::PNG(data), + craft_image_codecs::Format::Jpeg => usvg::ImageKind::JPEG(data), + craft_image_codecs::Format::Gif => usvg::ImageKind::GIF(data), + craft_image_codecs::Format::WebP => usvg::ImageKind::WEBP(data), + _ => return None, + }; + return this.state.lock().unwrap_or_else(PoisonError::into_inner).raster(&kind).then_some(kind); + } + if !matches!(mime, "image/svg+xml" | "text/plain") { + if mime.starts_with("image/") { + let mut state = this.state.lock().unwrap_or_else(PoisonError::into_inner); + state.invalid_raster = state.invalid_raster.saturating_add(1); + } + return None; + } + this.embedded_bytes(&data, options) + }), + } + } + + fn can_start_child(&self) -> bool { + let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); + if state.depth >= self.limits.embedded_depth { + state.svg_limits = state.svg_limits.saturating_add(1); + state.svg_resource_limits = state.svg_resource_limits.saturating_add(1); + return false; + } + true + } + + fn embedded_bytes(&self, data: &[u8], options: &usvg::Options<'_>) -> Option { + if !self.can_start_child() { + return None; + } + let room = { + let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); + if state.svg_failure_exhausted { + state.classify_after_svg_failure(data); + return None; + } + state.svg_bytes_left + }; + let text = match svgz::text(data, room.min(self.limits.bytes)) { + Ok(text) if text.len() <= room => text, + error => { + let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); + state.svg_bytes_left = 0; + if matches!(error, Err(svgz::Error::TooLarge(_))) || error.is_ok() { + state.svg_limits = state.svg_limits.saturating_add(1); + state.svg_resource_limits = state.svg_resource_limits.saturating_add(1); + } else { + state.invalid_svg = state.invalid_svg.saturating_add(1); + state.svg_failure_exhausted = true; + state.classification_content_left = room; + } + return None; + } + }; + self.precharge_and_parse(&text, options) + } + + fn embedded_text(&self, text: &str, options: &usvg::Options<'_>) -> Option { + if !self.can_start_child() { + return None; + } + self.precharge_and_parse(text, options) + } + + fn precharge_and_parse(&self, text: &str, options: &usvg::Options<'_>) -> Option { + { + let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); + let Some(left) = state.svg_bytes_left.checked_sub(text.len()) else { + state.svg_bytes_left = 0; + state.svg_limits = state.svg_limits.saturating_add(1); + state.svg_resource_limits = state.svg_resource_limits.saturating_add(1); + return None; + }; + // Original UTF-8 bytes/work are never refunded when repair shortens + // an attribute or conversion subsequently fails. + state.svg_bytes_left = left; + } + let checked = match preflight(text, &self.limits) { + Ok(checked) => checked, + Err(error) => { + let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); + match error { + Error::TooDeep(_) => state.svg_limits = state.svg_limits.saturating_add(1), + Error::Text(svgz::Error::TooLarge(_)) => { + state.svg_limits = state.svg_limits.saturating_add(1); + state.svg_resource_limits = state.svg_resource_limits.saturating_add(1); + } + _ => state.invalid_svg = state.invalid_svg.saturating_add(1), + } + return None; + } + }; + let scope = { + let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); + let Some(total) = state.xml_depth.checked_add(checked.height).filter(|depth| *depth <= self.limits.tree_depth) else { + state.svg_limits = state.svg_limits.saturating_add(1); + return None; + }; + let previous = state.xml_depth; + state.xml_depth = total; + state.depth = state.depth.saturating_add(1); + state.svg_depth = state.svg_depth.max(state.depth); + Scope { state: Arc::clone(&self.state), previous, child: true } + }; + let result = convert_checked(checked, options); + drop(scope); + let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); + match result { + Ok(tree) => { + state.svg_count = state.svg_count.saturating_add(1); + Some(usvg::ImageKind::SVG(tree)) + } + Err(_) => { + state.invalid_svg = state.invalid_svg.saturating_add(1); + None + } + } + } +} + +struct Scope { + state: Arc>, + previous: usize, + child: bool, +} +impl Drop for Scope { + fn drop(&mut self) { + let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); + state.xml_depth = self.previous; + if self.child { + state.depth = state.depth.saturating_sub(1); + } else { + state.root_active = false; + } + } +} + +fn convert_checked(checked: Preflight<'_>, options: &usvg::Options<'_>) -> Result { + match image_href::normalize(&checked)? { + std::borrow::Cow::Borrowed(_) => checked.parse(options), + std::borrow::Cow::Owned(text) => { + let limits = checked.limits; + drop(checked); + preflight(&text, &limits)?.parse(options) + } + } +} + +#[cfg(test)] +mod tests; + +#[cfg(test)] +mod xml_tests; diff --git a/crates/svg/src/tree/validated/tests.rs b/crates/svg/src/tree/validated/tests.rs new file mode 100644 index 000000000..c090d7ab6 --- /dev/null +++ b/crates/svg/src/tree/validated/tests.rs @@ -0,0 +1,340 @@ +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::indexing_slicing)] +use super::*; +use std::io::Write; +const PIXELS: u64 = 24_000_000; +const SVG_BYTES: usize = 16 << 20; + +fn test_limits(pixels: u64) -> Limits { + Limits { + bytes: 1 << 30, + depth: 513, + tree_depth: 513, + embedded_bytes: SVG_BYTES, + embedded_depth: 32, + embedded_raster_pixels: pixels, + ..Default::default() + } +} +fn test_state(pixels: u64) -> State { + State::new(test_limits(pixels)) +} +fn wrapped_options(pixels: u64) -> (usvg::Options<'static>, Arc>, Arc) { + let resolver = Arc::new(ValidatedImageResolver::new(test_limits(pixels))); + let options = usvg::Options { image_href_resolver: resolver.resolver(), ..Default::default() }; + (options, Arc::clone(&resolver.state), resolver) +} +fn on_test_stack(run: impl FnOnce() -> Result + Send) -> Result { + std::thread::scope(|scope| std::thread::Builder::new().stack_size(16 << 20).spawn_scoped(scope, run).unwrap().join().unwrap()) +} +fn png() -> Vec { + let image = craft_image_codecs::Image::from_u8(2, 2, craft_image_codecs::ChannelLayout::Rgb, [17, 83, 149].repeat(4)).unwrap(); + craft_image_codecs::encode(&image, craft_image_codecs::Format::Png, &Default::default()).unwrap() +} +fn data_url(mime: &str, bytes: &[u8]) -> String { + use std::fmt::Write; + let mut result = format!("data:{mime},"); + for byte in bytes { + write!(&mut result, "%{byte:02X}").unwrap(); + } + result +} + +#[test] +fn original_nested_xml_bytes_are_not_refunded_when_malformed_hrefs_shrink() { + on_test_stack(|| { + let (options, state, _resolver) = wrapped_options(PIXELS); + let prefix = ""; + let original_size = 3 << 20; + let source = Arc::new([prefix.as_bytes(), &vec![b'A'; original_size - prefix.len() - suffix.len()], suffix.as_bytes()].concat()); + assert_eq!(source.len(), original_size); + for accepted in 1..=5 { + let kind = (options.image_href_resolver.resolve_data)("image/svg+xml", Arc::clone(&source), &options); + assert!(matches!(kind, Some(usvg::ImageKind::SVG(_))), "source {accepted} fits the original-text allowance"); + drop(kind); + let state = state.lock().unwrap_or_else(PoisonError::into_inner); + assert_eq!(state.svg_bytes_left, SVG_BYTES - accepted * original_size); + assert!(!state.svg_failure_exhausted); + assert_eq!(state.classification_bytes_left, SVG_BYTES); + let usage = state.usage(); + assert_eq!(usage.embedded_svg_bytes, accepted * original_size, "the short replacement cannot refund original XML work"); + } + assert!((options.image_href_resolver.resolve_data)("image/svg+xml", Arc::clone(&source), &options).is_none()); + let state = state.lock().unwrap_or_else(PoisonError::into_inner); + assert_eq!(state.svg_bytes_left, 0); + assert_eq!((state.svg_limits, state.svg_resource_limits), (1, 1)); + assert!(!state.svg_failure_exhausted, "ordinary byte exhaustion cannot enter compatibility classification"); + assert_eq!(state.classification_bytes_left, SVG_BYTES); + assert_eq!(state.usage().svg_resource_limit_images, 1); + Ok(()) + }) + .unwrap(); +} + +#[test] +fn invalid_utf8_gzip_consumes_remaining_svg_work_before_the_next_child() { + on_test_stack(|| { + let (options, state, _resolver) = wrapped_options(PIXELS); + let mut encoder = flate2::write::GzEncoder::new(Vec::new(), flate2::Compression::default()); + encoder.write_all(&[0xff; 4096]).unwrap(); + let invalid = Arc::new(encoder.finish().unwrap()); + assert!((options.image_href_resolver.resolve_data)("image/svg+xml", invalid, &options).is_none()); + { + let state = state.lock().unwrap_or_else(PoisonError::into_inner); + assert_eq!(state.svg_bytes_left, 0, "a failed decode cannot retry the full work allowance"); + assert_eq!(state.invalid_svg, 1); + assert!(state.svg_failure_exhausted); + assert_eq!(state.svg_resource_limits, 0); + assert_eq!(state.classification_bytes_left, SVG_BYTES); + } + let valid = Arc::new(b"".to_vec()); + let valid_size = valid.len(); + assert!((options.image_href_resolver.resolve_data)("image/svg+xml", valid, &options).is_none()); + let state = state.lock().unwrap_or_else(PoisonError::into_inner); + assert_eq!((state.invalid_svg, state.svg_limits, state.svg_resource_limits), (1, 1, 0)); + assert_eq!(state.classification_bytes_left, SVG_BYTES, "plain input does not spend retry inflation work"); + let usage = state.usage(); + assert_eq!(usage.embedded_svg_bytes, SVG_BYTES); + assert_eq!(usage.svg_resource_limit_images, 0, "a later small child is omitted, not a resource error"); + let charged = 2 * SVG_BYTES - state.svg_bytes_left - state.classification_bytes_left; + assert_eq!(charged, SVG_BYTES); + assert!(valid_size < SVG_BYTES); + Ok(()) + }) + .unwrap(); +} + +#[test] +fn post_failure_classification_is_cumulative_and_never_admits_later_children() { + on_test_stack(|| { + let (options, state, _resolver) = wrapped_options(PIXELS); + let mut encoder = flate2::write::GzEncoder::new(Vec::new(), flate2::Compression::default()); + encoder.write_all(&[0xff; 256]).unwrap(); + assert!((options.image_href_resolver.resolve_data)("image/svg+xml", Arc::new(encoder.finish().unwrap()), &options).is_none()); + let text = b""; + let mut encoder = flate2::write::GzEncoder::new(Vec::new(), flate2::Compression::default()); + encoder.write_all(text).unwrap(); + let valid = Arc::new(encoder.finish().unwrap()); + // Exercise the cumulative inflated-byte boundary with a small injected + // second pool; public tests cover the full 16 MiB allowance. + let classification_limit = text.len() * 2 - 1; + state.lock().unwrap_or_else(PoisonError::into_inner).classification_bytes_left = classification_limit; + assert!((options.image_href_resolver.resolve_data)("image/svg+xml", Arc::clone(&valid), &options).is_none()); + { + let state = state.lock().unwrap_or_else(PoisonError::into_inner); + assert_eq!(state.classification_bytes_left, text.len() - 1); + assert_eq!((state.svg_limits, state.svg_resource_limits), (1, 0)); + } + assert!((options.image_href_resolver.resolve_data)("image/svg+xml", Arc::clone(&valid), &options).is_none()); + let state = state.lock().unwrap_or_else(PoisonError::into_inner); + assert_eq!(state.classification_bytes_left, 0); + assert_eq!((state.svg_limits, state.svg_resource_limits), (2, 1)); + assert_eq!(state.svg_bytes_left, 0, "classification never refunds original failed work"); + assert!(state.svg_failure_exhausted); + let charged = 2 * SVG_BYTES - state.svg_bytes_left - state.classification_bytes_left; + assert_eq!(charged, 2 * SVG_BYTES, "original content plus aggregate retry inflation allowances remain bounded"); + assert_eq!(state.usage().embedded_svg_count, 0, "classified children must never reach the shared parser"); + Ok(()) + }) + .unwrap(); +} + +#[test] +fn retry_inflation_room_and_saved_decoded_content_room_remain_independent() { + on_test_stack(|| { + let mut latin1 = b""); + let decoded_len = crate::svgz::decode(&latin1).unwrap().len(); + assert!(latin1.len() < 256 && decoded_len > 256 && decoded_len < 512); + let gzip = |bytes: &[u8]| { + let mut encoder = flate2::write::GzEncoder::new(Vec::new(), flate2::Compression::default()); + encoder.write_all(bytes).unwrap(); + Arc::new(encoder.finish().unwrap()) + }; + for (content_room, expected_resource) in [(512usize, false), (256, true)] { + let (options, state, _resolver) = wrapped_options(PIXELS); + // Model preceding genuine content consumption before an unreadable + // stream burns the rest. Classification must save this exact room. + state.lock().unwrap_or_else(PoisonError::into_inner).svg_bytes_left = content_room; + assert!((options.image_href_resolver.resolve_data)("image/svg+xml", gzip(&[0xff; 4]), &options).is_none()); + { + let mut state = state.lock().unwrap_or_else(PoisonError::into_inner); + assert_eq!(state.classification_content_left, content_room); + assert_eq!(state.svg_bytes_left, 0); + // Enough compressed retry work for the raw Latin-1 bytes, but + // less than their decoded UTF-8 length, just like main's case. + state.classification_bytes_left = latin1.len() + 1; + } + assert!((options.image_href_resolver.resolve_data)("image/svg+xml", gzip(&latin1), &options).is_none()); + let state = state.lock().unwrap_or_else(PoisonError::into_inner); + assert_eq!(state.classification_bytes_left, 1, "retry work charges inflated bytes, not UTF-8 bytes"); + assert_eq!(state.svg_resource_limits, usize::from(expected_resource)); + assert_eq!(state.svg_bytes_left, 0, "classification never restores original content allowance"); + assert_eq!(state.usage().embedded_svg_count, 0, "no classified child is parsed or drawn"); + } + Ok(()) + }) + .unwrap(); +} + +#[test] +fn failed_raster_callbacks_release_sources_and_keep_every_decode_charge() { + let mut broken = png(); + let idat = broken.windows(4).position(|bytes| bytes == b"IDAT").unwrap(); + broken[idat + 4] ^= 1; + assert_eq!(craft_image_codecs::probe_allocation_size(&broken).unwrap(), (2, 2)); + let mut state = test_state(8); + let encoded_before = state.encoded_left; + for attempt in 1..=2 { + // Match usvg's actual callback boundary: each href gets a new Arc. + let encoded = Arc::new(broken.clone()); + let weak = Arc::downgrade(&encoded); + let kind = usvg::ImageKind::PNG(Arc::clone(&encoded)); + assert!(!state.raster(&kind)); + assert_eq!(state.pixels_left, 8 - attempt * 4); + assert_eq!(state.encoded_left, encoded_before - attempt as usize * encoded.len()); + assert_eq!(state.invalid_raster, attempt as usize); + drop(kind); + drop(encoded); + assert!(weak.upgrade().is_none(), "validation must not retain failed callback buffers until parse completion"); + } + assert!(!state.raster(&usvg::ImageKind::PNG(Arc::new(png())))); + assert_eq!((state.invalid_raster, state.raster_limits), (2, 1)); + assert_eq!(state.usage().raster_pixels, 8); +} + +#[test] +fn valid_raster_callbacks_spend_exact_pixel_and_encoded_allowances_per_call() { + let encoded = Arc::new(png()); + let kind = usvg::ImageKind::PNG(Arc::clone(&encoded)); + let mut state = test_state(8); + state.encoded_left = encoded.len() * 2; + assert!(state.raster(&kind)); + assert_eq!((state.pixels_left, state.encoded_left), (4, encoded.len())); + assert!(state.raster(&kind), "even a directly reused Arc is a new actual validation call"); + assert_eq!((state.pixels_left, state.encoded_left), (0, 0)); + assert!(!state.raster(&kind)); + assert_eq!((state.invalid_raster, state.raster_limits), (0, 1)); + let usage = state.usage(); + assert_eq!((usage.raster_pixels, usage.raster_limit_images), (8, 1)); +} + +#[test] +fn raster_callbacks_own_per_call_pixel_charges_and_keep_mime_aliases_separate() { + let png = Arc::new(png()); + let (options, state, resolver) = wrapped_options(4); + assert!((options.image_href_resolver.resolve_data)("image/png", Arc::clone(&png), &options).is_some()); + assert!((options.image_href_resolver.resolve_data)("image/png", Arc::clone(&png), &options).is_none()); + assert_eq!((resolver.usage().raster_pixels, resolver.usage().invalid_raster_images, resolver.usage().raster_limit_images), (4, 0, 1)); + assert!((options.image_href_resolver.resolve_data)("image/jpeg", png, &options).is_none()); + let usage = state.lock().unwrap().usage(); + assert_eq!((usage.raster_pixels, usage.invalid_raster_images), (4, 1)); +} + +#[test] +fn encoded_raster_refusal_is_per_image_and_does_not_consume_unattempted_work() { + let bytes = png(); + let mut oversized = bytes.clone(); + oversized.extend([0; 32]); + let mut state = test_state(4); + state.encoded_left = bytes.len(); + assert!(!state.raster(&usvg::ImageKind::PNG(Arc::new(oversized)))); + assert_eq!((state.encoded_left, state.pixels_left), (bytes.len(), 4)); + assert!(state.raster(&usvg::ImageKind::PNG(Arc::new(bytes)))); + assert_eq!((state.encoded_left, state.pixels_left), (0, 0)); + let usage = state.usage(); + assert_eq!((usage.raster_pixels, usage.raster_limit_images, usage.invalid_raster_images), (4, 1, 0)); +} + +#[test] +fn encoded_raster_exhaustion_keeps_ordinary_drawing_and_reports_only_omitted_images() { + let bytes = png(); + let href = data_url("image/png", &bytes); + let text = format!( + r##""## + ); + let resolver = ValidatedImageResolver::new(test_limits(8)); + resolver.state.lock().unwrap().encoded_left = bytes.len(); + let tree = resolver.parse_preflight(preflight(&text, &resolver.limits()).unwrap(), usvg::Options::default()).unwrap(); + let usage = resolver.usage(); + assert_eq!((usage.raster_pixels, usage.raster_limit_images, usage.invalid_raster_images), (4, 1, 0)); + let output = super::super::draw::render(&tree, usvg::Transform::identity(), 4, 2, 0, 1 << 20).unwrap(); + let background = output.pixel(3, 1).unwrap().demultiply(); + assert_eq!((background.red(), background.green(), background.blue(), background.alpha()), (0, 255, 0, 255)); + let pixel = output.pixel(0, 0).unwrap().demultiply(); + assert_eq!((pixel.red(), pixel.green(), pixel.blue(), pixel.alpha()), (17, 83, 149, 255)); + assert_eq!(resolver.state.lock().unwrap().encoded_left, 0); +} + +// Preserve upstream's text_rechecked boundary using the integrated real resolver. +// Plain and gzip retries spend source bytes before decoding, independently of +// inflation work and the drawing's genuine decoded-content capacity. +#[test] +fn plain_legacy_encoding_rechecks_have_a_separate_bounded_work_allowance() { + on_test_stack(|| { + let xml = b""; + for compressed in [false, true] { + let (options, state, _resolver) = wrapped_options(PIXELS); + let encode = |bytes: &[u8]| { + if compressed { + let mut encoder = flate2::write::GzEncoder::new(Vec::new(), flate2::Compression::default()); + encoder.write_all(bytes).unwrap(); + encoder.finish().unwrap() + } else { + bytes.to_vec() + } + }; + assert!((options.image_href_resolver.resolve_data)("image/svg+xml", Arc::new(encode(&[0xff])), &options).is_none()); + state.lock().unwrap_or_else(PoisonError::into_inner).classification_text_bytes_left = xml.len(); + assert!((options.image_href_resolver.resolve_data)("image/svg+xml", Arc::new(encode(xml)), &options).is_none()); + { + let state = state.lock().unwrap_or_else(PoisonError::into_inner); + assert_eq!(state.classification_text_bytes_left, 0); + assert_eq!(state.svg_resource_limits, 0, "exactly fitting text recheck is permitted"); + assert_eq!(state.classification_bytes_left, SVG_BYTES - usize::from(compressed) * xml.len()); + } + assert!((options.image_href_resolver.resolve_data)("image/svg+xml", Arc::new(encode(xml)), &options).is_none()); + let state = state.lock().unwrap_or_else(PoisonError::into_inner); + assert_eq!(state.classification_text_bytes_left, 0); + assert_eq!(state.svg_resource_limits, 1, "the next source cannot repeat text-conversion work"); + assert_eq!(state.invalid_svg, 1, "the original encoding error stays invalid"); + assert_eq!(state.svg_limits, 2); + assert_eq!(state.usage().embedded_svg_count, 0, "rechecked children are never admitted"); + } + Ok(()) + }) + .unwrap(); +} + +#[test] +fn embedded_gzip_obeys_document_bytes_before_aggregate_inflation_room() { + on_test_stack(|| { + let mut text = b"".len(), b' '); + text.extend_from_slice(b"-->"); + assert_eq!(text.len(), 256); + let mut encoder = flate2::write::GzEncoder::new(Vec::new(), flate2::Compression::default()); + encoder.write_all(&text).unwrap(); + let encoded = Arc::new(encoder.finish().unwrap()); + for bytes in [text.len() - 1, text.len()] { + let limits = Limits { bytes, embedded_bytes: 1024, ..test_limits(4) }; + assert!(limits.embedded_bytes > text.len()); + let resolver = ValidatedImageResolver::new(limits); + let options = usvg::Options { image_href_resolver: resolver.resolver(), ..Default::default() }; + let image = (options.image_href_resolver.resolve_data)("image/svg+xml", Arc::clone(&encoded), &options); + let usage = resolver.usage(); + if bytes == text.len() { + assert!(matches!(image, Some(usvg::ImageKind::SVG(_))), "exact document boundary remains admissible"); + assert_eq!((usage.embedded_svg_count, usage.embedded_svg_bytes), (1, text.len())); + assert_eq!((usage.svg_resource_limit_images, usage.invalid_svg_images), (0, 0)); + } else { + assert!(image.is_none(), "aggregate room must not lift one document's inflate limit"); + assert_eq!((usage.embedded_svg_count, usage.svg_resource_limit_images, usage.invalid_svg_images), (0, 1, 0)); + assert_eq!(usage.embedded_svg_bytes, 1024, "refused work retains its aggregate charge"); + } + } + Ok(()) + }) + .unwrap(); +} diff --git a/crates/svg/src/tree/validated/xml_tests.rs b/crates/svg/src/tree/validated/xml_tests.rs new file mode 100644 index 000000000..b6b594433 --- /dev/null +++ b/crates/svg/src/tree/validated/xml_tests.rs @@ -0,0 +1,176 @@ +//! Public validated-context contracts; private byte/raster accounting lives in tests.rs. +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::indexing_slicing)] +use super::super::{Limits, PREFLIGHT_PASSES, preflight, usvg}; +use super::ValidatedImageResolver; +use std::io::Write; +use std::sync::{ + Arc, + atomic::{AtomicUsize, Ordering}, +}; + +const NS: &str = "http://www.w3.org/2000/svg"; + +fn drawing(contents: &str) -> String { + format!("{contents}") +} + +fn url(bytes: &[u8]) -> String { + use std::fmt::Write; + let mut value = String::from("data:image/svg+xml,"); + for byte in bytes { + write!(&mut value, "%{byte:02X}").unwrap(); + } + value +} + +fn gzip(bytes: &[u8]) -> Vec { + let mut encoder = flate2::write::GzEncoder::new(Vec::new(), flate2::Compression::default()); + encoder.write_all(bytes).unwrap(); + encoder.finish().unwrap() +} + +fn image(href: &str) -> String { + format!("") +} + +fn parse_count(text: &str, limits: Limits) -> (super::super::ImageUsage, usize) { + PREFLIGHT_PASSES.with(|count| count.set(0)); + let context = ValidatedImageResolver::new(limits); + let checked = preflight(text, &limits).unwrap(); + let tree = context.parse_preflight(checked, usvg::Options::default()).unwrap(); + assert!(!tree.root().children().is_empty(), "the visible drawing survives validation"); + (context.usage(), PREFLIGHT_PASSES.with(|count| count.get())) +} + +#[test] +fn validated_root_reuses_checked_xml_and_rechecks_only_changed_attributes() { + let ordinary = drawing(""); + let repaired = drawing(""); + let (usage, count) = parse_count(&ordinary, Limits::default()); + assert_eq!(count, 1); + assert_eq!(usage.invalid_raster_images, 0); + let (usage, count) = parse_count(&repaired, Limits::default()); + assert_eq!(count, 2); + assert_eq!(usage.invalid_raster_images, 1); +} + +#[test] +fn validated_plain_and_gzip_children_reuse_their_original_preflight() { + for repaired in [false, true] { + let mut contents = String::from(""); + if repaired { + contents.push_str(""); + } + let child = drawing(&contents); + for compressed in [false, true] { + let encoded = if compressed { gzip(child.as_bytes()) } else { child.as_bytes().to_vec() }; + let root = drawing(&image(&url(&encoded))); + let (usage, count) = parse_count(&root, Limits::default()); + assert_eq!(count, if repaired { 3 } else { 2 }, "compressed={compressed}, repaired={repaired}"); + assert_eq!(usage.embedded_svg_count, 1); + assert_eq!(usage.embedded_svg_bytes, child.len()); + assert_eq!(usage.invalid_raster_images, usize::from(repaired)); + assert_eq!(usage.invalid_svg_images, 0); + } + } +} + +#[test] +fn validated_original_xml_guards_precede_normalization_and_conversion() { + let normal = drawing(""); + let entity = format!("]>{}", drawing("")); + let markup = format!("'>]>{}", drawing("&a;")); + let referenced = drawing(""); + for (text, limits) in [ + (&normal, Limits { bytes: normal.len() - 1, ..Default::default() }), + (&normal, Limits { attributes: 0, ..Default::default() }), + (&normal, Limits { xml_nodes: 1, ..Default::default() }), + (&entity, Limits { entity_bytes: 1, ..Default::default() }), + (&markup, Limits { refuse_entity_markup: true, ..Default::default() }), + (&referenced, Limits { tree_depth: 2, ..Default::default() }), + ] { + assert!(preflight(text, &limits).is_err(), "original source must be refused before normalization: {text}"); + } + let limits = Limits { entity_bytes: 1024, ..Default::default() }; + let context = ValidatedImageResolver::new(limits); + let checked = preflight(&entity, &limits).unwrap(); + context.parse_preflight(checked, usvg::Options::default()).unwrap(); + assert_eq!(context.usage().invalid_raster_images, 1, "admitted entity data reaches omission accounting"); +} + +#[test] +fn validated_context_requires_exact_preflight_limits() { + let text = drawing(""); + let limits = Limits { bytes: 4096, tree_depth: 16, embedded_bytes: 2048, ..Default::default() }; + let context = ValidatedImageResolver::new(limits); + assert_eq!(context.limits(), limits); + for changed in [ + Limits { bytes: 4095, ..limits }, + Limits { bytes: 4097, ..limits }, + Limits { tree_depth: 15, ..limits }, + Limits { embedded_bytes: 2049, ..limits }, + ] { + let checked = preflight(&text, &changed).unwrap(); + assert!(context.parse_preflight(checked, usvg::Options::default()).is_err()); + assert_eq!(context.usage(), Default::default(), "policy mismatch must not start conversion"); + } + context.parse_preflight(preflight(&text, &limits).unwrap(), usvg::Options::default()).unwrap(); +} + +fn hostile_options(calls: &Arc) -> usvg::Options<'static> { + let string_calls = Arc::clone(calls); + let data_calls = Arc::clone(calls); + usvg::Options { + image_href_resolver: usvg::ImageHrefResolver { + resolve_string: Box::new(move |_, _| { + string_calls.fetch_add(1, Ordering::SeqCst); + panic!("ambient string resolver must not run") + }), + resolve_data: Box::new(move |_, _, _| { + data_calls.fetch_add(1, Ordering::SeqCst); + panic!("caller data resolver must not bypass validation") + }), + }, + ..Default::default() + } +} + +#[test] +fn validated_root_and_nested_context_override_untrusted_image_callbacks() { + let calls = Arc::new(AtomicUsize::new(0)); + let child = drawing( + "", + ); + let root = drawing(&format!("{}", image(&url(child.as_bytes())))); + let limits = Limits::default(); + let context = ValidatedImageResolver::new(limits); + context.parse_preflight(preflight(&root, &limits).unwrap(), hostile_options(&calls)).unwrap(); + assert_eq!(calls.load(Ordering::SeqCst), 0); + assert_eq!(context.usage().embedded_svg_count, 1); + assert_eq!(context.usage().invalid_raster_images, 1); + let direct = ValidatedImageResolver::new(limits); + assert!(matches!(direct.resolve_text(&child, hostile_options(&calls)).unwrap(), Some(usvg::ImageKind::SVG(_)))); + assert_eq!(calls.load(Ordering::SeqCst), 0); + assert_eq!(direct.usage().invalid_raster_images, 1); +} + +#[test] +fn expanded_root_references_and_child_share_the_converted_depth_limit() { + let child = drawing(""); // height 3 + let href = url(child.as_bytes()); + let root = drawing(&format!("{}", image(&href))); // height 6 + assert!(preflight(&root, &Limits { tree_depth: 5, ..Default::default() }).is_err()); + assert!(preflight(&root, &Limits { tree_depth: 6, ..Default::default() }).is_ok()); + assert!(preflight(&child, &Limits { tree_depth: 3, ..Default::default() }).is_ok()); + for (depth, admitted) in [(8, false), (9, true)] { + let limits = Limits { tree_depth: depth, ..Default::default() }; + let checked = preflight(&root, &limits).unwrap(); + assert!(checked.depth() < 6, "source nesting is shallower than expanded references"); + let context = ValidatedImageResolver::new(limits); + context.parse_preflight(checked, usvg::Options::default()).unwrap(); + let usage = context.usage(); + assert_eq!(usage.embedded_svg_count, usize::from(admitted)); + assert_eq!(usage.svg_limit_images, usize::from(!admitted)); + assert_eq!(usage.invalid_svg_images, 0); + } +} From ca56374cf1bda5b7660ccd526048ac134fd52d58 Mon Sep 17 00:00:00 2001 From: Terra854 Date: Tue, 17 Nov 2026 19:07:31 +0800 Subject: [PATCH 020/183] Use shared preflight in MIME body regression --- crates/svg/src/tree/mime_header_tests.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/svg/src/tree/mime_header_tests.rs b/crates/svg/src/tree/mime_header_tests.rs index 393a01729..c22ef7d4a 100644 --- a/crates/svg/src/tree/mime_header_tests.rs +++ b/crates/svg/src/tree/mime_header_tests.rs @@ -136,8 +136,8 @@ fn many_parameter_urls_preserve_bodies_and_base64_disposition() { ] { let text = format!(""); let repaired = repair(&text, &Limits { bytes: 2 << 20, ..Default::default() }).unwrap(); - let xml = checked_xml(&repaired, &Limits { bytes: 2 << 20, ..Default::default() }).unwrap(); - let value = xml.descendants().find(|node| node.has_tag_name("image")).unwrap().attribute("href").unwrap(); + let checked = super::super::preflight(&repaired, &Limits { bytes: 2 << 20, ..Default::default() }).unwrap(); + let value = checked.xml.descendants().find(|node| node.has_tag_name("image")).unwrap().attribute("href").unwrap(); assert!(!value.contains(";p0=")); assert_eq!(data_url::DataUrl::process(value).unwrap().decode_to_vec().unwrap().0, expected); assert!(matches!(repair(&repaired, &Limits { bytes: 2 << 20, ..Default::default() }).unwrap(), Cow::Borrowed(_))); From 6d0fa2c26dc05d7d909ec33051d05f4c40a740d5 Mon Sep 17 00:00:00 2001 From: Terra854 Date: Tue, 17 Nov 2026 19:09:27 +0800 Subject: [PATCH 021/183] Parse lockfile dependency graphs as TOML documents --- crates/svg/src/tree/draw/decoder_edges.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/svg/src/tree/draw/decoder_edges.rs b/crates/svg/src/tree/draw/decoder_edges.rs index 8258b5792..7d0c072d6 100644 --- a/crates/svg/src/tree/draw/decoder_edges.rs +++ b/crates/svg/src/tree/draw/decoder_edges.rs @@ -16,7 +16,7 @@ pub(crate) struct LockGraph { } impl LockGraph { pub(crate) fn parse(text: &str) -> Self { - let lock: toml::Value = text.parse().unwrap(); + let lock: toml::Value = toml::from_str(text).unwrap(); let packages = lock .get("package") .unwrap() From 76a27e21d72b9cd70c2d6204f91ad3544c3e8ee9 Mon Sep 17 00:00:00 2001 From: Terra854 Date: Tue, 17 Nov 2026 19:12:08 +0800 Subject: [PATCH 022/183] Keep validated policy storage within the renderer feature --- crates/svg/src/tree.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/svg/src/tree.rs b/crates/svg/src/tree.rs index 80feec75d..690320e82 100644 --- a/crates/svg/src/tree.rs +++ b/crates/svg/src/tree.rs @@ -167,6 +167,7 @@ pub fn root_unitless_size(svg: &str, limits: &Limits) -> Result { + #[cfg(feature = "tree-render")] limits: Limits, xml: roxmltree::Document<'s>, depth: usize, @@ -248,7 +249,13 @@ pub fn preflight<'s>(svg: &'s str, limits: &Limits) -> Result, Err let Some(height) = height(&xml, limits.tree_depth)? else { return Err(Error::TooDeep(limits.tree_depth)); }; - Ok(Preflight { limits: *limits, xml, depth, height }) + Ok(Preflight { + #[cfg(feature = "tree-render")] + limits: *limits, + xml, + depth, + height, + }) } /// Dimensions of an SVG viewport in SVG user units. From 96dd8c4e0996b3d85edf5c98070c261892ac30f3 Mon Sep 17 00:00:00 2001 From: Terra854 Date: Tue, 17 Nov 2026 19:14:47 +0800 Subject: [PATCH 023/183] Disambiguate the SVG writer documentation link --- crates/svg/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/svg/src/lib.rs b/crates/svg/src/lib.rs index ccb2b6837..79a706052 100644 --- a/crates/svg/src/lib.rs +++ b/crates/svg/src/lib.rs @@ -8,7 +8,7 @@ //! - `paths` (feature `paths`, on by default): the geometry of a document as Bézier paths in //! millimetres, for cutters, plotters and CAD import. //! - [`color`]: CSS colours. -//! - [`write`]: a writer for SVG documents, their path data and numbers. +//! - [`mod@write`]: a writer for SVG documents, their path data and numbers. //! - `tree` (feature `tree`): the full parser. usvg at the one version the Craft apps share, //! re-exported, behind an entry point that runs the checks above before it parses. //! From 8d5b02457ef0986742465cf69aefeb4dd1d2e7c8 Mon Sep 17 00:00:00 2001 From: r31lin <257763872+r31lin@users.noreply.github.com> Date: Tue, 17 Nov 2026 12:21:21 +0100 Subject: [PATCH 024/183] document-bundle: turn a non-zip file away after four bytes in read_preview_from The zip reader searches a whole file for an end-of-directory record before it gives up on a file that isn't a zip. DesignCraft reads the preview of every recent file this way before the start screen's first frame: 2.6 s for a local 110 MB InDesign document, 43 s on a network share. read_preview_from now checks the zip local-file header first. Fixes #2031 --- crates/document-bundle/src/lib.rs | 48 ++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/crates/document-bundle/src/lib.rs b/crates/document-bundle/src/lib.rs index 70a960a1f..845381f30 100644 --- a/crates/document-bundle/src/lib.rs +++ b/crates/document-bundle/src/lib.rs @@ -316,8 +316,19 @@ pub fn read_preview(bytes: &[u8], preview_entry: &str) -> Option> { } /// Read a bounded preview from a seekable file without loading the full bundle into memory. -pub fn read_preview_from(reader: R, preview_entry: &str) -> Option> { +/// +/// A file that does not start with a zip local-file header is turned away after four bytes. The zip +/// reader would otherwise search the whole file for an end-of-directory record it does not have, +/// which takes seconds for a large non-bundle file (an InDesign document in a recent-files list) +/// and minutes on a network share. +pub fn read_preview_from(mut reader: R, preview_entry: &str) -> Option> { const PREVIEW_LIMIT: u64 = 4 << 20; + let mut magic = [0u8; 4]; + reader.read_exact(&mut magic).ok()?; + if &magic != b"PK\x03\x04" { + return None; + } + reader.seek(std::io::SeekFrom::Start(0)).ok()?; let mut zip = zip::ZipArchive::new(reader).ok()?; let entry = zip.by_name(preview_entry).ok()?; if entry.size() > PREVIEW_LIMIT { @@ -409,6 +420,41 @@ mod tests { assert_eq!(read_preview(&bytes, SPEC.preview_entry).as_deref(), Some(&b"png"[..])); } + /// Counts the bytes read through it. + struct Counting { + inner: R, + read: usize, + } + + impl Read for Counting { + fn read(&mut self, buf: &mut [u8]) -> std::io::Result { + let n = self.inner.read(buf)?; + self.read += n; + Ok(n) + } + } + + impl Seek for Counting { + fn seek(&mut self, pos: std::io::SeekFrom) -> std::io::Result { + self.inner.seek(pos) + } + } + + #[test] + fn preview_from_a_reader_reads_a_bundle() { + let bytes = write(br#"{}"#, 4, "Test 0.1", Some(b"png"), &[], &[], SPEC).unwrap(); + assert_eq!(read_preview_from(Cursor::new(&bytes), SPEC.preview_entry).as_deref(), Some(&b"png"[..])); + } + + #[test] + fn preview_from_a_non_zip_reads_only_its_signature() { + let mut file = Counting { inner: Cursor::new(vec![0x42u8; 1 << 20]), read: 0 }; + assert_eq!(read_preview_from(&mut file, SPEC.preview_entry), None); + assert!(file.read <= 4, "read {} bytes of a file that is not a zip", file.read); + let mut empty = Counting { inner: Cursor::new(Vec::new()), read: 0 }; + assert_eq!(read_preview_from(&mut empty, SPEC.preview_entry), None); + } + #[test] fn extracts_legacy_inline_assets() { let loaded = read(br#"{"assetData":{"7":"AQID"},"name":"x"}"#, 4, SPEC).unwrap(); From 36e58391b1225a21b749bcf1a53d9be5ec961fbb Mon Sep 17 00:00:00 2001 From: Terra854 Date: Tue, 17 Nov 2026 19:34:40 +0800 Subject: [PATCH 025/183] Cover renderer backends and canonical Git dependency edges --- crates/svg/src/tree/draw/decoder_edges.rs | 60 +++++++- crates/svg/src/tree/draw/raster.rs | 4 + crates/svg/src/tree/draw/raster_tests.rs | 179 ++++++++++++++++++++++ 3 files changed, 242 insertions(+), 1 deletion(-) create mode 100644 crates/svg/src/tree/draw/raster_tests.rs diff --git a/crates/svg/src/tree/draw/decoder_edges.rs b/crates/svg/src/tree/draw/decoder_edges.rs index 7d0c072d6..ce6543b81 100644 --- a/crates/svg/src/tree/draw/decoder_edges.rs +++ b/crates/svg/src/tree/draw/decoder_edges.rs @@ -14,6 +14,12 @@ struct Package { pub(crate) struct LockGraph { packages: Vec, } +// Cargo dependency edges may omit the resolved Git fragment even though the +// selected package ID always records it. Other source identities stay exact. +fn source_matches(edge: &str, package: Option<&str>) -> bool { + let Some(package) = package else { return false }; + if edge.starts_with("git+") && !edge.contains('#') { package.split_once('#').map_or(package, |(base, _)| base) == edge } else { package == edge } +} impl LockGraph { pub(crate) fn parse(text: &str) -> Self { let lock: toml::Value = toml::from_str(text).unwrap(); @@ -55,7 +61,9 @@ impl LockGraph { let found: Vec<_> = self .packages .iter() - .filter(|p| p.id.name == name && version.is_none_or(|v| p.id.version == v) && source.is_none_or(|s| p.id.source.as_deref() == Some(s))) + .filter(|p| { + p.id.name == name && version.is_none_or(|v| p.id.version == v) && source.is_none_or(|s| source_matches(s, p.id.source.as_deref())) + }) .collect(); assert_eq!(found.len(), 1, "ambiguous or absent resolved edge {} from {from:?}", edges[0]); found[0].id.clone() @@ -125,3 +133,53 @@ fn selected_renderer_graph_rejects_a_split_validator_backend() { let split = make(true); assert!(std::panic::catch_unwind(|| assert_renderer_edges(&split, &split.workspace_package("craft-svg"))).is_err()); } + +#[test] +fn git_edges_resolve_full_package_ids_and_reject_canonical_ambiguity() { + let fixture = |second: bool| { + let mut text = String::from( + r#" +[[package]] +name = "consumer" +version = "1" +dependencies = ["codec 1 (git+https://example.invalid/codecs?rev=chosen)"] +[[package]] +name = "explicit" +version = "1" +dependencies = ["codec 1 (git+https://example.invalid/codecs?rev=chosen#aaaa)"] +[[package]] +name = "wrong" +version = "1" +dependencies = ["codec 1 (git+https://example.invalid/codecs?rev=chosen#cccc)"] +[[package]] +name = "codec" +version = "1" +source = "git+https://example.invalid/codecs?rev=chosen#aaaa" +"#, + ); + if second { + text.push_str( + r#" +[[package]] +name = "codec" +version = "1" +source = "git+https://example.invalid/codecs?rev=chosen#bbbb" +"#, + ); + } + LockGraph::parse(&text) + }; + let unique = fixture(false); + let selected = unique.dependency(&unique.workspace_package("consumer"), "codec"); + assert_eq!(selected.source.as_deref(), Some("git+https://example.invalid/codecs?rev=chosen#aaaa")); + assert_eq!(selected, unique.dependency(&unique.workspace_package("explicit"), "codec")); + assert!(std::panic::catch_unwind(|| unique.dependency(&unique.workspace_package("wrong"), "codec")).is_err()); + let ambiguous = fixture(true); + assert!(std::panic::catch_unwind(|| ambiguous.dependency(&ambiguous.workspace_package("consumer"), "codec")).is_err()); + assert_eq!(selected, ambiguous.dependency(&ambiguous.workspace_package("explicit"), "codec")); + assert!(!source_matches("registry+one", Some("registry+one#aaaa")), "registry sources remain exact"); + assert!( + !source_matches("git+https://example.invalid/codecs?rev=other", selected.source.as_deref()), + "requested Git revision remains part of the identity" + ); +} diff --git a/crates/svg/src/tree/draw/raster.rs b/crates/svg/src/tree/draw/raster.rs index fe250259d..ffeb0d684 100644 --- a/crates/svg/src/tree/draw/raster.rs +++ b/crates/svg/src/tree/draw/raster.rs @@ -138,3 +138,7 @@ fn webp_error(error: image_webp::DecodingError) -> RasterValidationFailure { _ => RasterValidationFailure::Invalid, } } + +#[cfg(test)] +#[path = "raster_tests.rs"] +mod raster_tests; diff --git a/crates/svg/src/tree/draw/raster_tests.rs b/crates/svg/src/tree/draw/raster_tests.rs new file mode 100644 index 000000000..a7783f8c5 --- /dev/null +++ b/crates/svg/src/tree/draw/raster_tests.rs @@ -0,0 +1,179 @@ +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::indexing_slicing)] +use super::*; +use craft_image_codecs::{ChannelLayout, Format, Image}; +use std::sync::Arc; + +fn kind(format: Format, bytes: Vec) -> usvg::ImageKind { + let bytes = Arc::new(bytes); + match format { + Format::Png => usvg::ImageKind::PNG(bytes), + Format::Jpeg => usvg::ImageKind::JPEG(bytes), + Format::Gif => usvg::ImageKind::GIF(bytes), + Format::WebP => usvg::ImageKind::WEBP(bytes), + _ => panic!("test raster format"), + } +} + +fn encoded(format: Format) -> Vec { + let image = Image::from_u8(2, 2, ChannelLayout::Rgb, [17, 83, 149].repeat(4)).unwrap(); + craft_image_codecs::encode(&image, format, &Default::default()).unwrap() +} + +fn segment(out: &mut Vec, marker: u8, payload: &[u8]) { + out.extend_from_slice(&[0xff, marker]); + out.extend_from_slice(&u16::try_from(payload.len() + 2).unwrap().to_be_bytes()); + out.extend_from_slice(payload); +} + +// ISO/IEC10918-1 framing, one gray 8x8 block. The single one-bit Huffman codes +// encode DC category 0 and AC EOB. No third-party asset or camera data is used. +fn gray_jpeg(bits: u8, entropy: &[u8]) -> Vec { + let mut data = vec![0xff, 0xd8]; + let mut quantization = vec![0]; + quantization.extend_from_slice(&[1; 64]); + segment(&mut data, 0xdb, &quantization); + segment(&mut data, if bits == 8 { 0xc0 } else { 0xc1 }, &[bits, 0, 8, 0, 8, 1, 1, 0x11, 0]); + let mut tables = Vec::new(); + for class in [0x00, 0x10] { + tables.extend_from_slice(&[class, 1]); + tables.extend_from_slice(&[0; 15]); + tables.push(0); + } + segment(&mut data, 0xc4, &tables); + segment(&mut data, 0xda, &[1, 1, 0, 0, 63, 0]); + data.extend_from_slice(entropy); + data.extend_from_slice(&[0xff, 0xd9]); + data +} + +fn crc32(bytes: &[u8]) -> u32 { + let mut value = !0u32; + for byte in bytes { + value ^= u32::from(*byte); + for _ in 0..8 { + value = (value >> 1) ^ (0xedb8_8320 & 0u32.wrapping_sub(value & 1)); + } + } + !value +} + +fn corrupt_png() -> Vec { + let mut data = encoded(Format::Png); + let mut at = 8; + loop { + let length = u32::from_be_bytes(data[at..at + 4].try_into().unwrap()) as usize; + if &data[at + 4..at + 8] == b"IDAT" { + // Keep the complete container and an honest CRC, but destroy the + // zlib header in the pixel stream rather than the dimension header. + assert!(length >= 2); + data[at + 8..at + 10].fill(0); + let crc = crc32(&data[at + 4..at + 8 + length]); + data[at + 8 + length..at + 12 + length].copy_from_slice(&crc.to_be_bytes()); + return data; + } + at += length + 12; + } +} + +fn corrupt_gif() -> Vec { + // Complete 2x2 GIF89a framing and palette, followed by a code7 when only + // codes 0..5 are initially defined by an LZW minimum code size of 2. + let mut data = b"GIF89a".to_vec(); + data.extend_from_slice(&[2, 0, 2, 0, 0x80, 0, 0]); + data.extend_from_slice(&[0, 0, 0, 0, 255, 0]); + data.extend_from_slice(&[0x2c, 0, 0, 0, 0, 2, 0, 2, 0, 0]); + data.extend_from_slice(&[2, 1, 7, 0, 0x3b]); + data +} + +fn corrupt_webp() -> Vec { + // Complete RIFF/VP8L dimensions, with no transform/Huffman/pixel bits. + // Chunk length and odd-byte padding remain internally consistent. + let mut data = b"RIFF".to_vec(); + data.extend_from_slice(&18u32.to_le_bytes()); + data.extend_from_slice(b"WEBPVP8L"); + data.extend_from_slice(&5u32.to_le_bytes()); + data.extend_from_slice(&[0x2f, 1, 0x40, 0, 0, 0]); + data +} + +#[test] +fn renderer_validator_accepts_complete_png_jpeg_gif_and_webp_at_exact_pixel_allowance() { + for format in [Format::Png, Format::Jpeg, Format::Gif, Format::WebP] { + let data = encoded(format); + assert_eq!(craft_image_codecs::probe_allocation_size(&data).unwrap(), (2, 2)); + let mut remaining = 4; + assert_eq!(validate_raster(&kind(format, data), 4, &mut remaining), Ok(()), "{format:?}"); + assert_eq!(remaining, 0, "{format:?}: exact area must be charged"); + } +} + +#[test] +fn renderer_validator_rejects_corrupt_pixels_after_valid_dimensions_without_refunding_work() { + let cases = [ + (Format::Png, corrupt_png(), (2, 2)), + // One-bit tables have no code starting with1. Stuffed all-one bits + // are an invalid entropy code, while SOF/DQT/DHT/SOS remain valid. + (Format::Jpeg, gray_jpeg(8, &[0xff, 0, 0xff, 0, 0xff, 0]), (8, 8)), + (Format::Gif, corrupt_gif(), (2, 2)), + (Format::WebP, corrupt_webp(), (2, 2)), + ]; + for (format, data, dimensions) in cases { + assert_eq!(craft_image_codecs::probe_allocation_size(&data).unwrap(), dimensions, "{format:?}"); + match format { + Format::Jpeg => { + let mut headers = zune_jpeg::JpegDecoder::new(Cursor::new(&data)); + headers.decode_headers().expect("intact JPEG scan headers before corrupt entropy"); + } + Format::Gif => { + gif::DecodeOptions::new().read_info(data.as_slice()).expect("intact GIF headers before corrupt LZW pixels"); + } + Format::WebP => { + image_webp::WebPDecoder::new(Cursor::new(&data)).expect("intact WebP headers before missing pixel bits"); + } + _ => {} + } + let pixels = u64::from(dimensions.0) * u64::from(dimensions.1); + let image = kind(format, data); + let mut remaining = pixels * 2; + for left in [pixels, 0] { + assert_eq!(validate_raster(&image, pixels, &mut remaining), Err(RasterValidationFailure::Invalid), "{format:?}"); + assert_eq!(remaining, left, "{format:?}: failed decode work is nonrefundable"); + } + assert_eq!(validate_raster(&image, pixels, &mut remaining), Err(RasterValidationFailure::Limit), "{format:?}"); + assert_eq!(remaining, 0); + } +} + +#[test] +fn twelve_bit_jpeg_is_valid_for_the_general_codec_but_not_the_svg_renderer() { + for bits in [8, 12] { + // DC=0, EOB=0, then six one-pad bits: a constant mid-gray block. + let data = gray_jpeg(bits, &[0x3f]); + let decoded = craft_image_codecs::decode(&data).unwrap(); + assert_eq!(decoded.dimensions(), (8, 8)); + let mut remaining = 64; + let expected = if bits == 8 { Ok(()) } else { Err(RasterValidationFailure::Invalid) }; + assert_eq!(validate_raster(&kind(Format::Jpeg, data), 64, &mut remaining), expected, "{bits}-bit"); + assert_eq!(remaining, 0, "capability refusal still spends attempted decode work"); + } +} + +#[test] +fn renderer_validator_refuses_unadmitted_headers_and_pixels_without_charging_unattempted_decode() { + for format in [Format::Png, Format::Jpeg, Format::Gif, Format::WebP] { + let image = kind(format, encoded(format)); + let mut remaining = 4; + assert_eq!(validate_raster(&image, 3, &mut remaining), Err(RasterValidationFailure::Limit), "{format:?}: per-image ceiling"); + assert_eq!(remaining, 4); + remaining = 3; + assert_eq!(validate_raster(&image, 4, &mut remaining), Err(RasterValidationFailure::Limit), "{format:?}: cumulative allowance"); + assert_eq!(remaining, 3); + assert_eq!( + validate_raster(&kind(format, b"invalid raster header".to_vec()), 4, &mut remaining), + Err(RasterValidationFailure::Invalid), + "{format:?}" + ); + assert_eq!(remaining, 3, "invalid dimensions cannot reserve an invented area"); + } +} From 8af8f407af4c81c80f05396343df0d238b97626b Mon Sep 17 00:00:00 2001 From: Terra854 Date: Tue, 17 Nov 2026 19:42:04 +0800 Subject: [PATCH 026/183] Use an observed JPEG decode failure fixture --- crates/svg/src/tree/draw/raster_tests.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/crates/svg/src/tree/draw/raster_tests.rs b/crates/svg/src/tree/draw/raster_tests.rs index a7783f8c5..273705744 100644 --- a/crates/svg/src/tree/draw/raster_tests.rs +++ b/crates/svg/src/tree/draw/raster_tests.rs @@ -46,6 +46,18 @@ fn gray_jpeg(bits: u8, entropy: &[u8]) -> Vec { data } +fn corrupt_jpeg() -> Vec { + let mut data = gray_jpeg(8, &[0x3f]); + let scan = data.windows(2).position(|marker| marker == b"\xff\xda").unwrap(); + // Keep the complete scan header and valid entropy, but reference table 1 + // while DHT defines only table 0. The renderer accepts these headers, then + // fails pixel decoding when checking the selected Huffman tables. Random + // all-one entropy is tolerated by its default policy and is not this guard. + assert_eq!(data[scan + 6], 0); + data[scan + 6] = 0x11; + data +} + fn crc32(bytes: &[u8]) -> u32 { let mut value = !0u32; for byte in bytes { @@ -112,9 +124,8 @@ fn renderer_validator_accepts_complete_png_jpeg_gif_and_webp_at_exact_pixel_allo fn renderer_validator_rejects_corrupt_pixels_after_valid_dimensions_without_refunding_work() { let cases = [ (Format::Png, corrupt_png(), (2, 2)), - // One-bit tables have no code starting with1. Stuffed all-one bits - // are an invalid entropy code, while SOF/DQT/DHT/SOS remain valid. - (Format::Jpeg, gray_jpeg(8, &[0xff, 0, 0xff, 0, 0xff, 0]), (8, 8)), + // Header-only admission cannot detect this missing scan-table dependency. + (Format::Jpeg, corrupt_jpeg(), (8, 8)), (Format::Gif, corrupt_gif(), (2, 2)), (Format::WebP, corrupt_webp(), (2, 2)), ]; @@ -123,7 +134,7 @@ fn renderer_validator_rejects_corrupt_pixels_after_valid_dimensions_without_refu match format { Format::Jpeg => { let mut headers = zune_jpeg::JpegDecoder::new(Cursor::new(&data)); - headers.decode_headers().expect("intact JPEG scan headers before corrupt entropy"); + headers.decode_headers().expect("intact JPEG scan headers before unavailable pixel-decode table"); } Format::Gif => { gif::DecodeOptions::new().read_info(data.as_slice()).expect("intact GIF headers before corrupt LZW pixels"); From fcafab33d9fedbefb0992d7776db3b6ae8b918f6 Mon Sep 17 00:00:00 2001 From: Terra854 Date: Tue, 17 Nov 2026 20:09:30 +0800 Subject: [PATCH 027/183] Preserve the exact embedded SVG depth boundary --- crates/svg/README.md | 6 ++++-- crates/svg/src/tree/validated.rs | 7 +++--- crates/svg/src/tree/validated/xml_tests.rs | 25 +++++++++++++++++++++- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/crates/svg/README.md b/crates/svg/README.md index 0810b1217..519015c1b 100644 --- a/crates/svg/README.md +++ b/crates/svg/README.md @@ -46,8 +46,10 @@ The caller supplies fonts and a sufficient stack/worker for its depth policy. `parse_preflight` accepts only an opaque preflight made with exactly this context's limits. It consumes options and installs its own data-only resolver, including for all children; unrelated callbacks cannot fetch a linked file or bypass admission. -The full expanded root height and each child's expanded height share one depth -allowance. An overlapping root conversion on the same context is refused. +Expanded root ancestor frames (checked height minus the callback leaf) and each +child's complete expanded height share one depth allowance. The callback leaf is +not counted twice; source nesting alone cannot hide expanded reference chains. +An overlapping root conversion on the same context is refused. Unchanged XML converts from its original checked DOM. A modified data URL requires one checked replacement DOM. Invalid URLs become bounded resolver-visible image diff --git a/crates/svg/src/tree/validated.rs b/crates/svg/src/tree/validated.rs index cb1b6e8c3..658b2641f 100644 --- a/crates/svg/src/tree/validated.rs +++ b/crates/svg/src/tree/validated.rs @@ -191,9 +191,10 @@ impl ValidatedImageResolver { if checked.limits != self.limits { return Err(Error::Parse("checked SVG limits differ from the validated image resolver".into())); } - // A shallow source can expand through use/paint references. Reserve the - // full checked converted height before any child callback, not source depth. - let _scope = self.root_scope(checked.height)?; + // A shallow source can expand through use/paint references. Reserve its + // expanded ancestor frames, excluding the callback leaf itself. The child + // contributes its complete checked height, as in legacy child admission. + let _scope = self.root_scope(checked.height.saturating_sub(1))?; options.image_href_resolver = self.resolver(); convert_checked(checked, &options) } diff --git a/crates/svg/src/tree/validated/xml_tests.rs b/crates/svg/src/tree/validated/xml_tests.rs index b6b594433..34e1e604e 100644 --- a/crates/svg/src/tree/validated/xml_tests.rs +++ b/crates/svg/src/tree/validated/xml_tests.rs @@ -162,7 +162,10 @@ fn expanded_root_references_and_child_share_the_converted_depth_limit() { assert!(preflight(&root, &Limits { tree_depth: 5, ..Default::default() }).is_err()); assert!(preflight(&root, &Limits { tree_depth: 6, ..Default::default() }).is_ok()); assert!(preflight(&child, &Limits { tree_depth: 3, ..Default::default() }).is_ok()); - for (depth, admitted) in [(8, false), (9, true)] { + // Expanded root height6 includes the callback leaf: reserve5 ancestors, + // then admit the child's complete height3. Source depth alone would wrongly + // accept the cap7 case, while reserving the leaf twice would reject cap8. + for (depth, admitted) in [(7, false), (8, true)] { let limits = Limits { tree_depth: depth, ..Default::default() }; let checked = preflight(&root, &limits).unwrap(); assert!(checked.depth() < 6, "source nesting is shallower than expanded references"); @@ -174,3 +177,23 @@ fn expanded_root_references_and_child_share_the_converted_depth_limit() { assert_eq!(usage.invalid_svg_images, 0); } } + +#[test] +fn plain_root_callback_leaf_does_not_spend_the_child_boundary_twice() { + let child = drawing(""); // height3 + let root = drawing(&image(&url(child.as_bytes()))); // height2, one ancestor + for (depth, admitted) in [(3, false), (4, true)] { + let limits = Limits { tree_depth: depth, ..Default::default() }; + assert!(preflight(&root, &limits).is_ok()); + assert!(preflight(&child, &limits).is_ok()); + let context = ValidatedImageResolver::new(limits); + let tree = context.parse_preflight(preflight(&root, &limits).unwrap(), usvg::Options::default()).unwrap(); + assert_eq!(context.usage().embedded_svg_count, usize::from(admitted)); + assert_eq!(context.usage().svg_limit_images, usize::from(!admitted)); + assert_eq!(context.usage().invalid_svg_images, 0); + let pixels = super::super::draw::render(&tree, usvg::Transform::identity(), 4, 4, 0, 1 << 20).unwrap(); + let sample = pixels.pixel(1, 1).unwrap(); + assert_eq!((sample.red(), sample.green(), sample.blue()), (0, 0, 0)); + assert_eq!(sample.alpha(), if admitted { 255 } else { 0 }, "exact-boundary child must actually draw"); + } +} From ff8c279854733aea4a5806838f19a5e81a76cfa7 Mon Sep 17 00:00:00 2001 From: Davi Augusto Date: Tue, 17 Nov 2026 10:02:44 -0300 Subject: [PATCH 028/183] craft-raw: Sony ZV-E10 in-file distortion The ZV-E10 joins APSC_BODIES with the ILCE-6700's rule (11 knots over its own default crop's half diagonal / 10 = 360.56 px, the corrected- radius index, the frame-filling zoom, the 0.5 px APS-C fit gate) and its own distortion unit, 16384: the ILCE-6700's 15000 over-corrects its 16 mm photos by about 9 %. APS-C bodies now carry their unit. Measured on 4 photos with the E PZ 16-50 mm at 16-32 mm against the camera JPEG: p95 0.26-0.64 px at 1440 px as rendered (uncorrected up to 18.7 px; unit 15000 up to 2.18 px). Ported from storytold/lightcraft#3743, overtaken by the craft-raw cutover. --- .../docs/sony-ilce7rm6-lens-corrections.md | 35 ++++++++++-- crates/raw/src/arw_lens_rm6.rs | 54 +++++++++++++++---- 2 files changed, 76 insertions(+), 13 deletions(-) diff --git a/crates/raw/docs/sony-ilce7rm6-lens-corrections.md b/crates/raw/docs/sony-ilce7rm6-lens-corrections.md index 216fc4b63..8a87bdc3b 100644 --- a/crates/raw/docs/sony-ilce7rm6-lens-corrections.md +++ b/crates/raw/docs/sony-ilce7rm6-lens-corrections.md @@ -7,7 +7,7 @@ chromatic aberration (CA). LightCraft reads them and turns distortion into a DNG reaches the same **Optics ▸ Enable Lens Corrections** (`optics.lens_profile`) as a DNG's embedded warp and Panasonic's RW2 distortion data. Lateral CA is parsed and converts to the warp's red and blue planes, but it is **off by default**: applied after demosaic it made the render's CA worse (Verification). Vignetting is read but not applied (below). The -conversion is verified on the **ILCE-7RM6** and, for distortion, the **ILCE-6700** ([ILCE-6700](#ilce-6700)); the +conversion is verified on the **ILCE-7RM6** and, for distortion, the **ILCE-6700** ([ILCE-6700](#ilce-6700)) and the **ZV-E10** ([ZV-E10](#zv-e10)); the ILCE-7RM4A has its own conversion, with other conventions ([Two conventions](#two-conventions)), and other Sony bodies' tables give no correction until they are verified. @@ -105,7 +105,7 @@ the photo (portrait files are covered) and is carried by DNG export, as RW2's is ## Which bodies get it Only bodies on one of two allowlists in `arw_lens_rm6.rs` get an opcode: `FULL_FRAME_CROP` (today `ILCE-7RM6`, -9984 × 6656) and `APSC_BODIES` (today `ILCE-6700`, below). The unit and the knot spacing are verified per body; a body +9984 × 6656) and `APSC_BODIES` (today `ILCE-6700` and `ZV-E10`, below, each with its distortion unit). The unit and the knot spacing are verified per body; a body with another sensor size or another unit would be warped wrongly. Other bodies get no correction from this conversion; the ILCE-7RM4A gets its own, with other conventions (below). To add a body: collect photos of it shot with distortion correction on (several lenses and focal lengths), repeat the camera-JPEG registration below against the uncorrected @@ -113,7 +113,7 @@ render, confirm the unit, the knot spacing and the zoom rule (or measure the bod default crop to `FULL_FRAME_CROP`, or an APS-C body whose knots span its own crop (as measured for the ILCE-6700) to `APSC_BODIES`, with a test; an APS-C body also needs its fit gate checked against the camera JPEG (see *ILCE-6700*). -For bodies in `APSC_BODIES` (today `ILCE-6700`), the knots span the file's own default crop: spacing = its half +For bodies in `APSC_BODIES` (today `ILCE-6700` and `ZV-E10`), the knots span the file's own default crop: spacing = its half diagonal / (knot count − 1). This crop-based rule applies only to that list. The ILCE-7RM6 keeps its sensor-fixed 400 px in both modes; in full frame (16 knots) the crop-based rule gives the same 400 px, and in its APS-C mode (11 knots) it would give 392 px, which was only an alternative measurement there (it fits as well, above). @@ -166,6 +166,29 @@ As rendered (`lightcraft-cli render`, Enable Lens Corrections on): At 11.7 mm and longer an exception of this kind fits worse than the body's rule (412 px / 14500 on the grid: 0.73–1.19 px against 0.48–0.69 px), so it stops at 10.5 mm, the longest measured focal length where it helps; 10.6–11.6 mm is unmeasured and takes the body's rule. +## ZV-E10 + +The ZV-E10 (APS-C, 6000 × 4000 default crop at (12, 12) in 6048 × 4024 storage) writes 11-knot tables like the +ILCE-6700, zero-padded to the same 17 values. Measured as above on 4 photos shot with distortion correction Auto (the +E PZ 16-50 mm F3.5-5.6 OSS, which forces it; its owner's photos, only the summary numbers here): 2 at 16 mm, 1 at 29 mm +(portrait) and 1 at 32 mm. Feature matches between the uncorrected render and the camera JPEG +(LightCraft's `tools/sony_distortion_check.py`, SIFT agreement after the best similarity), the camera's map applied to the render's +points in a scan of knot spacing 340–380 px and unit 15000–17800: + +| | p95 residual at 1440 px | +|---|---| +| Uncorrected | 2.7–18.7 px (16 mm: 18.6–18.7 px) | +| The ILCE-6700's rule (half diagonal / 10 = 360.56 px, unit 15000), as rendered | 0.45–2.18 px: the 16 mm photos over-corrected by about 9 % | +| Sensor-fixed 400 px, unit 16384 | 0.43–3.21 px | +| **Half diagonal / 10 = 360.56 px, unit 16384** (exact table) | **0.27–0.61 px** | +| The same as LightCraft renders it (`lightcraft-cli render`, Enable Lens Corrections on, fitted polynomial) | **0.26–0.64 px** (median residual 0.07–0.36 px) | + +At 360.56 px every unit from 16300 to 17000 lands within 0.60–0.64 px worst (the measurement's floor on these scenes); +spacing and unit trade off along a ridge as on the ILCE-6700 (375 px / 15700 and 380 px / 15400 reach 0.59 px), so the +body keeps the ILCE-6700's crop-based spacing and takes its own unit, 16384, in `APSC_BODIES`. The fitted polynomial +passes the 0.5 px APS-C fit gate on all four tables, the strongest (16 mm, −1905 at the last knot) included. An HDR +merge of a ZV-E10 bracket keeps the warp in the merged DNG's `OpcodeList3`, as for any raw with embedded corrections. + ## Two conventions A second Sony decoder, `src/arw_lens.rs` @@ -344,7 +367,7 @@ the resampled source by the source, framing and output size, so tone, colour and ## Limits -- **ILCE-7RM6 and ILCE-6700 only.** Other Sony bodies record the same tags; their knot spacing (defined here by the +- **ILCE-7RM6, ILCE-6700 and ZV-E10 only.** Other Sony bodies record the same tags; their knot spacing (defined here by the full-frame crop, or an APS-C body's own crop), unit and zoom rule are unverified, so they get no correction from this conversion (the ILCE-7RM4A's distortion has its own: [Two conventions](#two-conventions)). - **ILCE-6700 at strong barrel distortion:** the body's rule leaves 1.36–1.38 px at the Sigma 10–18 mm's 10 mm end; @@ -355,6 +378,10 @@ the resampled source by the source, framing and output size, so tone, colour and 6656 × 4608 frame, misses the 0.5 px fit gate, so that photo stays uncorrected (5.3 px). Other wide lenses with similarly strong tables are unmeasured. Its vignetting and lateral CA tables are read, not applied: measured in #2801 (the camera JPEG doesn't compensate vignetting, as on the ILCE-7RM6). +- **ZV-E10: one lens, four photos.** Only the E PZ 16-50 mm (16–32 mm) is measured. Its unit, 16384, differs from + the ILCE-6700's 15000; the ILCE-6700's own E 16–55 mm at 16 mm also fits a higher unit (16000, above), so the unit + may belong to the lens rather than the body. Other lenses on the ZV-E10 are unmeasured and take 16384. The + ZV-E10M2 (another sensor) is not covered. - **APS-C distortion is unverified in camera on the ILCE-7RM6:** no APS-C photo with distortion correction on was available; the APS-C knot spacing is verified on CA only, and the APS-C zoom follows the full-frame rule. - **Aspect-ratio crops** (in-camera 4:3, 16:9, 1:1) were not measured; the correction uses the crop the file records. diff --git a/crates/raw/src/arw_lens_rm6.rs b/crates/raw/src/arw_lens_rm6.rs index d3e3b7275..29b71d6b0 100644 --- a/crates/raw/src/arw_lens_rm6.rs +++ b/crates/raw/src/arw_lens_rm6.rs @@ -40,9 +40,10 @@ //! The correction is produced whatever the in-camera flag says. Only bodies listed in [`FULL_FRAME_CROP`] or //! [`APSC_BODIES`] get it: the unit and the knot spacing are verified on the ILCE-7RM6 and, for distortion, on the //! ILCE-6700 (APS-C, 11 knots spanning its own crop, the same unit 15000: 0.73 px worst over 27 photos with three -//! lenses as rendered, 1.38 px at the 10–18 mm's 10 mm end). Another body is added by repeating the measurement on its photos shot -//! with distortion correction on and listing its full-frame default crop (or, for an APS-C body, its model). The method -//! and the numbers: docs/sony-ilce7rm6-lens-corrections.md. +//! lenses as rendered, 1.38 px at the 10–18 mm's 10 mm end) and the ZV-E10 (the same APS-C rule with unit 16384: +//! 0.64 px worst over 4 photos with the E PZ 16–50 mm at 16–32 mm as rendered). Another body is added by repeating the +//! measurement on its photos shot with distortion correction on and listing its full-frame default crop (or, for an +//! APS-C body, its model). The method and the numbers: docs/sony-ilce7rm6-lens-corrections.md. use crate::opcodes::max_radius; use crate::shared::fit_radial_warp; @@ -59,9 +60,15 @@ pub(crate) const CA_FLAG: u16 = 0x7034; /// The bodies whose tables are verified (Exif `Model`), with their full-frame default crop (width, height) in px. const FULL_FRAME_CROP: &[(&str, (f64, f64))] = &[("ILCE-7RM6", (9984.0, 6656.0))]; -/// The verified APS-C bodies (Exif `Model`): their knots span the file's own default crop, the last knot at its corner. -/// Measured on the ILCE-6700 (docs/sony-ilce7rm6-lens-corrections.md → ILCE-6700). -const APSC_BODIES: &[&str] = &["ILCE-6700"]; +/// The verified APS-C bodies (Exif `Model`) with their distortion unit: their knots span the file's own default crop, +/// the last knot at its corner. Measured against the camera JPEG (docs/sony-ilce7rm6-lens-corrections.md → ILCE-6700, +/// ZV-E10): the ILCE-6700 at the ILCE-7RM6's 15000; the ZV-E10 at 16384, where 15000 over-corrects by about 9 %. +const APSC_BODIES: &[(&str, f64)] = &[("ILCE-6700", DISTORTION_UNIT), ("ZV-E10", 16384.0)]; + +/// The distortion unit of an [`APSC_BODIES`] body. +fn apsc_unit(model: &str) -> Option { + APSC_BODIES.iter().find(|(m, _)| *m == model.trim()).map(|&(_, unit)| unit) +} /// A lens whose tables follow its body's convention with another knot spacing and unit, at the focal lengths up to /// `max_focal_mm`; measured like the body, against the camera JPEG. @@ -153,7 +160,7 @@ fn knot_spacing(model: &str, knots: usize, crop: Rect) -> Option { } let gaps = knots.checked_sub(1).filter(|&n| n > 0)?; let half_diagonal = (crop.width as f64).hypot(crop.height as f64) / 2.0; - (APSC_BODIES.contains(&model) && crate::arw_lens::is_3_2(crop)).then(|| half_diagonal / gaps as f64) + (apsc_unit(model).is_some() && crate::arw_lens::is_3_2(crop)).then(|| half_diagonal / gaps as f64) } /// The knot table at radius `r` px: knot `i` at `i · spacing`, linear in between, the last segment extended beyond @@ -261,8 +268,8 @@ pub(crate) fn lens_opcodes(raw: &Ifd, model: &str, lens: Option<&str>, focal_mm: let Some(spacing) = knot_spacing(model, knots, crop) else { return Vec::new() }; let op = if let Some(e) = lens_exception(model, lens, focal_mm) { gated_warp_opcode(&tables, e.knot_spacing, e.unit, active, crop, false, APSC_FIT_ERROR_PX_AT_1440) - } else if APSC_BODIES.contains(&model.trim()) { - gated_warp_opcode(&tables, spacing, DISTORTION_UNIT, active, crop, false, APSC_FIT_ERROR_PX_AT_1440) + } else if let Some(unit) = apsc_unit(model) { + gated_warp_opcode(&tables, spacing, unit, active, crop, false, APSC_FIT_ERROR_PX_AT_1440) } else { warp_opcode(&tables, spacing, active, crop, false) }; @@ -310,6 +317,8 @@ mod tests { const FF_HQ_R: [f64; 4] = [0.9715153129, 0.02236266369, 0.0007060224765, 0.005666341563]; const FF_HQ_B: [f64; 4] = [0.97137946, 0.02277016389, 0.0003830082563, 0.005727820598]; const APSC_G: [f64; 4] = [1.01627551, -0.0618606692, 0.02768349621, -0.005595798468]; + /// The ZV-E10 16 mm example's G plane (unit 16384, knots over its crop's half diagonal / 10), from the same recipe. + const ZV_E10_G: [f64; 4] = [1.051925248, -0.1972416727, 0.09393523723, -0.0282770833]; const APSC_R: [f64; 4] = [1.016503991, -0.06206460153, 0.0278447625, -0.005644118171]; const APSC_B: [f64; 4] = [1.016155702, -0.06162477627, 0.02753315326, -0.005554915901]; @@ -629,6 +638,33 @@ mod tests { assert!(matches!(ops.as_slice(), [Opcode::WarpRectilinear { planes, .. }] if planes.len() == 1), "{ops:?}"); } + /// A ZV-E10 file (E PZ 16-50 mm at 16 mm): 11 knots, zero-padded as this body stores them. + const ZV_E10_16MM_DISTORTION: [i16; 17] = [11, 72, -7, -129, -266, -446, -640, -877, -1114, -1380, -1639, -1905, 0, 0, 0, 0, 0]; + /// The ZV-E10's decoded geometry: 6048 × 4024 storage, a 6000 × 4000 default crop at (12, 12). + const ZV_E10_ACTIVE: Rect = Rect { x: 0, y: 0, width: 6048, height: 4024 }; + const ZV_E10_CROP: Rect = Rect { x: 12, y: 12, width: 6000, height: 4000 }; + + /// The ZV-E10 follows the ILCE-6700's APS-C rule (knots over its own crop's half diagonal / 10, the APS-C fit + /// gate) with its own unit, 16384; its zero padding is not read as knots, and its successor (ZV-E10M2) stays + /// unverified. + #[test] + fn zv_e10_uses_the_apsc_rule_with_its_own_unit() { + let s = knot_spacing("ZV-E10", 11, ZV_E10_CROP).unwrap(); + assert!((s - 360.5551).abs() < 1e-3, "{s}"); + let ifd = sony_lens_ifd(&ZV_E10_16MM_DISTORTION, &APSC_VIGNETTING, &APSC_CA, [17, 2, 1]); + let t = read_tables(&ifd); + assert_eq!(t.distortion.as_ref().map(Vec::len), Some(11)); + let gated = gated_warp_opcode(&t, s, 16384.0, ZV_E10_ACTIVE, ZV_E10_CROP, false, APSC_FIT_ERROR_PX_AT_1440); + let ops = lens_opcodes(&ifd, " ZV-E10 ", Some("E PZ 16-50mm F3.5-5.6 OSS"), Some(16.0), ZV_E10_ACTIVE, ZV_E10_CROP); + assert_warp(ops.first().cloned(), [3011.5 / 6047.0, 0.5], &[ZV_E10_G]); + assert_eq!(ops, gated.into_iter().collect::>()); + // the ILCE-6700's unit would warp it differently + let at_15000 = gated_warp_opcode(&t, s, DISTORTION_UNIT, ZV_E10_ACTIVE, ZV_E10_CROP, false, APSC_FIT_ERROR_PX_AT_1440); + assert_ne!(ops.first(), at_15000.as_ref()); + assert_eq!(apsc_unit("ILCE-6700"), Some(DISTORTION_UNIT)); + assert!(lens_opcodes(&ifd, "ZV-E10M2", None, None, ZV_E10_ACTIVE, ZV_E10_CROP).is_empty()); + } + const SIGMA_10_18: &str = "10-18mm F2.8 DC DN | Contemporary 023"; /// The Sigma 10-18 mm exception: its spacing and unit at 10-10.5 mm, the body's rule from 11.7 mm (and without a From 3ce8b38f88dc02cfb762dfe69817b028e9752f6f Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 17 Nov 2026 08:37:42 -0500 Subject: [PATCH 029/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything f64ae3bf3c8863a982af1304e06de20653803968. --- crates/pcap/src/lib.rs | 1277 ++++++++++++++++++++++++++++++ crates/pcap/tests/support/mod.rs | 167 ++++ 2 files changed, 1444 insertions(+) create mode 100644 crates/pcap/src/lib.rs create mode 100644 crates/pcap/tests/support/mod.rs diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs new file mode 100644 index 000000000..62698612d --- /dev/null +++ b/crates/pcap/src/lib.rs @@ -0,0 +1,1277 @@ +//! Saved packet captures: classic pcap (microsecond and nanosecond, either byte order) and pcapng +//! (section, interface, enhanced/simple/obsolete packet blocks). Frames are decoded from Ethernet +//! (with VLAN tags), raw IP, Linux cooked (SLL/SLL2) and BSD loopback links into IPv4/IPv6, +//! TCP/UDP/ICMP, and the application facts most people ask about: DNS questions and answers, +//! HTTP/1.x request and status lines with the Host header, and the TLS ClientHello server name +//! (SNI) and ALPN. Each frame is decoded on its own: no TCP reassembly, no decryption. Pure, no I/O, +//! every length checked. + +use crate::FormatError; +use crate::bytes::Reader; +use serde::Serialize; +use std::collections::{BTreeMap, BTreeSet, HashMap}; +use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; + +/// Most frames read from one capture. +pub const MAX_PACKETS: u64 = 5_000_000; +/// Most flows tracked; later flows are counted but get no id. +pub const MAX_FLOWS: usize = 100_000; +/// Most distinct values kept per inventory (endpoints, DNS names, hosts…). +pub const MAX_INVENTORY: usize = 10_000; + +const CLASSIC_US: u32 = 0xa1b2_c3d4; +const CLASSIC_NS: u32 = 0xa1b2_3c4d; +const NG_SHB: u32 = 0x0a0d_0d0a; +const NG_BOM: u32 = 0x1a2b_3c4d; + +/// One capture interface (a pcap file has exactly one). +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct Interface { + pub link_type: u32, + pub link_name: &'static str, + pub snaplen: u32, + /// Timestamp units per second, as a power: (base 10 or 2, exponent). + #[serde(skip)] + tsresol: (u8, u8), +} + +/// The plain name of a link-layer type. +pub fn link_name(link: u32) -> &'static str { + match link { + 0 => "BSD loopback", + 1 => "Ethernet", + 12 | 14 | 101 => "raw IP", + 108 => "OpenBSD loopback", + 113 => "Linux cooked (SLL)", + 228 => "raw IPv4", + 229 => "raw IPv6", + 276 => "Linux cooked v2 (SLL2)", + 105 => "IEEE 802.11", + 127 => "802.11 radiotap", + _ => "other", + } +} + +/// One captured frame. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Frame<'a> { + /// 1-based frame number, as capture tools show it. + pub number: u64, + /// Nanoseconds since the Unix epoch, when representable. + pub ts_ns: Option, + pub interface: usize, + pub link_type: u32, + pub original_len: u32, + pub data: &'a [u8], +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum Kind { + Classic { le: bool, nanos: bool }, + Ng { le: bool }, +} + +/// Walks the frames of a capture. Malformed data stops the walk with a warning, never a panic. +#[derive(Debug, Clone)] +pub struct Capture<'a> { + data: &'a [u8], + pos: usize, + kind: Kind, + /// Interfaces of the current pcapng section start here in `interfaces`. + section_base: usize, + pub format: &'static str, + pub version: String, + pub interfaces: Vec, + pub warnings: Vec, + /// The walk stopped at `MAX_PACKETS`. + pub truncated: bool, + count: u64, +} + +fn rd_u16(r: &Reader<'_>, le: bool, off: usize) -> Option { + if le { r.u16_le(off) } else { r.u16_be(off) } +} + +fn rd_u32(r: &Reader<'_>, le: bool, off: usize) -> Option { + if le { r.u32_le(off) } else { r.u32_be(off) } +} + +/// True when the bytes start like a pcap or pcapng file. +pub fn is_capture(data: &[u8]) -> bool { + let r = Reader::new(data); + matches!(r.u32_le(0), Some(CLASSIC_US | CLASSIC_NS | NG_SHB)) || matches!(r.u32_be(0), Some(CLASSIC_US | CLASSIC_NS)) +} + +impl<'a> Capture<'a> { + /// Read the file header. + pub fn new(data: &'a [u8]) -> Result { + let r = Reader::new(data); + let magic_le = r.u32_le(0).ok_or_else(|| FormatError::Truncated("no capture header".into()))?; + let magic_be = r.u32_be(0).unwrap_or(0); + let mut cap = Capture { + data, + pos: 0, + kind: Kind::Ng { le: true }, + section_base: 0, + format: "pcapng", + version: String::new(), + interfaces: Vec::new(), + warnings: Vec::new(), + truncated: false, + count: 0, + }; + let classic = |le: bool, nanos: bool| -> Result<(Kind, String, Interface), FormatError> { + let major = rd_u16(&r, le, 4).ok_or_else(|| FormatError::Truncated("pcap header".into()))?; + let minor = rd_u16(&r, le, 6).unwrap_or(0); + let snaplen = rd_u32(&r, le, 16).ok_or_else(|| FormatError::Truncated("pcap header".into()))?; + // The top bits of the link field can carry FCS information; the type is the low 28 bits. + let link = rd_u32(&r, le, 20).ok_or_else(|| FormatError::Truncated("pcap header".into()))? & 0x0fff_ffff; + let res = if nanos { (10, 9) } else { (10, 6) }; + Ok((Kind::Classic { le, nanos }, format!("{major}.{minor}"), Interface { link_type: link, link_name: link_name(link), snaplen, tsresol: res })) + }; + match (magic_le, magic_be) { + (CLASSIC_US, _) | (_, CLASSIC_US) | (CLASSIC_NS, _) | (_, CLASSIC_NS) => { + let le = magic_le == CLASSIC_US || magic_le == CLASSIC_NS; + let nanos = (if le { magic_le } else { magic_be }) == CLASSIC_NS; + let (kind, version, iface) = classic(le, nanos)?; + cap.kind = kind; + cap.format = "pcap"; + cap.version = version; + cap.interfaces.push(iface); + cap.pos = 24; + } + (NG_SHB, _) => { + let le = match r.u32_le(8) { + Some(NG_BOM) => true, + _ if r.u32_be(8) == Some(NG_BOM) => false, + _ => return Err(FormatError::Malformed("pcapng section header without a byte-order mark".into())), + }; + cap.kind = Kind::Ng { le }; + cap.version = format!("{}.{}", rd_u16(&r, le, 12).unwrap_or(0), rd_u16(&r, le, 14).unwrap_or(0)); + } + _ => return Err(FormatError::Unsupported("not a pcap or pcapng capture".into())), + } + Ok(cap) + } + + fn stop(&mut self, why: impl Into) -> Option> { + self.warnings.push(why.into()); + self.pos = self.data.len(); + None + } + + fn ts(&self, iface: usize, units: u64) -> Option { + let (base, exp) = self.interfaces.get(iface).map(|i| i.tsresol).unwrap_or((10, 6)); + let ns = if base == 10 { + if exp <= 9 { u128::from(units) * 10u128.pow(u32::from(9 - exp)) } else { u128::from(units) / 10u128.checked_pow(u32::from(exp - 9))? } + } else { + (u128::from(units) * 1_000_000_000) >> exp.min(127) + }; + u64::try_from(ns).ok() + } + + fn frame(&mut self, iface: usize, ts_units: u64, data: &'a [u8], original_len: u32) -> Frame<'a> { + self.count += 1; + Frame { + number: self.count, + ts_ns: self.ts(iface, ts_units), + interface: iface, + link_type: self.interfaces.get(iface).map(|i| i.link_type).unwrap_or(u32::MAX), + original_len, + data, + } + } + + fn next_classic(&mut self, le: bool, nanos: bool) -> Option> { + let r = Reader::new(self.data); + let p = self.pos; + if p >= self.data.len() { + return None; + } + let (Some(sec), Some(frac), Some(incl), Some(orig)) = (rd_u32(&r, le, p), rd_u32(&r, le, p + 4), rd_u32(&r, le, p + 8), rd_u32(&r, le, p + 12)) else { + return self.stop(format!("record header at offset {p} is cut short")); + }; + let Some(body) = usize::try_from(incl).ok().and_then(|n| r.slice(p + 16, n)) else { + return self.stop(format!("record at offset {p} claims {incl} bytes past the end of the file")); + }; + self.pos = p + 16 + body.len(); + let units = u64::from(sec) * if nanos { 1_000_000_000 } else { 1_000_000 } + u64::from(frac); + Some(self.frame(0, units, body, orig)) + } + + fn next_ng(&mut self, mut le: bool) -> Option> { + loop { + let r = Reader::new(self.data); + let p = self.pos; + if p >= self.data.len() { + return None; + } + let Some(btype) = rd_u32(&r, le, p) else { return self.stop(format!("block header at offset {p} is cut short")) }; + if btype == NG_SHB { + // A new section can switch byte order. + le = match r.u32_le(p + 8) { + Some(NG_BOM) => true, + _ if r.u32_be(p + 8) == Some(NG_BOM) => false, + _ => return self.stop(format!("section header at offset {p} has no byte-order mark")), + }; + self.kind = Kind::Ng { le }; + self.section_base = self.interfaces.len(); + } + let Some(blen) = rd_u32(&r, le, p + 4).and_then(|v| usize::try_from(v).ok()) else { + return self.stop(format!("block at offset {p} is cut short")); + }; + if blen < 12 || blen % 4 != 0 || r.slice(p, blen).is_none() { + return self.stop(format!("block at offset {p} has an impossible length {blen}")); + } + self.pos = p + blen; + let body = p + 8; + let body_end = p + blen - 4; + match btype { + 1 => { + let link = u32::from(rd_u16(&r, le, body).unwrap_or(u16::MAX)); + let snaplen = rd_u32(&r, le, body + 4).unwrap_or(0); + let mut tsresol = (10u8, 6u8); + let mut o = body + 8; + while o + 4 <= body_end { + let (Some(code), Some(len)) = (rd_u16(&r, le, o), rd_u16(&r, le, o + 2)) else { break }; + if code == 0 { + break; + } + if code == 9 + && len == 1 + && let Some(v) = r.u8(o + 4) + { + tsresol = if v & 0x80 == 0 { (10, v) } else { (2, v & 0x7f) }; + } + o += 4 + usize::from(len).div_ceil(4) * 4; + } + self.interfaces.push(Interface { link_type: link, link_name: link_name(link), snaplen, tsresol }); + } + 6 | 2 => { + let (iface, hi, lo, cap, orig) = if btype == 6 { + ( + rd_u32(&r, le, body).map(|v| v as usize), + rd_u32(&r, le, body + 4), + rd_u32(&r, le, body + 8), + rd_u32(&r, le, body + 12), + rd_u32(&r, le, body + 16), + ) + } else { + ( + rd_u16(&r, le, body).map(usize::from), + rd_u32(&r, le, body + 4), + rd_u32(&r, le, body + 8), + rd_u32(&r, le, body + 12), + rd_u32(&r, le, body + 16), + ) + }; + let (Some(iface), Some(hi), Some(lo), Some(cap), Some(orig)) = (iface, hi, lo, cap, orig) else { continue }; + let Some(data) = usize::try_from(cap).ok().filter(|&c| body + 20 + c <= body_end).and_then(|c| r.slice(body + 20, c)) else { + self.warnings.push(format!("packet block at offset {p} claims more bytes than it holds; skipped")); + continue; + }; + let iface = self.section_base + iface; + if iface >= self.interfaces.len() { + self.warnings.push(format!("packet block at offset {p} names an undeclared interface; skipped")); + continue; + } + return Some(self.frame(iface, (u64::from(hi) << 32) | u64::from(lo), data, orig)); + } + 3 => { + let Some(orig) = rd_u32(&r, le, body) else { continue }; + let iface = self.section_base; + let snap = self.interfaces.get(iface).map(|i| i.snaplen).filter(|&s| s > 0).unwrap_or(u32::MAX); + let room = body_end.saturating_sub(body + 4); + let cap = (orig.min(snap) as usize).min(room); + let Some(data) = r.slice(body + 4, cap) else { continue }; + if iface >= self.interfaces.len() { + continue; + } + // Simple packet blocks carry no timestamp. + self.count += 1; + return Some(Frame { + number: self.count, + ts_ns: None, + interface: iface, + link_type: self.interfaces.get(iface).map(|i| i.link_type).unwrap_or(u32::MAX), + original_len: orig, + data, + }); + } + _ => {} + } + } + } +} + +impl<'a> Iterator for Capture<'a> { + type Item = Frame<'a>; + + fn next(&mut self) -> Option> { + if self.count >= MAX_PACKETS { + if !self.truncated && self.pos < self.data.len() { + self.truncated = true; + self.warnings.push(format!("stopped after {MAX_PACKETS} frames")); + } + return None; + } + match self.kind { + Kind::Classic { le, nanos } => self.next_classic(le, nanos), + Kind::Ng { le } => self.next_ng(le), + } + } +} + +// --------------------------------------------------------------------------------------------- +// Decoding + +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct IpInfo { + pub version: u8, + pub src: IpAddr, + pub dst: IpAddr, + /// IP protocol number of the payload (6 TCP, 17 UDP, 1 ICMP, 58 ICMPv6…). + pub protocol: u8, + /// TTL or hop limit. + pub ttl: u8, + /// A non-first fragment: the transport header is in another frame. + pub fragment: bool, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct Transport { + /// tcp, udp, icmp, icmpv6 or other + pub protocol: &'static str, + #[serde(skip_serializing_if = "Option::is_none")] + pub src_port: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub dst_port: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tcp_flags: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub seq: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub ack: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub window: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub icmp_type: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub icmp_code: Option, + pub payload_len: usize, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct DnsQuestion { + pub name: String, + pub qtype: String, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct DnsAnswer { + pub name: String, + pub rtype: String, + pub ttl: u32, + pub value: String, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct Dns { + pub id: u16, + pub response: bool, + pub rcode: u8, + pub questions: Vec, + pub answers: Vec, + /// The message was cut short or malformed part-way. + pub incomplete: bool, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct Http { + /// request or response + pub kind: &'static str, + #[serde(skip_serializing_if = "Option::is_none")] + pub method: Option, + /// Request target with any user:password removed. + #[serde(skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + pub version: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub host: Option, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct TlsHello { + pub record_version: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub sni: Option, + pub alpn: Vec, + pub supported_versions: Vec, + /// The ClientHello continues in a later segment; extensions may be missing. + pub partial: bool, +} + +/// What one frame says. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize)] +pub struct Decoded { + /// Protocol stack, outermost first: eth, vlan, sll, ipv4, ipv6, arp, tcp, udp, icmp, dns, http, tls… + pub protocols: Vec<&'static str>, + #[serde(skip_serializing_if = "Option::is_none")] + pub ip: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub transport: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub dns: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub http: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tls: Option, + /// Where decoding stopped early, when it did. + #[serde(skip_serializing_if = "Option::is_none")] + pub note: Option, +} + +impl Decoded { + /// The protocol stack joined with `:`. + pub fn stack(&self) -> String { + self.protocols.join(":") + } + + /// The direction-independent conversation this frame belongs to, and whether it travels a→b. + pub fn flow_key(&self) -> Option<(FlowKey, bool)> { + let ip = self.ip.as_ref()?; + let t = self.transport.as_ref(); + let sp = t.and_then(|t| t.src_port).unwrap_or(0); + let dp = t.and_then(|t| t.dst_port).unwrap_or(0); + let (s, d) = ((ip.src, sp), (ip.dst, dp)); + let forward = s <= d; + let (a, b) = if forward { (s, d) } else { (d, s) }; + Some((FlowKey { protocol: ip.protocol, a, b }, forward)) + } +} + +/// A conversation: IP protocol and the two (address, port) ends in sorted order. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] +pub struct FlowKey { + pub protocol: u8, + pub a: (IpAddr, u16), + pub b: (IpAddr, u16), +} + +/// Decode one frame from its link layer up. +pub fn decode(link_type: u32, data: &[u8]) -> Decoded { + let mut d = Decoded::default(); + let r = Reader::new(data); + let (ethertype, off) = match link_type { + 1 => { + d.protocols.push("eth"); + let mut et = r.u16_be(12); + let mut off = 14usize; + for _ in 0..2 { + if matches!(et, Some(0x8100 | 0x88a8)) { + d.protocols.push("vlan"); + et = r.u16_be(off + 2); + off += 4; + } + } + (et, off) + } + 113 => { + d.protocols.push("sll"); + (r.u16_be(14), 16) + } + 276 => { + d.protocols.push("sll2"); + (r.u16_be(0), 20) + } + 0 | 108 => { + d.protocols.push("loopback"); + // The family is in the capturing host's byte order (NULL) or big-endian (LOOP). + let fam = if link_type == 108 { r.u32_be(0) } else { r.u32_le(0).filter(|&v| v < 256).or_else(|| r.u32_be(0)) }; + ( + fam.map(|f| { + if f == 2 { + 0x0800 + } else if matches!(f, 24 | 28 | 30) { + 0x86dd + } else { + 0 + } + }), + 4, + ) + } + 12 | 14 | 101 | 228 | 229 => { + d.protocols.push("raw"); + (r.u8(0).map(|b| if b >> 4 == 6 { 0x86dd } else { 0x0800 }), 0) + } + _ => { + d.note = Some(format!("link type {link_type} ({}) is not decoded", link_name(link_type))); + return d; + } + }; + let payload = data.get(off..).unwrap_or(&[]); + match ethertype { + Some(0x0800) => ipv4(payload, &mut d), + Some(0x86dd) => ipv6(payload, &mut d), + Some(0x0806) => d.protocols.push("arp"), + Some(other) => d.note = Some(format!("ethertype {other:#06x} is not decoded")), + None => d.note = Some("frame too short for its link header".into()), + } + d +} + +fn ipv4(p: &[u8], d: &mut Decoded) { + let r = Reader::new(p); + let (Some(vihl), Some(total), Some(frag), Some(ttl), Some(proto)) = (r.u8(0), r.u16_be(2), r.u16_be(6), r.u8(8), r.u8(9)) else { + d.note = Some("IPv4 header cut short".into()); + return; + }; + let ihl = usize::from(vihl & 0x0f) * 4; + let (Some(src), Some(dst)) = (r.slice(12, 4), r.slice(16, 4)) else { return }; + if vihl >> 4 != 4 || ihl < 20 { + d.note = Some("not a valid IPv4 header".into()); + return; + } + d.protocols.push("ipv4"); + let ip4 = |b: &[u8]| { + IpAddr::V4(Ipv4Addr::new( + b.first().copied().unwrap_or(0), + b.get(1).copied().unwrap_or(0), + b.get(2).copied().unwrap_or(0), + b.get(3).copied().unwrap_or(0), + )) + }; + let fragment = frag & 0x1fff != 0; + d.ip = Some(IpInfo { version: 4, src: ip4(src), dst: ip4(dst), protocol: proto, ttl, fragment }); + let end = usize::from(total).clamp(ihl, p.len().max(ihl)); + let body = p.get(ihl..end).unwrap_or(&[]); + if fragment { + d.note = Some("IPv4 fragment (transport header is in the first fragment)".into()); + return; + } + transport(proto, body, d); +} + +fn ipv6(p: &[u8], d: &mut Decoded) { + let r = Reader::new(p); + let (Some(plen), Some(mut next), Some(hops), Some(src), Some(dst)) = (r.u16_be(4), r.u8(6), r.u8(7), r.slice(8, 16), r.slice(24, 16)) else { + d.note = Some("IPv6 header cut short".into()); + return; + }; + d.protocols.push("ipv6"); + let ip6 = |b: &[u8]| IpAddr::V6(Ipv6Addr::from(<[u8; 16]>::try_from(b).unwrap_or([0; 16]))); + let end = (40 + usize::from(plen)).min(p.len()); + let mut off = 40usize; + let mut fragment = false; + for _ in 0..8 { + match next { + 0 | 43 | 60 => { + let (Some(n), Some(l)) = (r.u8(off), r.u8(off + 1)) else { break }; + next = n; + off += (usize::from(l) + 1) * 8; + } + 44 => { + let (Some(n), Some(fo)) = (r.u8(off), r.u16_be(off + 2)) else { break }; + next = n; + fragment = fo & 0xfff8 != 0; + off += 8; + } + 51 => { + let (Some(n), Some(l)) = (r.u8(off), r.u8(off + 1)) else { break }; + next = n; + off += (usize::from(l) + 2) * 4; + } + _ => break, + } + } + d.ip = Some(IpInfo { version: 6, src: ip6(src), dst: ip6(dst), protocol: next, ttl: hops, fragment }); + if fragment { + d.note = Some("IPv6 fragment (transport header is in the first fragment)".into()); + return; + } + transport(next, p.get(off..end).unwrap_or(&[]), d); +} + +fn tcp_flags(f: u8) -> String { + let names = [(0x02, "SYN"), (0x10, "ACK"), (0x01, "FIN"), (0x04, "RST"), (0x08, "PSH"), (0x20, "URG")]; + names.iter().filter(|(b, _)| f & b != 0).map(|(_, n)| *n).collect::>().join(",") +} + +fn transport(proto: u8, p: &[u8], d: &mut Decoded) { + let r = Reader::new(p); + let empty = Transport { + protocol: "other", + src_port: None, + dst_port: None, + tcp_flags: None, + seq: None, + ack: None, + window: None, + icmp_type: None, + icmp_code: None, + payload_len: 0, + }; + match proto { + 6 => { + let (Some(sp), Some(dp), Some(seq), Some(ack), Some(off), Some(flags), Some(win)) = + (r.u16_be(0), r.u16_be(2), r.u32_be(4), r.u32_be(8), r.u8(12), r.u8(13), r.u16_be(14)) + else { + d.note = Some("TCP header cut short".into()); + return; + }; + d.protocols.push("tcp"); + let payload = p.get(usize::from(off >> 4) * 4..).unwrap_or(&[]); + d.transport = Some(Transport { + protocol: "tcp", + src_port: Some(sp), + dst_port: Some(dp), + tcp_flags: Some(tcp_flags(flags)), + seq: Some(seq), + ack: Some(ack), + window: Some(win), + payload_len: payload.len(), + ..empty + }); + if (sp == 53 || dp == 53) && payload.len() > 2 { + dns(payload.get(2..).unwrap_or(&[]), d, "dns"); + } else if !payload.is_empty() { + tcp_app(payload, d); + } + } + 17 => { + let (Some(sp), Some(dp)) = (r.u16_be(0), r.u16_be(2)) else { + d.note = Some("UDP header cut short".into()); + return; + }; + d.protocols.push("udp"); + let payload = p.get(8..).unwrap_or(&[]); + d.transport = Some(Transport { protocol: "udp", src_port: Some(sp), dst_port: Some(dp), payload_len: payload.len(), ..empty }); + if sp == 53 || dp == 53 { + dns(payload, d, "dns"); + } else if sp == 5353 || dp == 5353 { + dns(payload, d, "mdns"); + } + } + 1 | 58 => { + let name = if proto == 1 { "icmp" } else { "icmpv6" }; + d.protocols.push(name); + d.transport = Some(Transport { protocol: name, icmp_type: r.u8(0), icmp_code: r.u8(1), payload_len: p.len().saturating_sub(4), ..empty }); + } + _ => d.transport = Some(Transport { protocol: "other", payload_len: p.len(), ..empty }), + } +} + +pub fn qtype_name(t: u16) -> String { + match t { + 1 => "A".into(), + 2 => "NS".into(), + 5 => "CNAME".into(), + 6 => "SOA".into(), + 12 => "PTR".into(), + 15 => "MX".into(), + 16 => "TXT".into(), + 28 => "AAAA".into(), + 33 => "SRV".into(), + 64 => "SVCB".into(), + 65 => "HTTPS".into(), + 255 => "ANY".into(), + n => format!("TYPE{n}"), + } +} + +/// A (possibly compressed) DNS name at `off`; returns the name and the offset after it. +fn dns_name(msg: &[u8], mut off: usize) -> Option<(String, usize)> { + let mut out = String::new(); + let mut after: Option = None; + for _ in 0..128 { + let len = *msg.get(off)?; + match len { + 0 => return Some((if out.is_empty() { ".".into() } else { out }, after.unwrap_or(off + 1))), + l if l & 0xc0 == 0xc0 => { + let ptr = usize::from(u16::from_be_bytes([l & 0x3f, *msg.get(off + 1)?])); + after.get_or_insert(off + 2); + if ptr >= off { + return None; // only backward pointers, so no loops + } + off = ptr; + } + l if l < 64 => { + let label = msg.get(off + 1..off + 1 + usize::from(l))?; + if !out.is_empty() { + out.push('.'); + } + out.extend(label.iter().map(|&c| if c.is_ascii_graphic() { char::from(c) } else { '?' })); + if out.len() > 255 { + return None; + } + off += 1 + usize::from(l); + } + _ => return None, + } + } + None +} + +fn dns(msg: &[u8], d: &mut Decoded, label: &'static str) { + let r = Reader::new(msg); + let (Some(id), Some(flags), Some(qd), Some(an)) = (r.u16_be(0), r.u16_be(2), r.u16_be(4), r.u16_be(6)) else { return }; + // Sanity: opcode 0–6 and no absurd counts, so random payload on port 53 isn't misread. + if (flags >> 11) & 0xf > 6 || qd > 64 || qd == 0 && an == 0 { + return; + } + d.protocols.push(label); + let mut out = Dns { id, response: flags & 0x8000 != 0, rcode: (flags & 0xf) as u8, questions: Vec::new(), answers: Vec::new(), incomplete: false }; + let mut off = 12usize; + for _ in 0..qd { + let Some((name, next)) = dns_name(msg, off) else { + out.incomplete = true; + break; + }; + let Some(qt) = r.u16_be(next) else { + out.incomplete = true; + break; + }; + out.questions.push(DnsQuestion { name, qtype: qtype_name(qt) }); + off = next + 4; + } + if !out.incomplete { + for _ in 0..an.min(64) { + let Some((name, next)) = dns_name(msg, off) else { + out.incomplete = true; + break; + }; + let (Some(rt), Some(ttl), Some(rdlen)) = (r.u16_be(next), r.u32_be(next + 4), r.u16_be(next + 8)) else { + out.incomplete = true; + break; + }; + let rd_off = next + 10; + let Some(rd) = r.slice(rd_off, usize::from(rdlen)) else { + out.incomplete = true; + break; + }; + let value = match (rt, rd.len()) { + (1, 4) => Ipv4Addr::new( + rd.first().copied().unwrap_or(0), + rd.get(1).copied().unwrap_or(0), + rd.get(2).copied().unwrap_or(0), + rd.get(3).copied().unwrap_or(0), + ) + .to_string(), + (28, 16) => Ipv6Addr::from(<[u8; 16]>::try_from(rd).unwrap_or([0; 16])).to_string(), + (2 | 5 | 12, _) => dns_name(msg, rd_off).map(|(n, _)| n).unwrap_or_default(), + (15, _) => dns_name(msg, rd_off + 2).map(|(n, _)| n).unwrap_or_default(), + (16, _) => rd + .get(1..) + .map(|t| String::from_utf8_lossy(t.get(..usize::from(rd.first().copied().unwrap_or(0))).unwrap_or(t)).into_owned()) + .unwrap_or_default(), + (_, n) => format!("<{n} bytes>"), + }; + out.answers.push(DnsAnswer { name, rtype: qtype_name(rt), ttl, value }); + off = rd_off + usize::from(rdlen); + } + } + d.dns = Some(out); +} + +const METHODS: &[&str] = &["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "PATCH", "CONNECT", "TRACE"]; + +/// Remove `user:password@` from an absolute request target. +pub fn strip_userinfo(target: &str) -> String { + if let Some((scheme, rest)) = target.split_once("://") { + let auth_end = rest.find(['/', '?', '#']).unwrap_or(rest.len()); + if let Some(at) = rest.get(..auth_end).and_then(|a| a.rfind('@')) { + return format!("{scheme}://{}", rest.get(at + 1..).unwrap_or("")); + } + } + target.to_string() +} + +fn tcp_app(p: &[u8], d: &mut Decoded) { + let head = p.get(..p.len().min(16 << 10)).unwrap_or(p); + let line_end = head.windows(2).position(|w| w == b"\r\n").unwrap_or(head.len().min(2048)); + let line = String::from_utf8_lossy(head.get(..line_end.min(2048)).unwrap_or(&[])).into_owned(); + if let Some(rest) = line.strip_prefix("HTTP/1.") { + let status = rest.split(' ').nth(1).and_then(|s| s.parse().ok()); + d.protocols.push("http"); + d.http = + Some(Http { kind: "response", method: None, target: None, status, version: format!("HTTP/1.{}", rest.chars().next().unwrap_or('?')), host: None }); + return; + } + let mut parts = line.splitn(3, ' '); + if let (Some(m), Some(t), Some(v)) = (parts.next(), parts.next(), parts.next()) + && METHODS.contains(&m) + && v.starts_with("HTTP/1.") + { + let lower = String::from_utf8_lossy(head).to_ascii_lowercase(); + let host = lower.find("\r\nhost:").and_then(|i| { + let start = i + 7; + let raw = String::from_utf8_lossy(head.get(start..)?).into_owned(); + Some(raw.split("\r\n").next().unwrap_or("").trim().to_string()) + }); + d.protocols.push("http"); + d.http = Some(Http { kind: "request", method: Some(m.to_string()), target: Some(strip_userinfo(t)), status: None, version: v.to_string(), host }); + return; + } + tls(p, d); +} + +fn tls(p: &[u8], d: &mut Decoded) { + let r = Reader::new(p); + let (Some(ct), Some(major), Some(minor)) = (r.u8(0), r.u8(1), r.u8(2)) else { return }; + if !(20..=23).contains(&ct) || major != 3 || minor > 4 { + return; + } + d.protocols.push("tls"); + if ct != 22 || r.u8(5) != Some(1) { + return; + } + let ver = |v: u16| match v { + 0x0300 => "SSL 3.0".to_string(), + 0x0301 => "TLS 1.0".into(), + 0x0302 => "TLS 1.1".into(), + 0x0303 => "TLS 1.2".into(), + 0x0304 => "TLS 1.3".into(), + v if v & 0x0f0f == 0x0a0a => "GREASE".into(), + v => format!("{v:#06x}"), + }; + let mut hello = + TlsHello { record_version: ver(u16::from_be_bytes([major, minor])), sni: None, alpn: Vec::new(), supported_versions: Vec::new(), partial: false }; + // Record header (5) + handshake header (4) + client_version (2) + random (32). + let mut off = 5 + 4 + 2 + 32; + let skip8 = |off: usize| r.u8(off).map(|n| off + 1 + usize::from(n)); + let skip16 = |off: usize| r.u16_be(off).map(|n| off + 2 + usize::from(n)); + let Some(o) = skip8(off).and_then(skip16).and_then(skip8) else { + hello.partial = true; + d.tls = Some(hello); + return; + }; + off = o; + let Some(ext_len) = r.u16_be(off) else { + hello.partial = true; + d.tls = Some(hello); + return; + }; + let end = off + 2 + usize::from(ext_len); + hello.partial = end > p.len(); + let mut e = off + 2; + while e + 4 <= end.min(p.len()) { + let (Some(t), Some(l)) = (r.u16_be(e), r.u16_be(e + 2)) else { break }; + let body = e + 4; + let Some(data) = r.slice(body, usize::from(l)) else { + hello.partial = true; + break; + }; + let dr = Reader::new(data); + match t { + 0 => { + if dr.u8(2) == Some(0) + && let Some(n) = dr.u16_be(3).and_then(|n| dr.slice(5, usize::from(n))) + { + hello.sni = Some(n.iter().map(|&c| if c.is_ascii_graphic() { char::from(c) } else { '?' }).collect()); + } + } + 16 => { + let mut a = 2usize; + while let Some(n) = dr.u8(a) { + let Some(proto) = dr.slice(a + 1, usize::from(n)) else { break }; + hello.alpn.push(String::from_utf8_lossy(proto).into_owned()); + a += 1 + usize::from(n); + if hello.alpn.len() >= 16 { + break; + } + } + } + 43 => { + let mut a = 1usize; + while let Some(v) = dr.u16_be(a) { + let name = ver(v); + if name != "GREASE" { + hello.supported_versions.push(name); + } + a += 2; + if hello.supported_versions.len() >= 16 { + break; + } + } + } + _ => {} + } + e = body + usize::from(l); + } + d.tls = Some(hello); +} + +// --------------------------------------------------------------------------------------------- +// Flows and summaries + +/// Assigns stable 1-based flow ids in order of first appearance. +#[derive(Debug, Default)] +pub struct FlowTable { + ids: HashMap, + /// Frames whose flow arrived after `MAX_FLOWS` and got no id. + pub untracked: u64, +} + +impl FlowTable { + /// The id of `key`, creating it when there is room. + pub fn id_for(&mut self, key: FlowKey) -> Option { + if let Some(&id) = self.ids.get(&key) { + return Some(id); + } + if self.ids.len() >= MAX_FLOWS { + self.untracked += 1; + return None; + } + let id = self.ids.len() + 1; + self.ids.insert(key, id); + Some(id) + } +} + +/// "addr:port", with brackets around IPv6 addresses; the port is omitted when zero. +pub fn endpoint((ip, port): (IpAddr, u16)) -> String { + match (ip, port) { + (IpAddr::V6(v6), 0) => v6.to_string(), + (IpAddr::V6(v6), p) => format!("[{v6}]:{p}"), + (v4, 0) => v4.to_string(), + (v4, p) => format!("{v4}:{p}"), + } +} + +pub fn ip_protocol_name(p: u8) -> &'static str { + match p { + 1 => "icmp", + 6 => "tcp", + 17 => "udp", + 58 => "icmpv6", + _ => "other", + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct Flow { + pub id: usize, + pub protocol: &'static str, + pub a: String, + pub b: String, + pub packets: u64, + pub bytes: u64, + pub packets_a_to_b: u64, + pub packets_b_to_a: u64, + pub first_frame: u64, + #[serde(skip_serializing_if = "Option::is_none")] + pub first_ts_ns: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub last_ts_ns: Option, + /// Application protocols seen in it (dns, http, tls…). + pub applications: BTreeSet<&'static str>, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct Count { + pub value: String, + pub count: u64, +} + +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize)] +pub struct Summary { + pub format: &'static str, + pub version: String, + pub interfaces: Vec, + pub packets: u64, + pub bytes: u64, + pub first_ts_ns: Option, + pub last_ts_ns: Option, + /// Frames per protocol label. + pub protocols: Vec, + /// Frames per full protocol stack (eth:ipv4:udp:dns). + pub stacks: Vec, + /// Frames per IP address (source and destination each count once per frame). + pub endpoints: Vec, + pub flows: Vec, + pub flows_untracked_frames: u64, + /// "name (TYPE)" asked in DNS queries. + pub dns_queries: Vec, + /// "name TYPE value" from DNS responses. + pub dns_answers: Vec, + /// "METHOD host target" from HTTP/1.x requests. + pub http_requests: Vec, + /// Server names from TLS ClientHellos. + pub tls_sni: Vec, + pub tls_alpn: Vec, + /// Frames whose network layer was not decoded (other link types, ARP, other ethertypes). + pub undecoded_frames: u64, + /// Inventories that hit `MAX_INVENTORY` distinct values. + pub capped_inventories: Vec<&'static str>, + pub truncated: bool, + pub warnings: Vec, +} + +#[derive(Default)] +struct Tally { + map: BTreeMap, + capped: bool, +} + +impl Tally { + fn add(&mut self, k: String) { + if let Some(v) = self.map.get_mut(&k) { + *v += 1; + } else if self.map.len() < MAX_INVENTORY { + self.map.insert(k, 1); + } else { + self.capped = true; + } + } + + fn done(self, name: &'static str, capped: &mut Vec<&'static str>) -> Vec { + if self.capped { + capped.push(name); + } + let mut v: Vec = self.map.into_iter().map(|(value, count)| Count { value, count }).collect(); + v.sort_by(|a, b| b.count.cmp(&a.count).then_with(|| a.value.cmp(&b.value))); + v + } +} + +/// Read every frame once and summarize the capture. `cancelled` is polled every 4096 frames. +pub fn summarize(data: &[u8], cancelled: &dyn Fn() -> bool) -> Result { + let mut cap = Capture::new(data)?; + let mut s = Summary::default(); + let mut flows = FlowTable::default(); + let mut flow_rows: Vec = Vec::new(); + let (mut protocols, mut stacks, mut endpoints) = (Tally::default(), Tally::default(), Tally::default()); + let (mut queries, mut answers, mut http, mut sni, mut alpn) = (Tally::default(), Tally::default(), Tally::default(), Tally::default(), Tally::default()); + for f in cap.by_ref() { + if f.number % 4096 == 0 && cancelled() { + return Err(FormatError::Malformed("cancelled".into())); + } + s.packets += 1; + s.bytes += u64::from(f.original_len); + if let Some(t) = f.ts_ns { + s.first_ts_ns = Some(s.first_ts_ns.map_or(t, |x| x.min(t))); + s.last_ts_ns = Some(s.last_ts_ns.map_or(t, |x| x.max(t))); + } + let d = decode(f.link_type, f.data); + for p in &d.protocols { + protocols.add((*p).to_string()); + } + stacks.add(d.stack()); + let Some(ip) = &d.ip else { + s.undecoded_frames += 1; + continue; + }; + endpoints.add(ip.src.to_string()); + if ip.dst != ip.src { + endpoints.add(ip.dst.to_string()); + } + if let Some((key, forward)) = d.flow_key() + && let Some(id) = flows.id_for(key) + { + if id > flow_rows.len() { + flow_rows.push(Flow { + id, + protocol: ip_protocol_name(key.protocol), + a: endpoint(key.a), + b: endpoint(key.b), + packets: 0, + bytes: 0, + packets_a_to_b: 0, + packets_b_to_a: 0, + first_frame: f.number, + first_ts_ns: f.ts_ns, + last_ts_ns: f.ts_ns, + applications: BTreeSet::new(), + }); + } + if let Some(row) = flow_rows.get_mut(id - 1) { + row.packets += 1; + row.bytes += u64::from(f.original_len); + if forward { + row.packets_a_to_b += 1; + } else { + row.packets_b_to_a += 1; + } + if f.ts_ns.is_some() { + row.last_ts_ns = f.ts_ns; + } + for app in d.protocols.iter().skip_while(|p| !matches!(**p, "tcp" | "udp")).skip(1) { + row.applications.insert(app); + } + } + } + if let Some(dns) = &d.dns { + if !dns.response { + for q in &dns.questions { + queries.add(format!("{} ({})", q.name, q.qtype)); + } + } + for a in &dns.answers { + answers.add(format!("{} {} {}", a.name, a.rtype, a.value)); + } + } + if let Some(h) = &d.http + && h.kind == "request" + { + http.add(format!("{} {} {}", h.method.as_deref().unwrap_or("?"), h.host.as_deref().unwrap_or("-"), h.target.as_deref().unwrap_or(""))); + } + if let Some(t) = &d.tls { + if let Some(n) = &t.sni { + sni.add(n.clone()); + } + for a in &t.alpn { + alpn.add(a.clone()); + } + } + } + let mut capped = Vec::new(); + s.format = cap.format; + s.version = cap.version.clone(); + s.interfaces = cap.interfaces.clone(); + s.protocols = protocols.done("protocols", &mut capped); + s.stacks = stacks.done("stacks", &mut capped); + s.endpoints = endpoints.done("endpoints", &mut capped); + s.dns_queries = queries.done("dns_queries", &mut capped); + s.dns_answers = answers.done("dns_answers", &mut capped); + s.http_requests = http.done("http_requests", &mut capped); + s.tls_sni = sni.done("tls_sni", &mut capped); + s.tls_alpn = alpn.done("tls_alpn", &mut capped); + s.capped_inventories = capped; + s.flows = flow_rows; + s.flows_untracked_frames = flows.untracked; + s.truncated = cap.truncated; + s.warnings = cap.warnings; + Ok(s) +} + +/// `YYYY-MM-DDThh:mm:ss.nnnnnnnnnZ` for nanoseconds since the Unix epoch. +pub fn iso8601(ns: u64) -> String { + let secs = ns / 1_000_000_000; + let (days, rem) = (secs / 86_400, secs % 86_400); + // Civil-from-days (proleptic Gregorian), valid for every u64 day count we can reach. + let z = days as i64 + 719_468; + let era = z.div_euclid(146_097); + let doe = z - era * 146_097; + let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365; + let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); + let mp = (5 * doy + 2) / 153; + let day = doy - (153 * mp + 2) / 5 + 1; + let month = if mp < 10 { mp + 3 } else { mp - 9 }; + let year = yoe + era * 400 + i64::from(month <= 2); + format!("{year:04}-{month:02}-{day:02}T{:02}:{:02}:{:02}.{:09}Z", rem / 3600, rem % 3600 / 60, rem % 60, ns % 1_000_000_000) +} + +#[cfg(test)] +mod tests { + use super::*; + use craft_anything_testkit::pcap::{dns_query, pcap, pcapng, sample_frames, udp}; + + #[test] + fn decodes_dns_tls_http() { + let frames = sample_frames(); + let d = decode(1, &frames[1]); + assert_eq!(d.stack(), "eth:ipv4:udp:dns"); + let dns = d.dns.unwrap(); + assert!(dns.response); + assert_eq!(dns.questions[0].name, "example.com"); + assert_eq!(dns.answers[0].value, "93.184.216.34"); + assert_eq!(dns.answers[0].ttl, 3600); + + let d = decode(1, &frames[4]); + assert_eq!(d.stack(), "eth:ipv4:tcp:tls"); + let t = d.tls.unwrap(); + assert_eq!(t.sni.as_deref(), Some("example.com")); + assert_eq!(t.alpn, vec!["h2", "http/1.1"]); + assert_eq!(t.supported_versions, vec!["TLS 1.3", "TLS 1.2"]); + assert!(!t.partial); + + let d = decode(1, &frames[5]); + let h = d.http.unwrap(); + assert_eq!(h.method.as_deref(), Some("GET")); + assert_eq!(h.host.as_deref(), Some("example.com")); + assert_eq!(h.target.as_deref(), Some("http://example.com/a?b=1")); + assert_eq!(decode(1, &frames[3]).transport.unwrap().tcp_flags.as_deref(), Some("SYN,ACK")); + assert_eq!(decode(1, &frames[6]).stack(), "eth:arp"); + } + + #[test] + fn summarizes_pcap_and_pcapng_alike() { + let frames = sample_frames(); + for data in [pcap(&frames), pcapng(&frames)] { + let s = summarize(&data, &|| false).unwrap(); + assert_eq!(s.packets, 7); + assert_eq!(s.flows.len(), 3, "{:?}", s.flows); + assert_eq!(s.flows[0].protocol, "udp"); + assert_eq!(s.flows[0].packets, 2); + assert_eq!((s.flows[0].packets_a_to_b, s.flows[0].packets_b_to_a), (1, 1)); + assert!(s.flows[1].applications.contains("tls")); + assert_eq!(s.dns_queries[0].value, "example.com (A)"); + assert_eq!(s.dns_answers[0].value, "example.com A 93.184.216.34"); + assert_eq!(s.tls_sni[0].value, "example.com"); + assert_eq!(s.http_requests[0].value, "GET example.com http://example.com/a?b=1"); + assert_eq!(s.undecoded_frames, 1); + assert!(s.warnings.is_empty(), "{:?}", s.warnings); + assert_eq!(s.interfaces[0].link_type, 1); + assert!(s.first_ts_ns.unwrap() >= 1_700_000_000_000_000_000); + } + assert_eq!(summarize(&pcap(&frames), &|| false).unwrap().format, "pcap"); + assert_eq!(iso8601(1_700_000_000_000_000_500), "2023-11-14T22:13:20.000000500Z"); + assert_eq!(iso8601(0), "1970-01-01T00:00:00.000000000Z"); + } + + #[test] + fn ipv6_sll_and_raw_links() { + let mut v6 = vec![0x60, 0, 0, 0]; + let payload = udp(1000, 53, &dns_query()); + v6.extend((payload.len() as u16).to_be_bytes()); + v6.extend([17, 64]); + v6.extend([0x20, 0x01, 0x0d, 0xb8].iter().chain([0u8; 11].iter()).chain([1u8].iter())); + v6.extend([0x20, 0x01, 0x0d, 0xb8].iter().chain([0u8; 11].iter()).chain([2u8].iter())); + v6.extend(&payload); + let d = decode(101, &v6); + assert_eq!(d.stack(), "raw:ipv6:udp:dns"); + assert_eq!(d.ip.unwrap().src.to_string(), "2001:db8::1"); + let mut sll = vec![0u8; 14]; + sll.extend(0x86ddu16.to_be_bytes()); + sll.extend(&v6); + assert_eq!(decode(113, &sll).stack(), "sll:ipv6:udp:dns"); + assert!(decode(105, &v6).note.is_some()); + } + + #[test] + fn hostile_input_never_panics() { + assert!(Capture::new(b"").is_err()); + assert!(Capture::new(b"not a capture at all").is_err()); + let data = pcapng(&sample_frames()); + for cut in [0, 10, 28, 40, 100, data.len() / 2, data.len() - 3] { + let _ = summarize(data.get(..cut).unwrap(), &|| false); + } + let mut bad = pcap(&sample_frames()); + bad[32..36].copy_from_slice(&[0xff; 4]); // incl_len of the first record far past the end + let s = summarize(&bad, &|| false).unwrap(); + assert_eq!(s.packets, 0); + assert!(!s.warnings.is_empty()); + for seed in 0..200u64 { + let mut x = seed.wrapping_mul(6364136223846793005).wrapping_add(1442695040888963407); + let noise: Vec = (0..300) + .map(|_| { + x ^= x << 13; + x ^= x >> 7; + x ^= x << 17; + x as u8 + }) + .collect(); + for link in [0, 1, 101, 113, 276, 228] { + let _ = decode(link, &noise); + } + let mut f = sample_frames(); + f.push(noise); + let _ = summarize(&pcap(&f), &|| false); + } + // DNS compression loops are refused. + assert!(dns_name(&[0xc0, 0x00], 0).is_none()); + } +} diff --git a/crates/pcap/tests/support/mod.rs b/crates/pcap/tests/support/mod.rs new file mode 100644 index 000000000..366433bc3 --- /dev/null +++ b/crates/pcap/tests/support/mod.rs @@ -0,0 +1,167 @@ +//! Packet-capture fixtures: hand-built Ethernet/IPv4 frames (DNS, TCP handshake, TLS +//! ClientHello, HTTP request, ARP) written as classic pcap or pcapng. + +const CLASSIC_US: u32 = 0xa1b2_c3d4; +const NG_SHB: u32 = 0x0a0d_0d0a; +const NG_BOM: u32 = 0x1a2b_3c4d; + +pub fn eth(ethertype: u16, payload: &[u8]) -> Vec { + let mut f = vec![0xaa; 6]; + f.extend([0xbb; 6]); + f.extend(ethertype.to_be_bytes()); + f.extend(payload); + f +} + +pub fn ipv4_pkt(proto: u8, src: [u8; 4], dst: [u8; 4], payload: &[u8]) -> Vec { + let mut p = vec![0x45, 0, 0, 0, 0, 1, 0, 0, 64, proto, 0, 0]; + p.extend(src); + p.extend(dst); + let total = (20 + payload.len()) as u16; + p[2..4].copy_from_slice(&total.to_be_bytes()); + p.extend(payload); + p +} + +pub fn udp(sp: u16, dp: u16, payload: &[u8]) -> Vec { + let mut u = sp.to_be_bytes().to_vec(); + u.extend(dp.to_be_bytes()); + u.extend(((8 + payload.len()) as u16).to_be_bytes()); + u.extend([0, 0]); + u.extend(payload); + u +} + +pub fn tcp(sp: u16, dp: u16, flags: u8, payload: &[u8]) -> Vec { + let mut t = sp.to_be_bytes().to_vec(); + t.extend(dp.to_be_bytes()); + t.extend(1000u32.to_be_bytes()); + t.extend(0u32.to_be_bytes()); + t.extend([0x50, flags, 0xff, 0xff, 0, 0, 0, 0]); + t.extend(payload); + t +} + +/// DNS response for example.com A 93.184.216.34 (name compressed in the answer). +pub fn dns_response() -> Vec { + let mut m = vec![0x12, 0x34, 0x81, 0x80, 0, 1, 0, 1, 0, 0, 0, 0]; + m.extend(b"\x07example\x03com\x00\x00\x01\x00\x01"); + m.extend([0xc0, 12, 0, 1, 0, 1, 0, 0, 0x0e, 0x10, 0, 4, 93, 184, 216, 34]); + m +} + +pub fn dns_query() -> Vec { + let mut m = vec![0x12, 0x34, 0x01, 0x00, 0, 1, 0, 0, 0, 0, 0, 0]; + m.extend(b"\x07example\x03com\x00\x00\x01\x00\x01"); + m +} + +/// A TLS 1.3-style ClientHello naming `host` with ALPN h2 and http/1.1. +pub fn client_hello(host: &str) -> Vec { + let mut ext = Vec::new(); + let mut sni = vec![0u8]; + sni.extend((host.len() as u16).to_be_bytes()); + sni.extend(host.as_bytes()); + let mut sni_list = (sni.len() as u16).to_be_bytes().to_vec(); + sni_list.extend(sni); + ext.extend(0u16.to_be_bytes()); + ext.extend((sni_list.len() as u16).to_be_bytes()); + ext.extend(sni_list); + let alpn_list = b"\x02h2\x08http/1.1"; + ext.extend(16u16.to_be_bytes()); + ext.extend(((alpn_list.len() + 2) as u16).to_be_bytes()); + ext.extend((alpn_list.len() as u16).to_be_bytes()); + ext.extend(alpn_list); + ext.extend(43u16.to_be_bytes()); + ext.extend(5u16.to_be_bytes()); + ext.extend([4, 0x03, 0x04, 0x03, 0x03]); + let mut body = vec![3, 3]; + body.extend([7u8; 32]); + body.push(0); // session id + body.extend([0, 2, 0x13, 0x01]); // one cipher suite + body.extend([1, 0]); // compression + body.extend((ext.len() as u16).to_be_bytes()); + body.extend(ext); + let mut hs = vec![1]; + hs.extend(&(body.len() as u32).to_be_bytes()[1..]); + hs.extend(body); + let mut rec = vec![22, 3, 1]; + rec.extend((hs.len() as u16).to_be_bytes()); + rec.extend(hs); + rec +} + +/// Frames of a small conversation, as (link type 1) Ethernet frames. +pub fn sample_frames() -> Vec> { + let c = [192, 168, 1, 10]; + let dns_srv = [8, 8, 8, 8]; + let web = [93, 184, 216, 34]; + vec![ + eth(0x0800, &ipv4_pkt(17, c, dns_srv, &udp(50000, 53, &dns_query()))), + eth(0x0800, &ipv4_pkt(17, dns_srv, c, &udp(53, 50000, &dns_response()))), + eth(0x0800, &ipv4_pkt(6, c, web, &tcp(50001, 443, 0x02, &[]))), + eth(0x0800, &ipv4_pkt(6, web, c, &tcp(443, 50001, 0x12, &[]))), + eth(0x0800, &ipv4_pkt(6, c, web, &tcp(50001, 443, 0x18, &client_hello("example.com")))), + eth( + 0x0800, + &ipv4_pkt(6, c, web, &tcp(50002, 80, 0x18, b"GET http://user:pw@example.com/a?b=1 HTTP/1.1\r\nHost: example.com\r\nUser-Agent: t\r\n\r\n")), + ), + eth(0x0806, &[0u8; 28]), + ] +} + +/// A classic little-endian microsecond pcap of `frames`. +pub fn pcap(frames: &[Vec]) -> Vec { + let mut out = CLASSIC_US.to_le_bytes().to_vec(); + out.extend(2u16.to_le_bytes()); + out.extend(4u16.to_le_bytes()); + out.extend([0u8; 8]); + out.extend(65535u32.to_le_bytes()); + out.extend(1u32.to_le_bytes()); + for (i, f) in frames.iter().enumerate() { + out.extend((1_700_000_000u32 + i as u32).to_le_bytes()); + out.extend(500u32.to_le_bytes()); + out.extend((f.len() as u32).to_le_bytes()); + out.extend((f.len() as u32).to_le_bytes()); + out.extend(f); + } + out +} + +pub fn block(t: u32, body: &[u8]) -> Vec { + let mut body = body.to_vec(); + while body.len() % 4 != 0 { + body.push(0); + } + let len = (body.len() + 12) as u32; + let mut b = t.to_le_bytes().to_vec(); + b.extend(len.to_le_bytes()); + b.extend(body); + b.extend(len.to_le_bytes()); + b +} + +/// A little-endian pcapng with one Ethernet interface at nanosecond resolution. +pub fn pcapng(frames: &[Vec]) -> Vec { + let mut shb = NG_BOM.to_le_bytes().to_vec(); + shb.extend(1u16.to_le_bytes()); + shb.extend(0u16.to_le_bytes()); + shb.extend((-1i64).to_le_bytes()); + let mut out = block(NG_SHB, &shb); + let mut idb = 1u16.to_le_bytes().to_vec(); + idb.extend([0, 0]); + idb.extend(0u32.to_le_bytes()); + idb.extend([9, 0, 1, 0, 9, 0, 0, 0, 0, 0, 0, 0]); // if_tsresol = 9, end of options + out.extend(block(1, &idb)); + for (i, f) in frames.iter().enumerate() { + let ts: u64 = 1_700_000_000_000_000_000 + i as u64; + let mut epb = 0u32.to_le_bytes().to_vec(); + epb.extend(((ts >> 32) as u32).to_le_bytes()); + epb.extend((ts as u32).to_le_bytes()); + epb.extend((f.len() as u32).to_le_bytes()); + epb.extend((f.len() as u32).to_le_bytes()); + epb.extend(f); + out.extend(block(6, &epb)); + } + out +} From 84df0cd3fb2a65ce46cf966aa9efdc8a6da1ec8e Mon Sep 17 00:00:00 2001 From: phatloi0010 Date: Tue, 17 Nov 2026 08:37:42 -0500 Subject: [PATCH 030/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything 34216be702a74e817fd70cad78ecfeaeac49969c. --- crates/pcap/src/lib.rs | 44 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index 62698612d..9f637aa31 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -33,6 +33,9 @@ pub struct Interface { /// Timestamp units per second, as a power: (base 10 or 2, exponent). #[serde(skip)] tsresol: (u8, u8), + /// Signed offset in seconds added to timestamps on this interface (`if_tsoffset`). + #[serde(skip)] + tsoffset: i64, } /// The plain name of a link-layer type. @@ -96,6 +99,10 @@ fn rd_u32(r: &Reader<'_>, le: bool, off: usize) -> Option { if le { r.u32_le(off) } else { r.u32_be(off) } } +fn rd_i64(r: &Reader<'_>, le: bool, off: usize) -> Option { + if le { r.u64_le(off) } else { r.u64_be(off) }.map(|v| v as i64) +} + /// True when the bytes start like a pcap or pcapng file. pub fn is_capture(data: &[u8]) -> bool { let r = Reader::new(data); @@ -127,7 +134,8 @@ impl<'a> Capture<'a> { // The top bits of the link field can carry FCS information; the type is the low 28 bits. let link = rd_u32(&r, le, 20).ok_or_else(|| FormatError::Truncated("pcap header".into()))? & 0x0fff_ffff; let res = if nanos { (10, 9) } else { (10, 6) }; - Ok((Kind::Classic { le, nanos }, format!("{major}.{minor}"), Interface { link_type: link, link_name: link_name(link), snaplen, tsresol: res })) + let iface = Interface { link_type: link, link_name: link_name(link), snaplen, tsresol: res, tsoffset: 0 }; + Ok((Kind::Classic { le, nanos }, format!("{major}.{minor}"), iface)) }; match (magic_le, magic_be) { (CLASSIC_US, _) | (_, CLASSIC_US) | (CLASSIC_NS, _) | (_, CLASSIC_NS) => { @@ -162,12 +170,14 @@ impl<'a> Capture<'a> { fn ts(&self, iface: usize, units: u64) -> Option { let (base, exp) = self.interfaces.get(iface).map(|i| i.tsresol).unwrap_or((10, 6)); + let offset_s = self.interfaces.get(iface).map(|i| i.tsoffset).unwrap_or(0); let ns = if base == 10 { if exp <= 9 { u128::from(units) * 10u128.pow(u32::from(9 - exp)) } else { u128::from(units) / 10u128.checked_pow(u32::from(exp - 9))? } } else { (u128::from(units) * 1_000_000_000) >> exp.min(127) }; - u64::try_from(ns).ok() + let adjusted = i128::try_from(ns).ok()?.checked_add(i128::from(offset_s) * 1_000_000_000)?; + u64::try_from(adjusted).ok() } fn frame(&mut self, iface: usize, ts_units: u64, data: &'a [u8], original_len: u32) -> Frame<'a> { @@ -231,6 +241,7 @@ impl<'a> Capture<'a> { let link = u32::from(rd_u16(&r, le, body).unwrap_or(u16::MAX)); let snaplen = rd_u32(&r, le, body + 4).unwrap_or(0); let mut tsresol = (10u8, 6u8); + let mut tsoffset = 0i64; let mut o = body + 8; while o + 4 <= body_end { let (Some(code), Some(len)) = (rd_u16(&r, le, o), rd_u16(&r, le, o + 2)) else { break }; @@ -239,13 +250,20 @@ impl<'a> Capture<'a> { } if code == 9 && len == 1 + && o + 5 <= body_end && let Some(v) = r.u8(o + 4) { tsresol = if v & 0x80 == 0 { (10, v) } else { (2, v & 0x7f) }; + } else if code == 14 + && len == 8 + && o + 12 <= body_end + && let Some(v) = rd_i64(&r, le, o + 4) + { + tsoffset = v; } o += 4 + usize::from(len).div_ceil(4) * 4; } - self.interfaces.push(Interface { link_type: link, link_name: link_name(link), snaplen, tsresol }); + self.interfaces.push(Interface { link_type: link, link_name: link_name(link), snaplen, tsresol, tsoffset }); } 6 | 2 => { let (iface, hi, lo, cap, orig) = if btype == 6 { @@ -1222,6 +1240,26 @@ mod tests { assert_eq!(iso8601(0), "1970-01-01T00:00:00.000000000Z"); } + #[test] + fn pcapng_interface_tsoffset_adjusts_timestamps() { + let base = pcapng(&sample_frames()); + for offset_s in [3600i64, -50i64] { + let mut data = base[..52].to_vec(); + data.extend(14u16.to_le_bytes()); + data.extend(8u16.to_le_bytes()); + data.extend(offset_s.to_le_bytes()); + data.extend(&base[52..]); + data[32..36].copy_from_slice(&44u32.to_le_bytes()); + data[68..72].copy_from_slice(&44u32.to_le_bytes()); + let expected0 = (1_700_000_000_000_000_000i128 + i128::from(offset_s) * 1_000_000_000) as u64; + let frames: Vec<_> = Capture::new(&data).unwrap().collect(); + assert_eq!(frames[0].ts_ns, Some(expected0)); + let s = summarize(&data, &|| false).unwrap(); + assert_eq!((s.first_ts_ns, s.last_ts_ns), (Some(expected0), Some(expected0 + 6))); + assert_eq!((s.flows[0].first_ts_ns, s.flows[0].last_ts_ns), (Some(expected0), Some(expected0 + 1))); + } + } + #[test] fn ipv6_sll_and_raw_links() { let mut v6 = vec![0x60, 0, 0, 0]; From 969444e8d9c763dbb124a7af327d7e6556ee589f Mon Sep 17 00:00:00 2001 From: GGWA <65288322+rech4210@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:37:43 -0500 Subject: [PATCH 031/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything c217cd6f99616cd87443987a1718828d696b66d4. --- crates/pcap/src/lib.rs | 85 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 2 deletions(-) diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index 9f637aa31..60404db3e 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -131,8 +131,8 @@ impl<'a> Capture<'a> { let major = rd_u16(&r, le, 4).ok_or_else(|| FormatError::Truncated("pcap header".into()))?; let minor = rd_u16(&r, le, 6).unwrap_or(0); let snaplen = rd_u32(&r, le, 16).ok_or_else(|| FormatError::Truncated("pcap header".into()))?; - // The top bits of the link field can carry FCS information; the type is the low 28 bits. - let link = rd_u32(&r, le, 20).ok_or_else(|| FormatError::Truncated("pcap header".into()))? & 0x0fff_ffff; + // Link type: bits 0–15; reserved: 16–25 and 27; FCS-present: 26; FCS length in 16-bit words: 28–31. + let link = rd_u32(&r, le, 20).ok_or_else(|| FormatError::Truncated("pcap header".into()))? & 0xffff; let res = if nanos { (10, 9) } else { (10, 6) }; let iface = Interface { link_type: link, link_name: link_name(link), snaplen, tsresol: res, tsoffset: 0 }; Ok((Kind::Classic { le, nanos }, format!("{major}.{minor}"), iface)) @@ -1187,6 +1187,87 @@ mod tests { use super::*; use craft_anything_testkit::pcap::{dns_query, pcap, pcapng, sample_frames, udp}; + fn classic_link_word(link_word: u32, le: bool, nanos: bool, trailer: usize) { + let link = link_word & 0xffff; + let mut frame = sample_frames()[1].clone(); + if link == 101 { + frame.drain(..14); + } + frame.extend(vec![0xab; trailer]); + let word = |v: u32| if le { v.to_le_bytes() } else { v.to_be_bytes() }; + let short = |v: u16| if le { v.to_le_bytes() } else { v.to_be_bytes() }; + let mut data = word(if nanos { CLASSIC_NS } else { CLASSIC_US }).to_vec(); + data.extend(short(2)); + data.extend(short(4)); + data.extend([0; 8]); + data.extend(word(65535)); + data.extend(word(link_word)); + data.extend(word(1_700_000_000)); + data.extend(word(500)); + data.extend(word(frame.len() as u32)); + data.extend(word(frame.len() as u32)); + data.extend(&frame); + + let mut cap = Capture::new(&data).unwrap(); + assert_eq!(cap.interfaces[0].link_type, link); + assert_eq!(cap.interfaces[0].link_name, if link == 1 { "Ethernet" } else { "raw IP" }); + let packet = cap.next().unwrap(); + assert_eq!(packet.link_type, link); + assert_eq!(packet.data, frame); + assert_eq!(packet.ts_ns, Some(1_700_000_000_000_000_000 + if nanos { 500 } else { 500_000 })); + let d = decode(packet.link_type, packet.data); + assert_eq!(d.stack(), if link == 1 { "eth:ipv4:udp:dns" } else { "raw:ipv4:udp:dns" }); + let ip = d.ip.unwrap(); + assert_eq!(ip.src.to_string(), "8.8.8.8"); + assert_eq!(ip.dst.to_string(), "192.168.1.10"); + let dns = d.dns.unwrap(); + assert!(dns.response); + assert_eq!(dns.answers[0].value, "93.184.216.34"); + assert!(cap.next().is_none()); + + let s = summarize(&data, &|| false).unwrap(); + assert_eq!(s.packets, 1); + assert_eq!(s.undecoded_frames, 0); + assert_eq!(s.dns_answers[0].value, "example.com A 93.184.216.34"); + assert_eq!(s.flows[0].protocol, "udp"); + assert!(s.warnings.is_empty()); + } + + #[test] + fn fcs_bits_do_not_change_the_ethernet_link_type() { + classic_link_word(0x24000001, true, false, 4); + } + + #[test] + fn fcs_bits_are_masked_in_big_endian_files() { + classic_link_word(0x24000001, false, false, 4); + } + + #[test] + fn fcs_bits_are_masked_in_nanosecond_files() { + classic_link_word(0x24000001, true, true, 4); + } + + #[test] + fn a_one_word_fcs_length_is_masked() { + classic_link_word(0x14000001, true, false, 2); + } + + #[test] + fn fcs_bits_do_not_change_the_raw_ip_link_type() { + classic_link_word(0x24000065, true, false, 4); + } + + #[test] + fn ethernet_without_fcs_bits_still_decodes() { + classic_link_word(1, true, false, 0); + } + + #[test] + fn raw_ip_without_fcs_bits_still_decodes() { + classic_link_word(101, true, false, 0); + } + #[test] fn decodes_dns_tls_http() { let frames = sample_frames(); From f8837751e3d773782e0d93defba67e95cfb67dd6 Mon Sep 17 00:00:00 2001 From: BFlat Date: Tue, 17 Nov 2026 08:37:44 -0500 Subject: [PATCH 032/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything e56379f062cdbfe77c51d379a5825374227c61f7. --- crates/pcap/src/lib.rs | 66 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index 60404db3e..c017cfa6e 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -781,10 +781,27 @@ fn dns(msg: &[u8], d: &mut Decoded, label: &'static str) { (28, 16) => Ipv6Addr::from(<[u8; 16]>::try_from(rd).unwrap_or([0; 16])).to_string(), (2 | 5 | 12, _) => dns_name(msg, rd_off).map(|(n, _)| n).unwrap_or_default(), (15, _) => dns_name(msg, rd_off + 2).map(|(n, _)| n).unwrap_or_default(), - (16, _) => rd - .get(1..) - .map(|t| String::from_utf8_lossy(t.get(..usize::from(rd.first().copied().unwrap_or(0))).unwrap_or(t)).into_owned()) - .unwrap_or_default(), + (16, _) => { + // RFC 1035 §3.3.14: one TXT RDATA holds any number of + // length-prefixed character strings, and a zero-length + // string does not end the record. Consumers join them all + // (RFC 7208 §3.3), so keep every string instead of the + // first one and skip the rest of the RDATA. + let mut txt = String::new(); + let mut pos = 0; + while let Some(&len) = rd.get(pos) { + let len = usize::from(len); + let end = (pos + 1).saturating_add(len).min(rd.len()); + match rd.get(pos + 1..end) { + Some(part) => { + txt.push_str(&String::from_utf8_lossy(part)); + pos = end; + } + None => break, + } + } + txt + } (_, n) => format!("<{n} bytes>"), }; out.answers.push(DnsAnswer { name, rtype: qtype_name(rt), ttl, value }); @@ -1185,7 +1202,46 @@ pub fn iso8601(ns: u64) -> String { #[cfg(test)] mod tests { use super::*; - use craft_anything_testkit::pcap::{dns_query, pcap, pcapng, sample_frames, udp}; + use craft_anything_testkit::pcap::{dns_query, eth, ipv4_pkt, pcap, pcapng, sample_frames, udp}; + + /// One-answer DNS response for `example.com` with a TXT answer carrying `rdata`. + fn txt_response(rdata: &[u8]) -> Vec { + let mut m = vec![0x12, 0x34, 0x81, 0x80, 0, 1, 0, 1, 0, 0, 0, 0]; + m.extend(b"\x07example\x03com\x00\x00\x01\x00\x01"); + m.extend([0xc0, 12, 0, 16, 0, 1, 0, 0, 0x00, 0x3c]); + m.extend((rdata.len() as u16).to_be_bytes()); + m.extend(rdata); + m + } + + #[test] + fn dns_txt_answer_keeps_every_character_string() { + // RFC 1035 §3.3.14: one TXT RDATA holds any number of length-prefixed + // character strings. Only the first used to survive (issue #330). + let rdata = [ + 5, b'f', b'i', b'r', b's', b't', // "first" + 6, b's', b'e', b'c', b'o', b'n', b'd', // "second" + ]; + let frame = eth(0x0800, &ipv4_pkt(17, [8, 8, 8, 8], [192, 168, 1, 10], &udp(53, 50000, &txt_response(&rdata)))); + let d = decode(1, &frame); + let dns = d.dns.unwrap(); + assert_eq!(dns.answers.len(), 1); + assert_eq!(dns.answers[0].rtype, "TXT"); + assert_eq!(dns.answers[0].value, "firstsecond"); + assert!(!dns.incomplete); + } + + #[test] + fn dns_txt_empty_first_string_keeps_later_content() { + // A zero-length character string does not end the record. + let rdata = [0, 6, b's', b'e', b'c', b'o', b'n', b'd']; + let frame = eth(0x0800, &ipv4_pkt(17, [8, 8, 8, 8], [192, 168, 1, 10], &udp(53, 50000, &txt_response(&rdata)))); + let d = decode(1, &frame); + let dns = d.dns.unwrap(); + assert_eq!(dns.answers.len(), 1); + assert_eq!(dns.answers[0].value, "second"); + assert!(!dns.incomplete); + } fn classic_link_word(link_word: u32, le: bool, nanos: bool, trailer: usize) { let link = link_word & 0xffff; From 013cc27059b42c43286b82166fdf7f349e661f9d Mon Sep 17 00:00:00 2001 From: Afloat <132809511+Afloat16@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:37:44 -0500 Subject: [PATCH 033/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything e3d95b43000e947e97abb6c4601644dc1e18c388. --- crates/pcap/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index c017cfa6e..866f3b013 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -1304,6 +1304,18 @@ mod tests { classic_link_word(0x24000001, true, true, 4); } + #[test] + fn fcs_bits_are_masked_in_big_endian_nanosecond_files() { + classic_link_word(0x24000001, false, true, 4); + classic_link_word(1, false, true, 0); + } + + #[test] + fn fcs_bits_do_not_change_big_endian_nanosecond_raw_ip() { + classic_link_word(0x24000065, false, true, 4); + classic_link_word(101, false, true, 0); + } + #[test] fn a_one_word_fcs_length_is_masked() { classic_link_word(0x14000001, true, false, 2); From 98fa4f5dc6fb4d216359efac3825ca26aedfe1af Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:37:45 -0500 Subject: [PATCH 034/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything 493c20f414ab7a6860953319eb0225a64ef25932. --- crates/pcap/src/lib.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index 866f3b013..9c3e6ae8b 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -1091,8 +1091,10 @@ pub fn summarize(data: &[u8], cancelled: &dyn Fn() -> bool) -> Result Date: Tue, 17 Nov 2026 08:37:45 -0500 Subject: [PATCH 035/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything b0003d7ab2a7c3f3c727cfc2a426fcbd16e65e99. --- crates/pcap/src/lib.rs | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index 9c3e6ae8b..5922f6f95 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -634,22 +634,24 @@ fn transport(proto: u8, p: &[u8], d: &mut Decoded) { }; match proto { 6 => { - let (Some(sp), Some(dp), Some(seq), Some(ack), Some(off), Some(flags), Some(win)) = - (r.u16_be(0), r.u16_be(2), r.u32_be(4), r.u32_be(8), r.u8(12), r.u8(13), r.u16_be(14)) - else { + let (Some(sp), Some(dp)) = (r.u16_be(0), r.u16_be(2)) else { d.note = Some("TCP header cut short".into()); return; }; d.protocols.push("tcp"); - let payload = p.get(usize::from(off >> 4) * 4..).unwrap_or(&[]); + let (seq, ack, off, flags, win) = (r.u32_be(4), r.u32_be(8), r.u8(12), r.u8(13), r.u16_be(14)); + if win.is_none() { + d.note = Some("TCP header cut short".into()); + } + let payload = off.map_or(&[][..], |off| p.get(usize::from(off >> 4) * 4..).unwrap_or(&[])); d.transport = Some(Transport { protocol: "tcp", src_port: Some(sp), dst_port: Some(dp), - tcp_flags: Some(tcp_flags(flags)), - seq: Some(seq), - ack: Some(ack), - window: Some(win), + tcp_flags: flags.map(tcp_flags), + seq, + ack, + window: win, payload_len: payload.len(), ..empty }); @@ -1206,6 +1208,24 @@ mod tests { use super::*; use craft_anything_testkit::pcap::{dns_query, eth, ipv4_pkt, pcap, pcapng, sample_frames, udp}; + #[test] + fn tcp_cut_inside_header_keeps_ports() { + // Ports sit in the first 4 bytes; a cut later in the header must not drop them (as UDP). + let mut tcp = Vec::new(); + tcp.extend(41000u16.to_be_bytes()); + tcp.extend(9000u16.to_be_bytes()); + tcp.extend([0, 0, 0, 1, 0, 0, 0, 0, 0x50, 0x18, 4, 0, 0, 0, 0, 0]); + let mut frame = eth(0x0800, &ipv4_pkt(6, [10, 0, 0, 1], [10, 0, 0, 2], &tcp)); + frame.truncate(14 + 20 + 11); + let d = decode(1, &frame); + let t = d.transport.unwrap(); + assert_eq!((t.src_port, t.dst_port), (Some(41000), Some(9000))); + assert_eq!(t.seq, Some(1)); + assert_eq!(t.ack, None); + assert_eq!(t.window, None); + assert!(d.protocols.contains(&"tcp")); + } + /// One-answer DNS response for `example.com` with a TXT answer carrying `rdata`. fn txt_response(rdata: &[u8]) -> Vec { let mut m = vec![0x12, 0x34, 0x81, 0x80, 0, 1, 0, 1, 0, 0, 0, 0]; From f14c029eb26240886b41d7e1b3f97bf6f978105e Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:37:46 -0500 Subject: [PATCH 036/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything d0c5feefa761ad98317665b4fc547a5921803a36. --- crates/pcap/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index 5922f6f95..bb5d6ad7b 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -1034,6 +1034,9 @@ pub struct Summary { pub dns_queries: Vec, /// "name TYPE value" from DNS responses. pub dns_answers: Vec, + /// "question A|AAAA address" from DNS responses: each address answered, keyed by the response's first + /// question (so CNAME chains end at the name that was asked), as Wireshark's fields report them. + pub dns_addresses: Vec, /// "METHOD host target" from HTTP/1.x requests. pub http_requests: Vec, /// Server names from TLS ClientHellos. @@ -1082,6 +1085,7 @@ pub fn summarize(data: &[u8], cancelled: &dyn Fn() -> bool) -> Result = Vec::new(); let (mut protocols, mut stacks, mut endpoints) = (Tally::default(), Tally::default(), Tally::default()); let (mut queries, mut answers, mut http, mut sni, mut alpn) = (Tally::default(), Tally::default(), Tally::default(), Tally::default(), Tally::default()); + let mut addresses = Tally::default(); for f in cap.by_ref() { if f.number % 4096 == 0 && cancelled() { return Err(FormatError::Malformed("cancelled".into())); @@ -1151,6 +1155,13 @@ pub fn summarize(data: &[u8], cancelled: &dyn Fn() -> bool) -> Result().is_ok()) { + addresses.add(format!("{} {} {}", q.name, a.rtype, a.value)); + } + } } if let Some(h) = &d.http && h.kind == "request" @@ -1175,6 +1186,7 @@ pub fn summarize(data: &[u8], cancelled: &dyn Fn() -> bool) -> Result Date: Tue, 17 Nov 2026 08:37:46 -0500 Subject: [PATCH 037/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything 73f9d5a8d35907362c5945b669bda83435712943. --- crates/pcap/src/lib.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index bb5d6ad7b..f36d5ab8a 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -998,6 +998,8 @@ pub struct Flow { pub bytes: u64, pub packets_a_to_b: u64, pub packets_b_to_a: u64, + pub bytes_a_to_b: u64, + pub bytes_b_to_a: u64, pub first_frame: u64, #[serde(skip_serializing_if = "Option::is_none")] pub first_ts_ns: Option, @@ -1124,6 +1126,8 @@ pub fn summarize(data: &[u8], cancelled: &dyn Fn() -> bool) -> Result bool) -> Result Date: Tue, 17 Nov 2026 08:37:47 -0500 Subject: [PATCH 038/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything 5845227f9f760a116a2a4be9059481134c942de3. --- crates/pcap/src/lib.rs | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index f36d5ab8a..5b9aee530 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -582,25 +582,37 @@ fn ipv6(p: &[u8], d: &mut Decoded) { d.protocols.push("ipv6"); let ip6 = |b: &[u8]| IpAddr::V6(Ipv6Addr::from(<[u8; 16]>::try_from(b).unwrap_or([0; 16]))); let end = (40 + usize::from(plen)).min(p.len()); + let payload_reader = Reader::new(p.get(..end).unwrap_or(&[])); let mut off = 40usize; let mut fragment = false; for _ in 0..8 { match next { 0 | 43 | 60 => { - let (Some(n), Some(l)) = (r.u8(off), r.u8(off + 1)) else { break }; + let (Some(n), Some(l)) = (payload_reader.u8(off), payload_reader.u8(off + 1)) else { break }; + let len = (usize::from(l) + 1) * 8; + if off.checked_add(len).is_none_or(|next_off| next_off > end) { + break; + } next = n; - off += (usize::from(l) + 1) * 8; + off += len; } 44 => { - let (Some(n), Some(fo)) = (r.u8(off), r.u16_be(off + 2)) else { break }; + if off.checked_add(8).is_none_or(|next_off| next_off > end) { + break; + } + let (Some(n), Some(fo)) = (payload_reader.u8(off), payload_reader.u16_be(off + 2)) else { break }; next = n; fragment = fo & 0xfff8 != 0; off += 8; } 51 => { - let (Some(n), Some(l)) = (r.u8(off), r.u8(off + 1)) else { break }; + let (Some(n), Some(l)) = (payload_reader.u8(off), payload_reader.u8(off + 1)) else { break }; + let len = (usize::from(l) + 2) * 4; + if off.checked_add(len).is_none_or(|next_off| next_off > end) { + break; + } next = n; - off += (usize::from(l) + 2) * 4; + off += len; } _ => break, } @@ -1473,6 +1485,18 @@ mod tests { } } + #[test] + fn ipv6_extension_outside_declared_payload_is_ignored() { + let mut v6 = vec![0x60, 0, 0, 0]; + v6.extend(0u16.to_be_bytes()); + v6.extend([60, 64]); + v6.extend([0u8; 32]); + v6.extend([17, 0, 0, 0, 0, 0, 0, 0]); + + let d = decode(101, &v6); + assert_eq!(d.ip.unwrap().protocol, 60); + } + #[test] fn ipv6_sll_and_raw_links() { let mut v6 = vec![0x60, 0, 0, 0]; From 7a5c99810f0b5f3b07085494fe2d780859a8742e Mon Sep 17 00:00:00 2001 From: BFlat Date: Tue, 17 Nov 2026 08:37:48 -0500 Subject: [PATCH 039/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything b9ca099903aeef5d4b33a7e83e8e7062ab94c65a. --- crates/pcap/src/lib.rs | 202 ++++++++++++++---- .../pcap/tests/regression_pcapng_framing.rs | 66 ++++++ .../pcap/tests/regression_tcp_dns_framing.rs | 67 ++++++ .../tests/regression_tcp_header_length.rs | 52 +++++ crates/pcap/tests/regression_tls_bounds.rs | 102 +++++++++ 5 files changed, 445 insertions(+), 44 deletions(-) create mode 100644 crates/pcap/tests/regression_pcapng_framing.rs create mode 100644 crates/pcap/tests/regression_tcp_dns_framing.rs create mode 100644 crates/pcap/tests/regression_tcp_header_length.rs create mode 100644 crates/pcap/tests/regression_tls_bounds.rs diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index 5b9aee530..809908396 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -224,15 +224,27 @@ impl<'a> Capture<'a> { _ if r.u32_be(p + 8) == Some(NG_BOM) => false, _ => return self.stop(format!("section header at offset {p} has no byte-order mark")), }; - self.kind = Kind::Ng { le }; - self.section_base = self.interfaces.len(); } let Some(blen) = rd_u32(&r, le, p + 4).and_then(|v| usize::try_from(v).ok()) else { return self.stop(format!("block at offset {p} is cut short")); }; - if blen < 12 || blen % 4 != 0 || r.slice(p, blen).is_none() { + let minimum = match btype { + NG_SHB => 28, + 1 => 20, + 2 | 6 => 32, + 3 => 16, + _ => 12, + }; + if blen < minimum || blen % 4 != 0 || r.slice(p, blen).is_none() { return self.stop(format!("block at offset {p} has an impossible length {blen}")); } + if rd_u32(&r, le, p + blen - 4).and_then(|n| usize::try_from(n).ok()) != Some(blen) { + return self.stop(format!("block at offset {p} has an inconsistent trailing length")); + } + if btype == NG_SHB { + self.kind = Kind::Ng { le }; + self.section_base = self.interfaces.len(); + } self.pos = p + blen; let body = p + 8; let body_end = p + blen - 4; @@ -652,10 +664,17 @@ fn transport(proto: u8, p: &[u8], d: &mut Decoded) { }; d.protocols.push("tcp"); let (seq, ack, off, flags, win) = (r.u32_be(4), r.u32_be(8), r.u8(12), r.u8(13), r.u16_be(14)); - if win.is_none() { - d.note = Some("TCP header cut short".into()); - } - let payload = off.map_or(&[][..], |off| p.get(usize::from(off >> 4) * 4..).unwrap_or(&[])); + let payload = match off.map(|off| usize::from(off >> 4) * 4) { + Some(length) if length < 20 => { + d.note = Some("TCP data offset is smaller than its header".into()); + &[][..] + } + Some(length) if length <= p.len() => p.get(length..).unwrap_or(&[]), + _ => { + d.note = Some("TCP header cut short".into()); + &[][..] + } + }; d.transport = Some(Transport { protocol: "tcp", src_port: Some(sp), @@ -667,8 +686,19 @@ fn transport(proto: u8, p: &[u8], d: &mut Decoded) { payload_len: payload.len(), ..empty }); - if (sp == 53 || dp == 53) && payload.len() > 2 { - dns(payload.get(2..).unwrap_or(&[]), d, "dns"); + if (sp == 53 || dp == 53) && !payload.is_empty() { + let framed = Reader::new(payload); + match framed.u16_be(0) { + Some(length) if length < 12 => d.note = Some("DNS over TCP length is smaller than its header".into()), + Some(length) => { + if let Some(message) = framed.slice(2, usize::from(length)) { + dns(message, d, "dns"); + } else { + d.note = Some("DNS over TCP message cut short".into()); + } + } + None => d.note = Some("DNS over TCP length prefix cut short".into()), + } } else if !payload.is_empty() { tcp_app(payload, d); } @@ -679,7 +709,19 @@ fn transport(proto: u8, p: &[u8], d: &mut Decoded) { return; }; d.protocols.push("udp"); - let payload = p.get(8..).unwrap_or(&[]); + let length = r.u16_be(4).map(usize::from).unwrap_or(0); + let payload = if p.len() < 8 { + d.note = Some("UDP header cut short".into()); + &[][..] + } else if length < 8 { + d.note = Some("UDP length is smaller than its header".into()); + &[][..] + } else { + if length > p.len() { + d.note = Some("UDP datagram cut short".into()); + } + p.get(8..length.min(p.len())).unwrap_or(&[]) + }; d.transport = Some(Transport { protocol: "udp", src_port: Some(sp), dst_port: Some(dp), payload_len: payload.len(), ..empty }); if sp == 53 || dp == 53 { dns(payload, d, "dns"); @@ -874,7 +916,11 @@ fn tls(p: &[u8], d: &mut Decoded) { return; } d.protocols.push("tls"); - if ct != 22 || r.u8(5) != Some(1) { + let Some(record_len) = r.u16_be(3) else { return }; + let record_end = 5 + usize::from(record_len); + let record_end_available = record_end.min(p.len()); + let record = Reader::new(p.get(..record_end_available).unwrap_or(&[])); + if ct != 22 || record.u8(5) != Some(1) { return; } let ver = |v: u16| match v { @@ -886,70 +932,138 @@ fn tls(p: &[u8], d: &mut Decoded) { v if v & 0x0f0f == 0x0a0a => "GREASE".into(), v => format!("{v:#06x}"), }; - let mut hello = - TlsHello { record_version: ver(u16::from_be_bytes([major, minor])), sni: None, alpn: Vec::new(), supported_versions: Vec::new(), partial: false }; - // Record header (5) + handshake header (4) + client_version (2) + random (32). - let mut off = 5 + 4 + 2 + 32; - let skip8 = |off: usize| r.u8(off).map(|n| off + 1 + usize::from(n)); - let skip16 = |off: usize| r.u16_be(off).map(|n| off + 2 + usize::from(n)); - let Some(o) = skip8(off).and_then(skip16).and_then(skip8) else { + let mut hello = TlsHello { + record_version: ver(u16::from_be_bytes([major, minor])), + sni: None, + alpn: Vec::new(), + supported_versions: Vec::new(), + partial: record_end > p.len(), + }; + let Some(handshake_header) = record.u32_be(5) else { hello.partial = true; d.tls = Some(hello); return; }; - off = o; + let handshake_end = 9 + (handshake_header & 0x00ff_ffff) as usize; + hello.partial |= handshake_end > record_end_available; + let hello_end = handshake_end.min(record_end_available); + let r = Reader::new(p.get(..hello_end).unwrap_or(&[])); + // Every variable-length field must fit inside this handshake, not merely the packet. + let skip8 = |off: usize| { + let n = usize::from(r.u8(off)?); + r.slice(off + 1, n)?; + Some(off + 1 + n) + }; + let skip16 = |off: usize| { + let n = usize::from(r.u16_be(off)?); + r.slice(off + 2, n)?; + Some(off + 2 + n) + }; + // Record header (5) + handshake header (4) + client_version (2) + random (32). + let Some(off) = skip8(5 + 4 + 2 + 32).and_then(skip16).and_then(skip8) else { + hello.partial = true; + d.tls = Some(hello); + return; + }; + // Extensions are optional in a complete ClientHello through TLS 1.2. + if off == handshake_end && hello_end == handshake_end { + d.tls = Some(hello); + return; + } let Some(ext_len) = r.u16_be(off) else { hello.partial = true; d.tls = Some(hello); return; }; - let end = off + 2 + usize::from(ext_len); - hello.partial = end > p.len(); + let declared_end = off + 2 + usize::from(ext_len); + hello.partial |= declared_end != handshake_end; + let end = declared_end.min(hello_end); + let extensions = Reader::new(p.get(..end).unwrap_or(&[])); let mut e = off + 2; - while e + 4 <= end.min(p.len()) { - let (Some(t), Some(l)) = (r.u16_be(e), r.u16_be(e + 2)) else { break }; + while e + 4 <= end { + let (Some(t), Some(l)) = (extensions.u16_be(e), extensions.u16_be(e + 2)) else { break }; let body = e + 4; - let Some(data) = r.slice(body, usize::from(l)) else { + let Some(data) = extensions.slice(body, usize::from(l)) else { hello.partial = true; break; }; let dr = Reader::new(data); match t { 0 => { - if dr.u8(2) == Some(0) - && let Some(n) = dr.u16_be(3).and_then(|n| dr.slice(5, usize::from(n))) - { - hello.sni = Some(n.iter().map(|&c| if c.is_ascii_graphic() { char::from(c) } else { '?' }).collect()); + if let Some(len) = dr.u16_be(0) { + let list_end = 2 + usize::from(len); + hello.partial |= list_end != data.len(); + let names = Reader::new(data.get(..list_end.min(data.len())).unwrap_or(&[])); + let mut a = 2; + while a < list_end.min(data.len()) { + let (Some(kind), Some(len)) = (names.u8(a), names.u16_be(a + 1)) else { + hello.partial = true; + break; + }; + let Some(name) = names.slice(a + 3, usize::from(len)) else { + hello.partial = true; + break; + }; + if kind == 0 { + if name.is_empty() { + hello.partial = true; + } else if hello.sni.is_none() { + hello.sni = Some(name.iter().map(|&c| if c.is_ascii_graphic() { char::from(c) } else { '?' }).collect()); + } + } + a += 3 + usize::from(len); + } + } else { + hello.partial = true; } } 16 => { - let mut a = 2usize; - while let Some(n) = dr.u8(a) { - let Some(proto) = dr.slice(a + 1, usize::from(n)) else { break }; - hello.alpn.push(String::from_utf8_lossy(proto).into_owned()); - a += 1 + usize::from(n); - if hello.alpn.len() >= 16 { - break; + if let Some(len) = dr.u16_be(0) { + let list_end = 2 + usize::from(len); + hello.partial |= list_end != data.len(); + let protocols = Reader::new(data.get(..list_end.min(data.len())).unwrap_or(&[])); + let mut a = 2usize; + while a < list_end.min(data.len()) && hello.alpn.len() < 16 { + let Some(n) = protocols.u8(a).filter(|&n| n > 0) else { + hello.partial = true; + break; + }; + let Some(proto) = protocols.slice(a + 1, usize::from(n)) else { + hello.partial = true; + break; + }; + hello.alpn.push(String::from_utf8_lossy(proto).into_owned()); + a += 1 + usize::from(n); } + } else { + hello.partial = true; } } 43 => { - let mut a = 1usize; - while let Some(v) = dr.u16_be(a) { - let name = ver(v); - if name != "GREASE" { - hello.supported_versions.push(name); - } - a += 2; - if hello.supported_versions.len() >= 16 { - break; + if let Some(len) = dr.u8(0) { + let list_end = 1 + usize::from(len); + hello.partial |= list_end != data.len() || len % 2 != 0; + let versions = Reader::new(data.get(..list_end.min(data.len())).unwrap_or(&[])); + let mut a = 1usize; + while let Some(v) = versions.u16_be(a) { + let name = ver(v); + if name != "GREASE" { + hello.supported_versions.push(name); + } + a += 2; + if hello.supported_versions.len() >= 16 { + break; + } } + } else { + hello.partial = true; } } _ => {} } e = body + usize::from(l); } + hello.partial |= e != end; d.tls = Some(hello); } diff --git a/crates/pcap/tests/regression_pcapng_framing.rs b/crates/pcap/tests/regression_pcapng_framing.rs new file mode 100644 index 000000000..69a58a6b3 --- /dev/null +++ b/crates/pcap/tests/regression_pcapng_framing.rs @@ -0,0 +1,66 @@ +use craft_anything_formats::pcap::summarize; +use craft_anything_testkit::pcap::{block, pcapng, sample_frames}; + +#[test] +fn mismatched_block_footers_stop_the_capture_with_a_warning() { + let original = pcapng(&sample_frames()); + for footer in [24, 56] { + let mut data = original.clone(); + data[footer..footer + 4].copy_from_slice(&12u32.to_le_bytes()); + let result = summarize(&data, &|| false).unwrap(); + assert!(!result.warnings.is_empty(), "footer at {footer}"); + assert_eq!(result.packets, 0); + } +} + +#[test] +fn fixed_block_headers_cannot_borrow_the_next_blocks_bytes() { + let header = pcapng(&[]); + for (kind, short_body) in [(1, vec![]), (2, vec![0; 16]), (6, vec![0; 16]), (3, vec![])] { + let mut data = header[..28].to_vec(); + if kind != 1 { + data.extend(&header[28..]); + } + data.extend(block(kind, &short_body)); + data.extend(&pcapng(&sample_frames())[28..]); + let result = summarize(&data, &|| false).unwrap(); + assert!(!result.warnings.is_empty(), "kind {kind}"); + assert_eq!(result.packets, 0, "kind {kind}"); + assert_eq!(result.interfaces.len(), usize::from(kind != 1), "kind {kind}"); + } +} + +#[test] +fn valid_blocks_and_unknown_blocks_still_work() { + let original = pcapng(&sample_frames()); + let mut data = original[..60].to_vec(); + data.extend(block(0x0000_1234, b"ignored")); + data.extend(&original[60..]); + let result = summarize(&data, &|| false).unwrap(); + assert_eq!(result.packets, 7); + assert!(result.warnings.is_empty()); + assert_eq!(result.interfaces.len(), 1); +} + +#[test] +fn big_endian_block_footers_use_the_sections_byte_order() { + let be_block = |kind: u32, body: &[u8]| { + let size = (body.len() + 12) as u32; + let mut out = kind.to_be_bytes().to_vec(); + out.extend(size.to_be_bytes()); + out.extend(body); + out.extend(size.to_be_bytes()); + out + }; + let mut section = 0x1a2b3c4du32.to_be_bytes().to_vec(); + section.extend([0, 1, 0, 0]); + section.extend((-1i64).to_be_bytes()); + let mut data = be_block(0x0a0d0d0a, §ion); + data.extend(be_block(1, &[0, 1, 0, 0, 0, 0, 0, 0])); + let result = summarize(&data, &|| false).unwrap(); + assert!(result.warnings.is_empty()); + assert_eq!(result.interfaces[0].link_type, 1); + let end = data.len(); + data[end - 4..].copy_from_slice(&20u32.to_le_bytes()); + assert!(!summarize(&data, &|| false).unwrap().warnings.is_empty()); +} diff --git a/crates/pcap/tests/regression_tcp_dns_framing.rs b/crates/pcap/tests/regression_tcp_dns_framing.rs new file mode 100644 index 000000000..4dad459bb --- /dev/null +++ b/crates/pcap/tests/regression_tcp_dns_framing.rs @@ -0,0 +1,67 @@ +use craft_anything_formats::pcap::{Decoded, decode}; +use craft_anything_testkit::pcap::{dns_query, dns_response, ipv4_pkt, tcp}; + +fn decoded(payload: &[u8]) -> Decoded { + decode(101, &ipv4_pkt(6, [192, 0, 2, 1], [192, 0, 2, 2], &tcp(53, 51000, 0x18, payload))) +} + +fn framed(message: &[u8], declared: usize) -> Vec { + let mut payload = (declared as u16).to_be_bytes().to_vec(); + payload.extend(message); + payload +} + +#[test] +fn an_unfinished_dns_message_is_not_reported_complete() { + let message = dns_response(); + let result = decoded(&framed(&message, message.len() + 1)); + assert!(result.dns.is_none()); + assert!(result.note.is_some()); + assert_eq!(result.transport.unwrap().src_port, Some(53)); +} + +#[test] +fn dns_records_cannot_borrow_bytes_past_the_message_length() { + let result = decoded(&framed(&dns_response(), 12)); + let dns = result.dns.unwrap(); + assert!(dns.questions.is_empty() && dns.answers.is_empty()); + assert!(dns.incomplete); +} + +#[test] +fn a_length_smaller_than_the_dns_header_is_rejected() { + for length in 0..12 { + let result = decoded(&framed(&dns_response(), length)); + assert!(result.dns.is_none(), "length {length}"); + assert!(result.note.is_some(), "length {length}"); + } +} + +#[test] +fn a_partial_dns_length_prefix_is_reported() { + let result = decoded(&[0]); + assert!(result.dns.is_none()); + assert!(result.note.is_some()); +} + +#[test] +fn an_empty_tcp_ack_does_not_claim_a_missing_dns_message() { + let result = decoded(&[]); + assert!(result.dns.is_none()); + assert!(result.note.is_none()); + assert_eq!(result.transport.unwrap().payload_len, 0); +} + +#[test] +fn the_first_complete_dns_message_is_decoded_without_the_next_one() { + let first = dns_query(); + let second = dns_response(); + let mut payload = framed(&first, first.len()); + payload.extend(framed(&second, second.len())); + let result = decoded(&payload); + let dns = result.dns.unwrap(); + assert!(!dns.response && !dns.incomplete); + assert_eq!(dns.questions[0].name, "example.com"); + assert!(dns.answers.is_empty()); + assert!(result.note.is_none()); +} diff --git a/crates/pcap/tests/regression_tcp_header_length.rs b/crates/pcap/tests/regression_tcp_header_length.rs new file mode 100644 index 000000000..189318116 --- /dev/null +++ b/crates/pcap/tests/regression_tcp_header_length.rs @@ -0,0 +1,52 @@ +use craft_anything_formats::pcap::{Decoded, decode}; +use craft_anything_testkit::pcap::{ipv4_pkt, tcp}; + +fn decoded(segment: &[u8]) -> Decoded { + decode(101, &ipv4_pkt(6, [192, 0, 2, 1], [192, 0, 2, 2], segment)) +} + +#[test] +fn a_tcp_header_shorter_than_twenty_bytes_is_not_payload() { + for words in 0..5u8 { + let mut segment = tcp(51000, 80, 0x18, b"GET / HTTP/1.1\r\n\r\n"); + segment[12] = words << 4; + let result = decoded(&segment); + let transport = result.transport.unwrap(); + assert_eq!(transport.payload_len, 0, "offset {words}"); + assert_eq!((transport.src_port, transport.dst_port), (Some(51000), Some(80))); + assert!(result.http.is_none() && result.tls.is_none()); + assert!(result.note.is_some()); + } +} + +#[test] +fn a_cut_tcp_header_keeps_ports_but_reports_the_cut() { + let whole = tcp(51000, 80, 0x18, b"request"); + for end in 4..20 { + let result = decoded(&whole[..end]); + let transport = result.transport.unwrap(); + assert_eq!((transport.src_port, transport.dst_port), (Some(51000), Some(80))); + assert_eq!(transport.payload_len, 0); + assert!(result.note.is_some(), "cut at {end}"); + } + for words in 6..=15u8 { + let mut segment = tcp(51000, 80, 0x18, &[]); + segment[12] = words << 4; + let result = decoded(&segment); + assert_eq!(result.transport.unwrap().payload_len, 0); + assert!(result.note.is_some(), "missing options for offset {words}"); + } +} + +#[test] +fn a_valid_tcp_header_with_options_finds_its_payload() { + let mut segment = tcp(51000, 80, 0x18, &[]); + segment[12] = 7 << 4; + segment.extend([1; 8]); + let payload = b"GET /resource HTTP/1.1\r\nHost: example.test\r\n\r\n"; + segment.extend(payload); + let result = decoded(&segment); + assert_eq!(result.transport.unwrap().payload_len, payload.len()); + assert_eq!(result.http.unwrap().target.as_deref(), Some("/resource")); + assert!(result.note.is_none()); +} diff --git a/crates/pcap/tests/regression_tls_bounds.rs b/crates/pcap/tests/regression_tls_bounds.rs new file mode 100644 index 000000000..674ff7942 --- /dev/null +++ b/crates/pcap/tests/regression_tls_bounds.rs @@ -0,0 +1,102 @@ +use craft_anything_formats::pcap::{Decoded, decode}; +use craft_anything_testkit::pcap::{client_hello, ipv4_pkt, tcp}; + +fn decoded(record: &[u8]) -> Decoded { + decode(101, &ipv4_pkt(6, [192, 0, 2, 1], [192, 0, 2, 2], &tcp(51000, 443, 0x18, record))) +} + +fn assert_no_complete_sni(record: &[u8]) { + let result = decoded(record); + assert!(result.protocols.contains(&"tls")); + assert!(result.tls.is_none_or(|hello| hello.sni.is_none() && hello.partial)); +} + +#[test] +fn a_client_hello_cannot_read_past_its_tls_record() { + let mut record = client_hello("example.test"); + record[3..5].copy_from_slice(&4u16.to_be_bytes()); + assert_no_complete_sni(&record); +} + +#[test] +fn a_client_hello_cannot_read_past_its_handshake() { + let mut record = client_hello("example.test"); + record[6..9].copy_from_slice(&[0, 0, 34]); + assert_no_complete_sni(&record); +} + +#[test] +fn extensions_cannot_read_past_the_declared_extension_list() { + let mut record = client_hello("example.test"); + record[50..52].copy_from_slice(&4u16.to_be_bytes()); + assert_no_complete_sni(&record); +} + +#[test] +fn a_truncated_record_reports_partial_even_when_the_hello_fields_fit() { + let mut record = client_hello("example.test"); + let larger = (record.len() + 20) as u16; + record[3..5].copy_from_slice(&larger.to_be_bytes()); + assert!(decoded(&record).tls.unwrap().partial); +} + +#[test] +fn server_names_stay_inside_the_name_list() { + let mut record = client_hello("example.test"); + record[56..58].copy_from_slice(&3u16.to_be_bytes()); + assert_no_complete_sni(&record); +} + +#[test] +fn alpn_names_stay_inside_the_protocol_list() { + let mut record = client_hello("example.test"); + let alpn_list = 52 + 4 + 5 + "example.test".len() + 4; + record[alpn_list..alpn_list + 2].copy_from_slice(&3u16.to_be_bytes()); + let hello = decoded(&record).tls.unwrap(); + assert_eq!(hello.alpn, ["h2"]); + assert!(hello.partial); +} + +#[test] +fn supported_versions_stay_inside_the_version_list() { + let mut record = client_hello("example.test"); + let versions = 52 + 4 + 5 + "example.test".len() + 4 + 14 + 4; + record[versions] = 2; + let hello = decoded(&record).tls.unwrap(); + assert_eq!(hello.supported_versions, ["TLS 1.3"]); + assert!(hello.partial); +} + +#[test] +fn a_complete_legacy_hello_can_omit_extensions() { + let mut record = client_hello("example.test"); + record.truncate(50); + record[3..5].copy_from_slice(&45u16.to_be_bytes()); + record[6..9].copy_from_slice(&[0, 0, 41]); + record[46..48].copy_from_slice(&0x002fu16.to_be_bytes()); + let hello = decoded(&record).tls.unwrap(); + assert!(hello.sni.is_none() && hello.alpn.is_empty() && hello.supported_versions.is_empty()); + assert!(!hello.partial); +} + +#[test] +fn a_following_handshake_does_not_extend_the_first_hello() { + let mut record = client_hello("example.test"); + record.extend([14, 0, 0, 0]); + let record_len = (record.len() - 5) as u16; + record[3..5].copy_from_slice(&record_len.to_be_bytes()); + let hello = decoded(&record).tls.unwrap(); + assert_eq!(hello.sni.as_deref(), Some("example.test")); + assert_eq!(hello.alpn, ["h2", "http/1.1"]); + assert!(!hello.partial); +} + +#[test] +fn complete_hello_metadata_is_unchanged() { + let record = client_hello("example.test"); + let hello = decoded(&record).tls.unwrap(); + assert_eq!(hello.sni.as_deref(), Some("example.test")); + assert_eq!(hello.alpn, ["h2", "http/1.1"]); + assert_eq!(hello.supported_versions, ["TLS 1.3", "TLS 1.2"]); + assert!(!hello.partial); +} From 9ecd830f68dea89eee60ba072da9148f6dd2aa79 Mon Sep 17 00:00:00 2001 From: BFlat Date: Tue, 17 Nov 2026 08:37:49 -0500 Subject: [PATCH 040/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything 60409b684c805482cfa3965fbc368bcc26de106d. --- crates/pcap/src/lib.rs | 248 +++++++++++++++---- crates/pcap/tests/dns_question_class.rs | 55 ++++ crates/pcap/tests/dns_rdata_names.rs | 184 ++++++++++++++ crates/pcap/tests/pcap_dns_name_limit.rs | 151 +++++++++++ crates/pcap/tests/pcap_dns_txt_lengths.rs | 196 +++++++++++++++ crates/pcap/tests/pcap_flow_time_range.rs | 36 +++ crates/pcap/tests/pcap_http_host_boundary.rs | 24 ++ crates/pcap/tests/pcap_ipv4_lengths.rs | 57 +++++ crates/pcap/tests/pcap_ipv6_fragments.rs | 40 +++ crates/pcap/tests/pcap_ipv6_version.rs | 53 ++++ crates/pcap/tests/pcapng_simple_payload.rs | 62 +++++ 11 files changed, 1061 insertions(+), 45 deletions(-) create mode 100644 crates/pcap/tests/dns_question_class.rs create mode 100644 crates/pcap/tests/dns_rdata_names.rs create mode 100644 crates/pcap/tests/pcap_dns_name_limit.rs create mode 100644 crates/pcap/tests/pcap_dns_txt_lengths.rs create mode 100644 crates/pcap/tests/pcap_flow_time_range.rs create mode 100644 crates/pcap/tests/pcap_http_host_boundary.rs create mode 100644 crates/pcap/tests/pcap_ipv4_lengths.rs create mode 100644 crates/pcap/tests/pcap_ipv6_fragments.rs create mode 100644 crates/pcap/tests/pcap_ipv6_version.rs create mode 100644 crates/pcap/tests/pcapng_simple_payload.rs diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index 809908396..d82dc8fea 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -12,7 +12,7 @@ use serde::Serialize; use std::collections::{BTreeMap, BTreeSet, HashMap}; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; -/// Most frames read from one capture. +/// Most frames and rejected simple packet blocks read from one capture. pub const MAX_PACKETS: u64 = 5_000_000; /// Most flows tracked; later flows are counted but get no id. pub const MAX_FLOWS: usize = 100_000; @@ -89,6 +89,8 @@ pub struct Capture<'a> { /// The walk stopped at `MAX_PACKETS`. pub truncated: bool, count: u64, + rejected_simple_blocks: u64, + rejected_simple_reported: bool, } fn rd_u16(r: &Reader<'_>, le: bool, off: usize) -> Option { @@ -126,6 +128,8 @@ impl<'a> Capture<'a> { warnings: Vec::new(), truncated: false, count: 0, + rejected_simple_blocks: 0, + rejected_simple_reported: false, }; let classic = |le: bool, nanos: bool| -> Result<(Kind, String, Interface), FormatError> { let major = rd_u16(&r, le, 4).ok_or_else(|| FormatError::Truncated("pcap header".into()))?; @@ -168,6 +172,26 @@ impl<'a> Capture<'a> { None } + fn packet_limit_reached(&mut self) -> bool { + if self.count.saturating_add(self.rejected_simple_blocks) < MAX_PACKETS { + return false; + } + if !self.truncated && self.pos < self.data.len() { + self.truncated = true; + self.warnings.push(format!("stopped after {MAX_PACKETS} packet records")); + } + true + } + + fn report_rejected_simple_blocks(&mut self) { + if self.rejected_simple_blocks > 0 && !self.rejected_simple_reported { + let n = self.rejected_simple_blocks; + let suffix = if n == 1 { "" } else { "s" }; + self.warnings.push(format!("skipped {n} simple packet block{suffix} with inconsistent captured lengths")); + self.rejected_simple_reported = true; + } + } + fn ts(&self, iface: usize, units: u64) -> Option { let (base, exp) = self.interfaces.get(iface).map(|i| i.tsresol).unwrap_or((10, 6)); let offset_s = self.interfaces.get(iface).map(|i| i.tsoffset).unwrap_or(0); @@ -211,6 +235,9 @@ impl<'a> Capture<'a> { fn next_ng(&mut self, mut le: bool) -> Option> { loop { + if self.packet_limit_reached() { + return None; + } let r = Reader::new(self.data); let p = self.pos; if p >= self.data.len() { @@ -312,7 +339,11 @@ impl<'a> Capture<'a> { let iface = self.section_base; let snap = self.interfaces.get(iface).map(|i| i.snaplen).filter(|&s| s > 0).unwrap_or(u32::MAX); let room = body_end.saturating_sub(body + 4); - let cap = (orig.min(snap) as usize).min(room); + let cap = orig.min(snap) as usize; + if cap.checked_add(3).map(|n| n & !3) != Some(room) { + self.rejected_simple_blocks += 1; + continue; + } let Some(data) = r.slice(body + 4, cap) else { continue }; if iface >= self.interfaces.len() { continue; @@ -338,17 +369,18 @@ impl<'a> Iterator for Capture<'a> { type Item = Frame<'a>; fn next(&mut self) -> Option> { - if self.count >= MAX_PACKETS { - if !self.truncated && self.pos < self.data.len() { - self.truncated = true; - self.warnings.push(format!("stopped after {MAX_PACKETS} frames")); + let frame = if self.packet_limit_reached() { + None + } else { + match self.kind { + Kind::Classic { le, nanos } => self.next_classic(le, nanos), + Kind::Ng { le } => self.next_ng(le), } - return None; - } - match self.kind { - Kind::Classic { le, nanos } => self.next_classic(le, nanos), - Kind::Ng { le } => self.next_ng(le), + }; + if frame.is_none() { + self.report_rejected_simple_blocks(); } + frame } } @@ -535,7 +567,12 @@ pub fn decode(link_type: u32, data: &[u8]) -> Decoded { } 12 | 14 | 101 | 228 | 229 => { d.protocols.push("raw"); - (r.u8(0).map(|b| if b >> 4 == 6 { 0x86dd } else { 0x0800 }), 0) + let ethertype = match link_type { + 228 => Some(0x0800), + 229 => Some(0x86dd), + _ => r.u8(0).map(|b| if b >> 4 == 6 { 0x86dd } else { 0x0800 }), + }; + (ethertype, 0) } _ => { d.note = Some(format!("link type {link_type} ({}) is not decoded", link_name(link_type))); @@ -560,11 +597,15 @@ fn ipv4(p: &[u8], d: &mut Decoded) { return; }; let ihl = usize::from(vihl & 0x0f) * 4; - let (Some(src), Some(dst)) = (r.slice(12, 4), r.slice(16, 4)) else { return }; - if vihl >> 4 != 4 || ihl < 20 { + if vihl >> 4 != 4 || ihl < 20 || usize::from(total) < ihl { d.note = Some("not a valid IPv4 header".into()); return; } + if r.slice(0, ihl).is_none() { + d.note = Some("IPv4 header cut short".into()); + return; + } + let (Some(src), Some(dst)) = (r.slice(12, 4), r.slice(16, 4)) else { return }; d.protocols.push("ipv4"); let ip4 = |b: &[u8]| { IpAddr::V4(Ipv4Addr::new( @@ -576,7 +617,7 @@ fn ipv4(p: &[u8], d: &mut Decoded) { }; let fragment = frag & 0x1fff != 0; d.ip = Some(IpInfo { version: 4, src: ip4(src), dst: ip4(dst), protocol: proto, ttl, fragment }); - let end = usize::from(total).clamp(ihl, p.len().max(ihl)); + let end = usize::from(total).min(p.len()); let body = p.get(ihl..end).unwrap_or(&[]); if fragment { d.note = Some("IPv4 fragment (transport header is in the first fragment)".into()); @@ -591,6 +632,10 @@ fn ipv6(p: &[u8], d: &mut Decoded) { d.note = Some("IPv6 header cut short".into()); return; }; + if r.u8(0).is_none_or(|version| version >> 4 != 6) { + d.note = Some("not a valid IPv6 header".into()); + return; + } d.protocols.push("ipv6"); let ip6 = |b: &[u8]| IpAddr::V6(Ipv6Addr::from(<[u8; 16]>::try_from(b).unwrap_or([0; 16]))); let end = (40 + usize::from(plen)).min(p.len()); @@ -616,6 +661,9 @@ fn ipv6(p: &[u8], d: &mut Decoded) { next = n; fragment = fo & 0xfff8 != 0; off += 8; + if fragment { + break; + } } 51 => { let (Some(n), Some(l)) = (payload_reader.u8(off), payload_reader.u8(off + 1)) else { break }; @@ -756,14 +804,29 @@ pub fn qtype_name(t: u16) -> String { } } -/// A (possibly compressed) DNS name at `off`; returns the name and the offset after it. -fn dns_name(msg: &[u8], mut off: usize) -> Option<(String, usize)> { +fn dns_sd_service_label(label: &[u8]) -> bool { + let Some(name) = label.strip_prefix(b"_") else { return false }; + // RFC 6763 §7 / RFC 6335 §5.1, excluding the leading underscore. + (1..=15).contains(&name.len()) + && name.first().is_some_and(u8::is_ascii_alphanumeric) + && name.last().is_some_and(u8::is_ascii_alphanumeric) + && name.iter().all(|c| c.is_ascii_alphanumeric() || *c == b'-') + && name.iter().any(u8::is_ascii_alphabetic) + && !name.windows(2).any(|pair| pair == b"--") +} + +/// A DNS name, the offset after it, and whether its wire labels name a DNS-SD instance. +fn dns_name(msg: &[u8], mut off: usize) -> Option<(String, usize, bool)> { let mut out = String::new(); + // Count the expanded wire name, including label lengths and the terminating root. + let mut wire_len = 1usize; let mut after: Option = None; + let mut labels = 0; + let mut service_instance = false; for _ in 0..128 { let len = *msg.get(off)?; match len { - 0 => return Some((if out.is_empty() { ".".into() } else { out }, after.unwrap_or(off + 1))), + 0 => return Some((if out.is_empty() { ".".into() } else { out }, after.unwrap_or(off + 1), labels >= 4 && service_instance)), l if l & 0xc0 == 0xc0 => { let ptr = usize::from(u16::from_be_bytes([l & 0x3f, *msg.get(off + 1)?])); after.get_or_insert(off + 2); @@ -774,13 +837,22 @@ fn dns_name(msg: &[u8], mut off: usize) -> Option<(String, usize)> { } l if l < 64 => { let label = msg.get(off + 1..off + 1 + usize::from(l))?; + wire_len += 1 + label.len(); + if wire_len > 255 { + return None; + } + // Match Instance / _service / _tcp|_udp / Domain before rendering: + // a literal dot inside one wire label is not a label boundary. + match labels { + 1 => service_instance = dns_sd_service_label(label), + 2 => service_instance &= label.eq_ignore_ascii_case(b"_tcp") || label.eq_ignore_ascii_case(b"_udp"), + _ => {} + } + labels += 1; if !out.is_empty() { out.push('.'); } out.extend(label.iter().map(|&c| if c.is_ascii_graphic() { char::from(c) } else { '?' })); - if out.len() > 255 { - return None; - } off += 1 + usize::from(l); } _ => return None, @@ -789,22 +861,26 @@ fn dns_name(msg: &[u8], mut off: usize) -> Option<(String, usize)> { None } +/// Decode a bounded set of DNS questions and answer/prerequisite records from one message. +/// Preserve complete entries before malformed data and mark the message incomplete. fn dns(msg: &[u8], d: &mut Decoded, label: &'static str) { let r = Reader::new(msg); let (Some(id), Some(flags), Some(qd), Some(an)) = (r.u16_be(0), r.u16_be(2), r.u16_be(4), r.u16_be(6)) else { return }; + let opcode = (flags >> 11) & 0xf; // Sanity: opcode 0–6 and no absurd counts, so random payload on port 53 isn't misread. - if (flags >> 11) & 0xf > 6 || qd > 64 || qd == 0 && an == 0 { + if opcode > 6 || qd > 64 || qd == 0 && an == 0 { return; } d.protocols.push(label); let mut out = Dns { id, response: flags & 0x8000 != 0, rcode: (flags & 0xf) as u8, questions: Vec::new(), answers: Vec::new(), incomplete: false }; let mut off = 12usize; for _ in 0..qd { - let Some((name, next)) = dns_name(msg, off) else { + let Some((name, next, _)) = dns_name(msg, off) else { out.incomplete = true; break; }; - let Some(qt) = r.u16_be(next) else { + // The class is not displayed, but both two-byte fields must be present. + let (Some(qt), Some(_class)) = (r.u16_be(next), r.u16_be(next + 2)) else { out.incomplete = true; break; }; @@ -813,11 +889,11 @@ fn dns(msg: &[u8], d: &mut Decoded, label: &'static str) { } if !out.incomplete { for _ in 0..an.min(64) { - let Some((name, next)) = dns_name(msg, off) else { + let Some((name, next, service_instance)) = dns_name(msg, off) else { out.incomplete = true; break; }; - let (Some(rt), Some(ttl), Some(rdlen)) = (r.u16_be(next), r.u32_be(next + 4), r.u16_be(next + 8)) else { + let (Some(rt), Some(class), Some(ttl), Some(rdlen)) = (r.u16_be(next), r.u16_be(next + 2), r.u32_be(next + 4), r.u16_be(next + 8)) else { out.incomplete = true; break; }; @@ -835,31 +911,54 @@ fn dns(msg: &[u8], d: &mut Decoded, label: &'static str) { ) .to_string(), (28, 16) => Ipv6Addr::from(<[u8; 16]>::try_from(rd).unwrap_or([0; 16])).to_string(), - (2 | 5 | 12, _) => dns_name(msg, rd_off).map(|(n, _)| n).unwrap_or_default(), - (15, _) => dns_name(msg, rd_off + 2).map(|(n, _)| n).unwrap_or_default(), + (2 | 5 | 12 | 15, _) => { + // RFC 2136 prerequisites can name an RRset without carrying its value. + if rd.is_empty() && opcode == 5 && matches!(class, 254 | 255) && ttl == 0 { + String::new() + } else { + let end = rd_off + rd.len(); + let start = rd_off + if rt == 15 { 2 } else { 0 }; + // Keep earlier bytes available to compression pointers, but the encoded + // name itself must fit the record and account for all of its RDATA. + let Some((name, _, _)) = dns_name(msg.get(..end).unwrap_or(&[]), start).filter(|(_, after, _)| *after == end) else { + out.incomplete = true; + break; + }; + name + } + } (16, _) => { - // RFC 1035 §3.3.14: one TXT RDATA holds any number of + // RFC 1035 §3.3.14: one TXT RDATA holds one or more // length-prefixed character strings, and a zero-length // string does not end the record. Consumers join them all // (RFC 7208 §3.3), so keep every string instead of the // first one and skip the rest of the RDATA. let mut txt = String::new(); let mut pos = 0; + // UPDATE's answer section holds prerequisites. ANY/NONE + // prerequisites use empty RDATA and zero TTL (RFC 2136 §2.4). + let empty_prerequisite = opcode == 5 && matches!(class, 254 | 255) && ttl == 0; + // DNS-SD receivers treat empty RDATA as an empty string + // (RFC 6763 §6.1), for both multicast and unicast DNS. + let empty_service_txt = opcode == 0 && service_instance; + out.incomplete |= rd.is_empty() && !empty_prerequisite && !empty_service_txt; while let Some(&len) = rd.get(pos) { let len = usize::from(len); - let end = (pos + 1).saturating_add(len).min(rd.len()); - match rd.get(pos + 1..end) { - Some(part) => { - txt.push_str(&String::from_utf8_lossy(part)); - pos = end; - } - None => break, - } + let end = pos + 1 + len; + let Some(part) = rd.get(pos + 1..end) else { + out.incomplete = true; + break; + }; + txt.push_str(&String::from_utf8_lossy(part)); + pos = end; } txt } (_, n) => format!("<{n} bytes>"), }; + if out.incomplete { + break; + } out.answers.push(DnsAnswer { name, rtype: qtype_name(rt), ttl, value }); off = rd_off + usize::from(rdlen); } @@ -896,12 +995,21 @@ fn tcp_app(p: &[u8], d: &mut Decoded) { && METHODS.contains(&m) && v.starts_with("HTTP/1.") { - let lower = String::from_utf8_lossy(head).to_ascii_lowercase(); - let host = lower.find("\r\nhost:").and_then(|i| { - let start = i + 7; - let raw = String::from_utf8_lossy(head.get(start..)?).into_owned(); - Some(raw.split("\r\n").next().unwrap_or("").trim().to_string()) - }); + let mut remaining = head.get(line_end + 2..).unwrap_or(&[]); + let mut host = None; + while let Some(end) = remaining.windows(2).position(|w| w == b"\r\n") { + let field = remaining.get(..end).unwrap_or(&[]); + if field.is_empty() { + break; + } + if let Some(colon) = field.iter().position(|&b| b == b':') + && field.get(..colon).is_some_and(|name| name.eq_ignore_ascii_case(b"host")) + { + host = field.get(colon + 1..).map(|value| String::from_utf8_lossy(value).trim().to_string()); + break; + } + remaining = remaining.get(end + 2..).unwrap_or(&[]); + } d.protocols.push("http"); d.http = Some(Http { kind: "request", method: Some(m.to_string()), target: Some(strip_userinfo(t)), status: None, version: v.to_string(), host }); return; @@ -1270,8 +1378,9 @@ pub fn summarize(data: &[u8], cancelled: &dyn Fn() -> bool) -> Result Vec { + eth(0x0800, &ipv4_pkt(17, [192, 0, 2, 1], [192, 0, 2, 2], &udp(51000, 53, message))) +} + +/// Neither a missing class nor a one-byte class can complete a DNS question. +#[test] +fn a_question_missing_any_class_byte_is_incomplete() { + let complete = dns_query(); + for missing in [1, 2] { + let message = &complete[..complete.len() - missing]; + let dns = decode(1, &packet(message)).dns.unwrap(); + assert!(dns.incomplete, "missing {missing} class bytes"); + assert!(dns.questions.is_empty(), "a question needs both type and class"); + } +} + +#[test] +fn complete_questions_survive_before_a_truncated_question() { + let mut message = dns_query(); + message[4..6].copy_from_slice(&2u16.to_be_bytes()); + message.extend([0xc0, 12, 0, 28, 0]); // compressed name, AAAA, one class byte + + let dns = decode(1, &packet(&message)).dns.unwrap(); + assert!(dns.incomplete); + assert_eq!(dns.questions.len(), 1); + assert_eq!(dns.questions[0].name, "example.com"); + assert_eq!(dns.questions[0].qtype, "A"); +} + +#[test] +fn incomplete_questions_do_not_enter_the_query_inventory() { + let mut message = dns_query(); + message.pop(); + let summary = summarize(&pcap(&[packet(&message)]), &|| false).unwrap(); + assert_eq!(summary.packets, 1); + assert!(summary.dns_queries.is_empty()); +} + +/// Class validation requires both bytes without restricting valid class values. +#[test] +fn complete_class_fields_are_accepted() { + for class in [1u16, 3, 255] { + let mut message = dns_query(); + message.truncate(message.len() - 2); + message.extend(class.to_be_bytes()); + let dns = decode(1, &packet(&message)).dns.unwrap(); + assert!(!dns.incomplete); + assert_eq!(dns.questions.len(), 1); + assert_eq!(dns.questions[0].name, "example.com"); + assert_eq!(dns.questions[0].qtype, "A"); + } +} diff --git a/crates/pcap/tests/dns_rdata_names.rs b/crates/pcap/tests/dns_rdata_names.rs new file mode 100644 index 000000000..88b7315b7 --- /dev/null +++ b/crates/pcap/tests/dns_rdata_names.rs @@ -0,0 +1,184 @@ +use craft_anything_formats::pcap::{decode, summarize}; +use craft_anything_testkit::pcap::{dns_query, eth, ipv4_pkt, pcap, udp}; + +fn response(record_type: u16, rdata: &[u8], declared_length: usize) -> Vec { + let mut message = dns_query(); + message[2..4].copy_from_slice(&0x8180u16.to_be_bytes()); + message[6..8].copy_from_slice(&1u16.to_be_bytes()); + message.extend([0xc0, 12]); // owner points to the question's name + message.extend(record_type.to_be_bytes()); + message.extend(1u16.to_be_bytes()); + message.extend(60u32.to_be_bytes()); + message.extend((declared_length as u16).to_be_bytes()); + message.extend(rdata); + message +} + +fn packet(message: &[u8]) -> Vec { + eth(0x0800, &ipv4_pkt(17, [192, 0, 2, 2], [192, 0, 2, 1], &udp(53, 51000, message))) +} + +/// Truncated literal names and compression pointers must stay inside RDLENGTH. +#[test] +fn answer_names_cannot_borrow_bytes_past_rdata() { + for record_type in [2, 5, 12, 15] { + for name in [b"\x04fake\x07example\x00".as_slice(), &[0xc0, 12]] { + let mut rdata = if record_type == 15 { vec![0, 10] } else { Vec::new() }; + let prefix = rdata.len(); + rdata.extend(name); + for declared in [prefix, prefix + name.len() - 1] { + let dns = decode(1, &packet(&response(record_type, &rdata, declared))).dns.unwrap(); + assert!(dns.incomplete, "type {record_type}, declared length {declared}"); + assert!(dns.answers.is_empty(), "a name must be wholly encoded in its record"); + } + } + } +} + +/// An incomplete pointer is malformed, rather than a successful empty answer. +#[test] +fn malformed_name_rdata_is_not_reported_as_an_empty_answer() { + for record_type in [2, 5, 12, 15] { + let rdata = if record_type == 15 { vec![0, 10, 0xc0] } else { vec![0xc0] }; + let dns = decode(1, &packet(&response(record_type, &rdata, rdata.len()))).dns.unwrap(); + assert!(dns.incomplete); + assert!(dns.answers.is_empty()); + } +} + +/// An MX name cannot borrow either of its required preference bytes from trailing data. +#[test] +fn an_mx_exchange_cannot_skip_a_missing_preference() { + for declared in [0, 1] { + let dns = decode(1, &packet(&response(15, &[0, 10, 0xc0, 12], declared))).dns.unwrap(); + assert!(dns.incomplete); + assert!(dns.answers.is_empty()); + } +} + +/// A terminator before the declared boundary must not hide unused RDATA bytes. +#[test] +fn a_name_must_account_for_all_of_its_rdata() { + for record_type in [2, 5, 12, 15] { + let rdata = if record_type == 15 { vec![0, 10, 0, 0xaa] } else { vec![0, 0xaa] }; + let dns = decode(1, &packet(&response(record_type, &rdata, rdata.len()))).dns.unwrap(); + assert!(dns.incomplete); + assert!(dns.answers.is_empty()); + } +} + +/// Literal, root, backward-pointer and label-plus-pointer names remain valid controls. +#[test] +fn complete_and_compressed_names_remain_supported() { + for record_type in [2, 5, 12, 15] { + for (name, expected) in [ + (b"\x04mail\x07example\x00".as_slice(), "mail.example"), + (&[0xc0, 12], "example.com"), + (b"\x03www\xc0\x0c".as_slice(), "www.example.com"), + (&[0], "."), + ] { + let mut rdata = if record_type == 15 { vec![0, 10] } else { Vec::new() }; + rdata.extend(name); + let dns = decode(1, &packet(&response(record_type, &rdata, rdata.len()))).dns.unwrap(); + assert!(!dns.incomplete, "type {record_type}, name {expected}"); + assert_eq!(dns.answers.len(), 1); + assert_eq!(dns.answers[0].value, expected); + } + } +} + +#[test] +fn names_outside_rdata_do_not_enter_the_answer_inventory() { + let message = response(5, b"\x04fake\x07example\x00", 0); + let summary = summarize(&pcap(&[packet(&message)]), &|| false).unwrap(); + assert_eq!(summary.packets, 1); + assert!(summary.dns_answers.is_empty()); +} + +#[test] +fn earlier_answers_survive_before_a_malformed_name() { + let mut message = response(1, &[192, 0, 2, 3], 4); + message[6..8].copy_from_slice(&2u16.to_be_bytes()); + let malformed = response(5, b"\x04fake\x07example\x00", 0); + message.extend(&malformed[dns_query().len()..]); + + let dns = decode(1, &packet(&message)).dns.unwrap(); + assert!(dns.incomplete); + assert_eq!(dns.answers.len(), 1); + assert_eq!(dns.answers[0].rtype, "A"); + assert_eq!(dns.answers[0].value, "192.0.2.3"); +} + +fn prerequisite_message(flags: u16, record_type: u16, class: u16, ttl: u32, rdata: &[u8]) -> Vec { + let mut message = vec![0, 1]; + message.extend(flags.to_be_bytes()); + message.extend([0, 1, 0, 2, 0, 0, 0, 0]); + message.extend(b"\x07example\x04test\0"); + message.extend([0, 6, 0, 1]); // One Zone record, SOA/IN. + message.extend(b"\x05first\xc0\x0c"); + message.extend(record_type.to_be_bytes()); + message.extend(class.to_be_bytes()); + message.extend(ttl.to_be_bytes()); + message.extend((rdata.len() as u16).to_be_bytes()); + message.extend(rdata); + // A different owner lets this value-dependent prerequisite coexist with CLASS NONE above. + message.extend(b"\x05after\xc0\x0c"); + message.extend([0, 1, 0, 1, 0, 0, 0, 0, 0, 4, 192, 0, 2, 4]); + message +} + +#[test] +fn empty_update_name_prerequisites_preserve_the_following_record() { + for record_type in [2, 5, 12, 15] { + for class in [254, 255] { + let dns = decode(1, &packet(&prerequisite_message(0x2800, record_type, class, 0, &[]))).dns.unwrap(); + assert!(!dns.incomplete, "type {record_type}, class {class}"); + assert_eq!(dns.answers.len(), 2); + assert_eq!(dns.answers[0].value, ""); + assert_eq!(dns.answers[1].name, "after.example.test"); + assert_eq!(dns.answers[1].value, "192.0.2.4"); + } + } +} + +#[test] +fn empty_name_rdata_is_rejected_outside_legal_update_prerequisites() { + let cases = [(0x8180, 254, 0), (0x8180, 255, 0), (0x2000, 254, 0), (0x2000, 255, 0), (0x2800, 1, 0), (0x2800, 254, 1), (0x2800, 255, 1)]; + for record_type in [2, 5, 12, 15] { + for (flags, class, ttl) in cases { + let dns = decode(1, &packet(&prerequisite_message(flags, record_type, class, ttl, &[]))).dns.unwrap(); + assert!(dns.incomplete, "type {record_type}, flags {flags:#x}, class {class}, TTL {ttl}"); + assert!(dns.answers.is_empty()); + } + } +} + +#[test] +fn update_name_rdata_still_requires_complete_exact_encoding() { + for record_type in [2, 5, 12, 15] { + for class in [1, 254, 255] { + for name in [&[0xc0][..], &[0, 0xaa]] { + let mut rdata = if record_type == 15 { vec![0, 10] } else { Vec::new() }; + rdata.extend(name); + let dns = decode(1, &packet(&prerequisite_message(0x2800, record_type, class, 0, &rdata))).dns.unwrap(); + assert!(dns.incomplete, "type {record_type}, class {class}, name {name:?}"); + assert!(dns.answers.is_empty()); + } + } + } +} + +#[test] +fn value_dependent_update_name_prerequisites_keep_their_values() { + for record_type in [2, 5, 12, 15] { + for (name, expected) in [(&[0][..], "."), (&[0xc0, 12], "example.test")] { + let mut rdata = if record_type == 15 { vec![0, 0] } else { Vec::new() }; + rdata.extend(name); + let dns = decode(1, &packet(&prerequisite_message(0x2800, record_type, 1, 0, &rdata))).dns.unwrap(); + assert!(!dns.incomplete, "type {record_type}, name {expected}"); + assert_eq!(dns.answers.len(), 2); + assert_eq!(dns.answers[0].value, expected); + assert_eq!(dns.answers[1].value, "192.0.2.4"); + } + } +} diff --git a/crates/pcap/tests/pcap_dns_name_limit.rs b/crates/pcap/tests/pcap_dns_name_limit.rs new file mode 100644 index 000000000..f16c89387 --- /dev/null +++ b/crates/pcap/tests/pcap_dns_name_limit.rs @@ -0,0 +1,151 @@ +use craft_anything_formats::pcap::{Dns, decode}; +use craft_anything_testkit::pcap::{ipv4_pkt, udp}; + +fn query(last: usize, compressed: bool) -> Dns { + let mut msg = vec![0, 1, 1, 0, 0, if compressed { 2 } else { 1 }, 0, 0, 0, 0, 0, 0]; + for len in [63, 63, 63, last] { + msg.push(len as u8); + msg.extend(vec![b'a'; len]); + } + msg.extend([0, 0, 1, 0, 1]); + if compressed { + msg.extend([0xc0, 12, 0, 1, 0, 1]); + } + decode(101, &ipv4_pkt(17, [1; 4], [2; 4], &udp(100, 53, &msg))).dns.unwrap() +} + +#[test] +fn label_lengths_and_the_root_octet_count_towards_the_dns_limit() { + for last in [62, 63] { + let dns = query(last, false); + assert!(dns.incomplete); + assert!(dns.questions.is_empty()); + } +} + +#[test] +fn a_255_octet_name_is_valid_in_plain_and_compressed_form() { + for compressed in [false, true] { + let dns = query(61, compressed); + assert!(!dns.incomplete); + assert_eq!(dns.questions.len(), if compressed { 2 } else { 1 }); + assert_eq!(dns.questions[0].name.len(), 253); + } +} + +fn prefixed_pointer(last: usize, answer_type: Option) -> Dns { + let mut msg = vec![0, 1, 0x81, 0x80, 0, if answer_type.is_some() { 1 } else { 2 }, 0, u8::from(answer_type.is_some()), 0, 0, 0, 0]; + for len in [63, 63, 63, last] { + msg.push(len as u8); + msg.extend(vec![b'a'; len]); + } + msg.extend([0, 0, 1, 0, 1]); + if let Some(rtype) = answer_type { + msg.extend([0xc0, 12]); + msg.extend(rtype.to_be_bytes()); + msg.extend([0, 1, 0, 0, 0, 0, 0, if rtype == 15 { 6 } else { 4 }]); + if rtype == 15 { + msg.extend([0, 10]); + } + } + msg.extend([1, b'x', 0xc0, 12]); + if answer_type.is_none() { + msg.extend([0, 1, 0, 1]); + } + decode(101, &ipv4_pkt(17, [1; 4], [2; 4], &udp(100, 53, &msg))).dns.unwrap() +} + +#[test] +fn a_literal_prefix_and_pointer_cannot_exceed_the_question_name_limit() { + let dns = prefixed_pointer(61, None); + assert!(dns.incomplete); + assert_eq!(dns.questions.len(), 1); +} + +#[test] +fn invalid_name_rdata_is_incomplete_instead_of_an_empty_answer() { + for rtype in [2, 5, 12, 15] { + let dns = prefixed_pointer(61, Some(rtype)); + assert!(dns.incomplete, "record type {rtype}"); + assert_eq!(dns.questions.len(), 1); + assert!(dns.answers.is_empty(), "record type {rtype}"); + } +} + +#[test] +fn a_prefixed_pointer_at_255_octets_remains_valid() { + let dns = prefixed_pointer(59, None); + assert!(!dns.incomplete); + assert_eq!(dns.questions.len(), 2); + for rtype in [2, 5, 12, 15] { + let dns = prefixed_pointer(59, Some(rtype)); + assert!(!dns.incomplete, "record type {rtype}"); + assert_eq!(dns.answers.len(), 1); + assert_eq!(dns.answers[0].value.len(), 253); + } +} + +fn name_rdata_then_a(flags: u16, class: u16, ttl: u32, rtype: u16, rdata: &[u8]) -> Dns { + let mut msg = vec![0, 1]; + msg.extend(flags.to_be_bytes()); + msg.extend([0, 1, 0, 2, 0, 0, 0, 0]); + msg.extend(b"\x07example\x04test\0"); + msg.extend([0, 6, 0, 1]); // Zone: SOA/IN for UPDATE requests. + msg.extend([3, b'o', b'n', b'e', 0xc0, 12]); + msg.extend(rtype.to_be_bytes()); + msg.extend(class.to_be_bytes()); + msg.extend(ttl.to_be_bytes()); + msg.extend((rdata.len() as u16).to_be_bytes()); + msg.extend(rdata); + // A different owner keeps the two UPDATE prerequisites independent. + msg.extend([4, b'n', b'e', b'x', b't', 0xc0, 12, 0, 1, 0, 1, 0, 0, 0, 0, 0, 4, 203, 0, 113, 1]); + decode(101, &ipv4_pkt(17, [1; 4], [2; 4], &udp(100, 53, &msg))).dns.unwrap() +} + +#[test] +fn empty_update_name_prerequisites_preserve_the_following_record() { + for rtype in [2, 5, 12, 15] { + for class in [254, 255] { + let dns = name_rdata_then_a(0x2800, class, 0, rtype, &[]); + assert!(!dns.incomplete, "type {rtype}, class {class}"); + assert_eq!(dns.answers.len(), 2); + assert_eq!(dns.answers[0].value, ""); + assert_eq!(dns.answers[1].value, "203.0.113.1"); + } + } +} + +#[test] +fn empty_name_rdata_is_rejected_outside_legal_update_prerequisites() { + let cases = [(0x8180, 254, 0), (0x8180, 255, 0), (0x2000, 254, 0), (0x2000, 255, 0), (0x2800, 1, 0), (0x2800, 254, 1), (0x2800, 255, 1)]; + for rtype in [2, 5, 12, 15] { + for (flags, class, ttl) in cases { + let dns = name_rdata_then_a(flags, class, ttl, rtype, &[]); + assert!(dns.incomplete, "type {rtype}, flags {flags:#x}, class {class}, TTL {ttl}"); + assert!(dns.answers.is_empty()); + } + } +} + +#[test] +fn a_cut_rdata_pointer_cannot_borrow_the_following_owner() { + for rtype in [2, 5, 12, 15] { + let mut rdata = if rtype == 15 { vec![0, 10] } else { Vec::new() }; + rdata.push(0xc0); // The next owner's length would complete a pointer to the header's zero byte. + let dns = name_rdata_then_a(0x8180, 1, 0, rtype, &rdata); + assert!(dns.incomplete, "type {rtype}"); + assert!(dns.answers.is_empty()); + } +} + +#[test] +fn root_name_rdata_remains_valid() { + for rtype in [2, 5, 12, 15] { + let rdata = if rtype == 15 { vec![0, 0, 0] } else { vec![0] }; + let dns = name_rdata_then_a(0x8180, 1, 0, rtype, &rdata); + assert!(!dns.incomplete, "type {rtype}"); + assert_eq!(dns.answers.len(), 2); + assert_eq!(dns.answers[0].value, "."); + assert_eq!(dns.answers[1].value, "203.0.113.1"); + } +} diff --git a/crates/pcap/tests/pcap_dns_txt_lengths.rs b/crates/pcap/tests/pcap_dns_txt_lengths.rs new file mode 100644 index 000000000..a90207b21 --- /dev/null +++ b/crates/pcap/tests/pcap_dns_txt_lengths.rs @@ -0,0 +1,196 @@ +use craft_anything_formats::pcap::{Dns, decode}; +use craft_anything_testkit::pcap::{ipv4_pkt, udp}; + +fn response(data: &[u8]) -> Dns { + let mut msg = vec![0, 1, 0x81, 0x80, 0, 0, 0, 1, 0, 0, 0, 0]; + msg.extend([0, 0, 16, 0, 1, 0, 0, 0, 60]); + msg.extend((data.len() as u16).to_be_bytes()); + msg.extend(data); + decode(101, &ipv4_pkt(17, [1; 4], [2; 4], &udp(53, 100, &msg))).dns.unwrap() +} + +fn prerequisites(flags: u16, class: u16, ttl: u32, data: &[u8]) -> Dns { + let mut msg = vec![0, 1]; + msg.extend(flags.to_be_bytes()); + msg.extend([0, 1, 0, 2, 0, 0, 0, 0]); + // UPDATE's zone section has the question layout: example.test, SOA, IN. + msg.extend(b"\x07example\x04test\x00\x00\x06\x00\x01"); + msg.extend([0xc0, 12, 0, 16]); + msg.extend(class.to_be_bytes()); + msg.extend(ttl.to_be_bytes()); + msg.extend((data.len() as u16).to_be_bytes()); + msg.extend(data); + // Different owners let NONE and value-dependent prerequisites hold together. + // The following TXT record must also survive. + msg.extend(b"\x05after"); + msg.extend([0xc0, 12, 0, 16, 0, 1, 0, 0, 0, 0, 0, 3, 2, b'o', b'k']); + decode(101, &ipv4_pkt(17, [1; 4], [2; 4], &udp(100, 53, &msg))).dns.unwrap() +} + +fn named_txt(owner: &[&[u8]], data: &[u8], port: u16, flags: u16, class: u16, ttl: u32, compressed: bool) -> Dns { + let mut name = Vec::new(); + for label in owner { + name.push(u8::try_from(label.len()).unwrap()); + name.extend(*label); + } + name.push(0); + let mut msg = vec![0, 1]; + msg.extend(flags.to_be_bytes()); + msg.extend([0, 1, 0, 2, 0, 0, 0, 0]); + msg.extend(&name); + msg.extend([0, 16, 0, 1]); + if compressed { + msg.extend([0xc0, 12]); + } else { + msg.extend(&name); + } + msg.extend([0, 16]); + msg.extend(class.to_be_bytes()); + msg.extend(ttl.to_be_bytes()); + msg.extend(u16::try_from(data.len()).unwrap().to_be_bytes()); + msg.extend(data); + // The next answer must survive an empty DNS-SD TXT record. + msg.extend([0xc0, 12, 0, 1, 0, 1, 0, 0, 0, 60, 0, 4, 127, 0, 0, 1]); + decode(101, &ipv4_pkt(17, [1; 4], [2; 4], &udp(port, 100, &msg))).dns.unwrap() +} + +fn assert_empty_txt_and_following_answer(dns: Dns) { + assert!(!dns.incomplete); + assert_eq!(dns.answers.len(), 2); + assert_eq!(dns.answers[0].rtype, "TXT"); + assert_eq!(dns.answers[0].value, ""); + assert_eq!(dns.answers[1].value, "127.0.0.1"); +} + +#[test] +fn empty_dns_sd_txt_preserves_following_answers() { + let multicast: &[&[u8]] = &[b"Printer", b"_ipp", b"_tcp", b"local"]; + let unicast: &[&[u8]] = &[b"Printer", b"_ipp", b"_tcp", b"example", b"test"]; + for (port, owner) in [(5353, multicast), (53, unicast)] { + assert_empty_txt_and_following_answer(named_txt(owner, &[], port, 0x8400, 1, 60, false)); + } +} + +#[test] +fn empty_dns_sd_txt_is_valid_in_mdns_known_answers_and_cache_flush_records() { + let owner: &[&[u8]] = &[b"Printer", b"_ipp", b"_tcp", b"local"]; + // Queries may contain known answers; the cache-flush bit belongs to CLASS. + for (flags, class) in [(0, 1), (0x8400, 0x8001)] { + assert_empty_txt_and_following_answer(named_txt(owner, &[], 5353, flags, class, 60, false)); + } +} + +#[test] +fn dns_sd_owner_preserves_wire_labels_case_and_compression() { + let owner: &[&[u8]] = &[b"Printer.with dots", b"_Ab-12", b"_UdP", b"example", b"test"]; + for compressed in [false, true] { + assert_empty_txt_and_following_answer(named_txt(owner, &[], 53, 0x8180, 1, 60, compressed)); + } +} + +#[test] +fn other_empty_txt_owners_are_not_dns_sd_instances() { + let owners: &[&[&[u8]]] = &[ + &[b"Printer", b"local"], + &[b"Printer._ipp._tcp", b"local"], + &[b"Printer", b"_ipp._tcp", b"_tcp", b"local"], + &[b"_ipp", b"_tcp", b"local"], + &[b"Printer", b"_ipp", b"_tcp"], + &[b"Printer", b"_ipp", b"_other", b"local"], + &[b"Printer", b"_123", b"_tcp", b"local"], + &[b"Printer", b"_bad--name", b"_tcp", b"local"], + ]; + for owner in owners { + let dns = named_txt(owner, &[], 5353, 0x8400, 1, 60, false); + assert!(dns.incomplete, "owner {owner:?}"); + assert!(dns.answers.is_empty()); + } +} + +#[test] +fn dns_sd_txt_still_rejects_truncated_nonempty_strings() { + let owner: &[&[u8]] = &[b"Printer", b"_ipp", b"_tcp", b"local"]; + for data in [&b"\x02x"[..], &b"\x00\x04x"[..]] { + let dns = named_txt(owner, data, 5353, 0x8400, 0x8001, 60, true); + assert!(dns.incomplete); + assert!(dns.answers.is_empty()); + } +} + +#[test] +fn dns_sd_owner_does_not_relax_update_prerequisite_classes() { + let owner: &[&[u8]] = &[b"Printer", b"_ipp", b"_tcp", b"example", b"test"]; + let dns = named_txt(owner, &[], 53, 5 << 11, 1, 0, true); + assert!(dns.incomplete); + assert!(dns.answers.is_empty()); + for class in [254, 255] { + assert_empty_txt_and_following_answer(named_txt(owner, &[], 53, 5 << 11, class, 0, true)); + } +} + +#[test] +fn empty_update_prerequisites_preserve_following_records() { + for class in [254, 255] { + let dns = prerequisites(5 << 11, class, 0, &[]); + assert!(!dns.incomplete, "class {class}"); + assert_eq!(dns.answers.len(), 2); + assert_eq!(dns.answers[0].name, "example.test"); + assert_eq!(dns.answers[0].value, ""); + assert_eq!(dns.answers[1].name, "after.example.test"); + assert_eq!(dns.answers[1].value, "ok"); + } +} + +#[test] +fn empty_txt_rdata_requires_update_and_a_prerequisite_class() { + assert!(response(&[]).incomplete); + for (flags, class, ttl) in [(0x8180, 254, 0), (0x8180, 255, 0), (5 << 11, 1, 0), (5 << 11, 254, 60), (5 << 11, 255, 60)] { + let dns = prerequisites(flags, class, ttl, &[]); + assert!(dns.incomplete, "flags {flags:#x}, class {class}, ttl {ttl}"); + assert!(dns.answers.is_empty()); + } + for opcode in [1, 2, 3, 4, 6] { + for class in [254, 255] { + let dns = prerequisites(opcode << 11, class, 0, &[]); + assert!(dns.incomplete, "opcode {opcode}, class {class}"); + assert!(dns.answers.is_empty()); + } + } +} + +#[test] +fn update_prerequisite_classes_do_not_allow_truncated_strings() { + for class in [254, 255] { + let dns = prerequisites(5 << 11, class, 0, b"\x02x"); + assert!(dns.incomplete); + assert!(dns.answers.is_empty()); + } +} + +#[test] +fn truncated_txt_strings_are_not_complete_answers() { + for data in [&b"\x05abc"[..], &b"\x02ok\x04x"[..], &b"\x01"[..]] { + let dns = response(data); + assert!(dns.incomplete); + assert!(dns.answers.is_empty()); + } +} + +#[test] +fn empty_and_multiple_complete_strings_remain_valid() { + for (data, expected) in [(&b"\x00"[..], ""), (&b"\x00\x02ok\x01!"[..], "ok!")] { + let dns = response(data); + assert!(!dns.incomplete); + assert_eq!(dns.answers[0].value, expected); + } +} + +#[test] +fn value_dependent_update_accepts_an_empty_character_string() { + let dns = prerequisites(5 << 11, 1, 0, b"\x00"); + assert!(!dns.incomplete); + assert_eq!(dns.answers.len(), 2); + assert_eq!(dns.answers[0].value, ""); + assert_eq!(dns.answers[1].name, "after.example.test"); + assert_eq!(dns.answers[1].value, "ok"); +} diff --git a/crates/pcap/tests/pcap_flow_time_range.rs b/crates/pcap/tests/pcap_flow_time_range.rs new file mode 100644 index 000000000..96b6c128b --- /dev/null +++ b/crates/pcap/tests/pcap_flow_time_range.rs @@ -0,0 +1,36 @@ +use craft_anything_formats::pcap::summarize; +use craft_anything_testkit::pcap::{block, eth, ipv4_pkt, pcap, pcapng, udp}; + +fn frame() -> Vec { + eth(0x0800, &ipv4_pkt(17, [1; 4], [2; 4], &udp(100, 200, b"body"))) +} + +#[test] +fn out_of_order_flow_packets_keep_the_earliest_and_latest_timestamps() { + let f = frame(); + let mut capture = pcap(&[f.clone(), f.clone(), f.clone()]); + for (i, seconds) in [30u32, 10, 20].into_iter().enumerate() { + let at = 24 + i * (16 + f.len()); + capture[at..at + 4].copy_from_slice(&seconds.to_le_bytes()); + } + let summary = summarize(&capture, &|| false).unwrap(); + let flow = &summary.flows[0]; + assert_eq!(flow.first_ts_ns, summary.first_ts_ns); + assert_eq!(flow.last_ts_ns, summary.last_ts_ns); + assert_eq!(flow.first_frame, 1); +} + +#[test] +fn a_timestamped_packet_fills_a_flow_started_by_a_simple_packet() { + let f = frame(); + let headers = pcapng(&[]); + let mut simple = (f.len() as u32).to_le_bytes().to_vec(); + simple.extend(&f); + let mut capture = headers.clone(); + capture.extend(block(3, &simple)); + capture.extend(&pcapng(&[f])[headers.len()..]); + let summary = summarize(&capture, &|| false).unwrap(); + assert!(summary.first_ts_ns.is_some()); + assert_eq!(summary.flows[0].first_ts_ns, summary.first_ts_ns); + assert_eq!(summary.flows[0].last_ts_ns, summary.last_ts_ns); +} diff --git a/crates/pcap/tests/pcap_http_host_boundary.rs b/crates/pcap/tests/pcap_http_host_boundary.rs new file mode 100644 index 000000000..13b6955d8 --- /dev/null +++ b/crates/pcap/tests/pcap_http_host_boundary.rs @@ -0,0 +1,24 @@ +use craft_anything_formats::pcap::{Http, decode}; +use craft_anything_testkit::pcap::{ipv4_pkt, tcp}; + +fn request(data: &[u8]) -> Http { + decode(101, &ipv4_pkt(6, [1; 4], [2; 4], &tcp(100, 80, 0x18, data))).http.unwrap() +} + +#[test] +fn a_host_shaped_line_in_the_body_is_not_a_request_header() { + let http = request(b"POST / HTTP/1.1\r\nContent-Length: 22\r\n\r\nbody\r\nHost: forged.test\r\n"); + assert!(http.host.is_none()); +} + +#[test] +fn invalid_utf8_before_host_does_not_shift_header_byte_offsets() { + let http = request(b"GET / HTTP/1.1\r\nX-Data: \xff\r\nHoSt:\tReal.test \t\r\n\r\n"); + assert_eq!(http.host.as_deref(), Some("Real.test")); +} + +#[test] +fn host_requires_a_complete_header_line_and_keeps_its_spelling() { + assert!(request(b"GET / HTTP/1.1\r\nHost: cut").host.is_none()); + assert_eq!(request(b"GET / HTTP/1.1\r\nHost: Real.test\r\n\r\n").host.as_deref(), Some("Real.test")); +} diff --git a/crates/pcap/tests/pcap_ipv4_lengths.rs b/crates/pcap/tests/pcap_ipv4_lengths.rs new file mode 100644 index 000000000..21f1f6eac --- /dev/null +++ b/crates/pcap/tests/pcap_ipv4_lengths.rs @@ -0,0 +1,57 @@ +use craft_anything_formats::pcap::decode; +use craft_anything_testkit::pcap::{ipv4_pkt, udp}; + +#[test] +fn incomplete_ipv4_base_headers_explain_why_decoding_stopped() { + let packet = ipv4_pkt(17, [1; 4], [2; 4], &[]); + for captured in 10..20 { + let decoded = decode(101, &packet[..captured]); + assert!(decoded.ip.is_none(), "captured {captured} bytes"); + assert!(decoded.transport.is_none(), "captured {captured} bytes"); + assert_eq!(decoded.note.as_deref(), Some("IPv4 header cut short"), "captured {captured} bytes"); + } +} + +#[test] +fn an_ipv4_total_length_cannot_be_shorter_than_its_header() { + for total in [0u16, 19, 23] { + let mut packet = ipv4_pkt(17, [1, 2, 3, 4], [5, 6, 7, 8], &udp(100, 200, b"body")); + packet[0] = 0x46; + packet[2..4].copy_from_slice(&total.to_be_bytes()); + let decoded = decode(101, &packet); + assert!(decoded.ip.is_none()); + assert!(decoded.transport.is_none()); + assert!(decoded.note.is_some()); + } +} + +#[test] +fn missing_ipv4_options_do_not_form_a_complete_ip_header() { + let mut packet = ipv4_pkt(17, [1; 4], [2; 4], &[]); + packet[0] = 0x46; + packet[2..4].copy_from_slice(&24u16.to_be_bytes()); + let decoded = decode(101, &packet); + assert!(decoded.ip.is_none()); + assert!(decoded.note.is_some()); +} + +#[test] +fn complete_options_and_truncated_transport_keep_their_valid_fields() { + let body = udp(100, 200, b"body"); + let mut payload = vec![0; 4]; + payload.extend(body); + let mut packet = ipv4_pkt(17, [1; 4], [2; 4], &payload); + packet[0] = 0x46; + assert_eq!(decode(101, &packet).transport.unwrap().payload_len, 4); + packet.truncate(34); + let decoded = decode(101, &packet); + assert!(decoded.ip.is_some()); + let transport = decoded.transport.unwrap(); + assert_eq!(transport.src_port, Some(100)); + assert_eq!(transport.dst_port, Some(200)); + assert_eq!(transport.payload_len, 2); + packet.truncate(28); + let decoded = decode(101, &packet); + assert!(decoded.ip.is_some()); + assert_eq!(decoded.transport.unwrap().src_port, Some(100)); +} diff --git a/crates/pcap/tests/pcap_ipv6_fragments.rs b/crates/pcap/tests/pcap_ipv6_fragments.rs new file mode 100644 index 000000000..8f82257d1 --- /dev/null +++ b/crates/pcap/tests/pcap_ipv6_fragments.rs @@ -0,0 +1,40 @@ +use craft_anything_formats::pcap::decode; +use craft_anything_testkit::pcap::{eth, udp}; + +fn packet(offset: u16, next: u8, payload: &[u8]) -> Vec { + let mut ip = vec![0u8; 40]; + ip[0] = 0x60; + ip[4..6].copy_from_slice(&((8 + payload.len()) as u16).to_be_bytes()); + ip[6] = 44; + ip.extend([next, 0]); + ip.extend(offset.to_be_bytes()); + ip.extend([0; 4]); + ip.extend(payload); + eth(0x86dd, &ip) +} + +#[test] +fn a_noninitial_fragment_cannot_reset_its_offset_from_payload_bytes() { + let mut payload = vec![17, 0, 0, 0, 0, 0, 0, 0]; + payload.extend(udp(100, 200, b"body")); + let decoded = decode(1, &packet(8, 44, &payload)); + assert!(decoded.ip.unwrap().fragment); + assert!(decoded.transport.is_none()); + assert!(!decoded.protocols.contains(&"udp")); +} + +#[test] +fn noninitial_fragment_bytes_cannot_change_the_recorded_protocol() { + let decoded = decode(1, &packet(8, 60, &[17, 0, 0, 0, 0, 0, 0, 0])); + assert_eq!(decoded.ip.unwrap().protocol, 60); + assert!(decoded.transport.is_none()); +} + +#[test] +fn initial_and_atomic_fragments_still_decode_transport_headers() { + for offset in [0, 1] { + let decoded = decode(1, &packet(offset, 17, &udp(100, 200, b"body"))); + assert!(!decoded.ip.unwrap().fragment); + assert_eq!(decoded.transport.unwrap().payload_len, 4); + } +} diff --git a/crates/pcap/tests/pcap_ipv6_version.rs b/crates/pcap/tests/pcap_ipv6_version.rs new file mode 100644 index 000000000..4e4b25dc3 --- /dev/null +++ b/crates/pcap/tests/pcap_ipv6_version.rs @@ -0,0 +1,53 @@ +use craft_anything_formats::pcap::decode; +use craft_anything_testkit::pcap::{eth, ipv4_pkt}; + +fn raw_packets() -> (Vec, Vec) { + let ipv4 = ipv4_pkt(17, [1; 4], [2; 4], &[0; 20]); + let mut ipv6 = vec![0u8; 40]; + ipv6[0] = 0x60; + ipv6[6] = 59; + (ipv4, ipv6) +} + +#[test] +fn explicit_raw_link_types_reject_the_other_ip_version() { + let (ipv4, ipv6) = raw_packets(); + for (link_type, packet) in [(228, &ipv6), (229, &ipv4)] { + let decoded = decode(link_type, packet); + assert!(decoded.ip.is_none(), "link type {link_type}"); + assert!(decoded.transport.is_none(), "link type {link_type}"); + assert!(decoded.note.is_some(), "link type {link_type}"); + } +} + +#[test] +fn matching_raw_link_types_and_generic_raw_packets_remain_readable() { + let (ipv4, ipv6) = raw_packets(); + assert_eq!(decode(228, &ipv4).ip.unwrap().version, 4); + assert_eq!(decode(229, &ipv6).ip.unwrap().version, 6); + for link_type in [12, 14, 101] { + assert_eq!(decode(link_type, &ipv4).ip.unwrap().version, 4); + assert_eq!(decode(link_type, &ipv6).ip.unwrap().version, 6); + } +} + +#[test] +fn an_ethernet_type_does_not_replace_the_ipv6_version_check() { + for version in [0, 4, 5, 7, 15] { + let mut packet = [0u8; 40]; + packet[0] = version << 4; + packet[6] = 59; + let decoded = decode(1, ð(0x86dd, &packet)); + assert!(decoded.ip.is_none(), "version {version}"); + assert!(decoded.transport.is_none()); + assert!(decoded.note.is_some()); + } +} + +#[test] +fn ipv6_version_keeps_traffic_class_bits() { + let mut packet = [0u8; 40]; + packet[0] = 0x6f; + packet[6] = 59; + assert_eq!(decode(1, ð(0x86dd, &packet)).ip.unwrap().version, 6); +} diff --git a/crates/pcap/tests/pcapng_simple_payload.rs b/crates/pcap/tests/pcapng_simple_payload.rs new file mode 100644 index 000000000..c61f6c70a --- /dev/null +++ b/crates/pcap/tests/pcapng_simple_payload.rs @@ -0,0 +1,62 @@ +use craft_anything_formats::pcap::Capture; +use craft_anything_testkit::pcap::{block, pcapng}; + +fn capture(original: u32, snaplen: u32, payload: &[u8]) -> Vec { + let mut out = pcapng(&[]); + out[40..44].copy_from_slice(&snaplen.to_le_bytes()); + let mut body = original.to_le_bytes().to_vec(); + body.extend(payload); + out.extend(block(3, &body)); + out +} + +#[test] +fn a_simple_packet_cannot_silently_shorten_its_declared_capture() { + let data = capture(10, 0, &[1, 2, 3, 4]); + let mut cap = Capture::new(&data).unwrap(); + assert!(cap.next().is_none()); + assert!(!cap.warnings.is_empty()); +} + +#[test] +fn a_simple_packet_cannot_have_unexplained_extra_payload() { + let data = capture(1, 0, &[1; 8]); + let mut cap = Capture::new(&data).unwrap(); + assert!(cap.next().is_none()); + assert!(!cap.warnings.is_empty()); +} + +#[test] +fn snaplen_truncation_and_alignment_padding_are_preserved() { + for (original, snaplen) in [(3, 0), (10, 3)] { + let data = capture(original, snaplen, &[1, 2, 3]); + let mut cap = Capture::new(&data).unwrap(); + let packet = cap.next().unwrap(); + assert_eq!(packet.data, [1, 2, 3]); + assert_eq!(packet.original_len, original); + assert!(cap.next().is_none()); + assert!(cap.warnings.is_empty()); + } +} + +#[test] +fn rejected_simple_packets_share_one_warning_and_preserve_later_frames() { + let mut data = pcapng(&[]); + let rejected = block(3, &1u32.to_le_bytes()); + for _ in 0..128 { + data.extend(&rejected); + } + let mut valid = 3u32.to_le_bytes().to_vec(); + valid.extend([1, 2, 3]); + data.extend(block(3, &valid)); + let mut cap = Capture::new(&data).unwrap(); + let frame = cap.next().unwrap(); + assert_eq!(frame.number, 1); + assert_eq!(frame.data, [1, 2, 3]); + assert!(cap.next().is_none()); + assert!(!cap.truncated); + assert_eq!(cap.warnings.len(), 1); + assert!(cap.warnings[0].contains("128 simple packet blocks")); + assert!(cap.next().is_none()); + assert_eq!(cap.warnings.len(), 1); +} From f4ddb7234dcb0f5e74b6c5a09a31a48de04060a9 Mon Sep 17 00:00:00 2001 From: Afloat Date: Tue, 17 Nov 2026 08:37:50 -0500 Subject: [PATCH 041/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything 6cbc66984c518bf4af7ed261594431eceba54e95. --- crates/pcap/src/lib.rs | 36 +++++++---- crates/pcap/tests/regression_tls_bounds.rs | 71 ++++++++++++++++++++++ 2 files changed, 96 insertions(+), 11 deletions(-) diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index d82dc8fea..695256f81 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -1037,7 +1037,7 @@ fn tls(p: &[u8], d: &mut Decoded) { 0x0302 => "TLS 1.1".into(), 0x0303 => "TLS 1.2".into(), 0x0304 => "TLS 1.3".into(), - v if v & 0x0f0f == 0x0a0a => "GREASE".into(), + v if v & 0x0f0f == 0x0a0a && v >> 8 == v & 0xff => "GREASE".into(), v => format!("{v:#06x}"), }; let mut hello = TlsHello { @@ -1057,18 +1057,24 @@ fn tls(p: &[u8], d: &mut Decoded) { let hello_end = handshake_end.min(record_end_available); let r = Reader::new(p.get(..hello_end).unwrap_or(&[])); // Every variable-length field must fit inside this handshake, not merely the packet. - let skip8 = |off: usize| { + let skip8 = |off: usize, min: usize, max: usize| { let n = usize::from(r.u8(off)?); + if !(min..=max).contains(&n) { + return None; + } r.slice(off + 1, n)?; Some(off + 1 + n) }; - let skip16 = |off: usize| { + let cipher_suites_end = |off: usize| { let n = usize::from(r.u16_be(off)?); + if n < 2 || n % 2 != 0 { + return None; + } r.slice(off + 2, n)?; Some(off + 2 + n) }; // Record header (5) + handshake header (4) + client_version (2) + random (32). - let Some(off) = skip8(5 + 4 + 2 + 32).and_then(skip16).and_then(skip8) else { + let Some(off) = skip8(5 + 4 + 2 + 32, 0, 32).and_then(cipher_suites_end).and_then(|p| skip8(p, 1, 255)) else { hello.partial = true; d.tls = Some(hello); return; @@ -1087,6 +1093,7 @@ fn tls(p: &[u8], d: &mut Decoded) { hello.partial |= declared_end != handshake_end; let end = declared_end.min(hello_end); let extensions = Reader::new(p.get(..end).unwrap_or(&[])); + let mut seen_extensions = BTreeSet::new(); let mut e = off + 2; while e + 4 <= end { let (Some(t), Some(l)) = (extensions.u16_be(e), extensions.u16_be(e + 2)) else { break }; @@ -1095,12 +1102,17 @@ fn tls(p: &[u8], d: &mut Decoded) { hello.partial = true; break; }; + if !seen_extensions.insert(t) { + hello.partial = true; + e = body + usize::from(l); + continue; + } let dr = Reader::new(data); match t { 0 => { if let Some(len) = dr.u16_be(0) { let list_end = 2 + usize::from(len); - hello.partial |= list_end != data.len(); + hello.partial |= len == 0 || list_end != data.len(); let names = Reader::new(data.get(..list_end.min(data.len())).unwrap_or(&[])); let mut a = 2; while a < list_end.min(data.len()) { @@ -1113,9 +1125,9 @@ fn tls(p: &[u8], d: &mut Decoded) { break; }; if kind == 0 { - if name.is_empty() { + if name.is_empty() || hello.sni.is_some() { hello.partial = true; - } else if hello.sni.is_none() { + } else { hello.sni = Some(name.iter().map(|&c| if c.is_ascii_graphic() { char::from(c) } else { '?' }).collect()); } } @@ -1128,10 +1140,10 @@ fn tls(p: &[u8], d: &mut Decoded) { 16 => { if let Some(len) = dr.u16_be(0) { let list_end = 2 + usize::from(len); - hello.partial |= list_end != data.len(); + hello.partial |= len == 0 || list_end != data.len(); let protocols = Reader::new(data.get(..list_end.min(data.len())).unwrap_or(&[])); let mut a = 2usize; - while a < list_end.min(data.len()) && hello.alpn.len() < 16 { + while a < list_end.min(data.len()) { let Some(n) = protocols.u8(a).filter(|&n| n > 0) else { hello.partial = true; break; @@ -1140,7 +1152,9 @@ fn tls(p: &[u8], d: &mut Decoded) { hello.partial = true; break; }; - hello.alpn.push(String::from_utf8_lossy(proto).into_owned()); + if hello.alpn.len() < 16 { + hello.alpn.push(String::from_utf8_lossy(proto).into_owned()); + } a += 1 + usize::from(n); } } else { @@ -1150,7 +1164,7 @@ fn tls(p: &[u8], d: &mut Decoded) { 43 => { if let Some(len) = dr.u8(0) { let list_end = 1 + usize::from(len); - hello.partial |= list_end != data.len() || len % 2 != 0; + hello.partial |= len < 2 || list_end != data.len() || len % 2 != 0; let versions = Reader::new(data.get(..list_end.min(data.len())).unwrap_or(&[])); let mut a = 1usize; while let Some(v) = versions.u16_be(a) { diff --git a/crates/pcap/tests/regression_tls_bounds.rs b/crates/pcap/tests/regression_tls_bounds.rs index 674ff7942..b616df155 100644 --- a/crates/pcap/tests/regression_tls_bounds.rs +++ b/crates/pcap/tests/regression_tls_bounds.rs @@ -100,3 +100,74 @@ fn complete_hello_metadata_is_unchanged() { assert_eq!(hello.supported_versions, ["TLS 1.3", "TLS 1.2"]); assert!(!hello.partial); } + +fn hello_with_vectors(session: &[u8], suites: &[u8], compression: &[u8], extensions: &[(u16, &[u8])]) -> craft_anything_formats::pcap::TlsHello { + let mut record = client_hello("unused.test"); + record.truncate(43); + record.push(session.len() as u8); + record.extend(session); + record.extend((suites.len() as u16).to_be_bytes()); + record.extend(suites); + record.push(compression.len() as u8); + record.extend(compression); + let mut ext = Vec::new(); + for (kind, bytes) in extensions { + ext.extend(kind.to_be_bytes()); + ext.extend((bytes.len() as u16).to_be_bytes()); + ext.extend(*bytes); + } + record.extend((ext.len() as u16).to_be_bytes()); + record.extend(ext); + let len = record.len(); + record[3..5].copy_from_slice(&((len - 5) as u16).to_be_bytes()); + record[6..9].copy_from_slice(&((len - 9) as u32).to_be_bytes()[1..]); + decoded(&record).tls.unwrap() +} + +#[test] +fn hello_vectors_must_have_protocol_lengths() { + assert!(!hello_with_vectors(&[0; 32], &[0, 47], &[0], &[]).partial); + assert!(hello_with_vectors(&[0; 33], &[0, 47], &[0], &[]).partial); + for suites in [&[][..], &[0, 47, 0][..]] { + assert!(hello_with_vectors(&[], suites, &[0], &[]).partial); + } + assert!(hello_with_vectors(&[], &[0, 47], &[], &[]).partial); + for (kind, empty) in [(0, &[0, 0][..]), (16, &[0, 0][..]), (43, &[0][..])] { + assert!(hello_with_vectors(&[], &[0, 47], &[0], &[(kind, empty)]).partial); + } +} + +#[test] +fn only_registered_grease_patterns_are_removed() { + let hello = hello_with_vectors(&[], &[0, 47], &[0], &[(43, &[6, 0x1a, 0x2a, 0x4a, 0x4a, 3, 4])]); + assert!(!hello.partial); + assert_eq!(hello.supported_versions, ["0x1a2a", "TLS 1.3"]); +} + +#[test] +fn duplicate_extensions_and_repeated_host_names_are_incomplete() { + let hello = hello_with_vectors(&[], &[0, 47], &[0], &[(43, &[2, 3, 4]), (43, &[2, 3, 3])]); + assert!(hello.partial); + assert_eq!(hello.supported_versions, ["TLS 1.3"]); + let hello = hello_with_vectors(&[], &[0, 47], &[0], &[(0, &[0, 8, 0, 0, 1, b'a', 0, 0, 1, b'b'])]); + assert!(hello.partial); + assert_eq!(hello.sni.as_deref(), Some("a")); +} + +#[test] +fn the_alpn_display_limit_does_not_hide_a_damaged_tail() { + let mut protocols = vec![0, 33]; + for _ in 0..16 { + protocols.extend([1, b'x']); + } + protocols.push(3); + let hello = hello_with_vectors(&[], &[0, 47], &[0], &[(16, &protocols)]); + assert_eq!(hello.alpn.len(), 16); + assert!(hello.partial); + protocols[1] = 34; + protocols.pop(); + protocols.extend([1, b'y']); + let hello = hello_with_vectors(&[], &[0, 47], &[0], &[(16, &protocols)]); + assert_eq!(hello.alpn.len(), 16); + assert!(!hello.partial); +} From 89152c14d8e2fd81d101a18f2b598192e1734edf Mon Sep 17 00:00:00 2001 From: Afloat Date: Tue, 17 Nov 2026 08:37:50 -0500 Subject: [PATCH 042/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything aed326ca6d74bfd119a3d1b191257c8f06fe3c51. --- crates/pcap/src/lib.rs | 120 +++++++++++++++++++++++++++++++++++------ 1 file changed, 103 insertions(+), 17 deletions(-) diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index 695256f81..53fe2e44e 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -12,7 +12,7 @@ use serde::Serialize; use std::collections::{BTreeMap, BTreeSet, HashMap}; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; -/// Most frames and rejected simple packet blocks read from one capture. +/// Most accepted and rejected packet records read from one capture. pub const MAX_PACKETS: u64 = 5_000_000; /// Most flows tracked; later flows are counted but get no id. pub const MAX_FLOWS: usize = 100_000; @@ -90,7 +90,10 @@ pub struct Capture<'a> { pub truncated: bool, count: u64, rejected_simple_blocks: u64, - rejected_simple_reported: bool, + rejected_short_blocks: u64, + rejected_interfaces: u64, + invalid_fractions: u64, + warnings_reported: bool, } fn rd_u16(r: &Reader<'_>, le: bool, off: usize) -> Option { @@ -129,7 +132,10 @@ impl<'a> Capture<'a> { truncated: false, count: 0, rejected_simple_blocks: 0, - rejected_simple_reported: false, + rejected_short_blocks: 0, + rejected_interfaces: 0, + invalid_fractions: 0, + warnings_reported: false, }; let classic = |le: bool, nanos: bool| -> Result<(Kind, String, Interface), FormatError> { let major = rd_u16(&r, le, 4).ok_or_else(|| FormatError::Truncated("pcap header".into()))?; @@ -173,7 +179,7 @@ impl<'a> Capture<'a> { } fn packet_limit_reached(&mut self) -> bool { - if self.count.saturating_add(self.rejected_simple_blocks) < MAX_PACKETS { + if self.count + self.rejected_simple_blocks + self.rejected_short_blocks + self.rejected_interfaces < MAX_PACKETS { return false; } if !self.truncated && self.pos < self.data.len() { @@ -183,12 +189,24 @@ impl<'a> Capture<'a> { true } - fn report_rejected_simple_blocks(&mut self) { - if self.rejected_simple_blocks > 0 && !self.rejected_simple_reported { + fn report_packet_warnings(&mut self) { + if self.warnings_reported { + return; + } + self.warnings_reported = true; + if self.rejected_short_blocks > 0 { + self.warnings.push(format!("skipped {} packet block(s) with captured data past the end", self.rejected_short_blocks)); + } + if self.rejected_interfaces > 0 { + self.warnings.push(format!("skipped {} packet block(s) naming an undeclared interface", self.rejected_interfaces)); + } + if self.invalid_fractions > 0 { + self.warnings.push(format!("ignored {} timestamp(s) with a fraction outside its second", self.invalid_fractions)); + } + if self.rejected_simple_blocks > 0 { let n = self.rejected_simple_blocks; let suffix = if n == 1 { "" } else { "s" }; self.warnings.push(format!("skipped {n} simple packet block{suffix} with inconsistent captured lengths")); - self.rejected_simple_reported = true; } } @@ -196,7 +214,11 @@ impl<'a> Capture<'a> { let (base, exp) = self.interfaces.get(iface).map(|i| i.tsresol).unwrap_or((10, 6)); let offset_s = self.interfaces.get(iface).map(|i| i.tsoffset).unwrap_or(0); let ns = if base == 10 { - if exp <= 9 { u128::from(units) * 10u128.pow(u32::from(9 - exp)) } else { u128::from(units) / 10u128.checked_pow(u32::from(exp - 9))? } + if exp <= 9 { + u128::from(units) * 10u128.pow(u32::from(9 - exp)) + } else { + 10u128.checked_pow(u32::from(exp - 9)).map_or(0, |scale| u128::from(units) / scale) + } } else { (u128::from(units) * 1_000_000_000) >> exp.min(127) }; @@ -229,8 +251,14 @@ impl<'a> Capture<'a> { return self.stop(format!("record at offset {p} claims {incl} bytes past the end of the file")); }; self.pos = p + 16 + body.len(); - let units = u64::from(sec) * if nanos { 1_000_000_000 } else { 1_000_000 } + u64::from(frac); - Some(self.frame(0, units, body, orig)) + let per_second = if nanos { 1_000_000_000 } else { 1_000_000 }; + let units = u64::from(sec) * u64::from(per_second) + u64::from(frac); + let mut frame = self.frame(0, units, body, orig); + if frac >= per_second { + self.invalid_fractions += 1; + frame.ts_ns = None; + } + Some(frame) } fn next_ng(&mut self, mut le: bool) -> Option> { @@ -323,15 +351,14 @@ impl<'a> Capture<'a> { ) }; let (Some(iface), Some(hi), Some(lo), Some(cap), Some(orig)) = (iface, hi, lo, cap, orig) else { continue }; - let Some(data) = usize::try_from(cap).ok().filter(|&c| body + 20 + c <= body_end).and_then(|c| r.slice(body + 20, c)) else { - self.warnings.push(format!("packet block at offset {p} claims more bytes than it holds; skipped")); + let Some(data) = usize::try_from(cap).ok().filter(|&c| c <= body_end - (body + 20)).and_then(|c| r.slice(body + 20, c)) else { + self.rejected_short_blocks += 1; continue; }; - let iface = self.section_base + iface; - if iface >= self.interfaces.len() { - self.warnings.push(format!("packet block at offset {p} names an undeclared interface; skipped")); + let Some(iface) = self.section_base.checked_add(iface).filter(|&id| id < self.interfaces.len()) else { + self.rejected_interfaces += 1; continue; - } + }; return Some(self.frame(iface, (u64::from(hi) << 32) | u64::from(lo), data, orig)); } 3 => { @@ -346,6 +373,7 @@ impl<'a> Capture<'a> { } let Some(data) = r.slice(body + 4, cap) else { continue }; if iface >= self.interfaces.len() { + self.rejected_interfaces += 1; continue; } // Simple packet blocks carry no timestamp. @@ -378,7 +406,7 @@ impl<'a> Iterator for Capture<'a> { } }; if frame.is_none() { - self.report_rejected_simple_blocks(); + self.report_packet_warnings(); } frame } @@ -1524,6 +1552,64 @@ mod tests { assert_eq!(cap.pos, data.len() - valid.len()); } + #[test] + fn malformed_packet_blocks_share_the_budget_and_report_each_reason_once() { + use craft_anything_testkit::pcap::block; + let mut data = pcapng(&[]); + for kind in [2, 6] { + let mut body = [0; 20]; + body[12..16].copy_from_slice(&u32::MAX.to_le_bytes()); + data.extend(block(kind, &body)); + } + let mut body = [0; 20]; + body[..4].copy_from_slice(&u32::MAX.to_le_bytes()); + data.extend(block(6, &body)); + let mut shb = pcapng(&[]); + shb.truncate(28); + data.extend(shb); + data.extend(block(3, &[0; 4])); // No interface in this section. + data.extend(block(3, &[0; 4])); + let mut cap = Capture::new(&data).unwrap(); + cap.count = MAX_PACKETS - 4; + assert!(cap.next().is_none()); + assert!(cap.truncated); + assert_eq!(cap.warnings.len(), 3); + assert!(cap.warnings.iter().any(|s| s.contains("2 packet block(s) naming"))); + assert!(cap.warnings.iter().any(|s| s.contains("2 packet block(s) with"))); + assert!(cap.next().is_none()); + assert_eq!(cap.warnings.len(), 3); + } + + #[test] + fn invalid_classic_fractions_do_not_move_the_capture_period() { + for (magic, scale) in [(CLASSIC_US, 1_000_000u32), (CLASSIC_NS, 1_000_000_000)] { + let mut data = pcap(&[vec![], vec![]]); + data[..4].copy_from_slice(&magic.to_le_bytes()); + data[28..32].copy_from_slice(&scale.to_le_bytes()); + data[44..48].copy_from_slice(&(scale - 1).to_le_bytes()); + let mut cap = Capture::new(&data).unwrap(); + assert_eq!(cap.next().unwrap().ts_ns, None); + assert!(cap.next().unwrap().ts_ns.is_some()); + assert!(cap.next().is_none()); + assert_eq!(cap.warnings.len(), 1); + } + } + + #[test] + fn subnanosecond_decimal_resolutions_keep_the_interface_offset() { + use craft_anything_testkit::pcap::block; + let mut data = pcapng(&[]); + data.truncate(28); + let mut idb = vec![1, 0, 0, 0, 0, 0, 0, 0, 9, 0, 1, 0, 127, 0, 0, 0, 14, 0, 8, 0]; + idb.extend(2i64.to_le_bytes()); + data.extend(block(1, &idb)); + let mut epb = [0; 20]; + epb[4..12].fill(0xff); + data.extend(block(6, &epb)); + let frame = Capture::new(&data).unwrap().next().unwrap(); + assert_eq!(frame.ts_ns, Some(2_000_000_000)); + } + #[test] fn tcp_cut_inside_header_keeps_ports() { // Ports sit in the first 4 bytes; a cut later in the header must not drop them (as UDP). From 03e190a52fd6a45a3490ddd12bec9e1e625eb977 Mon Sep 17 00:00:00 2001 From: Afloat Date: Tue, 17 Nov 2026 08:37:51 -0500 Subject: [PATCH 043/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything d8087e70fc2990f3b261d122427d9d4e0cde7e0c. --- crates/pcap/src/lib.rs | 92 +++++++++++++++++++++++----- crates/pcap/tests/dns_rdata_names.rs | 85 +++++++++++++++++++++++++ 2 files changed, 161 insertions(+), 16 deletions(-) diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index 53fe2e44e..221947261 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -768,7 +768,7 @@ fn transport(proto: u8, p: &[u8], d: &mut Decoded) { Some(length) if length < 12 => d.note = Some("DNS over TCP length is smaller than its header".into()), Some(length) => { if let Some(message) = framed.slice(2, usize::from(length)) { - dns(message, d, "dns"); + dns(message, d, "dns", false); } else { d.note = Some("DNS over TCP message cut short".into()); } @@ -800,9 +800,9 @@ fn transport(proto: u8, p: &[u8], d: &mut Decoded) { }; d.transport = Some(Transport { protocol: "udp", src_port: Some(sp), dst_port: Some(dp), payload_len: payload.len(), ..empty }); if sp == 53 || dp == 53 { - dns(payload, d, "dns"); + dns(payload, d, "dns", false); } else if sp == 5353 || dp == 5353 { - dns(payload, d, "mdns"); + dns(payload, d, "mdns", dp == 5353); } } 1 | 58 => { @@ -827,6 +827,7 @@ pub fn qtype_name(t: u16) -> String { 33 => "SRV".into(), 64 => "SVCB".into(), 65 => "HTTPS".into(), + 257 => "CAA".into(), 255 => "ANY".into(), n => format!("TYPE{n}"), } @@ -844,7 +845,7 @@ fn dns_sd_service_label(label: &[u8]) -> bool { } /// A DNS name, the offset after it, and whether its wire labels name a DNS-SD instance. -fn dns_name(msg: &[u8], mut off: usize) -> Option<(String, usize, bool)> { +fn dns_name(msg: &[u8], mut off: usize, allow_compression: bool) -> Option<(String, usize, bool)> { let mut out = String::new(); // Count the expanded wire name, including label lengths and the terminating root. let mut wire_len = 1usize; @@ -855,7 +856,7 @@ fn dns_name(msg: &[u8], mut off: usize) -> Option<(String, usize, bool)> { let len = *msg.get(off)?; match len { 0 => return Some((if out.is_empty() { ".".into() } else { out }, after.unwrap_or(off + 1), labels >= 4 && service_instance)), - l if l & 0xc0 == 0xc0 => { + l if allow_compression && l & 0xc0 == 0xc0 => { let ptr = usize::from(u16::from_be_bytes([l & 0x3f, *msg.get(off + 1)?])); after.get_or_insert(off + 2); if ptr >= off { @@ -891,9 +892,12 @@ fn dns_name(msg: &[u8], mut off: usize) -> Option<(String, usize, bool)> { /// Decode a bounded set of DNS questions and answer/prerequisite records from one message. /// Preserve complete entries before malformed data and mark the message incomplete. -fn dns(msg: &[u8], d: &mut Decoded, label: &'static str) { +fn dns(msg: &[u8], d: &mut Decoded, label: &'static str, mdns_wire_format: bool) { let r = Reader::new(msg); let (Some(id), Some(flags), Some(qd), Some(an)) = (r.u16_be(0), r.u16_be(2), r.u16_be(4), r.u16_be(6)) else { return }; + if msg.len() < 12 { + return; + } let opcode = (flags >> 11) & 0xf; // Sanity: opcode 0–6 and no absurd counts, so random payload on port 53 isn't misread. if opcode > 6 || qd > 64 || qd == 0 && an == 0 { @@ -903,7 +907,7 @@ fn dns(msg: &[u8], d: &mut Decoded, label: &'static str) { let mut out = Dns { id, response: flags & 0x8000 != 0, rcode: (flags & 0xf) as u8, questions: Vec::new(), answers: Vec::new(), incomplete: false }; let mut off = 12usize; for _ in 0..qd { - let Some((name, next, _)) = dns_name(msg, off) else { + let Some((name, next, _)) = dns_name(msg, off, true) else { out.incomplete = true; break; }; @@ -917,7 +921,7 @@ fn dns(msg: &[u8], d: &mut Decoded, label: &'static str) { } if !out.incomplete { for _ in 0..an.min(64) { - let Some((name, next, service_instance)) = dns_name(msg, off) else { + let Some((name, next, service_instance)) = dns_name(msg, off, true) else { out.incomplete = true; break; }; @@ -930,7 +934,13 @@ fn dns(msg: &[u8], d: &mut Decoded, label: &'static str) { out.incomplete = true; break; }; + let end = rd_off + rd.len(); + let within_record = msg.get(..end).unwrap_or(&[]); + let record_class = if mdns_wire_format { class & 0x7fff } else { class }; + let empty_prerequisite = rd.is_empty() && opcode == 5 && matches!(class, 254 | 255) && ttl == 0; let value = match (rt, rd.len()) { + (1 | 28 | 6 | 33 | 257, 0) if empty_prerequisite => String::new(), + (1 | 28, _) if record_class != 1 => format!("<{} bytes>", rd.len()), (1, 4) => Ipv4Addr::new( rd.first().copied().unwrap_or(0), rd.get(1).copied().unwrap_or(0), @@ -939,16 +949,65 @@ fn dns(msg: &[u8], d: &mut Decoded, label: &'static str) { ) .to_string(), (28, 16) => Ipv6Addr::from(<[u8; 16]>::try_from(rd).unwrap_or([0; 16])).to_string(), + (1 | 28, _) => { + out.incomplete = true; + break; + } + (33, _) => { + let fields = Reader::new(rd); + let Some((target, _, _)) = dns_name(within_record, rd_off + 6, mdns_wire_format).filter(|(_, after, _)| *after == end) else { + out.incomplete = true; + break; + }; + let (Some(priority), Some(weight), Some(port)) = (fields.u16_be(0), fields.u16_be(2), fields.u16_be(4)) else { + out.incomplete = true; + break; + }; + format!("{priority} {weight} {port} {target}") + } + (6, _) => { + let soa = dns_name(within_record, rd_off, true).and_then(|(primary, pos, _)| { + let (mailbox, pos, _) = dns_name(within_record, pos, true)?; + let (words, tail) = within_record.get(pos..)?.as_chunks::<4>(); + if !tail.is_empty() { + return None; + } + let words: &[[u8; 4]; 5] = words.try_into().ok()?; + let [serial, refresh, retry, expire, minimum] = words.map(u32::from_be_bytes); + Some(format!("{primary} {mailbox} {serial} {refresh} {retry} {expire} {minimum}")) + }); + let Some(soa) = soa else { + out.incomplete = true; + break; + }; + soa + } + (257, _) => { + let Some((&flags, rest)) = rd.split_first() else { + out.incomplete = true; + break; + }; + let caa = rest.split_first().and_then(|(&n, body)| body.split_at_checked(usize::from(n))).and_then(|(tag, value)| { + (!tag.is_empty() && tag.iter().all(u8::is_ascii_alphanumeric)).then(|| { + let value: String = value.iter().flat_map(|&byte| std::ascii::escape_default(byte)).map(char::from).collect(); + format!("{flags} {} {value}", String::from_utf8_lossy(tag)) + }) + }); + let Some(caa) = caa else { + out.incomplete = true; + break; + }; + caa + } (2 | 5 | 12 | 15, _) => { // RFC 2136 prerequisites can name an RRset without carrying its value. if rd.is_empty() && opcode == 5 && matches!(class, 254 | 255) && ttl == 0 { String::new() } else { - let end = rd_off + rd.len(); let start = rd_off + if rt == 15 { 2 } else { 0 }; // Keep earlier bytes available to compression pointers, but the encoded // name itself must fit the record and account for all of its RDATA. - let Some((name, _, _)) = dns_name(msg.get(..end).unwrap_or(&[]), start).filter(|(_, after, _)| *after == end) else { + let Some((name, _, _)) = dns_name(within_record, start, true).filter(|(_, after, _)| *after == end) else { out.incomplete = true; break; }; @@ -991,6 +1050,7 @@ fn dns(msg: &[u8], d: &mut Decoded, label: &'static str) { off = rd_off + usize::from(rdlen); } } + out.incomplete |= flags & 0x0200 != 0; d.dns = Some(out); } @@ -1313,7 +1373,7 @@ pub struct Summary { /// "name TYPE value" from DNS responses. pub dns_answers: Vec, /// "question A|AAAA address" from DNS responses: each address answered, keyed by the response's first - /// question (so CNAME chains end at the name that was asked), as Wireshark's fields report them. + /// question (so CNAME chains end at the name that was asked), or the record owner in a questionless reply. pub dns_addresses: Vec, /// "METHOD host target" from HTTP/1.x requests. pub http_requests: Vec, @@ -1438,11 +1498,11 @@ pub fn summarize(data: &[u8], cancelled: &dyn Fn() -> bool) -> Result().is_ok()) { - addresses.add(format!("{} {} {}", q.name, a.rtype, a.value)); + // Questionless replies (including unsolicited mDNS) name the address in the answer. + let name = dns.questions.first().map_or(&a.name, |q| &q.name); + addresses.add(format!("{name} {} {}", a.rtype, a.value)); } } } @@ -1919,6 +1979,6 @@ mod tests { let _ = summarize(&pcap(&f), &|| false); } // DNS compression loops are refused. - assert!(dns_name(&[0xc0, 0x00], 0).is_none()); + assert!(dns_name(&[0xc0, 0x00], 0, true).is_none()); } } diff --git a/crates/pcap/tests/dns_rdata_names.rs b/crates/pcap/tests/dns_rdata_names.rs index 88b7315b7..7d7d00644 100644 --- a/crates/pcap/tests/dns_rdata_names.rs +++ b/crates/pcap/tests/dns_rdata_names.rs @@ -182,3 +182,88 @@ fn value_dependent_update_name_prerequisites_keep_their_values() { } } } + +#[test] +fn an_in_address_requires_the_right_wire_size_but_update_prerequisites_may_be_empty() { + for (kind, bad) in [(1, &[1, 2, 3][..]), (28, &[0; 15][..])] { + let mut msg = response(kind, bad, bad.len()); + assert!(decode(1, &packet(&msg)).dns.unwrap().incomplete); + msg = response(kind, &[], 0); + msg[2..4].copy_from_slice(&0x2800u16.to_be_bytes()); + let n = msg.len(); + msg[n - 8..n - 6].copy_from_slice(&255u16.to_be_bytes()); + msg[n - 6..n - 2].fill(0); + let dns = decode(1, &packet(&msg)).dns.unwrap(); + assert!(!dns.incomplete); + assert_eq!(dns.answers[0].value, ""); + } +} + +#[test] +fn questionless_announcements_and_truncated_responses_keep_their_address() { + let mut message = vec![0, 0, 0x86, 0, 0, 0, 0, 1, 0, 0, 0, 0]; + message.extend(b"\x04node\x05local\x00\x00\x01\x80\x01\x00\x00\x00\x3c\x00\x04\xc0\x00\x02\x04"); + let frame = eth(0x0800, &ipv4_pkt(17, [192, 0, 2, 4], [224, 0, 0, 251], &udp(5353, 5353, &message))); + let dns = decode(1, &frame).dns.unwrap(); + assert!(dns.incomplete); + assert_eq!(dns.answers.len(), 1); + assert_eq!(summarize(&pcap(&[frame]), &|| false).unwrap().dns_addresses[0].value, "node.local A 192.0.2.4"); + assert!(decode(1, &packet(&message[..8])).dns.is_none()); +} + +#[test] +fn service_records_report_their_fields_and_refuse_invalid_framing() { + let mut soa = vec![0xc0, 12, 0xc0, 12]; + for n in 1u32..=5 { + soa.extend(n.to_be_bytes()); + } + for (kind, data, expected) in [ + (33, &b"\x00\x01\x00\x02\x01\xbb\x03srv\x00"[..], "1 2 443 srv"), + (6, soa.as_slice(), "example.com example.com 1 2 3 4 5"), + (257, &b"\x80\x05issueca.test"[..], "128 issue ca.test"), + ] { + let dns = decode(1, &packet(&response(kind, data, data.len()))).dns.unwrap(); + assert!(!dns.incomplete); + assert_eq!(dns.answers[0].value, expected); + } + for (kind, bad) in [(33, &b"\x00\x01\x00\x02\x01\xbb\xc0\x0c"[..]), (6, &soa[..soa.len() - 1]), (257, &b"\x00\x06issue"[..])] { + let dns = decode(1, &packet(&response(kind, bad, bad.len()))).dns.unwrap(); + assert!(dns.incomplete); + assert!(dns.answers.is_empty()); + } +} + +#[test] +fn mdns_srv_targets_can_be_compressed_except_in_legacy_replies() { + let data = [0, 1, 0, 2, 1, 187, 0xc0, 12]; + let msg = response(33, &data, data.len()); + for (port, legacy) in [(5353, false), (51000, true)] { + let frame = eth(0x0800, &ipv4_pkt(17, [192, 0, 2, 4], [192, 0, 2, 1], &udp(5353, port, &msg))); + let dns = decode(1, &frame).dns.unwrap(); + assert_eq!(dns.incomplete, legacy); + if !legacy { + assert_eq!(dns.answers[0].value, "1 2 443 example.com"); + } + } +} + +#[test] +fn caa_binary_values_remain_distinct_in_the_inventory() { + for (bytes, display) in [(&b"\xff"[..], r"\xff"), (b"\xfe", r"\xfe"), (br"\xff", r"\\xff")] { + let mut data = b"\x00\x01x".to_vec(); + data.extend(bytes); + let dns = decode(1, &packet(&response(257, &data, data.len()))).dns.unwrap(); + assert_eq!(dns.answers[0].value, format!("0 x {display}")); + } +} + +#[test] +fn only_mdns_masks_the_cache_flush_bit_in_an_address_class() { + let mut msg = response(1, &[192, 0, 2, 1], 4); + let class = msg.len() - 12; + msg[class..class + 2].copy_from_slice(&0x8001u16.to_be_bytes()); + for (port, expected) in [(53, "<4 bytes>"), (5353, "192.0.2.1")] { + let frame = eth(0x0800, &ipv4_pkt(17, [192, 0, 2, 4], [192, 0, 2, 1], &udp(port, port, &msg))); + assert_eq!(decode(1, &frame).dns.unwrap().answers[0].value, expected); + } +} From b9f792d293e02f9abc52be9dd0e835df5eae47fe Mon Sep 17 00:00:00 2001 From: Afloat Date: Tue, 17 Nov 2026 08:37:51 -0500 Subject: [PATCH 044/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything bd279b18f106ae64d1ec701d86d4da7aec219fba. --- crates/pcap/src/lib.rs | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index 221947261..e35f016c5 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -554,19 +554,10 @@ pub struct FlowKey { pub fn decode(link_type: u32, data: &[u8]) -> Decoded { let mut d = Decoded::default(); let r = Reader::new(data); - let (ethertype, off) = match link_type { + let (mut ethertype, mut off) = match link_type { 1 => { d.protocols.push("eth"); - let mut et = r.u16_be(12); - let mut off = 14usize; - for _ in 0..2 { - if matches!(et, Some(0x8100 | 0x88a8)) { - d.protocols.push("vlan"); - et = r.u16_be(off + 2); - off += 4; - } - } - (et, off) + (r.u16_be(12), 14usize) } 113 => { d.protocols.push("sll"); @@ -607,6 +598,16 @@ pub fn decode(link_type: u32, data: &[u8]) -> Decoded { return d; } }; + // Both Ethernet and Linux cooked headers carry an EtherType. Each VLAN + // tag supplies another EtherType after its tag-control field. + for _ in 0..2 { + if !matches!(ethertype, Some(0x8100 | 0x88a8)) { + break; + } + d.protocols.push("vlan"); + ethertype = r.u16_be(off + 2); + off += 4; + } let payload = data.get(off..).unwrap_or(&[]); match ethertype { Some(0x0800) => ipv4(payload, &mut d), @@ -1820,6 +1821,21 @@ mod tests { classic_link_word(101, true, false, 0); } + #[test] + fn linux_cooked_vlan_frames_reach_the_network_decoder() { + let ip = ipv4_pkt(17, [10, 0, 0, 1], [10, 0, 0, 2], &udp(123, 456, b"payload")); + for (link, header_len, protocol_at) in [(113, 16, 14), (276, 20, 0)] { + let mut frame = vec![0; header_len]; + frame[protocol_at..protocol_at + 2].copy_from_slice(&0x88a8_u16.to_be_bytes()); + frame.extend_from_slice(&[0, 1, 0x81, 0, 0, 2, 0x08, 0]); + frame.extend_from_slice(&ip); + let decoded = decode(link, &frame); + assert_eq!(decoded.protocols.iter().filter(|&&p| p == "vlan").count(), 2); + assert_eq!(decoded.transport.unwrap().dst_port, Some(456)); + assert!(decode(link, &frame[..header_len + 1]).ip.is_none()); + } + } + #[test] fn decodes_dns_tls_http() { let frames = sample_frames(); From 32ed24dc73b4d1724711f456826826511265e67c Mon Sep 17 00:00:00 2001 From: Afloat Date: Tue, 17 Nov 2026 08:37:52 -0500 Subject: [PATCH 045/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything 901f99f8465b3dc26b4c1b047388bcd78579f7f5. --- crates/pcap/src/lib.rs | 111 ++++++++++++++++++++- crates/pcap/tests/dns_discovery_answers.rs | 57 +++++++++++ 2 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 crates/pcap/tests/dns_discovery_answers.rs diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index e35f016c5..bcf634e4d 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -826,6 +826,11 @@ pub fn qtype_name(t: u16) -> String { 16 => "TXT".into(), 28 => "AAAA".into(), 33 => "SRV".into(), + 35 => "NAPTR".into(), + 39 => "DNAME".into(), + 44 => "SSHFP".into(), + 52 => "TLSA".into(), + 256 => "URI".into(), 64 => "SVCB".into(), 65 => "HTTPS".into(), 257 => "CAA".into(), @@ -891,6 +896,103 @@ fn dns_name(msg: &[u8], mut off: usize, allow_compression: bool) -> Option<(Stri None } +/// Decode discovery and authentication records whose domain names prohibit compression. +fn discovery_answer(kind: u16, rd: &[u8]) -> Option { + let r = Reader::new(rd); + let text = |b: &[u8]| b.iter().flat_map(|v| std::ascii::escape_default(*v)).map(char::from).collect::(); + let hex = |b: &[u8]| b.iter().map(|v| format!("{v:02x}")).collect::(); + match kind { + 39 => dns_name(rd, 0, false).filter(|(_, after, _)| *after == rd.len()).map(|(name, _, _)| name), + 44 => { + let (&algorithm, next) = rd.split_first()?; + let (&hash, digest) = next.split_first()?; + if digest.is_empty() || hash == 1 && digest.len() != 20 || hash == 2 && digest.len() != 32 { + return None; + } + Some(format!("{algorithm} {hash} {}", hex(digest))) + } + 52 => { + let [usage, selector, matching, cert @ ..] = rd else { return None }; + if cert.is_empty() || *matching == 1 && cert.len() != 32 || *matching == 2 && cert.len() != 64 { + return None; + } + Some(format!("{usage} {selector} {matching} {}", hex(cert))) + } + 256 => { + let target = rd.get(4..).filter(|s| !s.is_empty())?; + Some(format!("{} {} \"{}\"", r.u16_be(0)?, r.u16_be(2)?, strip_userinfo(&text(target)))) + } + 35 => { + let mut pos = 4; + let mut value = format!("{} {}", r.u16_be(0)?, r.u16_be(2)?); + for _ in 0..3 { + let len = usize::from(r.u8(pos)?); + value.push_str(&format!(" \"{}\"", text(r.slice(pos + 1, len)?))); + pos += 1 + len; + } + let (replacement, _, _) = dns_name(rd, pos, false).filter(|(_, after, _)| *after == rd.len())?; + Some(format!("{value} {replacement}")) + } + 64 | 65 => { + let priority = r.u16_be(0)?; + let (target, mut pos, _) = dns_name(rd, 2, false)?; + let mut value = format!("{priority} {target}"); + let mut previous = None; + while pos < rd.len() { + let key = r.u16_be(pos)?; + let len = usize::from(r.u16_be(pos + 2)?); + if key == u16::MAX || previous.is_some_and(|old| old >= key) { + return None; + } + let param = r.slice(pos + 4, len)?; + // Keep unknown keys lossless; interpreting them as text can fabricate an endpoint. + let field = match key { + 1 if priority != 0 => { + let mut remaining = param; + let mut ids = Vec::new(); + while let Some((&n, rest)) = remaining.split_first() { + if n == 0 { + return None; + } + let (id, tail) = rest.split_at_checked(usize::from(n))?; + ids.push(text(id).replace(',', "\\,")); + remaining = tail; + } + if ids.is_empty() { + return None; + } + format!("alpn={}", ids.join(",")) + } + 3 if priority != 0 => format!("port={}", u16::from_be_bytes(param.try_into().ok()?)), + 4 if priority != 0 => { + let (addresses, tail) = param.as_chunks::<4>(); + if addresses.is_empty() || !tail.is_empty() { + return None; + } + let hints: Vec<_> = addresses.iter().map(|ip| Ipv4Addr::from(*ip).to_string()).collect(); + format!("ipv4hint={}", hints.join(",")) + } + 6 if priority != 0 => { + let (addresses, tail) = param.as_chunks::<16>(); + if addresses.is_empty() || !tail.is_empty() { + return None; + } + let hints: Vec<_> = addresses.iter().map(|ip| Ipv6Addr::from(*ip).to_string()).collect(); + format!("ipv6hint={}", hints.join(",")) + } + _ => format!("key{key}=0x{}", hex(param)), + }; + value.push(' '); + value.push_str(&field); + previous = Some(key); + pos += len + 4; + } + Some(value) + } + _ => None, + } +} + /// Decode a bounded set of DNS questions and answer/prerequisite records from one message. /// Preserve complete entries before malformed data and mark the message incomplete. fn dns(msg: &[u8], d: &mut Decoded, label: &'static str, mdns_wire_format: bool) { @@ -940,7 +1042,7 @@ fn dns(msg: &[u8], d: &mut Decoded, label: &'static str, mdns_wire_format: bool) let record_class = if mdns_wire_format { class & 0x7fff } else { class }; let empty_prerequisite = rd.is_empty() && opcode == 5 && matches!(class, 254 | 255) && ttl == 0; let value = match (rt, rd.len()) { - (1 | 28 | 6 | 33 | 257, 0) if empty_prerequisite => String::new(), + (1 | 28 | 6 | 33 | 35 | 39 | 44 | 52 | 64 | 65 | 256 | 257, 0) if empty_prerequisite => String::new(), (1 | 28, _) if record_class != 1 => format!("<{} bytes>", rd.len()), (1, 4) => Ipv4Addr::new( rd.first().copied().unwrap_or(0), @@ -1042,6 +1144,13 @@ fn dns(msg: &[u8], d: &mut Decoded, label: &'static str, mdns_wire_format: bool) } txt } + (35 | 39 | 44 | 52 | 64 | 65 | 256, _) if record_class == 1 => { + let Some(value) = discovery_answer(rt, rd) else { + out.incomplete = true; + break; + }; + value + } (_, n) => format!("<{n} bytes>"), }; if out.incomplete { diff --git a/crates/pcap/tests/dns_discovery_answers.rs b/crates/pcap/tests/dns_discovery_answers.rs new file mode 100644 index 000000000..71f4cb0a3 --- /dev/null +++ b/crates/pcap/tests/dns_discovery_answers.rs @@ -0,0 +1,57 @@ +use craft_anything_formats::pcap::{Dns, decode}; +use craft_anything_testkit::pcap::{dns_query, eth, ipv4_pkt, udp}; + +fn answer(kind: u16, rd: &[u8]) -> Dns { + let mut msg = dns_query(); + msg[2..4].copy_from_slice(&0x8180u16.to_be_bytes()); + msg[6..8].copy_from_slice(&1u16.to_be_bytes()); + msg.extend([0xc0, 12]); + msg.extend(kind.to_be_bytes()); + msg.extend([0, 1, 0, 0, 0, 60]); + msg.extend((rd.len() as u16).to_be_bytes()); + msg.extend(rd); + decode(1, ð(0x0800, &ipv4_pkt(17, [192, 0, 2, 2], [192, 0, 2, 1], &udp(53, 51000, &msg)))).dns.unwrap() +} + +#[test] +fn svc_binding_reports_target_and_port() { + for kind in [64, 65] { + let msg = answer(kind, b"\0\x01\x03api\0\0\x03\0\x02\x20\xfb"); + assert_eq!(msg.answers[0].value, "1 api port=8443"); + assert_eq!(answer(kind, b"\0\x01\0\0\x01\0\x03\x02h2\0\x04\0\x04\xc0\0\x02\x01").answers[0].value, "1 . alpn=h2 ipv4hint=192.0.2.1"); + assert!(answer(kind, b"\0\x01\0\0\x01\0\x01\x00").incomplete); + assert!(answer(kind, b"\0\x01\xc0\x0c").incomplete); + assert!(answer(kind, b"\0\x01\0\0\x03\0\x01\x00").incomplete); + } +} +#[test] +fn sshfp_preserves_algorithm_and_complete_digest() { + let mut d = vec![4, 2]; + d.extend([0x5a; 32]); + assert_eq!(answer(44, &d).answers[0].value, format!("4 2 {}", "5a".repeat(32))); + assert!(answer(44, &d[..15]).incomplete); +} +#[test] +fn tlsa_keeps_selector_and_certificate_association() { + let mut d = vec![3, 1, 1]; + d.extend([0xaa; 32]); + assert_eq!(answer(52, &d).answers[0].value, format!("3 1 1 {}", "aa".repeat(32))); + assert!(answer(52, &d[..4]).incomplete); +} +#[test] +fn naptr_keeps_order_preference_strings_and_replacement() { + let rd = b"\0\x0a\0\x02\x01s\x03sip\0\x03srv\0"; + assert_eq!(answer(35, rd).answers[0].value, r#"10 2 "s" "sip" "" srv"#); + assert!(answer(35, &rd[..rd.len() - 1]).incomplete); +} +#[test] +fn uri_keeps_priority_weight_and_target() { + assert_eq!(answer(256, b"\0\x02\0\x05https://x.test/s").answers[0].value, r#"2 5 "https://x.test/s""#); + assert!(answer(256, b"\0\x02\0\x05").incomplete); +} +#[test] +fn dname_only_accepts_a_complete_uncompressed_target() { + assert_eq!(answer(39, b"\x04host\0").answers[0].value, "host"); + assert!(answer(39, b"\xc0\x0c").incomplete); + assert!(answer(39, b"\x04host\0extra").incomplete); +} From 747080c6593db7e35eea920e3667879b9dba4d8b Mon Sep 17 00:00:00 2001 From: Afloat Date: Tue, 17 Nov 2026 08:37:52 -0500 Subject: [PATCH 046/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything 34774fd3b3addd9c0537ec7890f2de939261911b. --- crates/pcap/src/lib.rs | 41 +++++++++++++----- crates/pcap/tests/pcap_dns_name_limit.rs | 13 ++++++ crates/pcap/tests/pcap_http_host_boundary.rs | 43 +++++++++++++++++++ .../pcap/tests/regression_pcapng_framing.rs | 11 +++++ 4 files changed, 98 insertions(+), 10 deletions(-) diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index bcf634e4d..f5203f002 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -10,6 +10,7 @@ use crate::FormatError; use crate::bytes::Reader; use serde::Serialize; use std::collections::{BTreeMap, BTreeSet, HashMap}; +use std::fmt::Write as _; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; /// Most accepted and rejected packet records read from one capture. @@ -887,7 +888,18 @@ fn dns_name(msg: &[u8], mut off: usize, allow_compression: bool) -> Option<(Stri if !out.is_empty() { out.push('.'); } - out.extend(label.iter().map(|&c| if c.is_ascii_graphic() { char::from(c) } else { '?' })); + for &c in label { + match c { + b'.' | b'\\' => { + out.push('\\'); + out.push(char::from(c)); + } + c if c.is_ascii_graphic() => out.push(char::from(c)), + _ => { + let _ = write!(out, "\\{c:03}"); + } + } + } off += 1 + usize::from(l); } _ => return None, @@ -1179,19 +1191,28 @@ pub fn strip_userinfo(target: &str) -> String { fn tcp_app(p: &[u8], d: &mut Decoded) { let head = p.get(..p.len().min(16 << 10)).unwrap_or(p); - let line_end = head.windows(2).position(|w| w == b"\r\n").unwrap_or(head.len().min(2048)); - let line = String::from_utf8_lossy(head.get(..line_end.min(2048)).unwrap_or(&[])).into_owned(); - if let Some(rest) = line.strip_prefix("HTTP/1.") { - let status = rest.split(' ').nth(1).and_then(|s| s.parse().ok()); + let Some(line_end) = head.windows(2).position(|w| w == b"\r\n") else { + tls(p, d); + return; + }; + let line = String::from_utf8_lossy(head.get(..line_end).unwrap_or(&[])); + let version = |v: &str| matches!(v.as_bytes(), [b'H', b'T', b'T', b'P', b'/', b'1', b'.', b'0'..=b'9']); + let mut parts = line.splitn(3, ' '); + let fields = (parts.next(), parts.next(), parts.next()); + if let (Some(v), Some(code), reason) = fields + && version(v) + && matches!(code.as_bytes(), [b'1'..=b'5', b'0'..=b'9', b'0'..=b'9']) + && reason.is_none_or(|text| text.bytes().all(|b| b == b'\t' || !b.is_ascii_control())) + { d.protocols.push("http"); - d.http = - Some(Http { kind: "response", method: None, target: None, status, version: format!("HTTP/1.{}", rest.chars().next().unwrap_or('?')), host: None }); + d.http = Some(Http { kind: "response", method: None, target: None, status: code.parse().ok(), version: v.to_string(), host: None }); return; } - let mut parts = line.splitn(3, ' '); - if let (Some(m), Some(t), Some(v)) = (parts.next(), parts.next(), parts.next()) + if let (Some(m), Some(t), Some(v)) = fields && METHODS.contains(&m) - && v.starts_with("HTTP/1.") + && !t.is_empty() + && !t.bytes().any(|b| b.is_ascii_control()) + && version(v) { let mut remaining = head.get(line_end + 2..).unwrap_or(&[]); let mut host = None; diff --git a/crates/pcap/tests/pcap_dns_name_limit.rs b/crates/pcap/tests/pcap_dns_name_limit.rs index f16c89387..cf2954d70 100644 --- a/crates/pcap/tests/pcap_dns_name_limit.rs +++ b/crates/pcap/tests/pcap_dns_name_limit.rs @@ -149,3 +149,16 @@ fn root_name_rdata_remains_valid() { assert_eq!(dns.answers[1].value, "203.0.113.1"); } } + +#[test] +fn dns_label_escapes_distinguish_wire_names_in_question_and_answer_owners() { + let mut message = vec![0, 1, 0x81, 0x80, 0, 2, 0, 1, 0, 0, 0, 0]; + message.extend(b"\x03a.b\x03\\\x00\xff\x00\x00\x01\x00\x01"); + message.extend(b"\x01a\x01b\x03\\\x00\xff\x00\x00\x01\x00\x01"); + message.extend([0xc0, 12, 0, 1, 0, 1, 0, 0, 0, 0, 0, 4, 1, 2, 3, 4]); + let dns = decode(101, &ipv4_pkt(17, [1; 4], [2; 4], &udp(53, 100, &message))).dns.unwrap(); + assert!(!dns.incomplete); + assert_eq!(dns.questions[0].name, r"a\.b.\\\000\255"); + assert_eq!(dns.questions[1].name, r"a.b.\\\000\255"); + assert_eq!(dns.answers[0].name, dns.questions[0].name); +} diff --git a/crates/pcap/tests/pcap_http_host_boundary.rs b/crates/pcap/tests/pcap_http_host_boundary.rs index 13b6955d8..6937196f6 100644 --- a/crates/pcap/tests/pcap_http_host_boundary.rs +++ b/crates/pcap/tests/pcap_http_host_boundary.rs @@ -22,3 +22,46 @@ fn host_requires_a_complete_header_line_and_keeps_its_spelling() { assert!(request(b"GET / HTTP/1.1\r\nHost: cut").host.is_none()); assert_eq!(request(b"GET / HTTP/1.1\r\nHost: Real.test\r\n\r\n").host.as_deref(), Some("Real.test")); } + +#[test] +fn http_evidence_needs_a_complete_start_line() { + for input in [ + b"GET / HTTP/1.1".as_slice(), + b"GET / HTTP/1.1x\r\n", + b"GET / HTTP/1.1 extra\r\n", + b"GET HTTP/1.0\r\n", + b"GET /bad\tpath HTTP/1.1\r\n", + b"HTTP/1.garbage\r\n", + b"HTTP/1.1 20 OK\r\n", + b"HTTP/1.1 999 OK\r\n", + b"HTTP/1.1 200 OK", + b"HTTP/1.garbage 204\r\n\r\n", + b"HTTP/1.1 20\r\n\r\n", + b"HTTP/1.1 2040\r\n\r\n", + b"HTTP/1.1 999\r\n\r\n", + b"HTTP/1.1 2x4\r\n\r\n", + b"HTTP/1.1 204", + b"HTTP/1.1 204 bad\0reason\r\n\r\n", + ] { + assert!(decode(101, &ipv4_pkt(6, [1; 4], [2; 4], &tcp(100, 80, 0x18, input))).http.is_none(), "{input:?}"); + } + assert_eq!(request(b"GET / HTTP/1.0\r\n").version, "HTTP/1.0"); + assert_eq!(request(b"HTTP/1.1 204 \r\n").status, Some(204)); + assert_eq!(request(b"HTTP/1.1 403 Access denied\r\n").status, Some(403)); +} + +#[test] +fn responses_with_no_reason_phrase_still_keep_the_status_code() { + for (input, version, code) in + [(b"HTTP/1.1 204\r\n\r\n".as_slice(), "HTTP/1.1", 204), (b"HTTP/1.0 200\r\nContent-Length: 0\r\n\r\n".as_slice(), "HTTP/1.0", 200)] + { + let decoded = decode(101, &ipv4_pkt(6, [1; 4], [2; 4], &tcp(80, 100, 0x18, input))); + assert!(decoded.protocols.contains(&"http")); + let http = decoded.http.unwrap(); + assert_eq!(http.kind, "response"); + assert_eq!(http.version, version); + assert_eq!(http.status, Some(code)); + assert!(http.method.is_none()); + assert!(http.target.is_none()); + } +} diff --git a/crates/pcap/tests/regression_pcapng_framing.rs b/crates/pcap/tests/regression_pcapng_framing.rs index 69a58a6b3..1fa8679fb 100644 --- a/crates/pcap/tests/regression_pcapng_framing.rs +++ b/crates/pcap/tests/regression_pcapng_framing.rs @@ -64,3 +64,14 @@ fn big_endian_block_footers_use_the_sections_byte_order() { data[end - 4..].copy_from_slice(&20u32.to_le_bytes()); assert!(!summarize(&data, &|| false).unwrap().warnings.is_empty()); } + +#[test] +fn a_skipped_packet_before_the_first_interface_preserves_later_frames() { + let original = pcapng(&sample_frames()); + let mut data = original[..28].to_vec(); + data.extend(block(3, &[0; 4])); + data.extend(&original[28..]); + let summary = summarize(&data, &|| false).unwrap(); + assert_eq!(summary.packets, 7); + assert!(summary.warnings.iter().any(|w| w.contains("undeclared interface"))); +} From a9acede958c93be3ae2577edcdc508cb6c84f5c2 Mon Sep 17 00:00:00 2001 From: RRFZ <247457381+Plastic-time@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:37:53 -0500 Subject: [PATCH 047/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything d67583b183e42bdb69a5ab440d2403eea58c7b0d. --- crates/pcap/src/lib.rs | 7 ++++-- crates/pcap/tests/pcap_http_methods.rs | 32 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 crates/pcap/tests/pcap_http_methods.rs diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index f5203f002..5ba79249b 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -1176,7 +1176,10 @@ fn dns(msg: &[u8], d: &mut Decoded, label: &'static str, mdns_wire_format: bool) d.dns = Some(out); } -const METHODS: &[&str] = &["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "PATCH", "CONNECT", "TRACE"]; +/// HTTP method names are case-sensitive tokens, including extension methods. +fn http_method(method: &str) -> bool { + !method.is_empty() && method.bytes().all(|b| b.is_ascii_alphanumeric() || b"!#$%&'*+-.^_`|~".contains(&b)) +} /// Remove `user:password@` from an absolute request target. pub fn strip_userinfo(target: &str) -> String { @@ -1209,7 +1212,7 @@ fn tcp_app(p: &[u8], d: &mut Decoded) { return; } if let (Some(m), Some(t), Some(v)) = fields - && METHODS.contains(&m) + && http_method(m) && !t.is_empty() && !t.bytes().any(|b| b.is_ascii_control()) && version(v) diff --git a/crates/pcap/tests/pcap_http_methods.rs b/crates/pcap/tests/pcap_http_methods.rs new file mode 100644 index 000000000..d2bc17062 --- /dev/null +++ b/crates/pcap/tests/pcap_http_methods.rs @@ -0,0 +1,32 @@ +use craft_anything_formats::pcap::decode; +use craft_anything_testkit::pcap::{ipv4_pkt, tcp}; + +/// WebDAV and extension methods retain the same HTTP evidence as core methods. +#[test] +fn extension_methods_are_http_requests() { + for method in ["PROPFIND", "MKCOL", "LOCK", "REPORT", "M-SEARCH", "custom", "X!#$%&'*+-.^_`|~012"] { + let request = format!("{method} /collection/ HTTP/1.1\r\nHost: dav.example\r\n\r\n"); + let decoded = decode(101, &ipv4_pkt(6, [1; 4], [2; 4], &tcp(100, 80, 0x18, request.as_bytes()))); + let http = decoded.http.unwrap_or_else(|| panic!("missing HTTP: {method}")); + assert_eq!(http.method.as_deref(), Some(method)); + assert_eq!(http.target.as_deref(), Some("/collection/")); + assert_eq!(http.host.as_deref(), Some("dav.example")); + } +} + +/// A method still needs a nonempty ASCII token and a complete valid start line. +#[test] +fn invalid_extension_method_lines_are_not_http() { + for request in [ + " / HTTP/1.1\r\n", + "BAD:METHOD / HTTP/1.1\r\n", + "BAD/METHOD / HTTP/1.1\r\n", + "MÉTHOD / HTTP/1.1\r\n", + "BAD\tMETHOD / HTTP/1.1\r\n", + "PROPFIND / HTTP/1.1", + "PROPFIND / HTTP/no\r\n", + ] { + let decoded = decode(101, &ipv4_pkt(6, [1; 4], [2; 4], &tcp(100, 80, 0x18, request.as_bytes()))); + assert!(decoded.http.is_none(), "{request:?}"); + } +} From 79a002518c97b57a431fc5639e1364e04988b397 Mon Sep 17 00:00:00 2001 From: RRFZ <247457381+Plastic-time@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:37:53 -0500 Subject: [PATCH 048/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything 43bd04745f42daefd9dea16756b13816fa7485a6. --- crates/pcap/src/lib.rs | 2 +- crates/pcap/tests/pcap_tcp_ecn.rs | 33 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 crates/pcap/tests/pcap_tcp_ecn.rs diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index 5ba79249b..065663423 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -716,7 +716,7 @@ fn ipv6(p: &[u8], d: &mut Decoded) { } fn tcp_flags(f: u8) -> String { - let names = [(0x02, "SYN"), (0x10, "ACK"), (0x01, "FIN"), (0x04, "RST"), (0x08, "PSH"), (0x20, "URG")]; + let names = [(0x02, "SYN"), (0x10, "ACK"), (0x01, "FIN"), (0x04, "RST"), (0x08, "PSH"), (0x20, "URG"), (0x40, "ECE"), (0x80, "CWR")]; names.iter().filter(|(b, _)| f & b != 0).map(|(_, n)| *n).collect::>().join(",") } diff --git a/crates/pcap/tests/pcap_tcp_ecn.rs b/crates/pcap/tests/pcap_tcp_ecn.rs new file mode 100644 index 000000000..e8668af1d --- /dev/null +++ b/crates/pcap/tests/pcap_tcp_ecn.rs @@ -0,0 +1,33 @@ +use craft_anything_formats::pcap::decode; + +/// Decode a raw IPv4 packet with a TCP header and the specified control bits. +fn flags_on_wire(bits: u8) -> String { + let mut packet = [0u8; 40]; + packet[0] = 0x45; + packet[2..4].copy_from_slice(&40u16.to_be_bytes()); + packet[8] = 64; + packet[9] = 6; + packet[20..24].copy_from_slice(&[0xc0, 0, 0x01, 0xbb]); + packet[32] = 0x50; + packet[33] = bits; + decode(228, &packet).transport.unwrap().tcp_flags.unwrap() +} + +/// An ECN-capable SYN shows both classic ECN flags. +#[test] +fn reports_ecn_setup_on_syn() { + assert_eq!(flags_on_wire(0xc2), "SYN,ECE,CWR"); +} + +/// The receiver and sender can signal ECE and CWR independently on ACKs. +#[test] +fn distinguishes_ecn_echo_and_window_reduction() { + assert_eq!(flags_on_wire(0x50), "ACK,ECE"); + assert_eq!(flags_on_wire(0x90), "ACK,CWR"); +} + +/// Existing non-ECN packets keep their flag strings. +#[test] +fn keeps_ordinary_ack_flags() { + assert_eq!(flags_on_wire(0x12), "SYN,ACK"); +} From eb837704646f851ac47cdc55b0e554b872e7f255 Mon Sep 17 00:00:00 2001 From: RRFZ <247457381+Plastic-time@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:37:53 -0500 Subject: [PATCH 049/183] pcap: preserve capture and protocol source history Port relevant PCAP implementation and regression snapshots from Craft Anything 3836b5bd529de3db647cd433f78715fb6c2ad07f. --- crates/pcap/src/lib.rs | 5 ++- crates/pcap/tests/pcap_ipv6_no_next_header.rs | 40 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 crates/pcap/tests/pcap_ipv6_no_next_header.rs diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index 065663423..5caa19938 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -712,7 +712,10 @@ fn ipv6(p: &[u8], d: &mut Decoded) { d.note = Some("IPv6 fragment (transport header is in the first fragment)".into()); return; } - transport(next, p.get(off..end).unwrap_or(&[]), d); + // RFC 8200: No Next Header ends the chain even if the packet has trailing bytes. + if next != 59 { + transport(next, p.get(off..end).unwrap_or(&[]), d); + } } fn tcp_flags(f: u8) -> String { diff --git a/crates/pcap/tests/pcap_ipv6_no_next_header.rs b/crates/pcap/tests/pcap_ipv6_no_next_header.rs new file mode 100644 index 000000000..fd698e393 --- /dev/null +++ b/crates/pcap/tests/pcap_ipv6_no_next_header.rs @@ -0,0 +1,40 @@ +use craft_anything_formats::pcap::decode; + +/// Build a raw IPv6 packet with the given payload and Next Header field. +fn packet(next: u8, payload: &[u8]) -> Vec { + let mut packet = vec![0; 40]; + packet[0] = 0x60; + packet[4..6].copy_from_slice(&u16::try_from(payload.len()).unwrap().to_be_bytes()); + packet[6] = next; + packet[7] = 64; + packet.extend_from_slice(payload); + packet +} + +/// Both an empty packet and bytes after No Next Header have no transport record. +#[test] +fn no_next_header_has_no_transport() { + for payload in [b"".as_slice(), b"padding"] { + let decoded = decode(229, &packet(59, payload)); + assert_eq!(decoded.ip.unwrap().protocol, 59); + assert_eq!(decoded.protocols, ["raw", "ipv6"]); + assert!(decoded.transport.is_none()); + } +} + +/// Destination Options can also end the header chain. +#[test] +fn no_next_header_after_an_extension() { + let decoded = decode(229, &packet(60, &[59, 0, 0, 0, 0, 0, 0, 0, 1, 2])); + assert_eq!(decoded.ip.unwrap().protocol, 59); + assert!(decoded.transport.is_none()); +} + +/// UDP after the same extension still yields its transport and payload. +#[test] +fn udp_after_an_extension_still_decodes() { + let decoded = decode(229, &packet(60, &[17, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 11, 0, 9, 0, 0, 42])); + let transport = decoded.transport.unwrap(); + assert_eq!(transport.protocol, "udp"); + assert_eq!((transport.src_port, transport.dst_port, transport.payload_len), (Some(10), Some(11), 1)); +} From e97e73f5792e180d3b9227c3c1a10a9e21f56b14 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 17 Nov 2026 08:38:13 -0500 Subject: [PATCH 050/183] dex: Craft Anything Port Craft Anything f64ae3bf3c8863a982af1304e06de20653803968 reader and opcode decoder. --- crates/dex/src/dex.rs | 810 ++++++++++++++++++++++++++++++++++++++ crates/dex/src/dex_ops.rs | 640 ++++++++++++++++++++++++++++++ 2 files changed, 1450 insertions(+) create mode 100644 crates/dex/src/dex.rs create mode 100644 crates/dex/src/dex_ops.rs diff --git a/crates/dex/src/dex.rs b/crates/dex/src/dex.rs new file mode 100644 index 000000000..e46d97b5b --- /dev/null +++ b/crates/dex/src/dex.rs @@ -0,0 +1,810 @@ +//! Dalvik executables (DEX): header, string/type/proto/field/method ids, class definitions, +//! class data, code items with try/catch handlers, class annotations, a smali-like listing of +//! method bodies and a reference finder. Counts are checked against the file size, strings are +//! decoded from MUTF-8 under a total budget, and every read is bounds-checked. + +use crate::FormatError; +use crate::bytes::Reader; +use crate::dex_ops::{IndexKind, Insn, Payload}; +use serde::Serialize; + +pub const NO_INDEX: u32 = 0xffff_ffff; +/// Longest string decoded (UTF-16 units). +const MAX_STRING_UNITS: usize = 16 * 1024; +/// Total UTF-16 units decoded across all strings of one file. +const STRING_BUDGET: usize = 64 * 1024 * 1024; +/// Most members per class list. +const MAX_MEMBERS: usize = 65_536; +/// Most try blocks / handlers per method. +const MAX_TRIES: usize = 4096; +const MAX_HANDLERS: usize = 256; + +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize)] +pub struct Header { + pub version: String, + pub checksum: String, + /// Adler-32 recomputed over the file. + pub checksum_ok: bool, + /// SHA-1 field as stored (not recomputed). + pub signature: String, + pub file_size: u32, + pub header_size: u32, + pub endian_tag: String, + pub string_ids: u32, + pub type_ids: u32, + pub proto_ids: u32, + pub field_ids: u32, + pub method_ids: u32, + pub class_defs: u32, + pub data_size: u32, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +struct ProtoId { + shorty: u32, + ret: u32, + params_off: u32, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct MemberId { + pub class_idx: u16, + /// Type (fields) or proto (methods). + pub type_or_proto: u16, + pub name_idx: u32, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct ClassDef { + pub class_idx: u32, + pub access: u32, + pub superclass_idx: u32, + pub interfaces_off: u32, + pub source_file_idx: u32, + pub annotations_off: u32, + pub class_data_off: u32, + pub static_values_off: u32, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] +pub struct EncodedField { + pub field_idx: u32, + pub access: u32, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] +pub struct EncodedMethod { + pub method_idx: u32, + pub access: u32, + pub code_off: u32, +} + +#[derive(Debug, Clone, Default, PartialEq, Eq)] +pub struct ClassData { + pub static_fields: Vec, + pub instance_fields: Vec, + pub direct_methods: Vec, + pub virtual_methods: Vec, + pub complete: bool, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct Handler { + /// Exception type descriptor; `None` for catch-all. + pub exception: Option, + pub address: u32, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct Try { + pub start: u32, + pub end: u32, + pub handlers: Vec, +} + +#[derive(Debug, Clone, Default, PartialEq, Eq)] +pub struct Code { + pub registers: u16, + pub ins: u16, + pub outs: u16, + pub insns: Vec, + pub tries: Vec, + pub debug_info_off: u32, +} + +/// A parsed DEX file. +#[derive(Debug, Clone)] +pub struct Dex<'a> { + data: &'a [u8], + pub header: Header, + pub strings: Vec, + types: Vec, + protos: Vec, + pub fields: Vec, + pub methods: Vec, + pub classes: Vec, + pub warnings: Vec, +} + +fn adler32(data: &[u8]) -> u32 { + let (mut a, mut b) = (1u32, 0u32); + for chunk in data.chunks(5552) { + for &x in chunk { + a += u32::from(x); + b += a; + } + a %= 65521; + b %= 65521; + } + (b << 16) | a +} + +/// Decode modified UTF-8 (as used by DEX and class files) to a String. +pub fn mutf8(r: &Reader<'_>, mut at: usize, max_units: usize) -> (String, usize) { + let mut units: Vec = Vec::new(); + let mut consumed = 0usize; + while units.len() < max_units { + let Some(b0) = r.u8(at) else { break }; + if b0 == 0 { + break; + } + let (u, n) = if b0 < 0x80 { + (u16::from(b0), 1) + } else if b0 & 0xe0 == 0xc0 { + let b1 = r.u8(at + 1).unwrap_or(0); + ((u16::from(b0 & 0x1f) << 6) | u16::from(b1 & 0x3f), 2) + } else if b0 & 0xf0 == 0xe0 { + let b1 = r.u8(at + 1).unwrap_or(0); + let b2 = r.u8(at + 2).unwrap_or(0); + ((u16::from(b0 & 0x0f) << 12) | (u16::from(b1 & 0x3f) << 6) | u16::from(b2 & 0x3f), 3) + } else { + (0xfffd, 1) + }; + units.push(u); + at = at.saturating_add(n); + consumed += n; + } + (String::from_utf16_lossy(&units), consumed) +} + +/// Signed LEB128 at `off`: (value, bytes). +pub fn sleb128(r: &Reader<'_>, off: usize) -> Option<(i64, usize)> { + let mut result = 0i64; + let mut shift = 0u32; + for i in 0..10usize { + let b = r.u8(off.checked_add(i)?)?; + result |= i64::from(b & 0x7f).checked_shl(shift)?; + shift += 7; + if b & 0x80 == 0 { + if shift < 64 && b & 0x40 != 0 { + result |= -1i64 << shift; + } + return Some((result, i + 1)); + } + } + None +} + +/// `Lcom/x/Y;` → `com.x.Y`; `[I` → `int[]`. +pub fn java_name(desc: &str) -> String { + let dims = desc.chars().take_while(|&c| c == '[').count(); + let base = desc.get(dims..).unwrap_or(""); + let name = match base { + "V" => "void".to_string(), + "Z" => "boolean".to_string(), + "B" => "byte".to_string(), + "S" => "short".to_string(), + "C" => "char".to_string(), + "I" => "int".to_string(), + "J" => "long".to_string(), + "F" => "float".to_string(), + "D" => "double".to_string(), + b if b.starts_with('L') && b.ends_with(';') => b.get(1..b.len() - 1).unwrap_or("").replace('/', "."), + b => b.to_string(), + }; + format!("{name}{}", "[]".repeat(dims.min(255))) +} + +/// `com.x.Y` or `com/x/Y` or `Lcom/x/Y;` → `Lcom/x/Y;`. +pub fn to_descriptor(name: &str) -> String { + let n = name.trim(); + if n.starts_with('L') && n.ends_with(';') { n.to_string() } else { format!("L{};", n.replace('.', "/")) } +} + +/// Access flag names for a class, field or method. +pub fn access_flags(flags: u32, kind: &str) -> Vec<&'static str> { + let mut v = Vec::new(); + let table: &[(u32, &str)] = &[ + (0x1, "public"), + (0x2, "private"), + (0x4, "protected"), + (0x8, "static"), + (0x10, "final"), + (0x100, "native"), + (0x200, "interface"), + (0x400, "abstract"), + (0x800, "strictfp"), + (0x1000, "synthetic"), + (0x2000, "annotation"), + (0x4000, "enum"), + (0x10000, "constructor"), + (0x20000, "declared-synchronized"), + ]; + for (bit, name) in table { + if flags & bit != 0 { + v.push(*name); + } + } + match kind { + "method" => { + if flags & 0x20 != 0 { + v.push("synchronized"); + } + if flags & 0x40 != 0 { + v.push("bridge"); + } + if flags & 0x80 != 0 { + v.push("varargs"); + } + } + "field" => { + if flags & 0x40 != 0 { + v.push("volatile"); + } + if flags & 0x80 != 0 { + v.push("transient"); + } + } + _ => {} + } + v +} + +fn table(r: &Reader<'_>, count_off: usize, what: &str, entry: usize) -> Result<(usize, usize), FormatError> { + let n = r.u32_le(count_off).ok_or_else(|| FormatError::Truncated("header".into()))? as usize; + let off = r.u32_le(count_off + 4).ok_or_else(|| FormatError::Truncated("header".into()))? as usize; + if n == 0 { + return Ok((0, 0)); + } + let bytes = n.checked_mul(entry).ok_or_else(|| FormatError::Malformed(format!("{what} count overflows")))?; + if off.checked_add(bytes).is_none_or(|e| e > r.len()) { + return Err(FormatError::Malformed(format!("{n} {what} at offset {off} run past the end of the file"))); + } + Ok((n, off)) +} + +/// True when bytes start with a DEX magic. +pub fn is_dex(data: &[u8]) -> bool { + data.starts_with(b"dex\n") && data.len() >= 0x70 +} + +/// Parse a DEX file. +pub fn parse(data: &[u8]) -> Result, FormatError> { + let r = Reader::new(data); + if !data.starts_with(b"dex\n") { + return Err(FormatError::Malformed("not a DEX file (no dex magic)".into())); + } + if data.len() < 0x70 { + return Err(FormatError::Truncated("DEX header".into())); + } + let mut warnings = Vec::new(); + let version = r.cstr(4, 4).unwrap_or_default(); + let checksum = r.u32_le(8).unwrap_or(0); + let file_size = r.u32_le(32).unwrap_or(0); + let endian = r.u32_le(40).unwrap_or(0); + if endian != 0x1234_5678 { + return Err(FormatError::Unsupported(format!("byte-swapped DEX (endian tag {endian:#x})"))); + } + if file_size as usize != data.len() { + warnings.push(format!("header says {file_size} bytes, the file has {}", data.len())); + } + let sum_end = (file_size as usize).min(data.len()); + let checksum_ok = data.get(12..sum_end).is_some_and(|d| adler32(d) == checksum); + if !checksum_ok { + warnings.push("Adler-32 checksum does not match the content".into()); + } + let (ns, so) = table(&r, 56, "strings", 4)?; + let (nt, to) = table(&r, 64, "types", 4)?; + let (np, po) = table(&r, 72, "protos", 12)?; + let (nf, fo) = table(&r, 80, "fields", 8)?; + let (nm, mo) = table(&r, 88, "methods", 8)?; + let (nc, co) = table(&r, 96, "classes", 32)?; + let header = Header { + version, + checksum: format!("{checksum:08x}"), + checksum_ok, + signature: r.slice(12, 20).map(|b| b.iter().map(|x| format!("{x:02x}")).collect()).unwrap_or_default(), + file_size, + header_size: r.u32_le(36).unwrap_or(0), + endian_tag: format!("{endian:#x}"), + string_ids: ns as u32, + type_ids: nt as u32, + proto_ids: np as u32, + field_ids: nf as u32, + method_ids: nm as u32, + class_defs: nc as u32, + data_size: r.u32_le(104).unwrap_or(0), + }; + let mut strings = Vec::with_capacity(ns); + let mut budget = STRING_BUDGET; + let mut over_budget = false; + for i in 0..ns { + let off = r.u32_le(so + i * 4).unwrap_or(0) as usize; + let s = match r.uleb128(off) { + Some((len, n)) if budget > 0 => { + let want = (len as usize).min(MAX_STRING_UNITS).min(budget); + let (s, _) = mutf8(&r, off.saturating_add(n), want); + budget = budget.saturating_sub(want.max(1)); + s + } + Some(_) => { + over_budget = true; + format!("") + } + None => format!(""), + }; + strings.push(s); + } + if over_budget { + warnings.push("string decoding budget reached; later strings are shown as ".into()); + } + let types = (0..nt).map(|i| r.u32_le(to + i * 4).unwrap_or(NO_INDEX)).collect(); + let protos = (0..np) + .map(|i| { + let o = po + i * 12; + ProtoId { shorty: r.u32_le(o).unwrap_or(0), ret: r.u32_le(o + 4).unwrap_or(NO_INDEX), params_off: r.u32_le(o + 8).unwrap_or(0) } + }) + .collect(); + let member = + |o: usize| MemberId { class_idx: r.u16_le(o).unwrap_or(0), type_or_proto: r.u16_le(o + 2).unwrap_or(0), name_idx: r.u32_le(o + 4).unwrap_or(NO_INDEX) }; + let fields = (0..nf).map(|i| member(fo + i * 8)).collect(); + let methods = (0..nm).map(|i| member(mo + i * 8)).collect(); + let classes = (0..nc) + .map(|i| { + let o = co + i * 32; + let g = |k: usize| r.u32_le(o + k * 4).unwrap_or(0); + ClassDef { + class_idx: g(0), + access: g(1), + superclass_idx: g(2), + interfaces_off: g(3), + source_file_idx: g(4), + annotations_off: g(5), + class_data_off: g(6), + static_values_off: g(7), + } + }) + .collect(); + Ok(Dex { data, header, strings, types, protos, fields, methods, classes, warnings }) +} + +impl<'a> Dex<'a> { + fn r(&self) -> Reader<'a> { + Reader::new(self.data) + } + + pub fn string(&self, i: u32) -> &str { + self.strings.get(i as usize).map(String::as_str).unwrap_or("") + } + + /// The descriptor of type `i` (`Lcom/x/Y;`). + pub fn type_desc(&self, i: u32) -> String { + match self.types.get(i as usize) { + Some(&s) => self.string(s).to_string(), + None => format!(""), + } + } + + fn type_list(&self, off: u32) -> Vec { + if off == 0 { + return Vec::new(); + } + let r = self.r(); + let n = r.u32_le(off as usize).unwrap_or(0) as usize; + (0..n.min(256)).filter_map(|i| r.u16_le(off as usize + 4 + i * 2).map(u32::from)).collect() + } + + /// `(Ljava/lang/String;I)V` + pub fn proto_desc(&self, i: u32) -> String { + match self.protos.get(i as usize) { + Some(p) => { + let params: String = self.type_list(p.params_off).into_iter().map(|t| self.type_desc(t)).collect(); + format!("({params}){}", self.type_desc(p.ret)) + } + None => format!(""), + } + } + + /// Parameter type descriptors and return type of proto `i`. + pub fn proto_parts(&self, i: u32) -> (Vec, String) { + match self.protos.get(i as usize) { + Some(p) => (self.type_list(p.params_off).into_iter().map(|t| self.type_desc(t)).collect(), self.type_desc(p.ret)), + None => (Vec::new(), "?".into()), + } + } + + pub fn shorty(&self, i: u32) -> &str { + self.protos.get(i as usize).map(|p| self.string(p.shorty)).unwrap_or("") + } + + /// `Lcls;->name:Ltype;` + pub fn field_ref(&self, i: u32) -> String { + match self.fields.get(i as usize) { + Some(f) => format!("{}->{}:{}", self.type_desc(u32::from(f.class_idx)), self.string(f.name_idx), self.type_desc(u32::from(f.type_or_proto))), + None => format!(""), + } + } + + /// `Lcls;->name(…)R` + pub fn method_ref(&self, i: u32) -> String { + match self.methods.get(i as usize) { + Some(m) => format!("{}->{}{}", self.type_desc(u32::from(m.class_idx)), self.string(m.name_idx), self.proto_desc(u32::from(m.type_or_proto))), + None => format!(""), + } + } + + pub fn class_name(&self, c: &ClassDef) -> String { + self.type_desc(c.class_idx) + } + + pub fn find_class(&self, name: &str) -> Option<&ClassDef> { + let want = to_descriptor(name); + self.classes.iter().find(|c| self.class_name(c) == want) + } + + pub fn interfaces(&self, c: &ClassDef) -> Vec { + self.type_list(c.interfaces_off).into_iter().map(|t| self.type_desc(t)).collect() + } + + /// Type descriptors of the class-level annotations. + pub fn annotations(&self, c: &ClassDef) -> Vec { + let r = self.r(); + let mut out = Vec::new(); + if c.annotations_off == 0 { + return out; + } + let Some(set_off) = r.u32_le(c.annotations_off as usize) else { return out }; + if set_off == 0 { + return out; + } + let n = r.u32_le(set_off as usize).unwrap_or(0) as usize; + for i in 0..n.min(256) { + let Some(item) = r.u32_le(set_off as usize + 4 + i * 4) else { break }; + // visibility u8, then encoded_annotation: uleb type_idx … + let vis = r.u8(item as usize).unwrap_or(0); + if let Some((t, _)) = r.uleb128(item as usize + 1) { + let v = match vis { + 0 => "build", + 1 => "runtime", + 2 => "system", + _ => "?", + }; + out.push(format!("{} ({v})", self.type_desc(t as u32))); + } + } + out + } + + pub fn class_data(&self, c: &ClassDef) -> ClassData { + let mut cd = ClassData::default(); + if c.class_data_off == 0 { + cd.complete = true; + return cd; + } + let r = self.r(); + let mut pos = c.class_data_off as usize; + let next = |pos: &mut usize| -> Option { + let (v, n) = r.uleb128(*pos)?; + *pos += n; + u32::try_from(v).ok() + }; + let (Some(sf), Some(inf), Some(dm), Some(vm)) = (next(&mut pos), next(&mut pos), next(&mut pos), next(&mut pos)) else { return cd }; + let remaining = self.data.len().saturating_sub(pos); + let total = [sf, inf, dm, vm].iter().map(|&x| x as usize).sum::(); + if total > remaining || total > MAX_MEMBERS * 4 { + return cd; + } + for (count, is_method, slot) in [(sf, false, 0), (inf, false, 1), (dm, true, 2), (vm, true, 3)] { + let mut idx: u32 = 0; + for _ in 0..count.min(MAX_MEMBERS as u32) { + let Some(diff) = next(&mut pos) else { return cd }; + let Some(access) = next(&mut pos) else { return cd }; + idx = match idx.checked_add(diff) { + Some(v) => v, + None => return cd, + }; + if is_method { + let Some(code_off) = next(&mut pos) else { return cd }; + let m = EncodedMethod { method_idx: idx, access, code_off }; + if slot == 2 { + cd.direct_methods.push(m); + } else { + cd.virtual_methods.push(m); + } + } else { + let f = EncodedField { field_idx: idx, access }; + if slot == 0 { + cd.static_fields.push(f); + } else { + cd.instance_fields.push(f); + } + } + } + } + cd.complete = true; + cd + } + + /// The code item at `off`. + pub fn code(&self, off: u32) -> Option { + if off == 0 { + return None; + } + let r = self.r(); + let o = off as usize; + let registers = r.u16_le(o)?; + let ins = r.u16_le(o + 2)?; + let outs = r.u16_le(o + 4)?; + let tries_size = usize::from(r.u16_le(o + 6)?); + let debug_info_off = r.u32_le(o + 8)?; + let n = r.u32_le(o + 12)? as usize; + let bytes = r.slice(o + 16, n.checked_mul(2)?)?; + let insns: Vec = bytes.as_chunks::<2>().0.iter().map(|c| u16::from_le_bytes(*c)).collect(); + let mut tries = Vec::new(); + let mut t_off = o + 16 + n * 2; + if tries_size > 0 && n % 2 == 1 { + t_off += 2; + } + let handlers_base = t_off + tries_size * 8; + for i in 0..tries_size.min(MAX_TRIES) { + let at = t_off + i * 8; + let (Some(start), Some(count), Some(h_off)) = (r.u32_le(at), r.u16_le(at + 4), r.u16_le(at + 6)) else { break }; + let mut handlers = Vec::new(); + let mut p = handlers_base + usize::from(h_off); + if let Some((size, k)) = sleb128(&r, p) { + p += k; + for _ in 0..size.unsigned_abs().min(MAX_HANDLERS as u64) { + let Some((t, k1)) = r.uleb128(p) else { break }; + let Some((addr, k2)) = r.uleb128(p + k1) else { break }; + p += k1 + k2; + handlers.push(Handler { exception: Some(self.type_desc(t as u32)), address: addr as u32 }); + } + if size <= 0 + && let Some((addr, _)) = r.uleb128(p) + { + handlers.push(Handler { exception: None, address: addr as u32 }); + } + } + tries.push(Try { start, end: start.saturating_add(u32::from(count)), handlers }); + } + Some(Code { registers, ins, outs, insns, tries, debug_info_off }) + } + + /// Name of method `i`. + pub fn method_name(&self, i: u32) -> &str { + self.methods.get(i as usize).map(|m| self.string(m.name_idx)).unwrap_or("") + } + + /// Java-like signature: `public static void log(java.lang.String)`. + pub fn method_signature(&self, m: &EncodedMethod) -> String { + let Some(id) = self.methods.get(m.method_idx as usize) else { return format!("", m.method_idx) }; + let (params, ret) = self.proto_parts(u32::from(id.type_or_proto)); + let flags = access_flags(m.access, "method").into_iter().filter(|f| *f != "constructor").collect::>().join(" "); + let params = params.iter().map(|p| java_name(p)).collect::>().join(", "); + format!("{}{}{} {}({params})", flags, if flags.is_empty() { "" } else { " " }, java_name(&ret), self.string(id.name_idx)).trim().to_string() + } + + /// Render one instruction smali-style. + pub fn format_insn(&self, i: &Insn) -> String { + let mut parts: Vec = Vec::new(); + if !i.regs.is_empty() { + let is_list = i.name.starts_with("invoke") || i.name.starts_with("filled-new-array"); + if i.range { + match (i.regs.first(), i.regs.last()) { + (Some(a), Some(b)) => parts.push(format!("{{v{a} .. v{b}}}")), + _ => parts.push("{}".into()), + } + } else if is_list { + parts.push(format!("{{{}}}", i.regs.iter().map(|r| format!("v{r}")).collect::>().join(", "))); + } else { + parts.extend(i.regs.iter().map(|r| format!("v{r}"))); + } + } else if i.range || i.name.starts_with("invoke") { + parts.push("{}".into()); + } + if let Some(l) = i.literal { + parts.push(if (-9..=9).contains(&l) { format!("{l}") } else { format!("{l:#x}") }); + } + if let Some(idx) = i.index { + parts.push(match i.index_kind { + IndexKind::String => format!("{:?}", self.string(idx)), + IndexKind::Type => self.type_desc(idx), + IndexKind::Field => self.field_ref(idx), + IndexKind::Method => self.method_ref(idx), + IndexKind::CallSite => format!("call_site@{idx}"), + IndexKind::MethodHandle => format!("method_handle@{idx}"), + IndexKind::Proto => self.proto_desc(idx), + IndexKind::None => format!("@{idx}"), + }); + } + if let Some(p) = i.index2 { + parts.push(self.proto_desc(p)); + } + if let Some(t) = i.target { + parts.push(format!(":{t:04x}")); + } + let mut s = if parts.is_empty() { i.name.to_string() } else { format!("{} {}", i.name, parts.join(", ")) }; + match (&i.payload, i.opcode) { + (Some(Payload::PackedSwitch { first_key, targets }), 0x2b) => { + let cases: Vec = targets + .iter() + .enumerate() + .take(32) + .map(|(k, t)| format!("{} -> :{:04x}", i64::from(*first_key) + k as i64, i64::from(i.offset) + i64::from(*t))) + .collect(); + s.push_str(&format!(" # {}", cases.join(", "))); + } + (Some(Payload::SparseSwitch { keys, targets }), 0x2c) => { + let cases: Vec = + keys.iter().zip(targets).take(32).map(|(k, t)| format!("{k} -> :{:04x}", i64::from(i.offset) + i64::from(*t))).collect(); + s.push_str(&format!(" # {}", cases.join(", "))); + } + (Some(Payload::FillArrayData { element_width, count, .. }), _) => s.push_str(&format!(" # {count} x {element_width}-byte elements")), + (Some(Payload::PackedSwitch { targets, .. }), 0) => s.push_str(&format!(" ({} cases)", targets.len())), + (Some(Payload::SparseSwitch { targets, .. }), 0) => s.push_str(&format!(" ({} cases)", targets.len())), + _ => {} + } + s + } +} + +/// One place code refers to a class, method or field. +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct Reference { + /// Caller method, `Lcls;->name(…)R`. + pub caller: String, + /// Code unit offset in the caller. + pub offset: u32, + pub instruction: &'static str, + /// method, field or type + pub kind: &'static str, + pub target: String, +} + +/// Every instruction that refers to class `desc` (optionally only its methods named `method`). +pub fn references(dex: &Dex<'_>, desc: &str, method: Option<&str>, max: usize) -> (Vec, bool) { + let mut out = Vec::new(); + for c in &dex.classes { + let cd = dex.class_data(c); + for m in cd.direct_methods.iter().chain(&cd.virtual_methods) { + let Some(code) = dex.code(m.code_off) else { continue }; + let (insns, _) = crate::dex_ops::decode(&code.insns, 200_000); + for i in &insns { + let Some(idx) = i.index else { continue }; + let hit = match i.index_kind { + IndexKind::Method => dex.methods.get(idx as usize).and_then(|id| { + let cls = dex.type_desc(u32::from(id.class_idx)); + (cls == desc && method.is_none_or(|n| dex.string(id.name_idx) == n)).then(|| ("method", dex.method_ref(idx))) + }), + IndexKind::Field if method.is_none() => { + dex.fields.get(idx as usize).and_then(|id| (dex.type_desc(u32::from(id.class_idx)) == desc).then(|| ("field", dex.field_ref(idx)))) + } + IndexKind::Type if method.is_none() => { + let t = dex.type_desc(idx); + (t.trim_start_matches('[') == desc).then_some(("type", t)) + } + _ => None, + }; + if let Some((kind, target)) = hit { + if out.len() >= max { + return (out, true); + } + out.push(Reference { caller: dex.method_ref(m.method_idx), offset: i.offset, instruction: i.name, kind, target }); + } + } + } + } + (out, false) +} + +#[cfg(test)] +mod tests { + use super::*; + use craft_anything_testkit::android as fx; + + #[test] + fn parses_fixture() { + let data = fx::notes_dex(); + let d = parse(&data).unwrap(); + assert!(d.warnings.is_empty(), "{:?}", d.warnings); + assert!(d.header.checksum_ok); + assert_eq!(d.header.version, "035"); + assert_eq!(d.classes.len(), 2); + let main = d.find_class("com.example.notes.MainActivity").unwrap(); + assert_eq!(d.type_desc(main.superclass_idx), "Landroid/app/Activity;"); + assert_eq!(d.interfaces(main), vec!["Ljava/lang/Runnable;"]); + assert_eq!(d.string(main.source_file_idx), "MainActivity.java"); + assert_eq!(d.annotations(main), vec!["Ljava/lang/Deprecated; (runtime)"]); + let cd = d.class_data(main); + assert!(cd.complete); + assert_eq!(cd.static_fields.len(), 1); + assert_eq!(cd.instance_fields.len(), 1); + assert_eq!(cd.direct_methods.len(), 1); + assert_eq!(cd.virtual_methods.len(), 3); + let on_create = cd.virtual_methods.iter().find(|m| d.method_name(m.method_idx) == "onCreate").unwrap(); + assert_eq!(d.method_signature(on_create), "public void onCreate(android.os.Bundle)"); + let code = d.code(on_create.code_off).unwrap(); + let (ins, complete) = crate::dex_ops::decode(&code.insns, 1000); + assert!(complete); + let text: Vec = ins.iter().map(|i| d.format_insn(i)).collect(); + assert_eq!(text[0], "const-string v0, \"Hello, Craft!\""); + assert_eq!(text[1], "invoke-static {v0}, Lcom/example/notes/Util;->log(Ljava/lang/String;)V"); + let pick = cd.virtual_methods.iter().find(|m| d.method_name(m.method_idx) == "pick").unwrap(); + let pc = d.code(pick.code_off).unwrap(); + assert_eq!(pc.tries.len(), 1); + assert_eq!(pc.tries[0].handlers[0].exception.as_deref(), Some("Ljava/lang/RuntimeException;")); + assert_eq!(pc.tries[0].handlers[1].exception, None); + let (pins, _) = crate::dex_ops::decode(&pc.insns, 1000); + let sw = pins.iter().find(|i| i.name == "packed-switch").unwrap(); + assert!(d.format_insn(sw).contains("# 1 -> :"), "{}", d.format_insn(sw)); + let (refs, more) = references(&d, "Lcom/example/notes/Util;", Some("log"), 100); + assert!(!more); + assert_eq!(refs.len(), 2, "{refs:?}"); + assert_eq!(refs[0].caller, "Lcom/example/notes/MainActivity;->onCreate(Landroid/os/Bundle;)V"); + let (all, _) = references(&d, "Ljava/lang/System;", None, 100); + assert_eq!(all[0].kind, "field"); + } + + #[test] + fn helpers() { + assert_eq!(java_name("[[Ljava/lang/String;"), "java.lang.String[][]"); + assert_eq!(java_name("J"), "long"); + assert_eq!(to_descriptor("a.b.C"), "La/b/C;"); + assert_eq!(to_descriptor("La/b/C;"), "La/b/C;"); + assert_eq!(access_flags(0x10009, "method"), vec!["public", "static", "constructor"]); + let r = Reader::new(&[0x7f]); + assert_eq!(sleb128(&r, 0), Some((-1, 1))); + let s = [0xc0, 0x80, 0xe2, 0x82, 0xac, 0x41, 0]; + assert_eq!(mutf8(&Reader::new(&s), 0, 100).0, "\0\u{20ac}A"); + } + + #[test] + fn hostile() { + let data = fx::notes_dex(); + let walk = |d: &Dex<'_>| { + for c in &d.classes { + let cd = d.class_data(c); + let _ = d.annotations(c); + let _ = d.interfaces(c); + for m in cd.direct_methods.iter().chain(&cd.virtual_methods) { + let _ = d.method_signature(m); + if let Some(code) = d.code(m.code_off) { + let (ins, _) = crate::dex_ops::decode(&code.insns, 10_000); + for i in &ins { + let _ = d.format_insn(i); + } + } + } + } + let _ = references(d, "Lcom/example/notes/Util;", None, 100); + }; + for m in craft_anything_testkit::mutations(&data) { + if let Ok(d) = parse(&m) { + walk(&d); + } + } + for len in 0..data.len() { + if let Ok(d) = parse(&data[..len]) { + walk(&d); + } + } + for seed in 0..64 { + let mut n = craft_anything_testkit::noise(seed, 2048); + n[..8].copy_from_slice(b"dex\n035\0"); + n[40..44].copy_from_slice(&0x1234_5678u32.to_le_bytes()); + if let Ok(d) = parse(&n) { + walk(&d); + } + } + } +} diff --git a/crates/dex/src/dex_ops.rs b/crates/dex/src/dex_ops.rs new file mode 100644 index 000000000..139ad77ac --- /dev/null +++ b/crates/dex/src/dex_ops.rs @@ -0,0 +1,640 @@ +//! Dalvik bytecode: the opcode table (all 256 slots and three payload pseudo-instructions) and a +//! decoder for every instruction format. Pure decoding; index operands are resolved by the caller. + +use serde::Serialize; + +/// What an index operand refers to. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] +#[serde(rename_all = "snake_case")] +pub enum IndexKind { + None, + String, + Type, + Field, + Method, + CallSite, + MethodHandle, + Proto, +} + +/// Instruction formats from the Dalvik specification (`10x`, `35c`, …). +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] +pub enum Fmt { + F10x, + F12x, + F11n, + F11x, + F10t, + F20t, + F22x, + F21t, + F21s, + F21h, + F21c, + F23x, + F22b, + F22t, + F22s, + F22c, + F30t, + F32x, + F31i, + F31t, + F31c, + F35c, + F3rc, + F45cc, + F4rcc, + F51l, +} + +impl Fmt { + /// Length in 16-bit code units. + pub fn units(self) -> usize { + use Fmt::*; + match self { + F10x | F12x | F11n | F11x | F10t => 1, + F20t | F22x | F21t | F21s | F21h | F21c | F23x | F22b | F22t | F22s | F22c => 2, + F30t | F32x | F31i | F31t | F31c | F35c | F3rc => 3, + F45cc | F4rcc => 4, + F51l => 5, + } + } +} + +/// One opcode slot. +#[derive(Debug, Clone, Copy)] +pub struct Op { + pub name: &'static str, + pub fmt: Fmt, + pub index: IndexKind, +} + +const fn op(name: &'static str, fmt: Fmt, index: IndexKind) -> Op { + Op { name, fmt, index } +} + +const UNUSED: Op = op("unused", Fmt::F10x, IndexKind::None); + +const UNOPS: [&str; 21] = [ + "neg-int", + "not-int", + "neg-long", + "not-long", + "neg-float", + "neg-double", + "int-to-long", + "int-to-float", + "int-to-double", + "long-to-int", + "long-to-float", + "long-to-double", + "float-to-int", + "float-to-long", + "float-to-double", + "double-to-int", + "double-to-long", + "double-to-float", + "int-to-byte", + "int-to-char", + "int-to-short", +]; + +const BINOPS: [&str; 32] = [ + "add-int", + "sub-int", + "mul-int", + "div-int", + "rem-int", + "and-int", + "or-int", + "xor-int", + "shl-int", + "shr-int", + "ushr-int", + "add-long", + "sub-long", + "mul-long", + "div-long", + "rem-long", + "and-long", + "or-long", + "xor-long", + "shl-long", + "shr-long", + "ushr-long", + "add-float", + "sub-float", + "mul-float", + "div-float", + "rem-float", + "add-double", + "sub-double", + "mul-double", + "div-double", + "rem-double", +]; + +const BINOPS_2ADDR: [&str; 32] = [ + "add-int/2addr", + "sub-int/2addr", + "mul-int/2addr", + "div-int/2addr", + "rem-int/2addr", + "and-int/2addr", + "or-int/2addr", + "xor-int/2addr", + "shl-int/2addr", + "shr-int/2addr", + "ushr-int/2addr", + "add-long/2addr", + "sub-long/2addr", + "mul-long/2addr", + "div-long/2addr", + "rem-long/2addr", + "and-long/2addr", + "or-long/2addr", + "xor-long/2addr", + "shl-long/2addr", + "shr-long/2addr", + "ushr-long/2addr", + "add-float/2addr", + "sub-float/2addr", + "mul-float/2addr", + "div-float/2addr", + "rem-float/2addr", + "add-double/2addr", + "sub-double/2addr", + "mul-double/2addr", + "div-double/2addr", + "rem-double/2addr", +]; + +const LIT16: [&str; 8] = ["add-int/lit16", "rsub-int", "mul-int/lit16", "div-int/lit16", "rem-int/lit16", "and-int/lit16", "or-int/lit16", "xor-int/lit16"]; +const LIT8: [&str; 11] = [ + "add-int/lit8", + "rsub-int/lit8", + "mul-int/lit8", + "div-int/lit8", + "rem-int/lit8", + "and-int/lit8", + "or-int/lit8", + "xor-int/lit8", + "shl-int/lit8", + "shr-int/lit8", + "ushr-int/lit8", +]; +const CMP: [&str; 5] = ["cmpl-float", "cmpg-float", "cmpl-double", "cmpg-double", "cmp-long"]; +const IF2: [&str; 6] = ["if-eq", "if-ne", "if-lt", "if-ge", "if-gt", "if-le"]; +const IFZ: [&str; 6] = ["if-eqz", "if-nez", "if-ltz", "if-gez", "if-gtz", "if-lez"]; +const ARR: [&str; 14] = [ + "aget", + "aget-wide", + "aget-object", + "aget-boolean", + "aget-byte", + "aget-char", + "aget-short", + "aput", + "aput-wide", + "aput-object", + "aput-boolean", + "aput-byte", + "aput-char", + "aput-short", +]; +const IFIELD: [&str; 14] = [ + "iget", + "iget-wide", + "iget-object", + "iget-boolean", + "iget-byte", + "iget-char", + "iget-short", + "iput", + "iput-wide", + "iput-object", + "iput-boolean", + "iput-byte", + "iput-char", + "iput-short", +]; +const SFIELD: [&str; 14] = [ + "sget", + "sget-wide", + "sget-object", + "sget-boolean", + "sget-byte", + "sget-char", + "sget-short", + "sput", + "sput-wide", + "sput-object", + "sput-boolean", + "sput-byte", + "sput-char", + "sput-short", +]; +const INVOKE: [&str; 5] = ["invoke-virtual", "invoke-super", "invoke-direct", "invoke-static", "invoke-interface"]; +const INVOKE_RANGE: [&str; 5] = ["invoke-virtual/range", "invoke-super/range", "invoke-direct/range", "invoke-static/range", "invoke-interface/range"]; + +fn pick(list: &[&'static str], i: u8, base: u8) -> &'static str { + list.get(usize::from(i.wrapping_sub(base))).copied().unwrap_or("unused") +} + +/// The opcode table entry for `b`. +pub fn opcode(b: u8) -> Op { + use Fmt::*; + use IndexKind as K; + match b { + 0x00 => op("nop", F10x, K::None), + 0x01 => op("move", F12x, K::None), + 0x02 => op("move/from16", F22x, K::None), + 0x03 => op("move/16", F32x, K::None), + 0x04 => op("move-wide", F12x, K::None), + 0x05 => op("move-wide/from16", F22x, K::None), + 0x06 => op("move-wide/16", F32x, K::None), + 0x07 => op("move-object", F12x, K::None), + 0x08 => op("move-object/from16", F22x, K::None), + 0x09 => op("move-object/16", F32x, K::None), + 0x0a => op("move-result", F11x, K::None), + 0x0b => op("move-result-wide", F11x, K::None), + 0x0c => op("move-result-object", F11x, K::None), + 0x0d => op("move-exception", F11x, K::None), + 0x0e => op("return-void", F10x, K::None), + 0x0f => op("return", F11x, K::None), + 0x10 => op("return-wide", F11x, K::None), + 0x11 => op("return-object", F11x, K::None), + 0x12 => op("const/4", F11n, K::None), + 0x13 => op("const/16", F21s, K::None), + 0x14 => op("const", F31i, K::None), + 0x15 => op("const/high16", F21h, K::None), + 0x16 => op("const-wide/16", F21s, K::None), + 0x17 => op("const-wide/32", F31i, K::None), + 0x18 => op("const-wide", F51l, K::None), + 0x19 => op("const-wide/high16", F21h, K::None), + 0x1a => op("const-string", F21c, K::String), + 0x1b => op("const-string/jumbo", F31c, K::String), + 0x1c => op("const-class", F21c, K::Type), + 0x1d => op("monitor-enter", F11x, K::None), + 0x1e => op("monitor-exit", F11x, K::None), + 0x1f => op("check-cast", F21c, K::Type), + 0x20 => op("instance-of", F22c, K::Type), + 0x21 => op("array-length", F12x, K::None), + 0x22 => op("new-instance", F21c, K::Type), + 0x23 => op("new-array", F22c, K::Type), + 0x24 => op("filled-new-array", F35c, K::Type), + 0x25 => op("filled-new-array/range", F3rc, K::Type), + 0x26 => op("fill-array-data", F31t, K::None), + 0x27 => op("throw", F11x, K::None), + 0x28 => op("goto", F10t, K::None), + 0x29 => op("goto/16", F20t, K::None), + 0x2a => op("goto/32", F30t, K::None), + 0x2b => op("packed-switch", F31t, K::None), + 0x2c => op("sparse-switch", F31t, K::None), + 0x2d..=0x31 => op(pick(&CMP, b, 0x2d), F23x, K::None), + 0x32..=0x37 => op(pick(&IF2, b, 0x32), F22t, K::None), + 0x38..=0x3d => op(pick(&IFZ, b, 0x38), F21t, K::None), + 0x44..=0x51 => op(pick(&ARR, b, 0x44), F23x, K::None), + 0x52..=0x5f => op(pick(&IFIELD, b, 0x52), F22c, K::Field), + 0x60..=0x6d => op(pick(&SFIELD, b, 0x60), F21c, K::Field), + 0x6e..=0x72 => op(pick(&INVOKE, b, 0x6e), F35c, K::Method), + 0x74..=0x78 => op(pick(&INVOKE_RANGE, b, 0x74), F3rc, K::Method), + 0x7b..=0x8f => op(pick(&UNOPS, b, 0x7b), F12x, K::None), + 0x90..=0xaf => op(pick(&BINOPS, b, 0x90), F23x, K::None), + 0xb0..=0xcf => op(pick(&BINOPS_2ADDR, b, 0xb0), F12x, K::None), + 0xd0..=0xd7 => op(pick(&LIT16, b, 0xd0), F22s, K::None), + 0xd8..=0xe2 => op(pick(&LIT8, b, 0xd8), F22b, K::None), + 0xfa => op("invoke-polymorphic", F45cc, K::Method), + 0xfb => op("invoke-polymorphic/range", F4rcc, K::Method), + 0xfc => op("invoke-custom", F35c, K::CallSite), + 0xfd => op("invoke-custom/range", F3rc, K::CallSite), + 0xfe => op("const-method-handle", F21c, K::MethodHandle), + 0xff => op("const-method-type", F21c, K::Proto), + _ => UNUSED, + } +} + +/// Switch and array payloads. +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +#[serde(tag = "kind", rename_all = "kebab-case")] +pub enum Payload { + PackedSwitch { first_key: i32, targets: Vec }, + SparseSwitch { keys: Vec, targets: Vec }, + FillArrayData { element_width: u16, count: u32, data: Vec }, +} + +/// One decoded instruction. +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct Insn { + /// Offset in 16-bit code units from the start of the method's code. + pub offset: u32, + pub opcode: u8, + pub name: &'static str, + /// Length in code units. + pub units: u32, + /// Registers in operand order (for ranges: every register in the range). + pub regs: Vec, + /// True for `/range` forms. + pub range: bool, + #[serde(skip_serializing_if = "Option::is_none")] + pub literal: Option, + /// Absolute branch or payload target, in code units. + #[serde(skip_serializing_if = "Option::is_none")] + pub target: Option, + pub index_kind: IndexKind, + #[serde(skip_serializing_if = "Option::is_none")] + pub index: Option, + /// Second index (the proto of `invoke-polymorphic`). + #[serde(skip_serializing_if = "Option::is_none")] + pub index2: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub payload: Option, +} + +/// Most entries decoded from one payload. +const MAX_PAYLOAD: usize = 65_536; + +fn u32_at(code: &[u16], i: usize) -> Option { + Some(u32::from(*code.get(i)?) | (u32::from(*code.get(i + 1)?) << 16)) +} + +/// Decode a payload pseudo-instruction at `pc`; returns it and its length in units. +fn payload(code: &[u16], pc: usize) -> Option<(Payload, usize)> { + let ident = *code.get(pc)?; + match ident { + 0x0100 => { + let size = usize::from(*code.get(pc + 1)?); + let first_key = u32_at(code, pc + 2)? as i32; + let mut targets = Vec::with_capacity(size.min(MAX_PAYLOAD)); + for i in 0..size.min(MAX_PAYLOAD) { + targets.push(u32_at(code, pc + 4 + i * 2)? as i32); + } + Some((Payload::PackedSwitch { first_key, targets }, size * 2 + 4)) + } + 0x0200 => { + let size = usize::from(*code.get(pc + 1)?); + let mut keys = Vec::with_capacity(size.min(MAX_PAYLOAD)); + let mut targets = Vec::with_capacity(size.min(MAX_PAYLOAD)); + for i in 0..size.min(MAX_PAYLOAD) { + keys.push(u32_at(code, pc + 2 + i * 2)? as i32); + targets.push(u32_at(code, pc + 2 + size * 2 + i * 2)? as i32); + } + Some((Payload::SparseSwitch { keys, targets }, size * 4 + 2)) + } + 0x0300 => { + let width = *code.get(pc + 1)?; + let count = u32_at(code, pc + 2)?; + let bytes = usize::from(width).checked_mul(count as usize)?; + let units = bytes.checked_add(1)? / 2 + 4; + if pc.checked_add(units)? > code.len() { + return None; + } + let mut data = Vec::with_capacity(bytes.min(MAX_PAYLOAD)); + for i in 0..bytes.min(MAX_PAYLOAD) { + let u = *code.get(pc + 4 + i / 2)?; + data.push(if i % 2 == 0 { u as u8 } else { (u >> 8) as u8 }); + } + Some((Payload::FillArrayData { element_width: width, count, data }, units)) + } + _ => None, + } +} + +/// Decode one instruction at `pc`, or `None` when it runs past the end. +pub fn decode_one(code: &[u16], pc: usize) -> Option { + use Fmt::*; + let u0 = *code.get(pc)?; + let b = (u0 & 0xff) as u8; + let hi = (u0 >> 8) as u8; + if b == 0 && hi != 0 { + let (p, units) = payload(code, pc)?; + let name = match p { + Payload::PackedSwitch { .. } => "packed-switch-payload", + Payload::SparseSwitch { .. } => "sparse-switch-payload", + Payload::FillArrayData { .. } => "array-data-payload", + }; + return Some(Insn { + offset: pc as u32, + opcode: 0, + name, + units: units as u32, + regs: vec![], + range: false, + literal: None, + target: None, + index_kind: IndexKind::None, + index: None, + index2: None, + payload: Some(p), + }); + } + let o = opcode(b); + let n = o.fmt.units(); + if pc.checked_add(n)? > code.len() { + return None; + } + let u = |i: usize| code.get(pc + i).copied().unwrap_or(0); + let a4 = u32::from(hi & 0x0f); + let b4 = u32::from(hi >> 4); + let aa = u32::from(hi); + let rel = |d: i64| pc as i64 + d; + let mut insn = Insn { + offset: pc as u32, + opcode: b, + name: o.name, + units: n as u32, + regs: vec![], + range: false, + literal: None, + target: None, + index_kind: o.index, + index: None, + index2: None, + payload: None, + }; + match o.fmt { + F10x => {} + F12x => insn.regs = vec![a4, b4], + F11n => { + insn.regs = vec![a4]; + insn.literal = Some(i64::from((hi as i8) >> 4)); + } + F11x => insn.regs = vec![aa], + F10t => insn.target = Some(rel(i64::from(hi as i8))), + F20t => insn.target = Some(rel(i64::from(u(1) as i16))), + F22x => insn.regs = vec![aa, u32::from(u(1))], + F21t => { + insn.regs = vec![aa]; + insn.target = Some(rel(i64::from(u(1) as i16))); + } + F21s => { + insn.regs = vec![aa]; + insn.literal = Some(i64::from(u(1) as i16)); + } + F21h => { + insn.regs = vec![aa]; + let v = i64::from(u(1) as i16); + insn.literal = Some(if b == 0x19 { v << 48 } else { v << 16 }); + } + F21c => { + insn.regs = vec![aa]; + insn.index = Some(u32::from(u(1))); + } + F23x => insn.regs = vec![aa, u32::from(u(1) & 0xff), u32::from(u(1) >> 8)], + F22b => { + insn.regs = vec![aa, u32::from(u(1) & 0xff)]; + insn.literal = Some(i64::from((u(1) >> 8) as u8 as i8)); + } + F22t => { + insn.regs = vec![a4, b4]; + insn.target = Some(rel(i64::from(u(1) as i16))); + } + F22s => { + insn.regs = vec![a4, b4]; + insn.literal = Some(i64::from(u(1) as i16)); + } + F22c => { + insn.regs = vec![a4, b4]; + insn.index = Some(u32::from(u(1))); + } + F30t => insn.target = Some(rel(i64::from((u32::from(u(1)) | (u32::from(u(2)) << 16)) as i32))), + F32x => insn.regs = vec![u32::from(u(1)), u32::from(u(2))], + F31i => { + insn.regs = vec![aa]; + insn.literal = Some(i64::from((u32::from(u(1)) | (u32::from(u(2)) << 16)) as i32)); + } + F31t => { + insn.regs = vec![aa]; + insn.target = Some(rel(i64::from((u32::from(u(1)) | (u32::from(u(2)) << 16)) as i32))); + } + F31c => { + insn.regs = vec![aa]; + insn.index = Some(u32::from(u(1)) | (u32::from(u(2)) << 16)); + } + F35c | F45cc => { + let count = b4.min(5) as usize; + let g = a4; + let w = u(2); + let all = [u32::from(w & 0xf), u32::from((w >> 4) & 0xf), u32::from((w >> 8) & 0xf), u32::from(w >> 12), g]; + insn.regs = all.iter().take(count).copied().collect(); + insn.index = Some(u32::from(u(1))); + if o.fmt == F45cc { + insn.index2 = Some(u32::from(u(3))); + } + } + F3rc | F4rcc => { + let first = u32::from(u(2)); + insn.regs = (0..aa).map(|i| first.saturating_add(i)).collect(); + insn.range = true; + insn.index = Some(u32::from(u(1))); + if o.fmt == F4rcc { + insn.index2 = Some(u32::from(u(3))); + } + } + F51l => { + insn.regs = vec![aa]; + let v = u64::from(u(1)) | (u64::from(u(2)) << 16) | (u64::from(u(3)) << 32) | (u64::from(u(4)) << 48); + insn.literal = Some(v as i64); + } + } + Some(insn) +} + +/// Decode a whole method body, attaching each switch/array payload to the instruction that +/// references it. Stops at `max` instructions. +pub fn decode(code: &[u16], max: usize) -> (Vec, bool) { + let mut out = Vec::new(); + let mut pc = 0usize; + let mut complete = true; + while pc < code.len() { + if out.len() >= max { + complete = false; + break; + } + match decode_one(code, pc) { + Some(i) => { + pc += (i.units as usize).max(1); + out.push(i); + } + None => { + complete = false; + break; + } + } + } + // Attach payloads to their users (31t formats). + let payloads: Vec<(i64, Payload)> = out.iter().filter_map(|i| i.payload.clone().map(|p| (i64::from(i.offset), p))).collect(); + for i in out.iter_mut().filter(|i| matches!(i.opcode, 0x26 | 0x2b | 0x2c)) { + if let Some(t) = i.target + && let Some((_, p)) = payloads.iter().find(|(o, _)| *o == t) + { + i.payload = Some(p.clone()); + } + } + (out, complete) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn table_is_complete() { + let mut named = 0; + for b in 0..=255u8 { + let o = opcode(b); + if o.name != "unused" { + named += 1; + } + } + // 256 slots minus the 0x3e-0x43, 0x73, 0x79-0x7a and 0xe3-0xf9 holes. + assert_eq!(named, 256 - 6 - 1 - 2 - 23); + assert_eq!(opcode(0x6e).name, "invoke-virtual"); + assert_eq!(opcode(0x8f).name, "int-to-short"); + assert_eq!(opcode(0xaf).name, "rem-double"); + assert_eq!(opcode(0xcf).name, "rem-double/2addr"); + assert_eq!(opcode(0xe2).name, "ushr-int/lit8"); + } + + #[test] + fn decodes_formats() { + // const/4 v1, #-1 ; invoke-static {v0, v1}, meth@5 ; packed-switch v0, +4 ; return-void + // payload: packed, size 2, first 10, targets 1, 2 + let code: Vec = vec![0xf112, 0x2071, 5, 0x0010, 0x002b, 4, 0, 0x000e, 0x0100, 2, 10, 0, 1, 0, 2, 0]; + let (ins, complete) = decode(&code, 100); + assert!(complete); + assert_eq!(ins[0].name, "const/4"); + assert_eq!(ins[0].literal, Some(-1)); + assert_eq!(ins[0].regs, vec![1]); + assert_eq!(ins[1].name, "invoke-static"); + assert_eq!(ins[1].regs, vec![0, 1]); + assert_eq!(ins[1].index, Some(5)); + assert_eq!(ins[2].name, "packed-switch"); + assert_eq!(ins[2].target, Some(8)); + assert_eq!(ins[2].payload, Some(Payload::PackedSwitch { first_key: 10, targets: vec![1, 2] })); + assert_eq!(ins[4].name, "packed-switch-payload"); + // const-wide v0, 0x1122334455667788 + let (w, _) = decode(&[0x0018, 0x7788, 0x5566, 0x3344, 0x1122], 10); + assert_eq!(w[0].literal, Some(0x1122_3344_5566_7788)); + // fill-array-data payload width 1 count 3 + let (f, _) = decode(&[0x0300, 1, 3, 0, 0x0201, 0x0003], 10); + assert_eq!(f[0].payload, Some(Payload::FillArrayData { element_width: 1, count: 3, data: vec![1, 2, 3] })); + // invoke-virtual/range {v4..v6} + let (r, _) = decode(&[0x0374, 9, 4], 10); + assert_eq!(r[0].regs, vec![4, 5, 6]); + assert!(r[0].range); + } + + #[test] + fn hostile() { + for seed in 0..200 { + let n = craft_anything_testkit::noise(seed, 256); + let code: Vec = n.as_chunks::<2>().0.iter().map(|c| u16::from_le_bytes(*c)).collect(); + let _ = decode(&code, 1000); + } + let _ = decode(&[0x0300, 0xffff, 0xffff, 0xffff], 10); + let _ = decode(&[0x0200, 0xffff], 10); + let _ = decode(&[0x0018], 10); + } +} From b4e455d01758837e2e9f5a3bf9b29ea6f34be1ad Mon Sep 17 00:00:00 2001 From: BFlat Date: Tue, 17 Nov 2026 08:38:14 -0500 Subject: [PATCH 051/183] dex: More format parsers keep to their declared lengths and refuse impossible values (#722) Port Craft Anything b9ca099903aeef5d4b33a7e83e8e7062ab94c65a reader and opcode decoder. --- crates/dex/src/dex.rs | 17 +++++------------ crates/dex/src/dex_ops.rs | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/crates/dex/src/dex.rs b/crates/dex/src/dex.rs index e46d97b5b..b01a1b247 100644 --- a/crates/dex/src/dex.rs +++ b/crates/dex/src/dex.rs @@ -148,18 +148,7 @@ pub fn mutf8(r: &Reader<'_>, mut at: usize, max_units: usize) -> (String, usize) if b0 == 0 { break; } - let (u, n) = if b0 < 0x80 { - (u16::from(b0), 1) - } else if b0 & 0xe0 == 0xc0 { - let b1 = r.u8(at + 1).unwrap_or(0); - ((u16::from(b0 & 0x1f) << 6) | u16::from(b1 & 0x3f), 2) - } else if b0 & 0xf0 == 0xe0 { - let b1 = r.u8(at + 1).unwrap_or(0); - let b2 = r.u8(at + 2).unwrap_or(0); - ((u16::from(b0 & 0x0f) << 12) | (u16::from(b1 & 0x3f) << 6) | u16::from(b2 & 0x3f), 3) - } else { - (0xfffd, 1) - }; + let (u, n) = crate::bytes::mutf8_unit(r.data().get(at..).unwrap_or_default()); units.push(u); at = at.saturating_add(n); consumed += n; @@ -173,6 +162,10 @@ pub fn sleb128(r: &Reader<'_>, off: usize) -> Option<(i64, usize)> { let mut shift = 0u32; for i in 0..10usize { let b = r.u8(off.checked_add(i)?)?; + // Only one value bit remains in the tenth byte; the rest must extend its sign. + if i == 9 && !matches!(b, 0x00 | 0x7f) { + return None; + } result |= i64::from(b & 0x7f).checked_shl(shift)?; shift += 7; if b & 0x80 == 0 { diff --git a/crates/dex/src/dex_ops.rs b/crates/dex/src/dex_ops.rs index 139ad77ac..53fbf1d05 100644 --- a/crates/dex/src/dex_ops.rs +++ b/crates/dex/src/dex_ops.rs @@ -384,6 +384,9 @@ fn payload(code: &[u16], pc: usize) -> Option<(Payload, usize)> { } 0x0300 => { let width = *code.get(pc + 1)?; + if !matches!(width, 1 | 2 | 4 | 8) { + return None; + } let count = u32_at(code, pc + 2)?; let bytes = usize::from(width).checked_mul(count as usize)?; let units = bytes.checked_add(1)? / 2 + 4; @@ -513,7 +516,10 @@ pub fn decode_one(code: &[u16], pc: usize) -> Option { insn.index = Some(u32::from(u(1)) | (u32::from(u(2)) << 16)); } F35c | F45cc => { - let count = b4.min(5) as usize; + if b4 > 5 { + return None; + } + let count = b4 as usize; let g = a4; let w = u(2); let all = [u32::from(w & 0xf), u32::from((w >> 4) & 0xf), u32::from((w >> 8) & 0xf), u32::from(w >> 12), g]; @@ -525,7 +531,11 @@ pub fn decode_one(code: &[u16], pc: usize) -> Option { } F3rc | F4rcc => { let first = u32::from(u(2)); - insn.regs = (0..aa).map(|i| first.saturating_add(i)).collect(); + let end = first.checked_add(aa)?; + if end > u32::from(u16::MAX) + 1 { + return None; + } + insn.regs = (first..end).collect(); insn.range = true; insn.index = Some(u32::from(u(1))); if o.fmt == F4rcc { From 77e7878f7bbc38fffd1ec024182f56098ca4d92d Mon Sep 17 00:00:00 2001 From: Afloat <132809511+Afloat16@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:38:14 -0500 Subject: [PATCH 052/183] dex: Address the parser review findings from #722 (#766) Port Craft Anything eab6a0f01bf9fc3a36798d322e4442e169394dfc reader and opcode decoder. --- crates/dex/src/dex.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/dex/src/dex.rs b/crates/dex/src/dex.rs index b01a1b247..6b23d2e78 100644 --- a/crates/dex/src/dex.rs +++ b/crates/dex/src/dex.rs @@ -156,14 +156,14 @@ pub fn mutf8(r: &Reader<'_>, mut at: usize, max_units: usize) -> (String, usize) (String::from_utf16_lossy(&units), consumed) } -/// Signed LEB128 at `off`: (value, bytes). +/// Signed 32-bit DEX LEB128 at `off`: (value, bytes), using at most five bytes. pub fn sleb128(r: &Reader<'_>, off: usize) -> Option<(i64, usize)> { let mut result = 0i64; let mut shift = 0u32; - for i in 0..10usize { + for i in 0..5usize { let b = r.u8(off.checked_add(i)?)?; - // Only one value bit remains in the tenth byte; the rest must extend its sign. - if i == 9 && !matches!(b, 0x00 | 0x7f) { + // Four value bits remain in byte five; the other bits must extend the sign. + if i == 4 && !matches!(b, 0x00..=0x07 | 0x78..=0x7f) { return None; } result |= i64::from(b & 0x7f).checked_shl(shift)?; From 0373b7f8e347bd4f284a0522365b19520547495c Mon Sep 17 00:00:00 2001 From: Afloat Date: Tue, 17 Nov 2026 08:38:14 -0500 Subject: [PATCH 053/183] dex: Preserve DEX boundaries when member or handler lists are capped (R3.12) (#1388) Port Craft Anything 34d9450b75f402217a7243c04d6c5ed3d2d3f8d4 reader and opcode decoder. --- crates/dex/src/dex.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/dex/src/dex.rs b/crates/dex/src/dex.rs index 6b23d2e78..c4076dfc8 100644 --- a/crates/dex/src/dex.rs +++ b/crates/dex/src/dex.rs @@ -523,6 +523,9 @@ impl<'a> Dex<'a> { } } } + if count > MAX_MEMBERS as u32 { + return cd; + } } cd.complete = true; cd @@ -563,6 +566,7 @@ impl<'a> Dex<'a> { handlers.push(Handler { exception: Some(self.type_desc(t as u32)), address: addr as u32 }); } if size <= 0 + && handlers.len() as u64 == size.unsigned_abs() && let Some((addr, _)) = r.uleb128(p) { handlers.push(Handler { exception: None, address: addr as u32 }); From 794b884096e75083a6ab22b936185cb0ece3cd46 Mon Sep 17 00:00:00 2001 From: Afloat Date: Tue, 17 Nov 2026 08:38:14 -0500 Subject: [PATCH 054/183] dex: Bound retained DEX payload attachments (R3.12) (#1548) Port Craft Anything 1ebdb78760d6bfd31f1a70e6389e0d441adb3d2e reader and opcode decoder. --- crates/dex/src/dex_ops.rs | 60 +++++++++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/crates/dex/src/dex_ops.rs b/crates/dex/src/dex_ops.rs index 53fbf1d05..71095fc75 100644 --- a/crates/dex/src/dex_ops.rs +++ b/crates/dex/src/dex_ops.rs @@ -354,6 +354,25 @@ pub struct Insn { /// Most entries decoded from one payload. const MAX_PAYLOAD: usize = 65_536; +/// Maximum payload bytes retained by one decoded method, including copies attached to users. +pub const DEFAULT_MAX_PAYLOAD_BYTES: usize = 64 << 20; + +impl Payload { + fn retained_bytes(&self) -> usize { + match self { + Self::PackedSwitch { targets, .. } => targets.len().saturating_mul(4), + Self::SparseSwitch { keys, targets } => keys.len().saturating_add(targets.len()).saturating_mul(4), + Self::FillArrayData { data, .. } => data.len(), + } + } + + fn complete(&self) -> bool { + match self { + Self::FillArrayData { element_width, count, data } => u64::from(*element_width) * u64::from(*count) == data.len() as u64, + _ => true, + } + } +} fn u32_at(code: &[u16], i: usize) -> Option { Some(u32::from(*code.get(i)?) | (u32::from(*code.get(i + 1)?) << 16)) @@ -552,19 +571,36 @@ pub fn decode_one(code: &[u16], pc: usize) -> Option { } /// Decode a whole method body, attaching each switch/array payload to the instruction that -/// references it. Stops at `max` instructions. +/// references it. Stops at `max` instructions and caps all retained payload copies together. pub fn decode(code: &[u16], max: usize) -> (Vec, bool) { + decode_with_payload_limit(code, max, DEFAULT_MAX_PAYLOAD_BYTES) +} + +/// Decode with an explicit aggregate payload byte budget. Payloads that do not fit are omitted; +/// their instruction metadata remains and the returned completeness flag is false. A source +/// payload and every attached copy consume the same budget, before the copy is allocated. +pub fn decode_with_payload_limit(code: &[u16], max: usize, max_payload_bytes: usize) -> (Vec, bool) { let mut out = Vec::new(); let mut pc = 0usize; let mut complete = true; + let mut bytes_left = max_payload_bytes; while pc < code.len() { if out.len() >= max { complete = false; break; } match decode_one(code, pc) { - Some(i) => { + Some(mut i) => { pc += (i.units as usize).max(1); + if let Some(p) = &i.payload { + complete &= p.complete(); + if let Some(left) = bytes_left.checked_sub(p.retained_bytes()) { + bytes_left = left; + } else { + i.payload = None; + complete = false; + } + } out.push(i); } None => { @@ -574,12 +610,20 @@ pub fn decode(code: &[u16], max: usize) -> (Vec, bool) { } } // Attach payloads to their users (31t formats). - let payloads: Vec<(i64, Payload)> = out.iter().filter_map(|i| i.payload.clone().map(|p| (i64::from(i.offset), p))).collect(); - for i in out.iter_mut().filter(|i| matches!(i.opcode, 0x26 | 0x2b | 0x2c)) { - if let Some(t) = i.target - && let Some((_, p)) = payloads.iter().find(|(o, _)| *o == t) - { - i.payload = Some(p.clone()); + // The decoder visits offsets in order. Index their positions without copying any payload. + let payloads: Vec<(i64, usize)> = out.iter().enumerate().filter(|(_, i)| i.payload.is_some()).map(|(n, i)| (i64::from(i.offset), n)).collect(); + for n in 0..out.len() { + let Some(target) = out.get(n).filter(|i| matches!(i.opcode, 0x26 | 0x2b | 0x2c)).and_then(|i| i.target) else { continue }; + let Ok(position) = payloads.binary_search_by_key(&target, |(offset, _)| *offset) else { continue }; + let Some(payload) = payloads.get(position).and_then(|(_, index)| out.get(*index)).and_then(|i| i.payload.as_ref()) else { continue }; + let Some(left) = bytes_left.checked_sub(payload.retained_bytes()) else { + complete = false; + continue; + }; + bytes_left = left; + let copy = payload.clone(); + if let Some(instruction) = out.get_mut(n) { + instruction.payload = Some(copy); } } (out, complete) From e1eae62fe29d52e6f5e79d0742fd587f54b02e8b Mon Sep 17 00:00:00 2001 From: BFlat Date: Tue, 17 Nov 2026 08:39:25 -0500 Subject: [PATCH 055/183] dex: retain array_widths regressions Source crates/formats/tests/dex_array_widths.rs at b9ca099903aeef5d4b33a7e83e8e7062ab94c65a. Imports adapted only. --- crates/dex/src/regressions/array_widths.rs | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 crates/dex/src/regressions/array_widths.rs diff --git a/crates/dex/src/regressions/array_widths.rs b/crates/dex/src/regressions/array_widths.rs new file mode 100644 index 000000000..37524b002 --- /dev/null +++ b/crates/dex/src/regressions/array_widths.rs @@ -0,0 +1,39 @@ +use crate::dex_ops::{Payload, decode, decode_one}; + +#[test] +fn zero_width_does_not_describe_a_huge_complete_array() { + let code = [0x0300, 0, 0xffff, 0xffff]; + assert!(decode_one(&code, 0).is_none()); + assert!(!decode(&code, 16).1); +} + +#[test] +fn unsupported_element_widths_are_refused_even_for_empty_arrays() { + for width in [0, 3, 5, 6, 7, 9, 16, u16::MAX] { + assert!(decode_one(&[0x0300, width, 0, 0], 0).is_none(), "width {width}"); + } +} + +#[test] +fn all_primitive_widths_and_odd_byte_padding_still_decode() { + for width in [1u16, 2, 4, 8] { + let count = 3u32; + let bytes = usize::from(width) * count as usize; + let mut code = vec![0x0300, width, count as u16, 0]; + code.resize(4 + bytes.div_ceil(2), 0x2211); + let instruction = decode_one(&code, 0).unwrap(); + assert_eq!(instruction.units as usize, code.len()); + match instruction.payload.unwrap() { + Payload::FillArrayData { element_width, count: decoded, data } => { + assert_eq!(element_width, width); + assert_eq!(decoded, count); + assert_eq!(data.len(), bytes); + assert_eq!(data[0], 0x11); + } + other => panic!("unexpected payload {other:?}"), + } + assert!(decode_one(&[0x0300, width, 0, 0], 0).is_some()); + code.pop(); + assert!(decode_one(&code, 0).is_none()); + } +} From 570e8bc8735cf6250adb1098dbe2244b1cb6200c Mon Sep 17 00:00:00 2001 From: Afloat Date: Tue, 17 Nov 2026 08:39:25 -0500 Subject: [PATCH 056/183] dex: retain capped_table_boundaries regressions Source crates/formats/tests/dex_capped_table_boundaries.rs at 34d9450b75f402217a7243c04d6c5ed3d2d3f8d4. Imports adapted only. --- .../regressions/capped_table_boundaries.rs | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 crates/dex/src/regressions/capped_table_boundaries.rs diff --git a/crates/dex/src/regressions/capped_table_boundaries.rs b/crates/dex/src/regressions/capped_table_boundaries.rs new file mode 100644 index 000000000..7fbb419f5 --- /dev/null +++ b/crates/dex/src/regressions/capped_table_boundaries.rs @@ -0,0 +1,114 @@ +use crate::dex::{self, ClassDef, Code}; + +const MEMBER_CAP: usize = 65_536; +const HANDLER_CAP: usize = 256; + +fn uleb(mut value: u32, bytes: &mut Vec) { + loop { + let byte = (value & 0x7f) as u8; + value >>= 7; + bytes.push(byte | if value == 0 { 0 } else { 0x80 }); + if value == 0 { + break; + } + } +} + +fn sleb(mut value: i32, bytes: &mut Vec) { + loop { + let byte = value as u8 & 0x7f; + value >>= 7; + let done = (value == 0 && byte & 0x40 == 0) || (value == -1 && byte & 0x40 != 0); + bytes.push(byte | if done { 0 } else { 0x80 }); + if done { + break; + } + } +} + +fn header() -> Vec { + let mut bytes = vec![0; 0x70]; + bytes[..8].copy_from_slice(b"dex\n035\0"); + bytes[36..40].copy_from_slice(&0x70u32.to_le_bytes()); + bytes[40..44].copy_from_slice(&0x1234_5678u32.to_le_bytes()); + bytes +} + +fn class_data(count: usize) -> dex::ClassData { + let mut bytes = header(); + for n in [count as u32, 0, 1, 0] { + uleb(n, &mut bytes); + } + bytes.extend_from_slice(&[0, 1].repeat(count)); + bytes.extend_from_slice(&[3, 9, 7]); + let len = bytes.len() as u32; + bytes[32..36].copy_from_slice(&len.to_le_bytes()); + let class = ClassDef { + class_idx: 0, + access: 0, + superclass_idx: 0, + interfaces_off: 0, + source_file_idx: 0, + annotations_off: 0, + class_data_off: 0x70, + static_values_off: 0, + }; + dex::parse(&bytes).unwrap().class_data(&class) +} + +fn code(size: i32, payload: &[u8]) -> Code { + let mut bytes = header(); + bytes.extend_from_slice(&[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 8, 0, 0, 0]); + bytes.extend_from_slice(&[0; 16]); + bytes.extend_from_slice(&[0, 0, 0, 0, 1, 0, 1, 0]); + bytes.push(1); + sleb(size, &mut bytes); + bytes.extend_from_slice(payload); + let len = bytes.len() as u32; + bytes[32..36].copy_from_slice(&len.to_le_bytes()); + dex::parse(&bytes).unwrap().code(0x70).unwrap() +} + +#[test] +fn capped_class_members_do_not_become_the_next_group() { + let data = class_data(MEMBER_CAP + 1); + assert_eq!(data.static_fields.len(), MEMBER_CAP); + assert!(data.direct_methods.is_empty()); + assert!(!data.complete); +} + +#[test] +fn an_exact_member_limit_keeps_the_following_group() { + let data = class_data(MEMBER_CAP); + assert_eq!(data.static_fields.len(), MEMBER_CAP); + assert!(data.complete); + assert_eq!(data.direct_methods, [dex::EncodedMethod { method_idx: 3, access: 9, code_off: 7 }]); +} + +#[test] +fn an_unread_typed_handler_is_not_a_catch_all() { + let mut payload = [0, 1].repeat(HANDLER_CAP + 1); + payload.push(7); + let parsed = code(-((HANDLER_CAP + 1) as i32), &payload); + assert_eq!(parsed.tries[0].handlers.len(), HANDLER_CAP); + assert!(parsed.tries[0].handlers.iter().all(|handler| handler.exception.is_some() && handler.address == 1)); +} + +#[test] +fn an_incomplete_typed_handler_cannot_supply_a_catch_all_address() { + let parsed = code(-2, &[0, 1, 0]); + assert_eq!(parsed.tries[0].handlers.len(), 1); + assert!(parsed.tries[0].handlers[0].exception.is_some()); + assert_eq!(parsed.tries[0].handlers[0].address, 1); +} + +#[test] +fn complete_typed_lists_keep_their_real_catch_all() { + for count in [0, 1, HANDLER_CAP] { + let mut payload = [0, 1].repeat(count); + payload.push(7); + let parsed = code(-(count as i32), &payload); + assert_eq!(parsed.tries[0].handlers.len(), count + 1); + assert_eq!(parsed.tries[0].handlers.last(), Some(&dex::Handler { exception: None, address: 7 })); + } +} From 79ad1aff6fa1758c91e53a9001baf4f38e5c028e Mon Sep 17 00:00:00 2001 From: BFlat Date: Tue, 17 Nov 2026 08:39:25 -0500 Subject: [PATCH 057/183] dex: retain invoke_registers regressions Source crates/formats/tests/dex_invoke_registers.rs at b9ca099903aeef5d4b33a7e83e8e7062ab94c65a. Imports adapted only. --- .../dex/src/regressions/invoke_registers.rs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 crates/dex/src/regressions/invoke_registers.rs diff --git a/crates/dex/src/regressions/invoke_registers.rs b/crates/dex/src/regressions/invoke_registers.rs new file mode 100644 index 000000000..c2c6faab6 --- /dev/null +++ b/crates/dex/src/regressions/invoke_registers.rs @@ -0,0 +1,33 @@ +use crate::dex_ops::{decode, decode_one}; + +#[test] +fn fixed_register_lists_cannot_claim_more_than_five_arguments() { + for op in [0x24u16, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0xfa, 0xfc] { + for count in 6..=15 { + let code = [(count << 12) | op, 1, 0x4321, 2]; + assert!(decode_one(&code, 0).is_none(), "opcode {op:#x}, count {count}"); + assert!(!decode(&code, 16).1); + } + } +} + +#[test] +fn range_arguments_cannot_leave_the_encoded_register_space() { + for op in [0x25u16, 0x74, 0x75, 0x76, 0x77, 0x78, 0xfb, 0xfd] { + assert!(decode_one(&[0x0200 | op, 1, u16::MAX, 2], 0).is_none(), "{op:#x}"); + assert!(decode_one(&[0xff00 | op, 1, u16::MAX - 1, 2], 0).is_none(), "{op:#x}"); + } +} + +#[test] +fn zero_and_boundary_register_lists_remain_valid() { + let fixed = decode_one(&[0x5571, 1, 0x4321], 0).unwrap(); + assert_eq!(fixed.regs, vec![1, 2, 3, 4, 5]); + assert!(decode_one(&[0x0071, 1, 0], 0).unwrap().regs.is_empty()); + let range = decode_one(&[0x0277, 1, u16::MAX - 1], 0).unwrap(); + assert_eq!(range.regs, vec![65534, 65535]); + assert!(decode_one(&[0x0077, 1, u16::MAX], 0).unwrap().regs.is_empty()); + let polymorphic = decode_one(&[0x01fb, 1, u16::MAX, 2], 0).unwrap(); + assert_eq!(polymorphic.regs, vec![65535]); + assert_eq!(polymorphic.index2, Some(2)); +} From 7cd3dcfdece717c73edc7463ac09fbeaf6ddb9fd Mon Sep 17 00:00:00 2001 From: Afloat Date: Tue, 17 Nov 2026 08:39:25 -0500 Subject: [PATCH 058/183] dex: retain payload_budgets regressions Source crates/formats/tests/dex_payload_budgets.rs at 1ebdb78760d6bfd31f1a70e6389e0d441adb3d2e. Imports adapted only. --- crates/dex/src/regressions/payload_budgets.rs | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 crates/dex/src/regressions/payload_budgets.rs diff --git a/crates/dex/src/regressions/payload_budgets.rs b/crates/dex/src/regressions/payload_budgets.rs new file mode 100644 index 000000000..8680373a4 --- /dev/null +++ b/crates/dex/src/regressions/payload_budgets.rs @@ -0,0 +1,88 @@ +use crate::dex_ops::{self, Payload}; + +fn arrays(references: usize, bytes: usize) -> Vec { + let mut code = Vec::new(); + let offset = (references * 3).next_multiple_of(2); + for n in 0..references { + let relative = u32::try_from(offset - n * 3).unwrap(); + code.extend([0x0026, relative as u16, (relative >> 16) as u16]); + } + code.resize(offset, 0); + let count = u32::try_from(bytes).unwrap(); + code.extend([0x0300, 1, count as u16, (count >> 16) as u16]); + code.resize(code.len() + bytes.div_ceil(2), 0x5a5a); + code +} + +fn bytes(rows: &[dex_ops::Insn]) -> usize { + rows.iter() + .map(|i| match i.payload.as_ref() { + Some(Payload::FillArrayData { data, .. }) => data.len(), + Some(Payload::PackedSwitch { targets, .. }) => targets.len() * 4, + Some(Payload::SparseSwitch { keys, targets }) => (keys.len() + targets.len()) * 4, + None => 0, + }) + .sum() +} + +#[test] +fn shared_arrays_charge_the_source_and_each_attached_copy() { + let code = arrays(4, 8); + let (rows, complete) = dex_ops::decode_with_payload_limit(&code, 100, 24); + assert!(!complete); + assert_eq!(bytes(&rows), 24); + assert!(rows[0].payload.is_some() && rows[1].payload.is_some()); + assert!(rows[2].payload.is_none() && rows[3].payload.is_none()); + assert!(rows.last().unwrap().payload.is_some()); + let (full, complete) = dex_ops::decode_with_payload_limit(&code, 100, 40); + assert!(complete); + assert_eq!(bytes(&full), 40); +} + +#[test] +fn zero_budget_keeps_offsets_and_payload_instruction_metadata() { + let code = arrays(2, 8); + let (rows, complete) = dex_ops::decode_with_payload_limit(&code, 100, 0); + assert!(!complete); + assert_eq!(rows.iter().map(|i| i.offset).collect::>(), [0, 3, 6]); + assert_eq!(rows[2].name, "array-data-payload"); + assert_eq!(rows[2].units, 8); + assert!(rows.iter().all(|i| i.payload.is_none())); + assert!(dex_ops::decode_with_payload_limit(&[0x000e], 100, 0).1); +} + +#[test] +fn both_switch_tables_are_accounted_and_backward_references_work() { + // packed table: one target; sparse table: one key and one target; users follow the tables. + let code = [0x0100, 1, 7, 0, 1, 0, 0x0200, 1, 9, 0, 2, 0, 0x002b, 0xfff4, 0xffff, 0x002c, 0xfff7, 0xffff]; + let (rows, complete) = dex_ops::decode_with_payload_limit(&code, 100, 24); + assert!(complete); + assert_eq!(rows[2].payload, Some(Payload::PackedSwitch { first_key: 7, targets: vec![1] })); + assert_eq!(rows[3].payload, Some(Payload::SparseSwitch { keys: vec![9], targets: vec![2] })); + let (rows, complete) = dex_ops::decode_with_payload_limit(&code, 100, 16); + assert!(!complete); + assert!(rows[2].payload.is_some()); + assert!(rows[3].payload.is_none()); + assert_eq!(bytes(&rows), 16); +} + +#[test] +fn the_existing_per_array_cap_is_reported_as_partial() { + let (rows, complete) = dex_ops::decode(&arrays(1, 65_537), 100); + assert!(!complete); + assert_eq!(bytes(&rows), 2 * 65_536); + let (rows, complete) = dex_ops::decode(&arrays(1, 8), 1); + assert!(!complete); + assert_eq!(rows.len(), 1); + assert!(rows[0].payload.is_none()); +} + +#[test] +#[ignore = "memory regression: run separately with a 128 MiB address-space limit"] +fn repeated_array_references_stay_under_the_default_byte_budget() { + let code = arrays(2048, 65_536); + let (rows, complete) = dex_ops::decode(&code, 200_000); + assert!(!complete); + assert_eq!(rows.len(), 2049); + assert_eq!(bytes(&rows), dex_ops::DEFAULT_MAX_PAYLOAD_BYTES); +} From 4039bc76955a61b44ce0838ea8d92315cfd955e0 Mon Sep 17 00:00:00 2001 From: Afloat <132809511+Afloat16@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:39:25 -0500 Subject: [PATCH 059/183] dex: retain signed_leb128 regressions Source crates/formats/tests/dex_signed_leb128.rs at eab6a0f01bf9fc3a36798d322e4442e169394dfc. Imports adapted only. --- crates/dex/src/regressions/signed_leb128.rs | 94 +++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 crates/dex/src/regressions/signed_leb128.rs diff --git a/crates/dex/src/regressions/signed_leb128.rs b/crates/dex/src/regressions/signed_leb128.rs new file mode 100644 index 000000000..f38fd8db6 --- /dev/null +++ b/crates/dex/src/regressions/signed_leb128.rs @@ -0,0 +1,94 @@ +use crate::bytes::Reader; +use crate::dex::{self, Code, Handler, sleb128}; + +#[test] +fn rejects_invalid_fifth_byte_sign_extensions() { + for prefix in [0x80, 0xff] { + for last in 0x08..=0x77 { + let mut encoded = vec![prefix; 4]; + encoded.push(last); + assert_eq!(sleb128(&Reader::new(&encoded), 0), None, "last byte {last:#x}"); + } + } +} + +#[test] +fn retains_signed_32_bit_limits_and_ordinary_values() { + assert_eq!(sleb128(&Reader::new(&[0xff, 0xff, 0xff, 0xff, 0x07]), 0), Some((i64::from(i32::MAX), 5))); + assert_eq!(sleb128(&Reader::new(&[0x80, 0x80, 0x80, 0x80, 0x78]), 0), Some((i64::from(i32::MIN), 5))); + assert_eq!(sleb128(&Reader::new(&[0x9b, 0xf1, 0x59]), 0), Some((-624485, 3))); + assert_eq!(sleb128(&Reader::new(&[0xe5, 0x8e, 0x26]), 0), Some((624485, 3))); + assert_eq!(sleb128(&Reader::new(&[0xff, 0x7f]), 0), Some((-1, 2))); + assert_eq!(sleb128(&Reader::new(&[0x80, 0]), 0), Some((0, 2))); + assert_eq!(sleb128(&Reader::new(&[0x55, 0x7f, 0x55]), 1), Some((-1, 1))); +} + +#[test] +fn retains_valid_five_byte_sign_extensions() { + assert_eq!(sleb128(&Reader::new(&[0x80, 0x80, 0x80, 0x80, 0]), 0), Some((0, 5))); + assert_eq!(sleb128(&Reader::new(&[0x81, 0x80, 0x80, 0x80, 0]), 0), Some((1, 5))); + assert_eq!(sleb128(&Reader::new(&[0xff, 0xff, 0xff, 0xff, 0x7f]), 0), Some((-1, 5))); +} + +#[test] +fn rejects_values_longer_than_five_bytes() { + for (prefix, last) in [(0x80, 0), (0xff, 0x7f)] { + for length in [6, 10] { + let mut encoded = vec![prefix; length - 1]; + encoded.push(last); + assert_eq!(sleb128(&Reader::new(&encoded), 0), None, "{encoded:x?}"); + } + } +} + +#[test] +fn rejects_truncated_values_and_out_of_range_offsets() { + assert_eq!(sleb128(&Reader::new(&[0x80; 5]), 0), None); + assert_eq!(sleb128(&Reader::new(&[0x80]), 0), None); + assert_eq!(sleb128(&Reader::new(&[]), 0), None); + assert_eq!(sleb128(&Reader::new(&[0]), usize::MAX), None); +} + +fn code_with_handler(size: &[u8], payload: &[u8]) -> Code { + let mut bytes = vec![0; 0x70]; + bytes[..8].copy_from_slice(b"dex\n035\0"); + bytes[36..40].copy_from_slice(&0x70u32.to_le_bytes()); + bytes[40..44].copy_from_slice(&0x1234_5678u32.to_le_bytes()); + // Eight nop instructions and one try entry pointing to the first encoded handler. + bytes.extend_from_slice(&[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 8, 0, 0, 0]); + bytes.extend_from_slice(&[0; 16]); + bytes.extend_from_slice(&[0, 0, 0, 0, 1, 0, 1, 0]); + bytes.push(1); + bytes.extend_from_slice(size); + bytes.extend_from_slice(payload); + let len = bytes.len() as u32; + bytes[32..36].copy_from_slice(&len.to_le_bytes()); + dex::parse(&bytes).unwrap().code(0x70).unwrap() +} + +#[test] +fn invalid_sizes_do_not_create_handlers() { + let sizes: &[&[u8]] = &[ + &[0x80, 0x80, 0x80, 0x80, 0x08], + &[0x80, 0x80, 0x80, 0x80, 0x77], + &[0x80, 0x80, 0x80, 0x80, 0x80, 0], + &[0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0], + ]; + for size in sizes { + // These bytes could be a type/address pair or a catch-all address if size is accepted. + let code = code_with_handler(size, &[0, 7]); + assert_eq!(code.tries.len(), 1); + assert!(code.tries[0].handlers.is_empty(), "invalid size {size:x?}"); + } +} + +#[test] +fn valid_catch_all_handlers_are_retained() { + for size in [&[0][..], &[0x80, 0x80, 0x80, 0x80, 0][..]] { + let code = code_with_handler(size, &[7]); + assert_eq!(code.tries.len(), 1); + assert_eq!(code.tries[0].start, 0); + assert_eq!(code.tries[0].end, 1); + assert_eq!(code.tries[0].handlers, vec![Handler { exception: None, address: 7 }]); + } +} From 66f8c510489bdb2729b30538bfec44f457cc3e64 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 08:40:02 -0500 Subject: [PATCH 060/183] Expose shared DEX inspection and bytecode decoding --- ATTRIBUTION.md | 4 + Cargo.lock | 8 + Cargo.toml | 1 + crates/dex/Cargo.toml | 13 + crates/dex/src/bytes.rs | 81 ++++++ crates/dex/src/dex.rs | 28 +- crates/dex/src/dex_ops.rs | 8 +- crates/dex/src/lib.rs | 42 +++ crates/dex/src/test_support.rs | 471 +++++++++++++++++++++++++++++++++ 9 files changed, 643 insertions(+), 13 deletions(-) create mode 100644 crates/dex/Cargo.toml create mode 100644 crates/dex/src/bytes.rs create mode 100644 crates/dex/src/lib.rs create mode 100644 crates/dex/src/test_support.rs diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 4c86afd61..cbf153813 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -132,3 +132,7 @@ Sanitization, animation fitting and numeric output policy remain caller-owned. ## JSONC span-preserving editing `crates/jsonc` is extracted from Craft Anything `crates/formats/src/jsonc.rs` at `e5c9c94106747ed44b9a3fb0decce867c2285f93` (MIT OR Apache-2.0). The original implementation and hardening by BFlat, newline preservation by NetterSilver, and subsequent RRFZ/Afloat correctness fixes retain separate primary-author port commits with immutable source revisions. Shared API wiring and optional input-byte admission are subsequent changes. Compatibility parsing and all existing formatting/editing tests are retained; application file I/O and policy are not imported. + +## Dalvik DEX inspection + +`crates/dex` extracts Craft Anything `crates/formats/src/dex.rs` and `dex_ops.rs` at `5979f9b13f16dcf1df3c7ae7f8e7735f452866f2` (MIT OR Apache-2.0). Five source-history ports preserve Brandon Thomas, BFlat and Afloat as primary authors. Five regression imports retain BFlat/Afloat authors and exact source revisions. The checked byte-reader/MUTF-8 subset and synthetic DEX fixture come from that app's `bytes.rs` and `testkit/src/android.rs`; deterministic noise/mutations come from its testkit. No application file I/O, APK logic or execution is imported. Shared neutral errors and workspace wiring are subsequent changes; existing per-file strings, member/handler and bytecode payload budgets are retained. diff --git a/Cargo.lock b/Cargo.lock index 9fa1f4401..720433ee7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1722,6 +1722,14 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-dex" +version = "0.1.0" +dependencies = [ + "serde", + "thiserror 2.0.21", +] + [[package]] name = "craft-dialogs" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 50ec3c917..803e433de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ rust-version = "1.95" repository = "https://github.com/storytold/craft-libs" [workspace.dependencies] +craft-dex = { path = "crates/dex" } craft-jsonc = { path = "crates/jsonc" } craft-palette = { path = "crates/palette" } craft-score = { path = "crates/score" } diff --git a/crates/dex/Cargo.toml b/crates/dex/Cargo.toml new file mode 100644 index 000000000..e4eb285f5 --- /dev/null +++ b/crates/dex/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name="craft-dex" +description="Dalvik DEX reader and bytecode decoder with retained input bounds and partial-report semantics" +version.workspace=true +edition.workspace=true +license.workspace=true +rust-version.workspace=true +repository.workspace=true +[lints] +workspace=true +[dependencies] +serde={workspace=true} +thiserror={workspace=true} diff --git a/crates/dex/src/bytes.rs b/crates/dex/src/bytes.rs new file mode 100644 index 000000000..555505a2d --- /dev/null +++ b/crates/dex/src/bytes.rs @@ -0,0 +1,81 @@ +//! Checked little/big-endian reads over untrusted bytes. Every read returns `None` when out of range. + +#[derive(Debug, Clone, Copy)] +pub struct Reader<'a> { + data: &'a [u8], +} + +impl<'a> Reader<'a> { + pub fn new(data: &'a [u8]) -> Self { + Reader { data } + } + + pub fn len(&self) -> usize { + self.data.len() + } + + pub fn data(&self) -> &'a [u8] { + self.data + } + + pub fn slice(&self, off: usize, len: usize) -> Option<&'a [u8]> { + let end = off.checked_add(len)?; + self.data.get(off..end) + } + + pub fn u8(&self, off: usize) -> Option { + self.data.get(off).copied() + } + + fn arr(&self, off: usize) -> Option<[u8; N]> { + self.slice(off, N)?.try_into().ok() + } + + pub fn u16_le(&self, off: usize) -> Option { + self.arr(off).map(u16::from_le_bytes) + } + + pub fn u32_le(&self, off: usize) -> Option { + self.arr(off).map(u32::from_le_bytes) + } + + /// A NUL-terminated string starting at `off`, at most `max` bytes, lossily decoded. + pub fn cstr(&self, off: usize, max: usize) -> Option { + let rest = self.data.get(off..)?; + let rest = rest.get(..max.min(rest.len()))?; + let end = rest.iter().position(|&b| b == 0).unwrap_or(rest.len()); + Some(String::from_utf8_lossy(rest.get(..end)?).into_owned()) + } + + /// Unsigned LEB128 at `off`: (value, bytes consumed). At most 10 bytes. + pub fn uleb128(&self, off: usize) -> Option<(u64, usize)> { + let mut result = 0u64; + for i in 0..10usize { + let b = self.u8(off.checked_add(i)?)?; + let payload = u64::from(b & 0x7f); + let shift = 7 * i as u32; + if shift > 0 && payload.checked_shl(shift)? >> shift != payload { + return None; + } + result |= payload << shift; + if b & 0x80 == 0 { + return Some((result, i + 1)); + } + } + None + } +} + +/// Decode one modified UTF-8 code unit. Invalid bytes consume only themselves, +/// so a damaged sequence cannot hide valid text or borrow missing bytes. +pub(crate) fn mutf8_unit(bytes: &[u8]) -> (u16, usize) { + match bytes { + [a @ 0x00..=0x7f, ..] => (u16::from(*a), 1), + [0xc0, 0x80, ..] => (0, 2), + [a @ 0xc2..=0xdf, b @ 0x80..=0xbf, ..] => ((u16::from(*a & 0x1f) << 6) | u16::from(*b & 0x3f), 2), + [a @ 0xe0..=0xef, b @ 0x80..=0xbf, c @ 0x80..=0xbf, ..] if *a != 0xe0 || *b >= 0xa0 => { + ((u16::from(*a & 0x0f) << 12) | (u16::from(*b & 0x3f) << 6) | u16::from(*c & 0x3f), 3) + } + _ => (0xfffd, 1), + } +} diff --git a/crates/dex/src/dex.rs b/crates/dex/src/dex.rs index c4076dfc8..e578dc397 100644 --- a/crates/dex/src/dex.rs +++ b/crates/dex/src/dex.rs @@ -348,8 +348,11 @@ pub fn parse(data: &[u8]) -> Result, FormatError> { ProtoId { shorty: r.u32_le(o).unwrap_or(0), ret: r.u32_le(o + 4).unwrap_or(NO_INDEX), params_off: r.u32_le(o + 8).unwrap_or(0) } }) .collect(); - let member = - |o: usize| MemberId { class_idx: r.u16_le(o).unwrap_or(0), type_or_proto: r.u16_le(o + 2).unwrap_or(0), name_idx: r.u32_le(o + 4).unwrap_or(NO_INDEX) }; + let member = |o: usize| MemberId { + class_idx: r.u16_le(o).unwrap_or(0), + type_or_proto: r.u16_le(o + 2).unwrap_or(0), + name_idx: r.u32_le(o + 4).unwrap_or(NO_INDEX), + }; let fields = (0..nf).map(|i| member(fo + i * 8)).collect(); let methods = (0..nm).map(|i| member(mo + i * 8)).collect(); let classes = (0..nc) @@ -423,7 +426,9 @@ impl<'a> Dex<'a> { /// `Lcls;->name:Ltype;` pub fn field_ref(&self, i: u32) -> String { match self.fields.get(i as usize) { - Some(f) => format!("{}->{}:{}", self.type_desc(u32::from(f.class_idx)), self.string(f.name_idx), self.type_desc(u32::from(f.type_or_proto))), + Some(f) => { + format!("{}->{}:{}", self.type_desc(u32::from(f.class_idx)), self.string(f.name_idx), self.type_desc(u32::from(f.type_or_proto))) + } None => format!(""), } } @@ -431,7 +436,9 @@ impl<'a> Dex<'a> { /// `Lcls;->name(…)R` pub fn method_ref(&self, i: u32) -> String { match self.methods.get(i as usize) { - Some(m) => format!("{}->{}{}", self.type_desc(u32::from(m.class_idx)), self.string(m.name_idx), self.proto_desc(u32::from(m.type_or_proto))), + Some(m) => { + format!("{}->{}{}", self.type_desc(u32::from(m.class_idx)), self.string(m.name_idx), self.proto_desc(u32::from(m.type_or_proto))) + } None => format!(""), } } @@ -683,9 +690,10 @@ pub fn references(dex: &Dex<'_>, desc: &str, method: Option<&str>, max: usize) - let cls = dex.type_desc(u32::from(id.class_idx)); (cls == desc && method.is_none_or(|n| dex.string(id.name_idx) == n)).then(|| ("method", dex.method_ref(idx))) }), - IndexKind::Field if method.is_none() => { - dex.fields.get(idx as usize).and_then(|id| (dex.type_desc(u32::from(id.class_idx)) == desc).then(|| ("field", dex.field_ref(idx)))) - } + IndexKind::Field if method.is_none() => dex + .fields + .get(idx as usize) + .and_then(|id| (dex.type_desc(u32::from(id.class_idx)) == desc).then(|| ("field", dex.field_ref(idx)))), IndexKind::Type if method.is_none() => { let t = dex.type_desc(idx); (t.trim_start_matches('[') == desc).then_some(("type", t)) @@ -707,7 +715,7 @@ pub fn references(dex: &Dex<'_>, desc: &str, method: Option<&str>, max: usize) - #[cfg(test)] mod tests { use super::*; - use craft_anything_testkit::android as fx; + use crate::test_support::android as fx; #[test] fn parses_fixture() { @@ -785,7 +793,7 @@ mod tests { } let _ = references(d, "Lcom/example/notes/Util;", None, 100); }; - for m in craft_anything_testkit::mutations(&data) { + for m in crate::test_support::mutations(&data) { if let Ok(d) = parse(&m) { walk(&d); } @@ -796,7 +804,7 @@ mod tests { } } for seed in 0..64 { - let mut n = craft_anything_testkit::noise(seed, 2048); + let mut n = crate::test_support::noise(seed, 2048); n[..8].copy_from_slice(b"dex\n035\0"); n[40..44].copy_from_slice(&0x1234_5678u32.to_le_bytes()); if let Ok(d) = parse(&n) { diff --git a/crates/dex/src/dex_ops.rs b/crates/dex/src/dex_ops.rs index 71095fc75..3c27d4c5c 100644 --- a/crates/dex/src/dex_ops.rs +++ b/crates/dex/src/dex_ops.rs @@ -170,7 +170,8 @@ const BINOPS_2ADDR: [&str; 32] = [ "rem-double/2addr", ]; -const LIT16: [&str; 8] = ["add-int/lit16", "rsub-int", "mul-int/lit16", "div-int/lit16", "rem-int/lit16", "and-int/lit16", "or-int/lit16", "xor-int/lit16"]; +const LIT16: [&str; 8] = + ["add-int/lit16", "rsub-int", "mul-int/lit16", "div-int/lit16", "rem-int/lit16", "and-int/lit16", "or-int/lit16", "xor-int/lit16"]; const LIT8: [&str; 11] = [ "add-int/lit8", "rsub-int/lit8", @@ -236,7 +237,8 @@ const SFIELD: [&str; 14] = [ "sput-short", ]; const INVOKE: [&str; 5] = ["invoke-virtual", "invoke-super", "invoke-direct", "invoke-static", "invoke-interface"]; -const INVOKE_RANGE: [&str; 5] = ["invoke-virtual/range", "invoke-super/range", "invoke-direct/range", "invoke-static/range", "invoke-interface/range"]; +const INVOKE_RANGE: [&str; 5] = + ["invoke-virtual/range", "invoke-super/range", "invoke-direct/range", "invoke-static/range", "invoke-interface/range"]; fn pick(list: &[&'static str], i: u8, base: u8) -> &'static str { list.get(usize::from(i.wrapping_sub(base))).copied().unwrap_or("unused") @@ -683,7 +685,7 @@ mod tests { #[test] fn hostile() { for seed in 0..200 { - let n = craft_anything_testkit::noise(seed, 256); + let n = crate::test_support::noise(seed, 256); let code: Vec = n.as_chunks::<2>().0.iter().map(|c| u16::from_le_bytes(*c)).collect(); let _ = decode(&code, 1000); } diff --git a/crates/dex/src/lib.rs b/crates/dex/src/lib.rs new file mode 100644 index 000000000..97d28b7f4 --- /dev/null +++ b/crates/dex/src/lib.rs @@ -0,0 +1,42 @@ +#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] +#![forbid(unsafe_code)] +//! Dalvik DEX inspection and bytecode decoding. Never executes bytecode. +mod bytes; +/// Checked byte reader accepted by the signed-LEB compatibility helper. +pub use bytes::Reader; +pub mod dex; +pub mod dex_ops; +pub use dex::*; +#[cfg(test)] +mod test_support; +/// Parser admission failures; damaged substructures retain the original partial-report behavior. +#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)] +pub enum DexError { + #[error("the file ends early ({0})")] + Truncated(String), + #[error("the file is malformed ({0})")] + Malformed(String), + #[error("not supported: {0}")] + Unsupported(String), +} +use DexError as FormatError; + +#[cfg(test)] +#[path = "regressions/array_widths.rs"] +mod array_widths; + +#[cfg(test)] +#[path = "regressions/capped_table_boundaries.rs"] +mod capped_table_boundaries; + +#[cfg(test)] +#[path = "regressions/invoke_registers.rs"] +mod invoke_registers; + +#[cfg(test)] +#[path = "regressions/payload_budgets.rs"] +mod payload_budgets; + +#[cfg(test)] +#[path = "regressions/signed_leb128.rs"] +mod signed_leb128; diff --git a/crates/dex/src/test_support.rs b/crates/dex/src/test_support.rs new file mode 100644 index 000000000..a3a179145 --- /dev/null +++ b/crates/dex/src/test_support.rs @@ -0,0 +1,471 @@ +// Synthetic DEX fixture and deterministic mutations retained from Craft Anything. +/// Deterministic pseudo-random bytes (xorshift) for fuzz-like loops. +pub fn noise(seed: u64, len: usize) -> Vec { + let mut x = seed.wrapping_mul(0x9e37_79b9_7f4a_7c15) | 1; + (0..len) + .map(|_| { + x ^= x << 13; + x ^= x >> 7; + x ^= x << 17; + x as u8 + }) + .collect() +} + +/// Every way to damage a sample used by robustness tests: truncations at many lengths and +/// single-byte corruptions spread across the file. +pub fn mutations(sample: &[u8]) -> Vec> { + let mut out = Vec::new(); + let n = sample.len(); + let step = (n / 64).max(1); + let mut len = 0; + while len < n { + out.push(sample[..len].to_vec()); + len += step; + } + for (i, seed) in (0..n).step_by(step).zip(1u64..) { + let mut m = sample.to_vec(); + let noise = noise(seed, 8); + for (j, v) in noise.iter().enumerate() { + if let Some(b) = m.get_mut(i + j) { + *b = *v; + } + } + out.push(m); + let mut m = sample.to_vec(); + if let Some(b) = m.get_mut(i) { + *b = 0xff; + } + out.push(m); + } + out +} + +pub mod android { + pub const HELLO: &str = "Hello, Craft!"; + fn u16le(v: &mut Vec, x: u16) { + v.extend_from_slice(&x.to_le_bytes()); + } + fn u32le(v: &mut Vec, x: u32) { + v.extend_from_slice(&x.to_le_bytes()); + } + fn uleb(v: &mut Vec, mut x: u32) { + loop { + let b = (x & 0x7f) as u8; + x >>= 7; + if x == 0 { + v.push(b); + break; + } + v.push(b | 0x80); + } + } + fn sleb(v: &mut Vec, mut x: i32) { + loop { + let b = (x & 0x7f) as u8; + x >>= 7; + let done = (x == 0 && b & 0x40 == 0) || (x == -1 && b & 0x40 != 0); + v.push(if done { b } else { b | 0x80 }); + if done { + break; + } + } + } + fn align4(v: &mut Vec) { + while !v.len().is_multiple_of(4) { + v.push(0); + } + } + + #[derive(Debug, Clone, Default)] + pub struct TrySpec { + pub start: u32, + pub count: u16, + /// (type idx, handler address) + pub handlers: Vec<(u32, u32)>, + pub catch_all: Option, + } + + #[derive(Debug, Clone, Default)] + pub struct CodeSpec { + pub registers: u16, + pub ins: u16, + pub outs: u16, + pub insns: Vec, + pub tries: Vec, + } + + #[derive(Debug, Clone)] + pub struct MethodSpec { + pub method: u32, + pub access: u32, + pub code: Option, + } + + #[derive(Debug, Clone, Default)] + pub struct ClassSpec { + pub class: u32, + pub access: u32, + pub superclass: u32, + pub interfaces: Vec, + pub source_file: u32, + pub annotations: Vec, + pub static_fields: Vec<(u32, u32)>, + pub instance_fields: Vec<(u32, u32)>, + pub direct: Vec, + pub virtuals: Vec, + } + + #[derive(Debug, Clone, Default)] + pub struct DexBuilder { + strings: Vec, + types: Vec, + protos: Vec<(u32, u32, Vec)>, + fields: Vec<(u32, u32, u32)>, + methods: Vec<(u32, u32, u32)>, + pub classes: Vec, + } + + impl DexBuilder { + pub fn string(&mut self, s: &str) -> u32 { + if let Some(i) = self.strings.iter().position(|x| x == s) { + return i as u32; + } + self.strings.push(s.to_string()); + (self.strings.len() - 1) as u32 + } + + pub fn ty(&mut self, desc: &str) -> u32 { + let s = self.string(desc); + if let Some(i) = self.types.iter().position(|&x| x == s) { + return i as u32; + } + self.types.push(s); + (self.types.len() - 1) as u32 + } + + pub fn proto(&mut self, ret: &str, params: &[&str]) -> u32 { + let short = |d: &str| if d.starts_with('L') || d.starts_with('[') { 'L' } else { d.chars().next().unwrap() }; + let shorty: String = std::iter::once(short(ret)).chain(params.iter().map(|p| short(p))).collect(); + let s = self.string(&shorty); + let r = self.ty(ret); + let ps: Vec = params.iter().map(|p| self.ty(p)).collect(); + if let Some(i) = self.protos.iter().position(|p| p.1 == r && p.2 == ps) { + return i as u32; + } + self.protos.push((s, r, ps)); + (self.protos.len() - 1) as u32 + } + + pub fn field(&mut self, cls: &str, ty: &str, name: &str) -> u32 { + let c = self.ty(cls); + let t = self.ty(ty); + let n = self.string(name); + if let Some(i) = self.fields.iter().position(|&f| f == (c, t, n)) { + return i as u32; + } + self.fields.push((c, t, n)); + (self.fields.len() - 1) as u32 + } + + pub fn method(&mut self, cls: &str, name: &str, ret: &str, params: &[&str]) -> u32 { + let c = self.ty(cls); + let p = self.proto(ret, params); + let n = self.string(name); + if let Some(i) = self.methods.iter().position(|&m| m == (c, p, n)) { + return i as u32; + } + self.methods.push((c, p, n)); + (self.methods.len() - 1) as u32 + } + + pub fn build(self) -> Vec { + let ns = self.strings.len(); + let nt = self.types.len(); + let np = self.protos.len(); + let nf = self.fields.len(); + let nm = self.methods.len(); + let nc = self.classes.len(); + let string_ids = 0x70; + let type_ids = string_ids + ns * 4; + let proto_ids = type_ids + nt * 4; + let field_ids = proto_ids + np * 12; + let method_ids = field_ids + nf * 8; + let class_defs = method_ids + nm * 8; + let mut data_start = class_defs + nc * 32; + data_start = (data_start + 3) & !3; + let mut d: Vec = Vec::new(); + let at = |d: &Vec| (data_start + d.len()) as u32; + // type lists + let tl = |d: &mut Vec, list: &[u32]| -> u32 { + if list.is_empty() { + return 0; + } + align4(d); + let o = at(d); + u32le(d, list.len() as u32); + for &t in list { + u16le(d, t as u16); + } + o + }; + let proto_params: Vec = self.protos.iter().map(|p| tl(&mut d, &p.2)).collect(); + let class_ifaces: Vec = self.classes.iter().map(|c| tl(&mut d, &c.interfaces)).collect(); + // string data + let mut string_offs = Vec::new(); + for s in &self.strings { + string_offs.push(at(&d)); + uleb(&mut d, s.encode_utf16().count() as u32); + for ch in s.chars() { + let c = ch as u32; + if c == 0 { + d.extend_from_slice(&[0xc0, 0x80]); + } else if c < 0x80 { + d.push(c as u8); + } else if c < 0x800 { + d.extend_from_slice(&[0xc0 | (c >> 6) as u8, 0x80 | (c & 0x3f) as u8]); + } else { + d.extend_from_slice(&[0xe0 | (c >> 12) as u8, 0x80 | ((c >> 6) & 0x3f) as u8, 0x80 | (c & 0x3f) as u8]); + } + } + d.push(0); + } + // code items, class data, annotations + let mut class_data_offs = Vec::new(); + let mut annot_offs = Vec::new(); + for c in &self.classes { + let code_off = |d: &mut Vec, m: &MethodSpec| -> u32 { + let Some(code) = &m.code else { return 0 }; + align4(d); + let o = at(d); + u16le(d, code.registers); + u16le(d, code.ins); + u16le(d, code.outs); + u16le(d, code.tries.len() as u16); + u32le(d, 0); + u32le(d, code.insns.len() as u32); + for &i in &code.insns { + u16le(d, i); + } + if !code.tries.is_empty() { + if code.insns.len() % 2 == 1 { + u16le(d, 0); + } + let mut list = Vec::new(); + uleb(&mut list, code.tries.len() as u32); + let mut offs = Vec::new(); + for t in &code.tries { + offs.push(list.len() as u16); + let n = t.handlers.len() as i32; + sleb(&mut list, if t.catch_all.is_some() { -n } else { n }); + for &(ty, addr) in &t.handlers { + uleb(&mut list, ty); + uleb(&mut list, addr); + } + if let Some(a) = t.catch_all { + uleb(&mut list, a); + } + } + for (t, off) in code.tries.iter().zip(offs) { + u32le(d, t.start); + u16le(d, t.count); + u16le(d, off); + } + d.extend_from_slice(&list); + } + o + }; + let mut direct = c.direct.clone(); + direct.sort_by_key(|m| m.method); + let mut virtuals = c.virtuals.clone(); + virtuals.sort_by_key(|m| m.method); + let direct_offs: Vec = direct.iter().map(|m| code_off(&mut d, m)).collect(); + let virtual_offs: Vec = virtuals.iter().map(|m| code_off(&mut d, m)).collect(); + let cd = at(&d); + let mut sf = c.static_fields.clone(); + sf.sort(); + let mut inf = c.instance_fields.clone(); + inf.sort(); + uleb(&mut d, sf.len() as u32); + uleb(&mut d, inf.len() as u32); + uleb(&mut d, direct.len() as u32); + uleb(&mut d, virtuals.len() as u32); + for list in [&sf, &inf] { + let mut prev = 0; + for &(f, a) in list.iter() { + uleb(&mut d, f - prev); + uleb(&mut d, a); + prev = f; + } + } + for (list, offs) in [(&direct, &direct_offs), (&virtuals, &virtual_offs)] { + let mut prev = 0; + for (m, &o) in list.iter().zip(offs.iter()) { + uleb(&mut d, m.method - prev); + uleb(&mut d, m.access); + uleb(&mut d, o); + prev = m.method; + } + } + class_data_offs.push(cd); + if c.annotations.is_empty() { + annot_offs.push(0); + } else { + let mut items = Vec::new(); + for &t in &c.annotations { + items.push(at(&d)); + d.push(1); // runtime visibility + uleb(&mut d, t); + uleb(&mut d, 0); + } + align4(&mut d); + let set_off = at(&d); + u32le(&mut d, items.len() as u32); + for i in items { + u32le(&mut d, i); + } + let dir = at(&d); + u32le(&mut d, set_off); + u32le(&mut d, 0); + u32le(&mut d, 0); + u32le(&mut d, 0); + annot_offs.push(dir); + } + } + align4(&mut d); + let file_size = data_start + d.len(); + let mut out = vec![0u8; data_start]; + out[..8].copy_from_slice(b"dex\n035\0"); + let put = |out: &mut Vec, off: usize, v: u32| out[off..off + 4].copy_from_slice(&v.to_le_bytes()); + put(&mut out, 32, file_size as u32); + put(&mut out, 36, 0x70); + put(&mut out, 40, 0x1234_5678); + for (i, (n, o)) in + [(ns, string_ids), (nt, type_ids), (np, proto_ids), (nf, field_ids), (nm, method_ids), (nc, class_defs)].iter().enumerate() + { + put(&mut out, 56 + i * 8, *n as u32); + put(&mut out, 60 + i * 8, if *n == 0 { 0 } else { *o as u32 }); + } + put(&mut out, 104, d.len() as u32); + put(&mut out, 108, data_start as u32); + for (i, o) in string_offs.iter().enumerate() { + put(&mut out, string_ids + i * 4, *o); + } + for (i, t) in self.types.iter().enumerate() { + put(&mut out, type_ids + i * 4, *t); + } + for (i, p) in self.protos.iter().enumerate() { + put(&mut out, proto_ids + i * 12, p.0); + put(&mut out, proto_ids + i * 12 + 4, p.1); + put(&mut out, proto_ids + i * 12 + 8, proto_params[i]); + } + for (i, (c, t, n)) in self.fields.iter().enumerate() { + out[field_ids + i * 8..field_ids + i * 8 + 2].copy_from_slice(&(*c as u16).to_le_bytes()); + out[field_ids + i * 8 + 2..field_ids + i * 8 + 4].copy_from_slice(&(*t as u16).to_le_bytes()); + put(&mut out, field_ids + i * 8 + 4, *n); + } + for (i, (c, p, n)) in self.methods.iter().enumerate() { + out[method_ids + i * 8..method_ids + i * 8 + 2].copy_from_slice(&(*c as u16).to_le_bytes()); + out[method_ids + i * 8 + 2..method_ids + i * 8 + 4].copy_from_slice(&(*p as u16).to_le_bytes()); + put(&mut out, method_ids + i * 8 + 4, *n); + } + for (i, c) in self.classes.iter().enumerate() { + let o = class_defs + i * 32; + for (k, v) in + [c.class, c.access, c.superclass, class_ifaces[i], c.source_file, annot_offs[i], class_data_offs[i], 0].iter().enumerate() + { + put(&mut out, o + k * 4, *v); + } + } + out.extend_from_slice(&d); + let sum = adler32(&out[12..]); + put(&mut out, 8, sum); + out + } + } + + fn adler32(data: &[u8]) -> u32 { + let (mut a, mut b) = (1u32, 0u32); + for &x in data { + a = (a + u32::from(x)) % 65521; + b = (b + a) % 65521; + } + (b << 16) | a + } + + const MAIN: &str = "Lcom/example/notes/MainActivity;"; + const UTIL: &str = "Lcom/example/notes/Util;"; + const STRING: &str = "Ljava/lang/String;"; + + /// `classes.dex` of the Notes app: `MainActivity` (constructor, `onCreate`, `run`, `pick` with a + /// packed switch inside a try/catch) and `Util` (two `log` overloads printing through + /// `System.out`). + pub fn notes_dex() -> Vec { + let mut b = DexBuilder::default(); + let activity = b.ty("Landroid/app/Activity;"); + let main = b.ty(MAIN); + let runnable = b.ty("Ljava/lang/Runnable;"); + let deprecated = b.ty("Ljava/lang/Deprecated;"); + let rte = b.ty("Ljava/lang/RuntimeException;"); + let object = b.ty("Ljava/lang/Object;"); + let util = b.ty(UTIL); + let tag = b.field(MAIN, STRING, "TAG"); + let count = b.field(MAIN, "I", "count"); + let out = b.field("Ljava/lang/System;", "Ljava/io/PrintStream;", "out"); + let super_init = b.method("Landroid/app/Activity;", "", "V", &[]); + let super_create = b.method("Landroid/app/Activity;", "onCreate", "V", &["Landroid/os/Bundle;"]); + let init = b.method(MAIN, "", "V", &[]); + let on_create = b.method(MAIN, "onCreate", "V", &["Landroid/os/Bundle;"]); + let run = b.method(MAIN, "run", "V", &[]); + let pick = b.method(MAIN, "pick", "I", &["I"]); + let log_s = b.method(UTIL, "log", "V", &[STRING]); + let log_i = b.method(UTIL, "log", "V", &["I"]); + let println = b.method("Ljava/io/PrintStream;", "println", "V", &[STRING]); + let hello = b.string(HELLO); + let main_src = b.string("MainActivity.java"); + let util_src = b.string("Util.java"); + let code = |registers, ins, outs, insns: Vec| Some(CodeSpec { registers, ins, outs, insns, tries: vec![] }); + b.classes.push(ClassSpec { + class: main, + access: 0x1, + superclass: activity, + interfaces: vec![runnable], + source_file: main_src, + annotations: vec![deprecated], + static_fields: vec![(tag, 0x1a)], + instance_fields: vec![(count, 0x2)], + direct: vec![MethodSpec { method: init, access: 0x10001, code: code(1, 1, 1, vec![0x1070, super_init as u16, 0x0000, 0x000e]) }], + virtuals: vec![ + MethodSpec { + method: on_create, + access: 0x1, + code: code(3, 2, 2, vec![0x001a, hello as u16, 0x1071, log_s as u16, 0x0000, 0x206f, super_create as u16, 0x0021, 0x000e]), + }, + MethodSpec { method: run, access: 0x1, code: code(1, 1, 1, vec![0x7012, 0x1071, log_i as u16, 0x0000, 0x000e]) }, + MethodSpec { + method: pick, + access: 0x1, + code: Some(CodeSpec { + registers: 3, + ins: 2, + outs: 0, + insns: vec![0x022b, 10, 0, 0x0012, 0x000f, 0x1012, 0x000f, 0x2012, 0x000f, 0x0000, 0x0100, 2, 1, 0, 5, 0, 7, 0], + tries: vec![TrySpec { start: 0, count: 3, handlers: vec![(rte, 3)], catch_all: Some(3) }], + }), + }, + ], + }); + b.classes.push(ClassSpec { + class: util, + access: 0x11, + superclass: object, + source_file: util_src, + direct: vec![ + MethodSpec { method: log_s, access: 0x9, code: code(2, 1, 2, vec![0x0062, out as u16, 0x206e, println as u16, 0x0010, 0x000e]) }, + MethodSpec { method: log_i, access: 0x9, code: code(1, 1, 0, vec![0x000e]) }, + ], + ..ClassSpec::default() + }); + b.build() + } +} From 33a83bab9b0cd594832aedd68fa7b3ae5c2eaaed Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 08:41:16 -0500 Subject: [PATCH 061/183] Expose shared packet capture and protocol inspection with retained bounds --- ATTRIBUTION.md | 4 + Cargo.lock | 10 ++ Cargo.toml | 1 + crates/pcap/Cargo.toml | 17 ++++ crates/pcap/src/bytes.rs | 49 +++++++++ crates/pcap/src/lib.rs | 99 ++++++++++++++----- crates/pcap/tests/dns_discovery_answers.rs | 7 +- crates/pcap/tests/dns_question_class.rs | 7 +- crates/pcap/tests/dns_rdata_names.rs | 7 +- crates/pcap/tests/pcap_dns_name_limit.rs | 7 +- crates/pcap/tests/pcap_dns_txt_lengths.rs | 7 +- crates/pcap/tests/pcap_flow_time_range.rs | 7 +- crates/pcap/tests/pcap_http_host_boundary.rs | 7 +- crates/pcap/tests/pcap_http_methods.rs | 7 +- crates/pcap/tests/pcap_ipv4_lengths.rs | 7 +- crates/pcap/tests/pcap_ipv6_fragments.rs | 7 +- crates/pcap/tests/pcap_ipv6_no_next_header.rs | 2 +- crates/pcap/tests/pcap_ipv6_version.rs | 7 +- crates/pcap/tests/pcap_tcp_ecn.rs | 2 +- crates/pcap/tests/pcapng_simple_payload.rs | 7 +- .../pcap/tests/regression_pcapng_framing.rs | 7 +- .../pcap/tests/regression_tcp_dns_framing.rs | 7 +- .../tests/regression_tcp_header_length.rs | 7 +- crates/pcap/tests/regression_tls_bounds.rs | 9 +- crates/pcap/tests/support/mod.rs | 8 +- 25 files changed, 244 insertions(+), 62 deletions(-) create mode 100644 crates/pcap/Cargo.toml create mode 100644 crates/pcap/src/bytes.rs diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 4c86afd61..c144ce05f 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -132,3 +132,7 @@ Sanitization, animation fitting and numeric output policy remain caller-owned. ## JSONC span-preserving editing `crates/jsonc` is extracted from Craft Anything `crates/formats/src/jsonc.rs` at `e5c9c94106747ed44b9a3fb0decce867c2285f93` (MIT OR Apache-2.0). The original implementation and hardening by BFlat, newline preservation by NetterSilver, and subsequent RRFZ/Afloat correctness fixes retain separate primary-author port commits with immutable source revisions. Shared API wiring and optional input-byte admission are subsequent changes. Compatibility parsing and all existing formatting/editing tests are retained; application file I/O and policy are not imported. + +## Packet capture and protocol inspection + +`crates/pcap` extracts Craft Anything `crates/formats/src/pcap.rs`, its checked byte reader primitives and synthetic packet fixtures/regressions at `5979f9b13f16dcf1df3c7ae7f8e7735f452866f2` (MIT OR Apache-2.0). Brandon Thomas introduced the implementation, byte reader and fixtures in `f64ae3bf3c8863a982af1304e06de20653803968`. Subsequent fixes by phatloi0010, GGWA, BFlat, Afloat, NetterSilver, Max Mittelstädt and RRFZ retain separate primary-author source-history commits with immutable source revisions. Shared error/API wiring and chrono-based timestamp formatting with exhaustive day-boundary parity tests are subsequent Dylan M. Taylor changes. No packet reassembly, decryption, live capture or app analysis policy is imported. diff --git a/Cargo.lock b/Cargo.lock index 9fa1f4401..c95ed6cb8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2625,6 +2625,16 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-pcap" +version = "0.1.0" +dependencies = [ + "chrono", + "serde", + "serde_json", + "thiserror 2.0.21", +] + [[package]] name = "craft-pdf" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 50ec3c917..e4fc7a980 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ rust-version = "1.95" repository = "https://github.com/storytold/craft-libs" [workspace.dependencies] +craft-pcap = { path = "crates/pcap" } craft-jsonc = { path = "crates/jsonc" } craft-palette = { path = "crates/palette" } craft-score = { path = "crates/score" } diff --git a/crates/pcap/Cargo.toml b/crates/pcap/Cargo.toml new file mode 100644 index 000000000..ea644cdf3 --- /dev/null +++ b/crates/pcap/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "craft-pcap" +description = "Read-only PCAP/PCAPNG and per-frame protocol inspection" +version.workspace = true +edition.workspace = true +license.workspace = true +rust-version.workspace = true +repository.workspace = true +[lints] +workspace = true +[dependencies] +serde = { workspace = true } +thiserror = { workspace = true } +chrono = { workspace = true } + +[dev-dependencies] +serde_json = { workspace = true } diff --git a/crates/pcap/src/bytes.rs b/crates/pcap/src/bytes.rs new file mode 100644 index 000000000..238b5b6b8 --- /dev/null +++ b/crates/pcap/src/bytes.rs @@ -0,0 +1,49 @@ +//! Checked little/big-endian reads over untrusted bytes. Every read returns `None` when out of range. + +#[derive(Debug, Clone, Copy)] +pub struct Reader<'a> { + data: &'a [u8], +} + +impl<'a> Reader<'a> { + pub fn new(data: &'a [u8]) -> Self { + Reader { data } + } + + pub fn slice(&self, off: usize, len: usize) -> Option<&'a [u8]> { + let end = off.checked_add(len)?; + self.data.get(off..end) + } + + pub fn u8(&self, off: usize) -> Option { + self.data.get(off).copied() + } + + fn arr(&self, off: usize) -> Option<[u8; N]> { + self.slice(off, N)?.try_into().ok() + } + + pub fn u16_le(&self, off: usize) -> Option { + self.arr(off).map(u16::from_le_bytes) + } + + pub fn u32_le(&self, off: usize) -> Option { + self.arr(off).map(u32::from_le_bytes) + } + + pub fn u64_le(&self, off: usize) -> Option { + self.arr(off).map(u64::from_le_bytes) + } + + pub fn u16_be(&self, off: usize) -> Option { + self.arr(off).map(u16::from_be_bytes) + } + + pub fn u32_be(&self, off: usize) -> Option { + self.arr(off).map(u32::from_be_bytes) + } + + pub fn u64_be(&self, off: usize) -> Option { + self.arr(off).map(u64::from_be_bytes) + } +} diff --git a/crates/pcap/src/lib.rs b/crates/pcap/src/lib.rs index 5caa19938..bc05c1f77 100644 --- a/crates/pcap/src/lib.rs +++ b/crates/pcap/src/lib.rs @@ -1,12 +1,32 @@ +#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] +#![forbid(unsafe_code)] + //! Saved packet captures: classic pcap (microsecond and nanosecond, either byte order) and pcapng //! (section, interface, enhanced/simple/obsolete packet blocks). Frames are decoded from Ethernet //! (with VLAN tags), raw IP, Linux cooked (SLL/SLL2) and BSD loopback links into IPv4/IPv6, //! TCP/UDP/ICMP, and the application facts most people ask about: DNS questions and answers, //! HTTP/1.x request and status lines with the Host header, and the TLS ClientHello server name //! (SNI) and ALPN. Each frame is decoded on its own: no TCP reassembly, no decryption. Pure, no I/O, -//! every length checked. +//! every length checked. Input bytes remain caller-owned and must be admitted to a caller budget. +//! Packet, flow and inventory caps below are retained; they are not a total allocator-byte guarantee. -use crate::FormatError; +mod bytes; +#[cfg(test)] +#[path = "../tests/support/mod.rs"] +mod test_support; + +/// Why capture inspection could not start or finish. +#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)] +pub enum PcapError { + #[error("the file ends early ({0})")] + Truncated(String), + #[error("the file is malformed ({0})")] + Malformed(String), + #[error("not supported: {0}")] + Unsupported(String), +} + +use crate::PcapError as FormatError; use crate::bytes::Reader; use serde::Serialize; use std::collections::{BTreeMap, BTreeSet, HashMap}; @@ -245,7 +265,9 @@ impl<'a> Capture<'a> { if p >= self.data.len() { return None; } - let (Some(sec), Some(frac), Some(incl), Some(orig)) = (rd_u32(&r, le, p), rd_u32(&r, le, p + 4), rd_u32(&r, le, p + 8), rd_u32(&r, le, p + 12)) else { + let (Some(sec), Some(frac), Some(incl), Some(orig)) = + (rd_u32(&r, le, p), rd_u32(&r, le, p + 4), rd_u32(&r, le, p + 8), rd_u32(&r, le, p + 12)) + else { return self.stop(format!("record header at offset {p} is cut short")); }; let Some(body) = usize::try_from(incl).ok().and_then(|n| r.slice(p + 16, n)) else { @@ -1022,7 +1044,8 @@ fn dns(msg: &[u8], d: &mut Decoded, label: &'static str, mdns_wire_format: bool) return; } d.protocols.push(label); - let mut out = Dns { id, response: flags & 0x8000 != 0, rcode: (flags & 0xf) as u8, questions: Vec::new(), answers: Vec::new(), incomplete: false }; + let mut out = + Dns { id, response: flags & 0x8000 != 0, rcode: (flags & 0xf) as u8, questions: Vec::new(), answers: Vec::new(), incomplete: false }; let mut off = 12usize; for _ in 0..qd { let Some((name, next, _)) = dns_name(msg, off, true) else { @@ -1236,7 +1259,8 @@ fn tcp_app(p: &[u8], d: &mut Decoded) { remaining = remaining.get(end + 2..).unwrap_or(&[]); } d.protocols.push("http"); - d.http = Some(Http { kind: "request", method: Some(m.to_string()), target: Some(strip_userinfo(t)), status: None, version: v.to_string(), host }); + d.http = + Some(Http { kind: "request", method: Some(m.to_string()), target: Some(strip_userinfo(t)), status: None, version: v.to_string(), host }); return; } tls(p, d); @@ -1559,7 +1583,8 @@ pub fn summarize(data: &[u8], cancelled: &dyn Fn() -> bool) -> Result = Vec::new(); let (mut protocols, mut stacks, mut endpoints) = (Tally::default(), Tally::default(), Tally::default()); - let (mut queries, mut answers, mut http, mut sni, mut alpn) = (Tally::default(), Tally::default(), Tally::default(), Tally::default(), Tally::default()); + let (mut queries, mut answers, mut http, mut sni, mut alpn) = + (Tally::default(), Tally::default(), Tally::default(), Tally::default(), Tally::default()); let mut addresses = Tally::default(); for f in cap.by_ref() { if f.number % 4096 == 0 && cancelled() { @@ -1680,30 +1705,21 @@ pub fn summarize(data: &[u8], cancelled: &dyn Fn() -> bool) -> Result String { - let secs = ns / 1_000_000_000; - let (days, rem) = (secs / 86_400, secs % 86_400); - // Civil-from-days (proleptic Gregorian), valid for every u64 day count we can reach. - let z = days as i64 + 719_468; - let era = z.div_euclid(146_097); - let doe = z - era * 146_097; - let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365; - let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); - let mp = (5 * doy + 2) / 153; - let day = doy - (153 * mp + 2) / 5 + 1; - let month = if mp < 10 { mp + 3 } else { mp - 9 }; - let year = yoe + era * 400 + i64::from(month <= 2); - format!("{year:04}-{month:02}-{day:02}T{:02}:{:02}:{:02}.{:09}Z", rem / 3600, rem % 3600 / 60, rem % 60, ns % 1_000_000_000) + // u64 nanoseconds span only 1970..2554, entirely within chrono's representable range. + chrono::DateTime::from_timestamp((ns / 1_000_000_000) as i64, (ns % 1_000_000_000) as u32) + .map(|time| time.to_rfc3339_opts(chrono::SecondsFormat::Nanos, true)) + .unwrap_or_default() } #[cfg(test)] mod tests { use super::*; - use craft_anything_testkit::pcap::{dns_query, eth, ipv4_pkt, pcap, pcapng, sample_frames, udp}; + use crate::test_support::{dns_query, eth, ipv4_pkt, pcap, pcapng, sample_frames, udp}; #[test] fn rejected_simple_packets_count_toward_the_scan_limit() { let mut data = pcapng(&[]); - let rejected = craft_anything_testkit::pcap::block(3, &1u32.to_le_bytes()); + let rejected = crate::test_support::block(3, &1u32.to_le_bytes()); for _ in 0..3 { data.extend(&rejected); } @@ -1722,7 +1738,7 @@ mod tests { #[test] fn rejected_simple_packets_at_eof_do_not_report_a_truncated_scan() { let mut data = pcapng(&[]); - let rejected = craft_anything_testkit::pcap::block(3, &1u32.to_le_bytes()); + let rejected = crate::test_support::block(3, &1u32.to_le_bytes()); for _ in 0..2 { data.extend(&rejected); } @@ -1737,8 +1753,8 @@ mod tests { #[test] fn valid_and_rejected_simple_packets_share_the_scan_limit() { let mut data = pcapng(&[]); - data.extend(craft_anything_testkit::pcap::block(3, &1u32.to_le_bytes())); - let valid = craft_anything_testkit::pcap::block(3, &0u32.to_le_bytes()); + data.extend(crate::test_support::block(3, &1u32.to_le_bytes())); + let valid = crate::test_support::block(3, &0u32.to_le_bytes()); data.extend(&valid); data.extend(&valid); let mut cap = Capture::new(&data).unwrap(); @@ -1751,7 +1767,7 @@ mod tests { #[test] fn malformed_packet_blocks_share_the_budget_and_report_each_reason_once() { - use craft_anything_testkit::pcap::block; + use crate::test_support::block; let mut data = pcapng(&[]); for kind in [2, 6] { let mut body = [0; 20]; @@ -1794,7 +1810,7 @@ mod tests { #[test] fn subnanosecond_decimal_resolutions_keep_the_interface_offset() { - use craft_anything_testkit::pcap::block; + use crate::test_support::block; let mut data = pcapng(&[]); data.truncate(28); let mut idb = vec![1, 0, 0, 0, 0, 0, 0, 0, 9, 0, 1, 0, 127, 0, 0, 0, 14, 0, 8, 0]; @@ -2134,3 +2150,34 @@ mod tests { assert!(dns_name(&[0xc0, 0x00], 0, true).is_none()); } } + +#[cfg(test)] +mod timestamp_parity { + fn legacy_iso8601(ns: u64) -> String { + let secs = ns / 1_000_000_000; + let (days, rem) = (secs / 86_400, secs % 86_400); + // Civil-from-days (proleptic Gregorian), valid for every u64 day count we can reach. + let z = days as i64 + 719_468; + let era = z.div_euclid(146_097); + let doe = z - era * 146_097; + let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365; + let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); + let mp = (5 * doy + 2) / 153; + let day = doy - (153 * mp + 2) / 5 + 1; + let month = if mp < 10 { mp + 3 } else { mp - 9 }; + let year = yoe + era * 400 + i64::from(month <= 2); + format!("{year:04}-{month:02}-{day:02}T{:02}:{:02}:{:02}.{:09}Z", rem / 3600, rem % 3600 / 60, rem % 60, ns % 1_000_000_000) + } + + #[test] + fn every_representable_day_and_boundaries_match_legacy() { + let day = 86_400_000_000_000u64; + for d in 0..=u64::MAX / day { + let ns = d * day; + assert_eq!(super::iso8601(ns), legacy_iso8601(ns)); + } + for ns in [0, 1, 999_999_999, 1_000_000_000, u64::MAX - 1, u64::MAX] { + assert_eq!(super::iso8601(ns), legacy_iso8601(ns)); + } + } +} diff --git a/crates/pcap/tests/dns_discovery_answers.rs b/crates/pcap/tests/dns_discovery_answers.rs index 71f4cb0a3..97d9dc0dc 100644 --- a/crates/pcap/tests/dns_discovery_answers.rs +++ b/crates/pcap/tests/dns_discovery_answers.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::{Dns, decode}; -use craft_anything_testkit::pcap::{dns_query, eth, ipv4_pkt, udp}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::{Dns, decode}; +use support::{dns_query, eth, ipv4_pkt, udp}; fn answer(kind: u16, rd: &[u8]) -> Dns { let mut msg = dns_query(); diff --git a/crates/pcap/tests/dns_question_class.rs b/crates/pcap/tests/dns_question_class.rs index 609fa9af1..b6583f7f3 100644 --- a/crates/pcap/tests/dns_question_class.rs +++ b/crates/pcap/tests/dns_question_class.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::{decode, summarize}; -use craft_anything_testkit::pcap::{dns_query, eth, ipv4_pkt, pcap, udp}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::{decode, summarize}; +use support::{dns_query, eth, ipv4_pkt, pcap, udp}; fn packet(message: &[u8]) -> Vec { eth(0x0800, &ipv4_pkt(17, [192, 0, 2, 1], [192, 0, 2, 2], &udp(51000, 53, message))) diff --git a/crates/pcap/tests/dns_rdata_names.rs b/crates/pcap/tests/dns_rdata_names.rs index 7d7d00644..7e8542a0a 100644 --- a/crates/pcap/tests/dns_rdata_names.rs +++ b/crates/pcap/tests/dns_rdata_names.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::{decode, summarize}; -use craft_anything_testkit::pcap::{dns_query, eth, ipv4_pkt, pcap, udp}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::{decode, summarize}; +use support::{dns_query, eth, ipv4_pkt, pcap, udp}; fn response(record_type: u16, rdata: &[u8], declared_length: usize) -> Vec { let mut message = dns_query(); diff --git a/crates/pcap/tests/pcap_dns_name_limit.rs b/crates/pcap/tests/pcap_dns_name_limit.rs index cf2954d70..82fc4e9f0 100644 --- a/crates/pcap/tests/pcap_dns_name_limit.rs +++ b/crates/pcap/tests/pcap_dns_name_limit.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::{Dns, decode}; -use craft_anything_testkit::pcap::{ipv4_pkt, udp}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::{Dns, decode}; +use support::{ipv4_pkt, udp}; fn query(last: usize, compressed: bool) -> Dns { let mut msg = vec![0, 1, 1, 0, 0, if compressed { 2 } else { 1 }, 0, 0, 0, 0, 0, 0]; diff --git a/crates/pcap/tests/pcap_dns_txt_lengths.rs b/crates/pcap/tests/pcap_dns_txt_lengths.rs index a90207b21..56312df41 100644 --- a/crates/pcap/tests/pcap_dns_txt_lengths.rs +++ b/crates/pcap/tests/pcap_dns_txt_lengths.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::{Dns, decode}; -use craft_anything_testkit::pcap::{ipv4_pkt, udp}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::{Dns, decode}; +use support::{ipv4_pkt, udp}; fn response(data: &[u8]) -> Dns { let mut msg = vec![0, 1, 0x81, 0x80, 0, 0, 0, 1, 0, 0, 0, 0]; diff --git a/crates/pcap/tests/pcap_flow_time_range.rs b/crates/pcap/tests/pcap_flow_time_range.rs index 96b6c128b..722121f4b 100644 --- a/crates/pcap/tests/pcap_flow_time_range.rs +++ b/crates/pcap/tests/pcap_flow_time_range.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::summarize; -use craft_anything_testkit::pcap::{block, eth, ipv4_pkt, pcap, pcapng, udp}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::summarize; +use support::{block, eth, ipv4_pkt, pcap, pcapng, udp}; fn frame() -> Vec { eth(0x0800, &ipv4_pkt(17, [1; 4], [2; 4], &udp(100, 200, b"body"))) diff --git a/crates/pcap/tests/pcap_http_host_boundary.rs b/crates/pcap/tests/pcap_http_host_boundary.rs index 6937196f6..5baa58fee 100644 --- a/crates/pcap/tests/pcap_http_host_boundary.rs +++ b/crates/pcap/tests/pcap_http_host_boundary.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::{Http, decode}; -use craft_anything_testkit::pcap::{ipv4_pkt, tcp}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::{Http, decode}; +use support::{ipv4_pkt, tcp}; fn request(data: &[u8]) -> Http { decode(101, &ipv4_pkt(6, [1; 4], [2; 4], &tcp(100, 80, 0x18, data))).http.unwrap() diff --git a/crates/pcap/tests/pcap_http_methods.rs b/crates/pcap/tests/pcap_http_methods.rs index d2bc17062..57eb4e548 100644 --- a/crates/pcap/tests/pcap_http_methods.rs +++ b/crates/pcap/tests/pcap_http_methods.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::decode; -use craft_anything_testkit::pcap::{ipv4_pkt, tcp}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::decode; +use support::{ipv4_pkt, tcp}; /// WebDAV and extension methods retain the same HTTP evidence as core methods. #[test] diff --git a/crates/pcap/tests/pcap_ipv4_lengths.rs b/crates/pcap/tests/pcap_ipv4_lengths.rs index 21f1f6eac..e1ea930a0 100644 --- a/crates/pcap/tests/pcap_ipv4_lengths.rs +++ b/crates/pcap/tests/pcap_ipv4_lengths.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::decode; -use craft_anything_testkit::pcap::{ipv4_pkt, udp}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::decode; +use support::{ipv4_pkt, udp}; #[test] fn incomplete_ipv4_base_headers_explain_why_decoding_stopped() { diff --git a/crates/pcap/tests/pcap_ipv6_fragments.rs b/crates/pcap/tests/pcap_ipv6_fragments.rs index 8f82257d1..1c413f4b3 100644 --- a/crates/pcap/tests/pcap_ipv6_fragments.rs +++ b/crates/pcap/tests/pcap_ipv6_fragments.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::decode; -use craft_anything_testkit::pcap::{eth, udp}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::decode; +use support::{eth, udp}; fn packet(offset: u16, next: u8, payload: &[u8]) -> Vec { let mut ip = vec![0u8; 40]; diff --git a/crates/pcap/tests/pcap_ipv6_no_next_header.rs b/crates/pcap/tests/pcap_ipv6_no_next_header.rs index fd698e393..b00848768 100644 --- a/crates/pcap/tests/pcap_ipv6_no_next_header.rs +++ b/crates/pcap/tests/pcap_ipv6_no_next_header.rs @@ -1,4 +1,4 @@ -use craft_anything_formats::pcap::decode; +use craft_pcap::decode; /// Build a raw IPv6 packet with the given payload and Next Header field. fn packet(next: u8, payload: &[u8]) -> Vec { diff --git a/crates/pcap/tests/pcap_ipv6_version.rs b/crates/pcap/tests/pcap_ipv6_version.rs index 4e4b25dc3..f69766321 100644 --- a/crates/pcap/tests/pcap_ipv6_version.rs +++ b/crates/pcap/tests/pcap_ipv6_version.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::decode; -use craft_anything_testkit::pcap::{eth, ipv4_pkt}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::decode; +use support::{eth, ipv4_pkt}; fn raw_packets() -> (Vec, Vec) { let ipv4 = ipv4_pkt(17, [1; 4], [2; 4], &[0; 20]); diff --git a/crates/pcap/tests/pcap_tcp_ecn.rs b/crates/pcap/tests/pcap_tcp_ecn.rs index e8668af1d..278fba8fe 100644 --- a/crates/pcap/tests/pcap_tcp_ecn.rs +++ b/crates/pcap/tests/pcap_tcp_ecn.rs @@ -1,4 +1,4 @@ -use craft_anything_formats::pcap::decode; +use craft_pcap::decode; /// Decode a raw IPv4 packet with a TCP header and the specified control bits. fn flags_on_wire(bits: u8) -> String { diff --git a/crates/pcap/tests/pcapng_simple_payload.rs b/crates/pcap/tests/pcapng_simple_payload.rs index c61f6c70a..ee4743020 100644 --- a/crates/pcap/tests/pcapng_simple_payload.rs +++ b/crates/pcap/tests/pcapng_simple_payload.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::Capture; -use craft_anything_testkit::pcap::{block, pcapng}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::Capture; +use support::{block, pcapng}; fn capture(original: u32, snaplen: u32, payload: &[u8]) -> Vec { let mut out = pcapng(&[]); diff --git a/crates/pcap/tests/regression_pcapng_framing.rs b/crates/pcap/tests/regression_pcapng_framing.rs index 1fa8679fb..1ba8d2878 100644 --- a/crates/pcap/tests/regression_pcapng_framing.rs +++ b/crates/pcap/tests/regression_pcapng_framing.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::summarize; -use craft_anything_testkit::pcap::{block, pcapng, sample_frames}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::summarize; +use support::{block, pcapng, sample_frames}; #[test] fn mismatched_block_footers_stop_the_capture_with_a_warning() { diff --git a/crates/pcap/tests/regression_tcp_dns_framing.rs b/crates/pcap/tests/regression_tcp_dns_framing.rs index 4dad459bb..e85c987aa 100644 --- a/crates/pcap/tests/regression_tcp_dns_framing.rs +++ b/crates/pcap/tests/regression_tcp_dns_framing.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::{Decoded, decode}; -use craft_anything_testkit::pcap::{dns_query, dns_response, ipv4_pkt, tcp}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::{Decoded, decode}; +use support::{dns_query, dns_response, ipv4_pkt, tcp}; fn decoded(payload: &[u8]) -> Decoded { decode(101, &ipv4_pkt(6, [192, 0, 2, 1], [192, 0, 2, 2], &tcp(53, 51000, 0x18, payload))) diff --git a/crates/pcap/tests/regression_tcp_header_length.rs b/crates/pcap/tests/regression_tcp_header_length.rs index 189318116..d931f97b2 100644 --- a/crates/pcap/tests/regression_tcp_header_length.rs +++ b/crates/pcap/tests/regression_tcp_header_length.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::{Decoded, decode}; -use craft_anything_testkit::pcap::{ipv4_pkt, tcp}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::{Decoded, decode}; +use support::{ipv4_pkt, tcp}; fn decoded(segment: &[u8]) -> Decoded { decode(101, &ipv4_pkt(6, [192, 0, 2, 1], [192, 0, 2, 2], segment)) diff --git a/crates/pcap/tests/regression_tls_bounds.rs b/crates/pcap/tests/regression_tls_bounds.rs index b616df155..92a710fc4 100644 --- a/crates/pcap/tests/regression_tls_bounds.rs +++ b/crates/pcap/tests/regression_tls_bounds.rs @@ -1,5 +1,8 @@ -use craft_anything_formats::pcap::{Decoded, decode}; -use craft_anything_testkit::pcap::{client_hello, ipv4_pkt, tcp}; +#[path = "support/mod.rs"] +mod support; + +use craft_pcap::{Decoded, decode}; +use support::{client_hello, ipv4_pkt, tcp}; fn decoded(record: &[u8]) -> Decoded { decode(101, &ipv4_pkt(6, [192, 0, 2, 1], [192, 0, 2, 2], &tcp(51000, 443, 0x18, record))) @@ -101,7 +104,7 @@ fn complete_hello_metadata_is_unchanged() { assert!(!hello.partial); } -fn hello_with_vectors(session: &[u8], suites: &[u8], compression: &[u8], extensions: &[(u16, &[u8])]) -> craft_anything_formats::pcap::TlsHello { +fn hello_with_vectors(session: &[u8], suites: &[u8], compression: &[u8], extensions: &[(u16, &[u8])]) -> craft_pcap::TlsHello { let mut record = client_hello("unused.test"); record.truncate(43); record.push(session.len() as u8); diff --git a/crates/pcap/tests/support/mod.rs b/crates/pcap/tests/support/mod.rs index 366433bc3..f897b5142 100644 --- a/crates/pcap/tests/support/mod.rs +++ b/crates/pcap/tests/support/mod.rs @@ -1,3 +1,4 @@ +#![allow(dead_code)] //! Packet-capture fixtures: hand-built Ethernet/IPv4 frames (DNS, TCP handshake, TLS //! ClientHello, HTTP request, ARP) written as classic pcap or pcapng. @@ -104,7 +105,12 @@ pub fn sample_frames() -> Vec> { eth(0x0800, &ipv4_pkt(6, c, web, &tcp(50001, 443, 0x18, &client_hello("example.com")))), eth( 0x0800, - &ipv4_pkt(6, c, web, &tcp(50002, 80, 0x18, b"GET http://user:pw@example.com/a?b=1 HTTP/1.1\r\nHost: example.com\r\nUser-Agent: t\r\n\r\n")), + &ipv4_pkt( + 6, + c, + web, + &tcp(50002, 80, 0x18, b"GET http://user:pw@example.com/a?b=1 HTTP/1.1\r\nHost: example.com\r\nUser-Agent: t\r\n\r\n"), + ), ), eth(0x0806, &[0u8; 28]), ] From 60f7c5d74f6e5dfda2fa5779cff0b57d8fd45263 Mon Sep 17 00:00:00 2001 From: techneissa <55485515+techneissa@users.noreply.github.com> Date: Tue, 17 Nov 2026 16:53:35 +0300 Subject: [PATCH 062/183] raw: read a DNG strip whose byte count is only ActiveArea wide in full (#2040) An uncompressed single-sample integer DNG strip whose StripByteCounts is exactly ActiveArea columns (from column 0) by ImageLength rows, while the file holds the whole ImageWidth by ImageLength raster from the strip's offset, is read at its declared size instead of refused. Every other shortfall stays Corrupt. --- crates/raw/src/dng.rs | 37 +++++++++++++- crates/raw/src/dng/compat_review_tests.rs | 59 +++++++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) diff --git a/crates/raw/src/dng.rs b/crates/raw/src/dng.rs index efa1ec4f5..a7be5d67b 100644 --- a/crates/raw/src/dng.rs +++ b/crates/raw/src/dng.rs @@ -8,6 +8,7 @@ use crate::{ BlackLevel, Camera, Cfa, CinemaTags, ColorData, LevelSource, LevelSources, Limits, Matrix3, Mode, Orientation, RawData, RawError, RawFormat, RawImage, RawNotices, Rect, Result, Timecode, opcodes, }; +use craft_tiff::image::{ImageInfo, Layout}; use craft_tiff::tags::{self as t, photometric}; use craft_tiff::{ByteOrder, Ifd, Tiff, Value}; @@ -273,7 +274,10 @@ fn decode_ifd(bytes: &[u8], tiff: &Tiff, pixels: &Ifd, main: &Ifd, mode: Mode, f { return Err(RawError::Unsupported(format!("DNG compression {c} (GoPro VC-5) is not decoded yet"))); } - let info = pixels.image()?; + let mut info = pixels.image()?; + if std::ptr::eq(pixels, raw) { + extend_understated_strip(bytes, &mut info, raw); + } let (w, h, cpp) = (info.width as usize, info.height as usize, info.samples_per_pixel as usize); // one sample (CFA or monochrome), RGB or four colours; two are neither and can't be developed (storytold/lightcraft#1511) if !matches!(cpp, 1 | 3 | 4) { @@ -522,6 +526,37 @@ fn cinema_tags(ifd0: &Ifd, raw: &Ifd) -> CinemaTags { } } +/// Trust the file over `StripByteCounts` for an uncompressed single-strip image whose byte count is exactly +/// `ActiveArea` columns by `ImageLength` rows while the file holds the whole `ImageWidth` by `ImageLength` raster from +/// the strip's offset on. DJI Mavic 3 DNGs write the count of the active columns (5280) for a strip of full 5376-wide +/// rows that ends at the end of the file, so reading only the counted bytes refuses a complete image +/// (storytold/craft-libs#2040). The strip is lengthened only then, so every other short strip is still refused, and +/// it never reaches past the end of the file. The active area has to start at column 0, so it is the stored rows' +/// leading columns. +fn extend_understated_strip(bytes: &[u8], info: &mut ImageInfo, raw: &Ifd) { + let bits = u64::from(info.bits()); + if !matches!(info.layout, Layout::Strips { .. }) + || info.compression != t::compression::NONE + || info.samples_per_pixel != 1 + || info.planar == 2 + || info.sample_format == 3 + || !matches!(bits, 8 | 16) + { + return; + } + let ([offset], [count]) = (&info.offsets[..], &info.byte_counts[..]) else { return }; + let Some([top, left, bottom, right]) = raw.u64s(t::ACTIVE_AREA).and_then(|a| <[u64; 4]>::try_from(a).ok()) else { return }; + if left != 0 || bottom <= top || right == 0 || right >= u64::from(info.width) { + return; + } + let row_bytes = |width: u64| width.checked_mul(u64::from(info.height))?.checked_mul(bits / 8); + let (Some(counted), Some(needed)) = (row_bytes(right), row_bytes(u64::from(info.width))) else { return }; + let fits = offset.checked_add(needed).is_some_and(|end| end <= bytes.len() as u64); + if *count == counted && fits { + info.byte_counts = vec![needed]; + } +} + /// The default crop is relative to ActiveArea. DNG 1.7.1 defines independent /// defaults: origin (0, 0), size ImageWidth/ImageLength. An unusable optional crop /// preserves the entire active image. Valid partly overlapping rectangles retain the diff --git a/crates/raw/src/dng/compat_review_tests.rs b/crates/raw/src/dng/compat_review_tests.rs index 48300cbf7..309d1e5b7 100644 --- a/crates/raw/src/dng/compat_review_tests.rs +++ b/crates/raw/src/dng/compat_review_tests.rs @@ -118,3 +118,62 @@ fn decoded_notices_record_actual_crop_gain_table_and_cfa_decisions() { let limits = Limits { max_samples: 47, ..Default::default() }; assert!(matches!(decode_as(&linear(&[]), Mode::Full, RawFormat::Dng, &limits), Err(RawError::Limit(_)))); } + +/// A 16-bit CFA DNG of `width` x `height` whose strip holds every row in full but whose `StripByteCounts` says +/// `counted` bytes. +fn understated_strip_dng(width: u32, height: u32, counted: u32, active_area: Option<[u32; 4]>) -> Vec { + let mut raw = IfdBuilder::new(); + for (tag, value) in [ + (t::IMAGE_WIDTH, Value::Long(vec![width])), + (t::IMAGE_LENGTH, Value::Long(vec![height])), + (t::BITS_PER_SAMPLE, Value::Short(vec![16])), + (t::SAMPLES_PER_PIXEL, Value::Short(vec![1])), + (t::PHOTOMETRIC, Value::Short(vec![photometric::CFA])), + (t::COMPRESSION, Value::Short(vec![1])), + (t::CFA_REPEAT_PATTERN_DIM, Value::Short(vec![2, 2])), + (t::CFA_PATTERN_EP, Value::Byte(vec![0, 1, 1, 2])), + ] { + raw.set(tag, value); + } + if let Some(area) = active_area { + raw.set(t::ACTIVE_AREA, Value::Long(area.to_vec())); + } + let samples = (width * height) as u16; + raw.set_image(ImageData::Strips { rows_per_strip: height, strips: vec![(0..samples).flat_map(u16::to_le_bytes).collect()] }); + let mut bytes = TiffWriter::new(ByteOrder::Little, false).write(&[raw]).unwrap(); + // the writer counts the real bytes: understate that one count, a LONG in the IFD + let count = (width * height * 2).to_le_bytes(); + let at = bytes.windows(4).position(|w| w == count).unwrap(); + bytes[at..at + 4].copy_from_slice(&counted.to_le_bytes()); + bytes +} + +/// storytold/craft-libs#2040: the DJI Mavic 3 counts 5280 x 3956 x 2 bytes for a strip that holds 5376-wide rows +/// to the end of the file. +#[test] +fn a_strip_counted_only_active_area_wide_is_read_in_full() { + let bytes = understated_strip_dng(8, 4, 6 * 4 * 2, Some([0, 0, 4, 6])); + for mode in [Mode::Full, Mode::Header] { + let img = decode_as(&bytes, mode, RawFormat::Dng, &Limits::default()).unwrap(); + assert_eq!((img.width, img.height), (8, 4)); + } + let img = decode_as(&bytes, Mode::Full, RawFormat::Dng, &Limits::default()).unwrap(); + let RawData::U16(v) = &img.data else { panic!("integer samples") }; + assert_eq!(v, &(0..32).collect::>()); +} + +/// Any other short strip is still a corrupt file. +#[test] +fn other_short_strips_are_still_refused() { + let refused = |bytes: Vec| matches!(decode_as(&bytes, Mode::Full, RawFormat::Dng, &Limits::default()), Err(RawError::Corrupt(_))); + // no ActiveArea to explain the count + assert!(refused(understated_strip_dng(8, 4, 6 * 4 * 2, None))); + // the count is not exactly the area's bytes + assert!(refused(understated_strip_dng(8, 4, 5 * 4 * 2, Some([0, 0, 4, 6])))); + // the area does not start at column 0 + assert!(refused(understated_strip_dng(8, 4, 6 * 4 * 2, Some([0, 2, 4, 8])))); + // the file does not hold the whole raster + let mut cut = understated_strip_dng(8, 4, 6 * 4 * 2, Some([0, 0, 4, 6])); + cut.truncate(cut.len() - 8); + assert!(refused(cut)); +} From c93a6057fe722107d6b465b3a0daead58ef3a439 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 08:54:38 -0500 Subject: [PATCH 063/183] Retain is_empty on the public checked byte reader --- crates/dex/src/bytes.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/dex/src/bytes.rs b/crates/dex/src/bytes.rs index 555505a2d..3e69ae4fd 100644 --- a/crates/dex/src/bytes.rs +++ b/crates/dex/src/bytes.rs @@ -14,6 +14,10 @@ impl<'a> Reader<'a> { self.data.len() } + pub fn is_empty(&self) -> bool { + self.data.is_empty() + } + pub fn data(&self) -> &'a [u8] { self.data } From 9ab8aac5ca01d34fca12bcb5a84679b155d1e2c7 Mon Sep 17 00:00:00 2001 From: Bra1nZ <95569966+Bra1nZ@users.noreply.github.com> Date: Tue, 17 Nov 2026 17:41:20 +0300 Subject: [PATCH 064/183] craft-docx: a package-wide XML element budget bounds hostile files' tree memory --- crates/docx/src/lib.rs | 4 +- crates/docx/src/package.rs | 135 +++++++++++++++++++- crates/docx/src/read.rs | 12 +- crates/docx/src/read/chunk.rs | 165 ++++++++++++++++++++++++- crates/docx/src/xml.rs | 65 +++++++--- crates/docx/tests/it/element_budget.rs | 44 +++++++ crates/docx/tests/it/main.rs | 1 + 7 files changed, 391 insertions(+), 35 deletions(-) create mode 100644 crates/docx/tests/it/element_budget.rs diff --git a/crates/docx/src/lib.rs b/crates/docx/src/lib.rs index c3c3e8df3..68d41ab4d 100644 --- a/crates/docx/src/lib.rs +++ b/crates/docx/src/lib.rs @@ -3,8 +3,8 @@ //! [`read`] turns a `.docx` package into a [`craft_wordmodel::Document`]; [`write`] does the //! reverse. Both are written from the public specification. The reader is lenient (unknown //! markup is skipped, bad numbers fall back to defaults) and bounded (zip entry sizes, total -//! decompressed size, XML depth and element counts are capped), so hostile input yields an -//! error or a best-effort document, never a panic. +//! decompressed size, XML depth, element counts per part and a package-wide element budget are +//! capped), so hostile input yields an error or a best-effort document, never a panic. #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] // The code came from an app whose lints allow this. #![allow(clippy::type_complexity)] diff --git a/crates/docx/src/package.rs b/crates/docx/src/package.rs index 3c7f45d94..6f90f56ba 100644 --- a/crates/docx/src/package.rs +++ b/crates/docx/src/package.rs @@ -1,5 +1,6 @@ //! OPC package access: bounded zip reading, relationships, part names. +use std::cell::Cell; use std::collections::{BTreeMap, HashMap}; use std::sync::Arc; @@ -216,6 +217,14 @@ fn opc_error(e: craft_opc::Error) -> DocxError { /// document keeps as it is (a picture, an embedded object) is handed over rather than copied. pub struct Package { opc: craft_opc::Package, + /// Elements this package's XML parts may still be parsed into. Every XML part read through + /// [`Package::xml`] charges it, so a file of many parts each inside the per-part cap builds + /// bounded tree memory in total — a chart part with no series builds a maximal tree for + /// almost no graphic work, and the trees the reader keeps accumulate. + budget: Cell, + /// What [`Package::reset_budget`] restores: the cap the package was opened with (the default, + /// or a smaller one from [`Package::open_limited_within`]). + budget_cap: usize, } impl Package { @@ -227,8 +236,16 @@ impl Package { /// `max_total` (counting entries that fail their checksum), is an error. A damaged entry is /// left out with a logged warning. pub fn open_limited(bytes: &[u8], max_part: u64, max_total: u64) -> Result { + Package::open_limited_within(bytes, max_part, max_total, xml::MAX_ELEMENTS_TOTAL) + } + + /// [`open_limited`] with an XML element budget of its own (nested documents share their + /// container's, tests use a small one). + pub fn open_limited_within(bytes: &[u8], max_part: u64, max_total: u64, max_elements: usize) -> Result { let limits = craft_opc::Limits::new(MAX_ENTRIES, max_part, max_total); - craft_opc::Package::open(bytes, &limits).map(|opc| Package { opc }).map_err(opc_error) + craft_opc::Package::open(bytes, &limits) + .map(|opc| Package { opc, budget: Cell::new(max_elements), budget_cap: max_elements }) + .map_err(opc_error) } /// The bytes of all its parts. @@ -244,7 +261,27 @@ impl Package { /// A package from parts already in memory (a Flat OPC file, a converted document), by part /// name without the leading `/`. pub fn from_parts(files: BTreeMap>) -> Package { - Package { opc: craft_opc::Package::from_parts(files) } + Package { opc: craft_opc::Package::from_parts(files), budget: Cell::new(xml::MAX_ELEMENTS_TOTAL), budget_cap: xml::MAX_ELEMENTS_TOTAL } + } + + /// Start a read's element budget over: the budget is per read, not per package's lifetime. + pub(crate) fn reset_budget(&self) { + self.budget.set(self.budget_cap); + } + + /// The XML elements left of the package's budget: nested documents open within it. + pub(crate) fn elements_left(&self) -> usize { + self.budget.get() + } + + /// Charge `count` elements a parsed part built against the budget. + pub(crate) fn charge(&self, count: usize) -> Result<(), DocxError> { + let left = self.budget.get(); + if count > left { + return Err(DocxError::Limit(format!("{count} XML elements, {left} left of the package's {} budget", self.budget_cap))); + } + self.budget.set(left - count); + Ok(()) } /// Part bytes by name (leading `/` ignored; case-insensitive). @@ -261,14 +298,28 @@ impl Package { /// [`Package::xml`] for the main document part: malformed XML is an error, not a truncated read. pub fn xml_strict(&self, name: &str) -> Result, DocxError> { match self.get(name) { - Some(b) => xml::parse_strict(b).map(Some), + Some(b) => { + // The parser stops at the remaining budget or the per-part cap, whichever is less: + // a part over what is left of the package's budget is refused before the whole + // per-part tree is built. + let (el, count) = xml::parse_strict_counted(b, self.budget.get().min(xml::MAX_ELEMENTS))?; + self.charge(count)?; + Ok(Some(el)) + } None => Ok(None), } } + /// A package part as a parsed XML tree, charged against the element budget: the parser + /// stops at what is left of the budget or the per-part cap, whichever is less, and the + /// count it built is charged after. A lenient read: malformed XML is a truncated one. pub fn xml(&self, name: &str) -> Result, DocxError> { match self.get(name) { - Some(b) => xml::parse(b).map(Some), + Some(b) => { + let (el, count) = xml::parse_counted(b, self.budget.get().min(xml::MAX_ELEMENTS))?; + self.charge(count)?; + Ok(Some(el)) + } None => Ok(None), } } @@ -448,6 +499,82 @@ mod tests { let junk = EmbeddedManifest::parse(b"R\tnope\trId1\tk\tt\tI\nP\tonly-two\n\t\t\n\xff\xfe"); assert!(junk.parts.is_empty()); } + + /// A file of many parts each inside the per-part cap is bounded in total: every XML part + /// read through the package charges a package-wide budget, and a part over it is skipped + /// (warned), never built. A chart part with no series builds a maximal tree for almost no + /// graphic work, so the trees a reader keeps would otherwise accumulate one per part. + #[test] + fn the_xml_element_budget_is_package_wide() { + let ns = r#"xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main""#; + let rels = r#""#; + let document = format!(r#""#); + let dense = |root: &str| format!(r#"<{root} {ns}>{}"#, "".repeat(900)); + let z = zip_of(&[ + ("word/document.xml", document.into_bytes()), + ("word/_rels/document.xml.rels", rels.as_bytes().to_vec()), + ("word/styles.xml", dense("w:styles").into_bytes()), + ("word/numbering.xml", dense("w:numbering").into_bytes()), + ]); + let pkg = Package::open_limited_within(&z, MAX_PART, MAX_TOTAL, 1_000).unwrap(); + // styles (900 elements) reads; numbering (900 more) is over what is left and is skipped + // with a warning, not built. + let read = || crate::read::read_opened(&pkg, None); + let (first, warned) = crate::test_log::warnings(read); + assert!(first.is_ok(), "{:?}", first.err()); + let refused: Vec<_> = warned.iter().filter(|w| w.contains("numbering") && w.contains("XML element")).collect(); + assert_eq!(refused.len(), 1, "{warned:?}"); + // The budget is per read: a second read starts it over and behaves the same. + let (second, warned) = crate::test_log::warnings(read); + assert!(second.is_ok(), "{:?}", second.err()); + assert_eq!(warned.iter().filter(|w| w.contains("numbering") && w.contains("XML element")).count(), 1, "{warned:?}"); + } + + /// The main document part itself is strict: over the budget it is an error, not a + /// best-effort read of a tree the file then paid for. + #[test] + fn a_main_part_over_the_element_budget_is_refused() { + let ns = r#"xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main""#; + let document = format!(r#"{}"#, "".repeat(20)); + let z = zip_of(&[("word/document.xml", document.into_bytes())]); + let pkg = Package::open_limited_within(&z, MAX_PART, MAX_TOTAL, 10).unwrap(); + assert!(matches!(crate::read::read_opened(&pkg, None), Err(DocxError::Limit(_)))); + } + + /// A part over what is left of the package's budget is refused while parsing, not after the + /// whole per-part tree is built: the parser stops at the remaining budget or the per-part + /// cap, whichever is less, so the file pays for at most what is left of the budget. + #[test] + fn a_part_over_the_remaining_budget_is_refused_while_parsing() { + let ns = r#"xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main""#; + let document = format!(r#"{}"#, "".repeat(200)); + let z = zip_of(&[("word/document.xml", document.into_bytes())]); + // 200 elements: inside the per-part cap, over the package's 100 budget. The parse + // refuses at the budget, so the error is the parse's, not the charge's, and names + // the effective limit for this parse (the remaining budget), not the whole budget. + let pkg = Package::open_limited_within(&z, MAX_PART, MAX_TOTAL, 100).unwrap(); + let e = crate::read::read_opened(&pkg, None).expect_err("refused"); + assert_eq!(e, DocxError::Limit("over the XML element budget for this parse: at most 100 elements".into())); + } + + /// A part parsed earlier shrinks what is left of the budget: the next part is refused while + /// parsing at the remaining, not at the whole budget, and the error names the effective limit + /// for this parse (the remaining), not the package's budget. + #[test] + fn an_earlier_part_reduces_the_remaining_budget_the_next_part_names_it() { + let ns = r#"xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main""#; + let styles = format!(r#"{}"#, "".repeat(60)); + let settings = format!(r#"{}"#, "".repeat(60)); + let z = zip_of(&[("word/styles.xml", styles.into_bytes()), ("word/settings.xml", settings.into_bytes())]); + // 100 elements of budget. The styles part parses (the main-part path: `xml_strict`) and + // charges its 61 elements, leaving 39. + let pkg = Package::open_limited_within(&z, MAX_PART, MAX_TOTAL, 100).unwrap(); + pkg.xml_strict("word/styles.xml").unwrap(); + // The settings part needs 61 elements, over the 39 left and under the per-part cap: the + // parse refuses at the remaining, so the error names 39, not the package's 100 budget. + let e = pkg.xml("word/settings.xml").expect_err("refused"); + assert_eq!(e, DocxError::Limit("over the XML element budget for this parse: at most 39 elements".into())); + } } #[cfg(test)] diff --git a/crates/docx/src/read.rs b/crates/docx/src/read.rs index 746225e97..18c9ea47a 100644 --- a/crates/docx/src/read.rs +++ b/crates/docx/src/read.rs @@ -154,9 +154,11 @@ pub(crate) fn read_opened(pkg: &Package, chunks: Option) -> Resul read_opened_in(pkg, ChunkState::new(chunks)).map(|(doc, ..)| doc) } -/// [`read_opened`] with what chunks may still bring in; also gives the chunks, chunk bytes and -/// graphic work left of that. -fn read_opened_in(pkg: &Package, chunks: ChunkState) -> Result<(Document, usize, u64, usize), DocxError> { +/// [`read_opened`] with what chunks may still bring in; also gives the chunks, chunk bytes, +/// graphic work and XML elements left of that. +fn read_opened_in(pkg: &Package, chunks: ChunkState) -> Result<(Document, usize, u64, usize, usize), DocxError> { + // The budget is per read, so a package read twice (tests, a Flat OPC conversion) starts over. + pkg.reset_budget(); let root_rels = pkg.rels(""); let main = root_rels.by_type(rt::OFFICE_DOC).filter(|r| !r.external).map(|r| r.target.clone()).unwrap_or_else(|| "word/document.xml".to_string()); let Some(root) = pkg.xml_strict(&main)? else { @@ -371,11 +373,11 @@ fn read_opened_in(pkg: &Package, chunks: ChunkState) -> Result<(Document, usize, if r.shape_ids { keep_glued_ids(&mut r.doc, &r.glued); } - let (left, bytes, graphic) = (r.chunks.left, r.chunks.bytes, r.chunks.graphic); + let (left, bytes, graphic, elements) = (r.chunks.left, r.chunks.bytes, r.chunks.graphic, pkg.elements_left()); let mut doc = r.doc; doc.skipped_parts.extend(pkg.skipped().iter().cloned()); doc.ensure_nonempty(); - Ok((doc, left, bytes, graphic)) + Ok((doc, left, bytes, graphic, elements)) } /// Most move ranges open at once, and most move names tracked, per file. diff --git a/crates/docx/src/read/chunk.rs b/crates/docx/src/read/chunk.rs index 2dc1674a7..9bdde064d 100644 --- a/crates/docx/src/read/chunk.rs +++ b/crates/docx/src/read/chunk.rs @@ -110,11 +110,17 @@ impl Reader<'_> { log::warn!("docx: alternative format chunks nest deeper than {MAX_CHUNK_NESTING}; the inner ones are left out"); return None; } - let pkg = - Package::open_limited(bytes, MAX_PART, self.chunks.bytes).map_err(|e| log::warn!("docx: unreadable nested document chunk: {e}")).ok()?; + // The nested document shares the file's element budget: open_limited_within, not a + // fresh cap — nesting goes deep, so 5 packages each getting 16M is the OOM class the + // budget exists for. The container's own parse spent part of the chain, so the cap is + // the lesser of the chain and what the container has left. + let cap = self.chunks.elements.min(self.pkg.elements_left()); + let pkg = Package::open_limited_within(bytes, MAX_PART, self.chunks.bytes, cap) + .map_err(|e| log::warn!("docx: unreadable nested document chunk: {e}")) + .ok()?; self.chunks.bytes = self.chunks.bytes.saturating_sub(pkg.size()); let state = ChunkState { nesting: self.chunks.nesting + 1, depth: depth + 1, ..self.chunks }; - let (doc, left, bytes, graphic) = match super::read_opened_in(&pkg, state) { + let (doc, left, bytes, graphic, elements) = match super::read_opened_in(&pkg, state) { Ok(read) => read, Err(e) => { log::warn!("docx: unreadable nested document chunk: {e}"); @@ -125,6 +131,16 @@ impl Reader<'_> { self.chunks.left = left; self.chunks.bytes = bytes; self.chunks.graphic = graphic; + self.chunks.elements = elements; + // The nested document's XML usage comes out of the container's budget too: a later + // sibling chunk and the container's own remaining parts parse against what is left + // of it. The charge can't refuse: the cap is the lesser of the file's remaining + // elements and what the container has left, and the container's budget doesn't move + // while the nested read goes. + let spent = cap.saturating_sub(elements); + if let Err(e) = self.pkg.charge(spent) { + log::warn!("docx: nested document chunk outspent the container's element budget: {e}"); + } Some(doc) } } @@ -139,6 +155,9 @@ pub(crate) struct ChunkState<'a> { /// Graphic work left in the file's budget ([`super::MAX_GRAPHIC_WORK`]): nested documents' /// charts and diagrams count against it too. pub graphic: usize, + /// XML elements left in the file's budget: nested packages share their container's + /// ([`crate::xml::MAX_ELEMENTS_TOTAL`]), not one of their own. + pub elements: usize, /// How deep in nested WordprocessingML chunks this reader is. pub nesting: u8, /// The XML depth its stories start at (a nested document's: that of the chunk naming it). @@ -148,7 +167,15 @@ pub(crate) struct ChunkState<'a> { impl<'a> ChunkState<'a> { pub fn new(import: Option>) -> Self { - ChunkState { left: MAX_CHUNKS, bytes: MAX_TOTAL, graphic: super::MAX_GRAPHIC_WORK, nesting: 0, depth: 0, import } + ChunkState { + left: MAX_CHUNKS, + bytes: MAX_TOTAL, + graphic: super::MAX_GRAPHIC_WORK, + elements: crate::xml::MAX_ELEMENTS_TOTAL, + nesting: 0, + depth: 0, + import, + } } } @@ -198,8 +225,8 @@ mod tests { let outer = package(r#""#, ("rIdC", "aFChunk", "afchunk.docx"), ("word/afchunk.docx", &inner)); let pkg = Package::open(&outer).unwrap(); let read = |graphic| { - let (d, .., left) = super::super::read_opened_in(&pkg, ChunkState { graphic, ..ChunkState::new(None) }).unwrap(); - (drawn(&d), left) + let (d, .., work, _) = super::super::read_opened_in(&pkg, ChunkState { graphic, ..ChunkState::new(None) }).unwrap(); + (drawn(&d), work) }; let (shown, left) = read(super::super::MAX_GRAPHIC_WORK); assert!(shown); @@ -207,4 +234,130 @@ mod tests { // With the file's budget spent, the nested document doesn't get one of its own. assert_eq!(read(0), (false, 0)); } + + /// A package whose body is `body`, with the document relationships `rels` (id, type, target) + /// and the parts `(name, bytes)` they name. + fn package_parts(body: &str, rels: &[(&str, &str, &str)], parts: &[(&str, &[u8])]) -> Vec { + let ns = r#"xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main""#; + let rels_xml = + |inner: &str| format!(r#"{inner}"#); + let rel = |(id, ty, target): &(&str, &str, &str)| { + format!(r#""#) + }; + let names: String = rels.iter().map(rel).collect::>().join(""); + let mut files: Vec<(&str, Vec)> = vec![ + ("_rels/.rels", rels_xml(&rel(&("rId1", "officeDocument", "word/document.xml"))).into_bytes()), + ("word/document.xml", format!(r#"{body}"#).into_bytes()), + ("word/_rels/document.xml.rels", rels_xml(&names).into_bytes()), + ]; + files.extend(parts.iter().map(|(name, bytes)| (*name, bytes.to_vec()))); + let mut zw = zip::ZipWriter::new(std::io::Cursor::new(Vec::new())); + for (name, bytes) in files { + zw.start_file(name, zip::write::SimpleFileOptions::default()).unwrap(); + zw.write_all(&bytes).unwrap(); + } + zw.finish().unwrap().into_inner() + } + + /// Whether the body holds a paragraph with `s`. + fn has(d: &Document, s: &str) -> bool { + d.body.iter().any(|b| b.as_para().map(|p| p.text.contains(s)).unwrap_or(false)) + } + + #[test] + fn a_nested_documents_elements_come_out_of_the_files_budget() { + // Three levels: the outer's altChunk names the inner, whose altChunk names the + // innermost. The chain spends down: the inner's own parse charges the file's budget, + // so the innermost opens with what the inner has left, not a fresh cap. + let innermost = package(r#"innermost"#, ("rIdZ", "chart", "charts/z.xml"), ("word/charts/z.xml", b"")); + let inner = package( + r#"inner"#, + ("rIdD", "aFChunk", "afchunk.docx"), + ("word/afchunk.docx", &innermost), + ); + let outer = package(r#""#, ("rIdC", "aFChunk", "afchunk.docx"), ("word/afchunk.docx", &inner)); + let pkg = Package::open(&outer).unwrap(); + let read = |elements| { + let (d, ..) = super::super::read_opened_in(&pkg, ChunkState { elements, ..ChunkState::new(None) }).unwrap(); + (has(&d, "inner"), has(&d, "innermost")) + }; + // With room, both levels flow in. + assert_eq!(read(crate::xml::MAX_ELEMENTS_TOTAL), (true, true)); + // The inner's own parse (its rels, then its main part) charged the file's budget: the + // innermost is left out instead of getting one of its own (before this, each nested + // package started with the full 16M). + assert_eq!(read(10), (true, false)); + } + + #[test] + fn a_nested_documents_elements_charge_the_container() { + // The nested document's XML usage comes out of the container's budget too: the cap + // the nested package was given, minus its returned remainder, is charged, so the + // container's remaining parts parse against what is left of the shared cap — not a + // budget that ignores the chunk. + let nested = package(r#"inner"#, ("rIdZ", "chart", "charts/z.xml"), ("word/charts/z.xml", b"")); + let body = r#"after"#; + let with = package(&format!(r#"{body}"#), ("rIdC", "aFChunk", "afchunk.docx"), ("word/afchunk.docx", &nested)); + let without = package(body, ("rIdZ", "chart", "charts/z.xml"), ("word/charts/z.xml", b"")); + let read = |outer: &[u8]| { + let pkg = Package::open(outer).unwrap(); + let (d, ..) = super::super::read_opened_in(&pkg, ChunkState { elements: 10, ..ChunkState::new(None) }).unwrap(); + (has(&d, "inner"), pkg.elements_left()) + }; + let (inner_in, charged) = read(&with); + assert!(inner_in); + let (_, base) = read(&without); + assert!(charged < base, "the nested document's usage is the container's: {charged} of {base}"); + } + + #[test] + fn a_grandchilds_reservation_charges_every_level() { + // Three levels: the innermost's reservation comes out of the inner's budget, and the + // inner's out of the outer's — the chain charges every container, so the outer's + // remainder is smaller with the deeper chain than with a shallow one. + let innermost = package(r#"leaf"#, ("rIdZ", "chart", "charts/z.xml"), ("word/charts/z.xml", b"")); + let inner = package( + r#"mid"#, + ("rIdD", "aFChunk", "afchunk.docx"), + ("word/afchunk.docx", &innermost), + ); + let outer = package(r#""#, ("rIdC", "aFChunk", "afchunk.docx"), ("word/afchunk.docx", &inner)); + let pkg = Package::open(&outer).unwrap(); + let (d, .., elements) = super::super::read_opened_in(&pkg, ChunkState::new(None)).unwrap(); + assert!(has(&d, "mid"), "the inner document didn't flow in"); + assert!(has(&d, "leaf"), "the innermost document didn't flow in"); + // The same container with a shallow chain: one reservation instead of two. + let shallow = package(r#""#, ("rIdC", "aFChunk", "afchunk.docx"), ("word/afchunk.docx", &innermost)); + let pkg = Package::open(&shallow).unwrap(); + let (.., shallow_elements) = super::super::read_opened_in(&pkg, ChunkState::new(None)).unwrap(); + assert!(elements < shallow_elements, "every level's reservation is charged: {elements} of {shallow_elements}"); + } + + #[test] + fn a_charged_budget_bounds_the_containers_part_and_the_sibling_after_it() { + // The container's budget pays for the parts it parses (the section's header, read + // during the chunk's own walk) and for the chunks after the first one: with a budget + // that fits the grandchild chunk and the header but not the sibling document's XML, + // the sibling is left out; skip the header's charge and it would flow in. + let hdr = r#"headheadhead"#; + let gc = package(r#"gc"#, ("rIdZ", "chart", "charts/z.xml"), ("word/charts/z.xml", b"")); + let sibling = + package(&r#"sibling"#.repeat(8), ("rIdZ", "chart", "charts/z.xml"), ("word/charts/z.xml", b"")); + let inner = package_parts( + r#"mid"#, + &[("rIdD", "aFChunk", "afchunk.docx"), ("rIdH", "header", "header1.xml"), ("rIdS", "aFChunk", "afchunk2.docx")], + &[("word/afchunk.docx", &gc), ("word/header1.xml", hdr.as_bytes()), ("word/afchunk2.docx", &sibling)], + ); + let outer = package(r#""#, ("rIdC", "aFChunk", "afchunk.docx"), ("word/afchunk.docx", &inner)); + let pkg = Package::open(&outer).unwrap(); + let read = |elements| { + let (d, ..) = super::super::read_opened_in(&pkg, ChunkState { elements, ..ChunkState::new(None) }).unwrap(); + (has(&d, "mid"), has(&d, "gc"), has(&d, "sibling")) + }; + // With room, everything flows in. + assert_eq!(read(crate::xml::MAX_ELEMENTS_TOTAL), (true, true, true)); + // The grandchild chunk and the header fit the file's budget; the sibling document's + // XML (8 paragraphs) doesn't, so it's left out instead of getting a fresh cap. + assert_eq!(read(40), (true, true, false)); + } } diff --git a/crates/docx/src/xml.rs b/crates/docx/src/xml.rs index fa50d217a..46da6911d 100644 --- a/crates/docx/src/xml.rs +++ b/crates/docx/src/xml.rs @@ -10,6 +10,10 @@ use crate::DocxError; pub const MAX_DEPTH: usize = 256; /// Maximum number of elements in one part. pub const MAX_ELEMENTS: usize = 8_000_000; +/// Maximum number of elements summed over every part a read parses: a file of many parts each +/// inside [`MAX_ELEMENTS`] would otherwise cost a tree per part, and the trees a reader keeps +/// (the main part's, charts' and diagrams') accumulate. +pub const MAX_ELEMENTS_TOTAL: usize = MAX_ELEMENTS * 2; /// Maximum number of attributes on one element (#3702). pub const MAX_ATTRS: usize = 1024; @@ -329,19 +333,31 @@ pub fn parse(bytes: &[u8]) -> Result { parse_ns(bytes, &[]) } +/// [`parse`], with the number of elements it built, stopping early at `max` elements: the caller +/// charges the count against a package-wide budget (see [`MAX_ELEMENTS_TOTAL`]), and a part over +/// what is left of it is refused before the whole per-part tree is built. +pub fn parse_counted(bytes: &[u8], max: usize) -> Result<(El, usize), DocxError> { + parse_with(bytes, &[], false, max) +} + +/// [`parse_counted`], strict, for a part whose loss would be silent data loss (the main +/// document): a mismatched end tag or an element left open at the end of the data is an error, +/// not a cue to stop reading. +pub fn parse_strict_counted(bytes: &[u8], max: usize) -> Result<(El, usize), DocxError> { + parse_with(bytes, &[], true, max) +} + /// [`parse`] with `extra` namespaces (prefix, URI) mapped to canonical prefixes first, so a /// related vocabulary (WordprocessingML 2003) reads with the prefixes the reader knows. pub fn parse_ns(bytes: &[u8], extra: &[(&'static str, &str)]) -> Result { - parse_with(bytes, extra, false) + parse_with(bytes, extra, false, MAX_ELEMENTS).map(|(e, _)| e) } -/// [`parse`] for a part whose loss would be silent data loss (the main document): a mismatched end -/// tag or an element left open at the end of the data is an error, not a cue to stop reading. -pub fn parse_strict(bytes: &[u8]) -> Result { - parse_with(bytes, &[], true) -} - -fn parse_with(bytes: &[u8], extra: &[(&'static str, &str)], strict: bool) -> Result { +/// The XML parser everything else goes through: transcodes UTF-16, walks the events and builds +/// the tree depth-first, stopping at `max` elements and counting the ones it built. A mismatched +/// end tag or an element left open at the end of the data is an error when `strict`, a cue to +/// stop reading when not. +fn parse_with(bytes: &[u8], extra: &[(&'static str, &str)], strict: bool, max: usize) -> Result<(El, usize), DocxError> { let namespaces: Vec<(&str, &str)> = extra.iter().copied().chain(NAMESPACES.iter().copied()).chain(OTHER_NAMESPACES.iter().copied()).chain(STRICT.iter().copied()).collect(); // The prefix of an element: its namespace's, with two exceptions for Strict documents @@ -375,7 +391,9 @@ fn parse_with(bytes: &[u8], extra: &[(&'static str, &str)], strict: bool) -> Res max_depth: MAX_DEPTH + 1, // Text stretches count as nodes too: two for each element. max_nodes: 2 * MAX_ELEMENTS, - max_elements: MAX_ELEMENTS, + // The parse stops here before the whole tree is built: a part over what is left of the + // package's element budget pays for at most that, not for the per-part cap. + max_elements: max, max_attrs: MAX_ATTRS, max_attrs_total: 2 * MAX_ELEMENTS, }; @@ -383,17 +401,27 @@ fn parse_with(bytes: &[u8], extra: &[(&'static str, &str)], strict: bool) -> Res if strict { options = options.strict(); } - let root = options.parse(bytes).map_err(|e| if e.is_limit() { DocxError::Limit(e.to_string()) } else { DocxError::Xml(e.to_string()) })?; - Ok(from_tree(root)) + let root = options.parse(bytes).map_err(|e| match &e { + craft_xml::Error::TooManyElements(_) => DocxError::Limit(format!("over the XML element budget for this parse: at most {max} elements")), + e if e.is_limit() => DocxError::Limit(e.to_string()), + e => DocxError::Xml(e.to_string()), + })?; + Ok(from_tree_counted(root)) } -/// The `craft-xml` tree as this module's (whose shape the reader was written against). +/// The `craft-xml` tree as this module's (whose shape the reader was written against), with the +/// number of elements the subtree holds (the caller charges it against a package-wide budget). // shortcut: one copy of each parsed part; read craft_xml::El directly when the reader is ported to it. -fn from_tree(e: craft_xml::El) -> El { +fn from_tree_counted(e: craft_xml::El) -> (El, usize) { let mut kids = Vec::with_capacity(e.children.len()); + let mut count = 1usize; for n in e.children { match n { - craft_xml::Node::El(c) => kids.push(Node::El(from_tree(c))), + craft_xml::Node::El(c) => { + let (kid, built) = from_tree_counted(c); + count += built; + kids.push(Node::El(kid)); + } craft_xml::Node::Text(t) | craft_xml::Node::CData(t) => match kids.last_mut() { Some(Node::Text(prev)) => prev.push_str(&t), _ => kids.push(Node::Text(t)), @@ -401,7 +429,7 @@ fn from_tree(e: craft_xml::El) -> El { craft_xml::Node::Pi { .. } | craft_xml::Node::Comment(_) => {} } } - El { name: e.name, attrs: e.attrs, kids } + (El { name: e.name, attrs: e.attrs, kids }, count) } /// This module's tree as `craft-xml`'s, for the shared readers (`craft-drawingml`, `craft-math`) @@ -515,12 +543,13 @@ mod tests { fn strict_parsing_rejects_a_dropped_entity_and_trailing_markup() { let bad = [&b"before &unknown; after"[..], b"", b""]; for xml in bad { - assert!(parse_strict(xml).is_err(), "{}", String::from_utf8_lossy(xml)); + assert!(parse_strict_counted(xml, MAX_ELEMENTS).is_err(), "{}", String::from_utf8_lossy(xml)); } assert!( - parse_strict( + parse_strict_counted( b"x & y -" +", + MAX_ELEMENTS ) .is_ok() ); diff --git a/crates/docx/tests/it/element_budget.rs b/crates/docx/tests/it/element_budget.rs new file mode 100644 index 000000000..6b220ae7c --- /dev/null +++ b/crates/docx/tests/it/element_budget.rs @@ -0,0 +1,44 @@ +//! The package-wide XML element budget: a file of many parts each inside the per-part +//! cap reads bounded, where every part used to build its own tree and the trees the +//! reader keeps accumulated. + +use crate::fixtures; +use craft_docx::read; + +const W_NS: &str = r#"xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships""#; + +#[test] +fn a_file_of_element_budget_parts_still_reads() { + // Nine chart parts of 2M elements each: 18M over the package's 16M budget. The later + // parts are skipped with a warning instead of built, and the file still reads. Before + // the budget, every part's whole tree was parsed and the chart trees stayed cached for + // the whole read (~230 MB per 2M-element part, measured), so a file like this cost one + // tree per part and scales linearly with the part count. + let parts = 9usize; + let chunk = "".repeat(2_000_000); + let chart_xml = format!(r#"{chunk}"#); + let mut document = format!( + r#""# + ); + for i in 0..parts { + document.push_str(&format!( + r#""# + )); + } + document.push_str(""); + let mut rels = String::from(r#""#); + for i in 0..parts { + rels.push_str(&format!( + r#""# + )); + } + rels.push_str(""); + let mut entries: Vec<(&str, Vec)> = vec![("word/document.xml", document.into_bytes()), ("word/_rels/document.xml.rels", rels.into_bytes())]; + for i in 0..parts { + entries.push((Box::leak(format!("word/charts/chart{i}.xml").into_boxed_str()), chart_xml.clone().into_bytes())); + } + let refs: Vec<(&str, &[u8])> = entries.iter().map(|(n, b)| (*n, b.as_slice())).collect(); + let z = fixtures::zip(&refs); + let doc = read(&z).expect("a file over the element budget still reads, the extra parts skipped"); + assert_eq!(doc.body.len(), parts, "the document's own paragraphs read"); +} diff --git a/crates/docx/tests/it/main.rs b/crates/docx/tests/it/main.rs index 926cb5154..942d946ae 100644 --- a/crates/docx/tests/it/main.rs +++ b/crates/docx/tests/it/main.rs @@ -16,6 +16,7 @@ mod default_size; mod drawing_payload; mod east_asian_lang; mod east_asian_layout; +mod element_budget; mod emphasis_marks; mod fixtures; mod font_table; From 1a0d5d607859a2e529851482de09b8e53aaeec3e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 09:58:00 -0500 Subject: [PATCH 065/183] Extract XFA namespace-aware XML DOM without layout policy --- ATTRIBUTION.md | 4 + Cargo.lock | 7 + Cargo.toml | 1 + crates/xfa/Cargo.toml | 14 ++ crates/xfa/README.md | 9 + crates/xfa/src/lib.rs | 6 + crates/xfa/src/xml.rs | 428 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 469 insertions(+) create mode 100644 crates/xfa/Cargo.toml create mode 100644 crates/xfa/README.md create mode 100644 crates/xfa/src/lib.rs create mode 100644 crates/xfa/src/xml.rs diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 4c86afd61..6caa0fd33 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -132,3 +132,7 @@ Sanitization, animation fitting and numeric output policy remain caller-owned. ## JSONC span-preserving editing `crates/jsonc` is extracted from Craft Anything `crates/formats/src/jsonc.rs` at `e5c9c94106747ed44b9a3fb0decce867c2285f93` (MIT OR Apache-2.0). The original implementation and hardening by BFlat, newline preservation by NetterSilver, and subsequent RRFZ/Afloat correctness fixes retain separate primary-author port commits with immutable source revisions. Shared API wiring and optional input-byte admission are subsequent changes. Compatibility parsing and all existing formatting/editing tests are retained; application file I/O and policy are not imported. + +## XFA XML DOM + +`crates/xfa/src/xml.rs` is extracted from PDFCraft at `271e479c53723b1b294c866d5cb2f27604601b29`, originally by Dylan M. Taylor (`eead4541`, `7d44e654`), MIT OR Apache-2.0. Only visibility and module boundaries change; PDF/layout/form policy remains in the app. diff --git a/Cargo.lock b/Cargo.lock index 9fa1f4401..7bf961c6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3380,6 +3380,13 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-xfa" +version = "0.1.0" +dependencies = [ + "craft-xml", +] + [[package]] name = "craft-xfl" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 50ec3c917..d9094ba20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ rust-version = "1.95" repository = "https://github.com/storytold/craft-libs" [workspace.dependencies] +craft-xfa = { path = "crates/xfa" } craft-jsonc = { path = "crates/jsonc" } craft-palette = { path = "crates/palette" } craft-score = { path = "crates/score" } diff --git a/crates/xfa/Cargo.toml b/crates/xfa/Cargo.toml new file mode 100644 index 000000000..7dca38e84 --- /dev/null +++ b/crates/xfa/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "craft-xfa" +description = "Namespace-aware source-span XML DOM for XFA adapters; no PDF or layout policy" +version.workspace = true +edition.workspace = true +license.workspace = true +rust-version.workspace = true +repository.workspace = true + +[lints] +workspace = true + +[dependencies] +craft-xml = { workspace = true } diff --git a/crates/xfa/README.md b/crates/xfa/README.md new file mode 100644 index 000000000..e4ed85e08 --- /dev/null +++ b/crates/xfa/README.md @@ -0,0 +1,9 @@ +# craft-xfa + +Scoped namespace-aware XML DOM extracted unchanged from PDFCraft xfa/xml.rs at 271e479c. This is not a complete XFA implementation: template interpretation, packets, data binding, scripts, layout, fonts and PDF generation remain app-owned. + +Preserves source byte ranges, coalesced text, namespace shadowing and document-local node identities. Uses craft-xml strict events with DTD rejection by default, depth 1024 and caller node count. Other event-reader defaults remain in force. Namespace snapshots are copied per element as before; this is not a new total-memory bound or a full XML namespaces conformance claim. + +Original source by Dylan M. Taylor (eead4541, 7d44e654), MIT OR Apache-2.0. + +Compatibility delta versus the original app XML pin e2dc681a3: current strict craft-xml rejects duplicate raw or expanded attribute names. This deliberately preserves shared security hardening; valid-document DOM behavior is unchanged, but malformed acceptance and errors are not promised byte-identical. Regression tests cover both duplicate forms. diff --git a/crates/xfa/src/lib.rs b/crates/xfa/src/lib.rs new file mode 100644 index 000000000..61640dbf6 --- /dev/null +++ b/crates/xfa/src/lib.rs @@ -0,0 +1,6 @@ +//! XFA XML infrastructure, extracted from PDFCraft. Layout and application policy stay local. +#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] +#![forbid(unsafe_code)] +/// Compatibility depth limit for XFA XML documents. +pub const MAX_XML_DEPTH: usize = 1024; +pub mod xml; diff --git a/crates/xfa/src/xml.rs b/crates/xfa/src/xml.rs new file mode 100644 index 000000000..0840170e6 --- /dev/null +++ b/crates/xfa/src/xml.rs @@ -0,0 +1,428 @@ +//! Lightweight namespace-aware XML DOM with source byte ranges, backed by `craft_xml`. + +use std::ops::Range; + +const XML_NS: &str = "http://www.w3.org/XML/1998/namespace"; +const XMLNS_NS: &str = "http://www.w3.org/2000/xmlns/"; + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub struct NodeId(pub usize); + +#[derive(Clone, Debug)] +pub struct ParsingOptions { + pub allow_dtd: bool, + pub nodes_limit: u32, +} + +impl Default for ParsingOptions { + fn default() -> Self { + Self { allow_dtd: false, nodes_limit: u32::MAX } + } +} + +#[derive(Clone, Debug)] +struct AttrData { + ns: Option, + name: String, + value: String, +} + +#[derive(Clone, Debug)] +enum NodeKind { + Element { + ns: Option, + name: String, + attrs: Vec, + /// In-scope `(prefix, uri)` bindings at this element (`""` for default namespace). + namespaces: Vec<(String, String)>, + range: Range, + }, + Text(String), +} + +#[derive(Clone, Debug)] +struct NodeData { + kind: NodeKind, + children: Vec, +} + +pub struct Document { + nodes: Vec, + root: usize, +} + +#[derive(Clone, Copy)] +pub struct Node<'a> { + doc: &'a Document, + id: usize, +} + +impl PartialEq for Node<'_> { + fn eq(&self, other: &Self) -> bool { + self.id == other.id && std::ptr::eq(self.doc, other.doc) + } +} + +impl Eq for Node<'_> {} + +#[derive(Clone, Copy)] +pub struct ExpandedName<'a> { + ns: Option<&'a str>, + name: &'a str, +} + +impl<'a> ExpandedName<'a> { + pub fn name(&self) -> &'a str { + self.name + } + + pub fn namespace(&self) -> Option<&'a str> { + self.ns + } +} + +pub trait AttributeKey { + fn matches(&self, ns: Option<&str>, name: &str) -> bool; +} + +impl AttributeKey for &str { + fn matches(&self, ns: Option<&str>, name: &str) -> bool { + ns.is_none() && name == *self + } +} + +impl AttributeKey for (&str, &str) { + fn matches(&self, ns: Option<&str>, name: &str) -> bool { + ns == Some(self.0) && name == self.1 + } +} + +#[derive(Clone, Copy)] +pub struct Attribute<'a> { + attr: &'a AttrData, +} + +impl<'a> Attribute<'a> { + pub fn name(&self) -> &'a str { + &self.attr.name + } + + pub fn namespace(&self) -> Option<&'a str> { + self.attr.ns.as_deref() + } + + pub fn value(&self) -> &'a str { + &self.attr.value + } +} + +#[derive(Clone, Copy)] +pub struct Namespace<'a> { + prefix: &'a str, + uri: &'a str, +} + +impl<'a> Namespace<'a> { + pub fn name(&self) -> Option<&'a str> { + (!self.prefix.is_empty()).then_some(self.prefix) + } + + pub fn uri(&self) -> &'a str { + self.uri + } +} + +fn split_qname(qname: &str) -> (&str, &str) { + match qname.split_once(':') { + Some((p, l)) => (p, l), + None => ("", qname), + } +} + +fn resolve_ns(scope: &[(String, String)], prefix: &str, is_attr: bool) -> Result, String> { + if prefix == "xml" { + return Ok(Some(XML_NS.to_string())); + } + if prefix == "xmlns" { + return Ok(Some(XMLNS_NS.to_string())); + } + if prefix.is_empty() { + if is_attr { + return Ok(None); + } + return Ok(scope.iter().rev().find(|(p, _)| p.is_empty()).and_then(|(_, u)| (!u.is_empty()).then(|| u.clone()))); + } + match scope.iter().rev().find(|(p, _)| p == prefix) { + Some((_, u)) if !u.is_empty() => Ok(Some(u.clone())), + _ => Err(format!("undeclared namespace prefix: {prefix}")), + } +} + +impl Document { + pub fn parse(text: &str) -> Result { + Self::parse_with_options(text, ParsingOptions::default()) + } + + pub fn parse_with_options(text: &str, options: ParsingOptions) -> Result { + let mut opts = craft_xml::Options { + strict: true, + doctype: if options.allow_dtd { craft_xml::Doctype::Ignore } else { craft_xml::Doctype::Reject }, + ..Default::default() + }; + opts.limits.max_nodes = options.nodes_limit as usize; + opts.limits.max_depth = crate::MAX_XML_DEPTH; + + let mut events = opts.events(text.as_bytes()); + let mut nodes: Vec = Vec::new(); + let mut open: Vec<(usize, usize)> = Vec::new(); // (node_id, scope_len_before) + let mut scope: Vec<(String, String)> = Vec::new(); + let mut root: Option = None; + + while let Some(ev) = events.next().map_err(|e| e.to_string())? { + let span = events.span(); + match ev { + craft_xml::Event::Start { name, attrs } => { + if nodes.len() >= options.nodes_limit as usize { + return Err("nodes limit reached".to_string()); + } + let scope_mark = scope.len(); + for (k, v) in &attrs { + if k == "xmlns" { + scope.push((String::new(), v.clone())); + } else if let Some(prefix) = k.strip_prefix("xmlns:") { + scope.push((prefix.to_string(), v.clone())); + } + } + let (el_prefix, el_local) = split_qname(&name); + let el_ns = resolve_ns(&scope, el_prefix, false)?; + let mut el_attrs = Vec::new(); + for (k, v) in attrs { + if k == "xmlns" || k.starts_with("xmlns:") { + continue; + } + let (ap, al) = split_qname(&k); + let ans = resolve_ns(&scope, ap, true)?; + el_attrs.push(AttrData { ns: ans, name: al.to_string(), value: v }); + } + // Deduplicate in-scope namespace bindings, keeping the innermost binding per prefix. + let mut namespaces: Vec<(String, String)> = Vec::new(); + for (p, u) in scope.iter().rev() { + if !namespaces.iter().any(|(ep, _)| ep == p) { + namespaces.push((p.clone(), u.clone())); + } + } + namespaces.retain(|(_, u)| !u.is_empty()); + let id = nodes.len(); + nodes.push(NodeData { + kind: NodeKind::Element { ns: el_ns, name: el_local.to_string(), attrs: el_attrs, namespaces, range: span.start..span.end }, + children: Vec::new(), + }); + if let Some(&(parent, _)) = open.last() { + nodes[parent].children.push(id); + } else if root.is_none() { + root = Some(id); + } + open.push((id, scope_mark)); + } + craft_xml::Event::End { .. } => { + if let Some((id, scope_mark)) = open.pop() { + if let NodeKind::Element { range, .. } = &mut nodes[id].kind { + range.end = span.end; + } + scope.truncate(scope_mark); + } + } + craft_xml::Event::Text(t) | craft_xml::Event::CData(t) => { + if let Some(&(parent, _)) = open.last() { + if let Some(&last_child) = nodes[parent].children.last() + && let NodeKind::Text(existing) = &mut nodes[last_child].kind + { + existing.push_str(&t); + continue; + } + if nodes.len() >= options.nodes_limit as usize { + return Err("nodes limit reached".to_string()); + } + let id = nodes.len(); + nodes.push(NodeData { kind: NodeKind::Text(t), children: Vec::new() }); + nodes[parent].children.push(id); + } + } + craft_xml::Event::Pi { .. } | craft_xml::Event::Comment(_) => {} + } + } + + let Some(root) = root else { + return Err("empty XML document".to_string()); + }; + Ok(Self { nodes, root }) + } + + pub fn root_element(&self) -> Node<'_> { + Node { doc: self, id: self.root } + } + + pub fn get_node(&self, id: NodeId) -> Option> { + (id.0 < self.nodes.len()).then_some(Node { doc: self, id: id.0 }) + } + + pub fn descendants(&self) -> Descendants<'_> { + Descendants { doc: self, stack: vec![self.root] } + } +} + +pub struct Descendants<'a> { + doc: &'a Document, + stack: Vec, +} + +impl<'a> Iterator for Descendants<'a> { + type Item = Node<'a>; + + fn next(&mut self) -> Option { + let id = self.stack.pop()?; + let children = &self.doc.nodes[id].children; + for &c in children.iter().rev() { + self.stack.push(c); + } + Some(Node { doc: self.doc, id }) + } +} + +impl<'a> Node<'a> { + pub fn id(&self) -> NodeId { + NodeId(self.id) + } + + pub fn document(&self) -> &'a Document { + self.doc + } + + pub fn is_element(&self) -> bool { + matches!(self.doc.nodes[self.id].kind, NodeKind::Element { .. }) + } + + pub fn is_text(&self) -> bool { + matches!(self.doc.nodes[self.id].kind, NodeKind::Text(_)) + } + + pub fn tag_name(&self) -> ExpandedName<'a> { + match &self.doc.nodes[self.id].kind { + NodeKind::Element { ns, name, .. } => ExpandedName { ns: ns.as_deref(), name }, + NodeKind::Text(_) => ExpandedName { ns: None, name: "" }, + } + } + + pub fn attribute(&self, key: K) -> Option<&'a str> { + match &self.doc.nodes[self.id].kind { + NodeKind::Element { attrs, .. } => attrs.iter().find(|a| key.matches(a.ns.as_deref(), &a.name)).map(|a| a.value.as_str()), + NodeKind::Text(_) => None, + } + } + + pub fn attributes(&self) -> impl ExactSizeIterator> + use<'a> { + let attrs = match &self.doc.nodes[self.id].kind { + NodeKind::Element { attrs, .. } => attrs.as_slice(), + NodeKind::Text(_) => &[], + }; + attrs.iter().map(|attr| Attribute { attr }) + } + + pub fn namespaces(&self) -> impl ExactSizeIterator> + use<'a> { + let ns = match &self.doc.nodes[self.id].kind { + NodeKind::Element { namespaces, .. } => namespaces.as_slice(), + NodeKind::Text(_) => &[], + }; + ns.iter().map(|(p, u)| Namespace { prefix: p, uri: u }) + } + + pub fn lookup_prefix(&self, uri: &str) -> Option<&'a str> { + if uri == XML_NS { + return Some("xml"); + } + match &self.doc.nodes[self.id].kind { + NodeKind::Element { namespaces, .. } => namespaces.iter().find(|(_, u)| u == uri).map(|(p, _)| p.as_str()), + NodeKind::Text(_) => None, + } + } + + pub fn lookup_namespace_uri(&self, prefix: Option<&str>) -> Option<&'a str> { + if prefix == Some("xml") { + return Some(XML_NS); + } + if prefix == Some("xmlns") { + return Some(XMLNS_NS); + } + let target = prefix.unwrap_or(""); + match &self.doc.nodes[self.id].kind { + NodeKind::Element { namespaces, .. } => namespaces.iter().find(|(p, _)| p == target).map(|(_, u)| u.as_str()), + NodeKind::Text(_) => None, + } + } + + pub fn children(&self) -> impl Iterator> + use<'a> { + let doc = self.doc; + doc.nodes[self.id].children.iter().map(move |&id| Node { doc, id }) + } + + pub fn descendants(&self) -> Descendants<'a> { + Descendants { doc: self.doc, stack: vec![self.id] } + } + + pub fn text(&self) -> Option<&'a str> { + match &self.doc.nodes[self.id].kind { + NodeKind::Text(t) => Some(t.as_str()), + NodeKind::Element { .. } => self.doc.nodes[self.id].children.first().and_then(|&cid| match &self.doc.nodes[cid].kind { + NodeKind::Text(t) => Some(t.as_str()), + _ => None, + }), + } + } + + pub fn range(&self) -> Range { + match &self.doc.nodes[self.id].kind { + NodeKind::Element { range, .. } => range.clone(), + NodeKind::Text(_) => 0..0, + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn namespace_shadowing_attributes_text_and_source_ranges() { + let text = "onethree"; + let doc = Document::parse(text).unwrap(); + let root = doc.root_element(); + assert_eq!(root.tag_name().namespace(), Some("urn:outer")); + assert_eq!(root.attribute("a"), Some("v")); + let child = root.children().next().unwrap(); + assert_eq!(child.tag_name().namespace(), Some("urn:p")); + assert_eq!(child.attribute(("urn:p", "a")), Some("x")); + assert_eq!(child.lookup_namespace_uri(None), Some("urn:inner")); + assert_eq!(child.text(), Some("onetwothree")); + assert_eq!(child.children().count(), 1); + assert!(text[child.range()].starts_with("")); + assert!(doc.get_node(child.id()).unwrap() == child); + assert_eq!(root.children().nth(1).unwrap().tag_name().namespace(), None); + assert_eq!(root.range(), 0..text.len()); + } + + #[test] + fn malformed_dtd_and_resource_limits_are_preserved() { + // Current shared XML rejects duplicate attributes, unlike the older app pin. + assert!(Document::parse("").is_err()); + assert!(Document::parse("").is_err()); + assert!(Document::parse("").is_err()); + assert!(Document::parse("").is_err()); + assert!(Document::parse_with_options("", ParsingOptions { allow_dtd: true, nodes_limit: 8 }).is_ok()); + assert!(Document::parse_with_options("text", ParsingOptions { allow_dtd: false, nodes_limit: 1 }).is_err()); + assert!(Document::parse_with_options("", ParsingOptions { allow_dtd: false, nodes_limit: 0 }).is_err()); + let text = format!("{}{}", "".repeat(1025), "".repeat(1025)); + assert!(Document::parse(&text).is_err()); + assert!(Document::parse("").is_err()); + } +} From c50eb61065846fc6d4feca3438ffa691dc855313 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 10:11:04 -0500 Subject: [PATCH 066/183] Document and test inherited namespace declaration budget --- crates/xfa/README.md | 2 ++ crates/xfa/src/xml.rs | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/crates/xfa/README.md b/crates/xfa/README.md index e4ed85e08..a3548c2d1 100644 --- a/crates/xfa/README.md +++ b/crates/xfa/README.md @@ -7,3 +7,5 @@ Preserves source byte ranges, coalesced text, namespace shadowing and document-l Original source by Dylan M. Taylor (eead4541, 7d44e654), MIT OR Apache-2.0. Compatibility delta versus the original app XML pin e2dc681a3: current strict craft-xml rejects duplicate raw or expanded attribute names. This deliberately preserves shared security hardening; valid-document DOM behavior is unchanged, but malformed acceptance and errors are not promised byte-identical. Regression tests cover both duplicate forms. + +The updated strict reader also bounds aggregate active namespace declarations to 1024 across ancestor elements, not just attributes per tag. The old app path could accept more inherited declarations. The exact boundary and one-over case are tested; this intentional tighter resource admission is retained. diff --git a/crates/xfa/src/xml.rs b/crates/xfa/src/xml.rs index 0840170e6..2f4a49db8 100644 --- a/crates/xfa/src/xml.rs +++ b/crates/xfa/src/xml.rs @@ -411,6 +411,23 @@ mod tests { assert_eq!(root.range(), 0..text.len()); } + #[test] + fn inherited_namespace_declarations_have_an_aggregate_budget() { + use std::fmt::Write; + let mut xml = String::from(""); + assert!(Document::parse(&accepted).is_ok()); + let rejected = format!("{xml} xmlns:extra='extra'/>"); + assert!(Document::parse(&rejected).is_err()); + } + #[test] fn malformed_dtd_and_resource_limits_are_preserved() { // Current shared XML rejects duplicate attributes, unlike the older app pin. From 786c5571f05595276857e7faa36c8be2fe895a7d Mon Sep 17 00:00:00 2001 From: techneissa <55485515+techneissa@users.noreply.github.com> Date: Tue, 17 Nov 2026 18:39:50 +0300 Subject: [PATCH 067/183] raw: refuse an understated DNG strip whose ActiveArea reaches below the image (#2040) decode drops such an ActiveArea for the whole image, so nothing would explain the short byte count. --- crates/raw/src/dng.rs | 2 +- crates/raw/src/dng/compat_review_tests.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/raw/src/dng.rs b/crates/raw/src/dng.rs index a7be5d67b..f62aeef47 100644 --- a/crates/raw/src/dng.rs +++ b/crates/raw/src/dng.rs @@ -546,7 +546,7 @@ fn extend_understated_strip(bytes: &[u8], info: &mut ImageInfo, raw: &Ifd) { } let ([offset], [count]) = (&info.offsets[..], &info.byte_counts[..]) else { return }; let Some([top, left, bottom, right]) = raw.u64s(t::ACTIVE_AREA).and_then(|a| <[u64; 4]>::try_from(a).ok()) else { return }; - if left != 0 || bottom <= top || right == 0 || right >= u64::from(info.width) { + if left != 0 || bottom <= top || bottom > u64::from(info.height) || right == 0 || right >= u64::from(info.width) { return; } let row_bytes = |width: u64| width.checked_mul(u64::from(info.height))?.checked_mul(bits / 8); diff --git a/crates/raw/src/dng/compat_review_tests.rs b/crates/raw/src/dng/compat_review_tests.rs index 309d1e5b7..149ee492d 100644 --- a/crates/raw/src/dng/compat_review_tests.rs +++ b/crates/raw/src/dng/compat_review_tests.rs @@ -170,6 +170,8 @@ fn other_short_strips_are_still_refused() { assert!(refused(understated_strip_dng(8, 4, 6 * 4 * 2, None))); // the count is not exactly the area's bytes assert!(refused(understated_strip_dng(8, 4, 5 * 4 * 2, Some([0, 0, 4, 6])))); + // the area reaches below the image, so decode would discard it + assert!(refused(understated_strip_dng(8, 4, 6 * 4 * 2, Some([4, 0, 5, 6])))); // the area does not start at column 0 assert!(refused(understated_strip_dng(8, 4, 6 * 4 * 2, Some([0, 2, 4, 8])))); // the file does not hold the whole raster From 71e271483380e211f38e7d49c0765c59cff6e785 Mon Sep 17 00:00:00 2001 From: techneissa <55485515+techneissa@users.noreply.github.com> Date: Tue, 17 Nov 2026 18:47:47 +0300 Subject: [PATCH 068/183] raw: lengthen an understated DNG strip only for integer samples (#2040) SampleFormat 4 and other undefined values no longer reach the extension; an absent tag still reads as 1 (unsigned), so a file without it is unchanged. --- crates/raw/src/dng.rs | 2 +- crates/raw/src/dng/compat_review_tests.rs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/raw/src/dng.rs b/crates/raw/src/dng.rs index f62aeef47..9589f5d4d 100644 --- a/crates/raw/src/dng.rs +++ b/crates/raw/src/dng.rs @@ -539,7 +539,7 @@ fn extend_understated_strip(bytes: &[u8], info: &mut ImageInfo, raw: &Ifd) { || info.compression != t::compression::NONE || info.samples_per_pixel != 1 || info.planar == 2 - || info.sample_format == 3 + || !matches!(info.sample_format, 1 | 2) || !matches!(bits, 8 | 16) { return; diff --git a/crates/raw/src/dng/compat_review_tests.rs b/crates/raw/src/dng/compat_review_tests.rs index 149ee492d..7fcc1b4f4 100644 --- a/crates/raw/src/dng/compat_review_tests.rs +++ b/crates/raw/src/dng/compat_review_tests.rs @@ -122,7 +122,15 @@ fn decoded_notices_record_actual_crop_gain_table_and_cfa_decisions() { /// A 16-bit CFA DNG of `width` x `height` whose strip holds every row in full but whose `StripByteCounts` says /// `counted` bytes. fn understated_strip_dng(width: u32, height: u32, counted: u32, active_area: Option<[u32; 4]>) -> Vec { + understated_strip_dng_with(width, height, counted, active_area, &[]) +} + +/// [`understated_strip_dng`] with `extra` tags set on the raw IFD. +fn understated_strip_dng_with(width: u32, height: u32, counted: u32, active_area: Option<[u32; 4]>, extra: &[(u16, Value)]) -> Vec { let mut raw = IfdBuilder::new(); + for (tag, value) in extra { + raw.set(*tag, value.clone()); + } for (tag, value) in [ (t::IMAGE_WIDTH, Value::Long(vec![width])), (t::IMAGE_LENGTH, Value::Long(vec![height])), @@ -170,6 +178,8 @@ fn other_short_strips_are_still_refused() { assert!(refused(understated_strip_dng(8, 4, 6 * 4 * 2, None))); // the count is not exactly the area's bytes assert!(refused(understated_strip_dng(8, 4, 5 * 4 * 2, Some([0, 0, 4, 6])))); + // samples that are neither integer nor absent-format (SampleFormat 4 is undefined) + assert!(refused(understated_strip_dng_with(8, 4, 6 * 4 * 2, Some([0, 0, 4, 6]), &[(t::SAMPLE_FORMAT, Value::Short(vec![4]))]))); // the area reaches below the image, so decode would discard it assert!(refused(understated_strip_dng(8, 4, 6 * 4 * 2, Some([4, 0, 5, 6])))); // the area does not start at column 0 From 09938cd99e9189890ace95006de4c6fc2211e468 Mon Sep 17 00:00:00 2001 From: Mauro Mazzieri Date: Tue, 17 Nov 2026 15:53:20 +0000 Subject: [PATCH 069/183] craft-rtf: page fields show each page's number Ported from storytold/wordcraft#6264 (issue storytold/wordcraft#6222), written before the RTF reader moved here. A PAGE, NUMPAGES, SECTIONPAGES, SECTION or PAGEREF field whose result is plain text in one formatting comes in as a field, with its lock, so the layout works out the number; \chpgn is a PAGE field and keeps a tracked insertion or deletion; a result whose text was hidden stays as read. --- crates/flow/src/to_doc.rs | 23 ++-- crates/rtf/src/doc.rs | 8 +- crates/rtf/src/doc/field.rs | 144 ++++++++++++++++++++ crates/rtf/src/doc/reader.rs | 6 + crates/rtf/src/doc/tests_fields.rs | 208 +++++++++++++++++++++++++++++ crates/rtf/src/doc/text.rs | 36 +++-- crates/rtf/src/doc/word.rs | 8 +- 7 files changed, 409 insertions(+), 24 deletions(-) create mode 100644 crates/rtf/src/doc/field.rs create mode 100644 crates/rtf/src/doc/tests_fields.rs diff --git a/crates/flow/src/to_doc.rs b/crates/flow/src/to_doc.rs index 0375c448c..8d9d4dca3 100644 --- a/crates/flow/src/to_doc.rs +++ b/crates/flow/src/to_doc.rs @@ -284,6 +284,18 @@ impl<'a> Builder<'a> { /// `cp` as a run may keep it: without its link and font once the runs' copies of them are /// over budget. + /// A run's properties with its tracked insertion, deletion and formatting change. + fn tracked_props(&mut self, f: &Fmt) -> CharProps { + let mut cp = self.budget(char_props(f)); + cp.ins = f.ins.as_ref().map(|m| self.revision(RevisionKind::Insert, m)); + cp.del = f.del.as_ref().map(|m| self.revision(RevisionKind::Delete, m)); + if let Some(c) = &f.fmt_change { + let old = self.budget(char_props(&c.old)); + cp.fmt_change = PropChange::boxed(self.revision(RevisionKind::Format, &c.mark), old); + } + cp + } + fn budget(&mut self, mut cp: CharProps) -> CharProps { let n = cp.link.as_ref().map_or(0, String::len).saturating_add(cp.font.as_ref().map_or(0, String::len)); match self.run_strings.checked_add(n).filter(|&t| t <= MAX_RUN_STRINGS) { @@ -553,13 +565,7 @@ impl<'a> Builder<'a> { match i { Inline::Text(t, f) => { let t = clean_text(t); - let mut cp = self.budget(char_props(f)); - cp.ins = f.ins.as_ref().map(|m| self.revision(RevisionKind::Insert, m)); - cp.del = f.del.as_ref().map(|m| self.revision(RevisionKind::Delete, m)); - if let Some(c) = &f.fmt_change { - let old = self.budget(char_props(&c.old)); - cp.fmt_change = PropChange::boxed(self.revision(RevisionKind::Format, &c.mark), old); - } + let mut cp = self.tracked_props(f); if p.kind == Kind::Code { // Code's font comes from its style, before a change as after it. if cp.font.as_deref() == Some(MONO_FONT) { @@ -633,7 +639,8 @@ impl<'a> Builder<'a> { } } Inline::Field { instr, result, fmt, locked } => { - let cp = self.budget(char_props(fmt)); + // A field inserted or deleted with tracked changes keeps them (RTF `\chpgn`). + let cp = self.tracked_props(fmt); let (instr, result) = (clean_text(instr), clean_text(result)); if instr.trim().is_empty() { append(&mut out, &result, &cp, None); diff --git a/crates/rtf/src/doc.rs b/crates/rtf/src/doc.rs index 77254151f..0426a4b7a 100644 --- a/crates/rtf/src/doc.rs +++ b/crates/rtf/src/doc.rs @@ -22,7 +22,10 @@ //! code page's bytes stream through one decoder, so a lead byte and its trail byte decode //! together and a run that looks like a UTF-8 BOM is not mistaken for one; the formatting words //! above, stylesheet-based -//! headings and `\outlinelevel`, lists through `\ls`/`\ilvl`, fields, bookmarks, pictures and +//! headings and `\outlinelevel`, lists through `\ls`/`\ilvl`, fields (in `import`, a page field +//! such as `PAGE` or `NUMPAGES` whose result is plain text in one paragraph stays a field, +//! `\fldlock` locking it, and `\chpgn` is a `PAGE` field; otherwise a field is its result's text), +//! bookmarks, pictures and //! tables, footnotes, endnotes (`\footnote` with `\ftnalt`) and comments (author, initials, date, //! text, the commented range). Group nesting, picture sizes and the number of notes and comments //! are capped. Not kept: custom note marks, comment replies (`\atnparent`), notes inside @@ -38,6 +41,7 @@ use craft_flow::{self as model, Cell, FBlock, FTable, Flow, Fmt, Inline, Kind, L use crate::date; mod export; +mod field; mod parse; mod reader; mod state; @@ -58,3 +62,5 @@ use word::hyperlink; #[cfg(test)] mod tests; +#[cfg(test)] +mod tests_fields; diff --git a/crates/rtf/src/doc/field.rs b/crates/rtf/src/doc/field.rs new file mode 100644 index 000000000..78d5f7d81 --- /dev/null +++ b/crates/rtf/src/doc/field.rs @@ -0,0 +1,144 @@ +//! Page fields kept as fields (#6222). The reader writes a field's result (`\fldrslt`) into the +//! paragraph like any text, which for a page number is the number Word last stored. When the +//! group of a field the layout works out from where it lands closes (`PAGE`, `NUMPAGES`, +//! `SECTIONPAGES`, `SECTION`, `PAGEREF`), a result that is plain text in one formatting, in the +//! paragraph the field started in, is replaced by an [`Inline::Field`] holding the instruction +//! (`\fldinst`) and that result, as for a DOCX field. Any other field, a result over several +//! paragraphs or formats, or one holding pictures or other objects stays what the reader made of +//! it: a field's result is drawn as one piece that does not wrap, so a long `MERGEFIELD` result +//! in a narrow table cell would overflow it. Only `import` keeps fields: `parse`, the flow +//! reader, reads their results as text. + +use super::reader::Reader; +use super::state::Dest; +use super::{Fmt, Inline}; + +/// The open fields read so far; deeper nesting keeps its results as text. +const MAX_OPEN: usize = 32; + +/// A field being read in the body text. +pub(super) struct OpenField { + /// The depth of the `{\field` group. + depth: usize, + /// Its instruction, in [`Reader::fields`]. + index: usize, + /// The paragraph it started in ([`Reader::para_seq`]). + para: u64, + /// The paragraph's inlines when it started, and the length of the last one when that was + /// text: a result in the same formatting runs on in that text. + start: usize, + tail_from: Option, + /// Its result group was met in the text (not inside another field's instruction). + result: bool, + locked: bool, + /// Hidden text of its result was left out: the result is not what showed. + hidden: bool, +} + +impl Reader { + /// `\field`, after its instruction slot is made: note where its result starts. + pub(super) fn open_field(&mut self) { + // Hidden text drops the result: the field stays hidden with it. + if !self.marks_on || self.st.dest != Dest::Body || self.st.hidden || self.open_fields.len() >= MAX_OPEN { + return; + } + let Some(index) = self.st.field else { return }; + let tail_from = match self.para.inlines.last() { + Some(Inline::Text(t, _)) => Some(t.len()), + _ => None, + }; + let (depth, para, start) = (self.depth(), self.para_seq, self.para.inlines.len()); + self.open_fields.push(OpenField { depth, index, para, start, tail_from, result: false, locked: false, hidden: false }); + } + + /// `\fldrslt` and `\fldlock`, read in a field's group. + pub(super) fn field_word(&mut self, w: &str) { + let (depth, field, body) = (self.depth(), self.st.field, self.st.dest == Dest::Body); + let Some(f) = self.open_fields.last_mut() else { return }; + match w { + "fldrslt" if body && field == Some(f.index) && depth == f.depth + 1 => f.result = true, + "fldlock" if depth == f.depth => f.locked = true, + _ => {} + } + } + + /// `\chpgn`, the current page number: a `PAGE` field. + pub(super) fn page_number_symbol(&mut self) { + if self.marks_on && self.st.dest == Dest::Body && !self.st.hidden { + // Tracked like text, so Accept and Reject apply to it. + let fmt = self.text_fmt(); + self.para.inlines.push(Inline::Field { instr: "PAGE".into(), result: String::new(), fmt, locked: false }); + self.para_has = true; + } + } + + /// Hidden text left out of the body: an open field's result is then not what showed, and the + /// field is left as read rather than made a field that would show. + pub(super) fn hidden_text_dropped(&mut self) { + if let Some(f) = self.open_fields.last_mut() + && f.result + { + f.hidden = true; + } + } + + /// A group closes: if it is an open field's, make the field. + pub(super) fn close_field_group(&mut self) { + if self.open_fields.last().is_none_or(|f| f.depth != self.depth()) { + return; + } + let Some(f) = self.open_fields.pop() else { return }; + if !f.result || f.hidden || f.para != self.para_seq { + return; + } + let instr = self.fields.get(f.index).map_or("", |s| s.trim()); + if !page_dependent(instr) { + return; + } + let Some((result, fmt)) = result_text(&self.para.inlines, &f, &self.st.fmt) else { return }; + let field = Inline::Field { instr: instr.to_string(), result, fmt, locked: f.locked }; + let inlines = &mut self.para.inlines; + inlines.truncate(f.start); + if let (Some(n), Some(Inline::Text(t, _))) = (f.tail_from, inlines.last_mut()) { + t.truncate(n); + } + inlines.push(field); + self.para_has = true; + } +} + +/// A field whose result the layout works out from the page it lands on. `STYLEREF` is not one +/// here: the layout looks its style up by name, and a running head whose style the RTF names +/// differently would show an error instead of Word's text. +fn page_dependent(instr: &str) -> bool { + let name = instr.split_whitespace().next().unwrap_or(""); + ["PAGE", "NUMPAGES", "SECTIONPAGES", "SECTION", "PAGEREF"].iter().any(|n| name.eq_ignore_ascii_case(n)) +} + +/// The text the field's result added to the paragraph and its formatting, when that is plain +/// text in one formatting with no tracked change; `None` otherwise. An empty result takes the +/// field group's formatting. +fn result_text(inlines: &[Inline], f: &OpenField, group: &Fmt) -> Option<(String, Fmt)> { + if inlines.len() < f.start { + return None; + } + let mut runs: Vec<(&str, &Fmt)> = Vec::new(); + if let Some(n) = f.tail_from { + let Some(Inline::Text(t, fmt)) = f.start.checked_sub(1).and_then(|i| inlines.get(i)) else { return None }; + let tail = t.get(n..)?; + if !tail.is_empty() { + runs.push((tail, fmt)); + } + } + for i in inlines.get(f.start..)? { + match i { + Inline::Text(t, fmt) => runs.push((t, fmt)), + _ => return None, + } + } + match runs.as_slice() { + [] => Some((String::new(), group.clone())), + [(t, fmt)] if fmt.ins.is_none() && fmt.del.is_none() && fmt.fmt_change.is_none() => Some(((*t).to_string(), (*fmt).clone())), + _ => None, + } +} diff --git a/crates/rtf/src/doc/reader.rs b/crates/rtf/src/doc/reader.rs index c0cc1c1ea..4c8a8b652 100644 --- a/crates/rtf/src/doc/reader.rs +++ b/crates/rtf/src/doc/reader.rs @@ -56,6 +56,10 @@ pub(super) struct Reader { pub(super) ov_list: i32, pub(super) ov_ls: i32, pub(super) fields: Vec, + /// The fields being read in the text, innermost last (`import` only). + pub(super) open_fields: Vec, + /// Counts the paragraphs ended, so a field knows whether its result stayed in one. + pub(super) para_seq: u64, // Picture being read. pub(super) pict_depth: Option, pub(super) pict_hex: Vec, @@ -344,6 +348,7 @@ impl Reader { if self.sub.as_ref().is_some_and(|s| s.depth == self.depth()) { self.end_sub(); } + self.close_field_group(); let closing = self.st.dest; // Destination-level commits. match closing { @@ -428,6 +433,7 @@ impl Reader { /// End the current paragraph (`\par`, `\cell`). pub(super) fn end_para(&mut self, in_cell: bool) { + self.para_seq += 1; let read = std::mem::take(&mut self.para); let props = self.para_props(&self.st); let mut p = Para { inlines: read.inlines, mark_ins: read.mark_ins, mark_del: read.mark_del, ..props }; diff --git a/crates/rtf/src/doc/tests_fields.rs b/crates/rtf/src/doc/tests_fields.rs new file mode 100644 index 000000000..ae1ab691f --- /dev/null +++ b/crates/rtf/src/doc/tests_fields.rs @@ -0,0 +1,208 @@ +//! Page fields read from RTF (#6222): a page-dependent field whose result is plain text in one +//! paragraph comes in as a field, so the layout works out its number; other fields stay their +//! result's text. Written by hand from the RTF specification's `\field`, `\fldinst`, `\fldrslt`, +//! `\fldlock` and `\chpgn`. + +use super::*; +use craft_wordmodel::para::InlineObject; + +/// The fields of each paragraph of a story, with the paragraph's text. +/// A paragraph's text with its fields (code, result, locked). +type ParaFields = (String, Vec<(String, String, bool)>); + +fn fields_of(blocks: &craft_wordmodel::Blocks) -> Vec { + blocks + .iter() + .filter_map(|b| if let craft_wordmodel::Block::Para(p) = &**b { Some(p) } else { None }) + .map(|p| { + let fields = p + .objects + .iter() + .filter_map(|o| match o { + InlineObject::Field { instr, result, locked, .. } => Some((instr.clone(), result.clone(), *locked)), + _ => None, + }) + .collect(); + (p.text.clone(), fields) + }) + .collect() +} + +fn footer(d: &craft_wordmodel::Document) -> Vec { + let id = d.last_section.footers.default.expect("a footer"); + fields_of(&d.parts[&id].blocks) +} + +#[test] +fn a_page_field_in_the_footer_is_a_field_not_its_stored_number() { + // As Word writes it: the text before the field has the same formatting as its result. + let rtf = br"{\rtf1\ansi\sectd +{\footerr \pard {\fs16 Pag. }{\field{\*\fldinst {\fs16 PAGE }}{\fldrslt {\fs16 2}}}\sectd \ltrsect{\par}} +\pard One\page Two\par}"; + let d = import(rtf).unwrap(); + let f = footer(&d); + assert_eq!(f.len(), 1, "{f:?}"); + assert_eq!(f[0].1, [("PAGE".to_string(), "2".to_string(), false)], "{f:?}"); + // "Pag. " stays text before the field: the result's run did not take it along. + assert!(f[0].0.starts_with("Pag. "), "{f:?}"); + assert_eq!(f[0].0.matches("Pag. ").count(), 1, "{f:?}"); +} + +#[test] +fn page_fields_in_the_body_keep_their_code_result_and_lock() { + let rtf = br#"{\rtf1\ansi +\pard Page {\field{\*\fldinst PAGE \\* roman}{\fldrslt ii}} of {\field\fldlock{\*\fldinst NUMPAGES}{\fldrslt 4}}\par +\pard {\field{\*\fldinst SECTIONPAGES}{\fldrslt }}x\par}"#; + let d = import(rtf).unwrap(); + let f = fields_of(&d.body); + assert_eq!(f[0].1, [("PAGE \\* roman".to_string(), "ii".to_string(), false), ("NUMPAGES".to_string(), "4".to_string(), true)], "{f:?}"); + assert!(f[0].0.starts_with("Page ") && f[0].0.contains(" of "), "{f:?}"); + // An empty result is still a field: the layout fills it in. + assert_eq!(f[1].1, [("SECTIONPAGES".to_string(), String::new(), false)], "{f:?}"); +} + +#[test] +fn other_fields_stay_the_text_of_their_result() { + // A field's result is drawn as one piece that does not wrap: a long merge field in a narrow + // cell keeps its text, which wraps, as before. + let rtf = br#"{\rtf1\ansi +\pard Before {\field{\*\fldinst DATE \\@ "dd/MM/yyyy"}{\fldrslt 11/11/2026}} after\par +\trowd\cellx600\pard\intbl {\field{\*\fldinst MERGEFIELD Approvato}{\fldrslt Presidente della Rete (Rossi Mario)}}\cell\row +\pard {\field{\*\fldinst AUTHOR}{\fldrslt }}x\par}"#; + let d = import(rtf).unwrap(); + let f = fields_of(&d.body); + assert_eq!((f[0].0.as_str(), f[0].1.len()), ("Before 11/11/2026 after", 0), "{f:?}"); + let cell = d.body.iter().find_map(|b| b.as_table()).and_then(|t| t.rows.first()).and_then(|r| r.cells.first()).unwrap(); + let cf = fields_of(&cell.blocks); + assert_eq!((cf[0].0.as_str(), cf[0].1.len()), ("Presidente della Rete (Rossi Mario)", 0), "{cf:?}"); + assert!(f.last().is_some_and(|(t, fl)| t == "x" && fl.is_empty()), "{f:?}"); +} + +#[test] +fn fields_that_cannot_be_one_field_stay_text() { + let rtf = br#"{\rtf1\ansi +\pard {\field{\*\fldinst{HYPERLINK "http://a.b"}}{\fldrslt{link}}}\par +\pard {\field{\*\fldinst TOC \\o "1-3"}{\fldrslt {Heading one\tab 1\par Heading two\tab 2}}}\par +\pard {\field{\*\fldinst PAGEREF a}{\fldrslt {\b 1}2}}\par +\pard {\field{\*\fldinst IF {\field{\*\fldinst PAGE}{\fldrslt 1}} = 1 "one" "many"}{\fldrslt one}}\par +\pard {\field{\*\fldinst PAGE}}\par +\pard {\field{\*\fldinst PAGE}{\fldrslt 1\par 2}}\par}"#; + let d = import(rtf).unwrap(); + let f = fields_of(&d.body); + let texts: Vec<&str> = f.iter().map(|(t, _)| t.as_str()).collect(); + // A link stays a link; a result over two paragraphs or in two formats stays its text. + assert_eq!(&texts[..4], ["link", "Heading one\t1", "Heading two\t2", "12"], "{f:?}"); + // The PAGE inside IF's instruction is part of the code, not a field of the paragraph. + assert_eq!(texts[4], "one", "{f:?}"); + // A field with no result group at all is left as it was (nothing). + assert!(f[5].0.is_empty(), "{f:?}"); + assert_eq!(&texts[6..8], ["1", "2"], "{f:?}"); + assert!(f.iter().all(|(_, fl)| fl.is_empty()), "{f:?}"); +} + +#[test] +fn a_table_of_contents_keeps_its_links_and_its_page_numbers_become_fields() { + // The shape Word writes: the TOC result spans paragraphs; each entry is a link around its + // text and a PAGEREF to the heading's bookmark. + let rtf = br#"{\rtf1\ansi +\pard {\field{\*\fldinst TOC \\o "1-3" \\h}{\fldrslt {\field{\*\fldinst HYPERLINK \\l "_Toc1"}{\fldrslt {One\tab {\field{\*\fldinst PAGEREF _Toc1 \\h}{\fldrslt 3}}}}}\par +{\field{\*\fldinst HYPERLINK \\l "_Toc2"}{\fldrslt {Two\tab {\field{\*\fldinst PAGEREF _Toc2 \\h}{\fldrslt 5}}}}}}}\par +\pard {\*\bkmkstart _Toc1}Heading{\*\bkmkend _Toc1}\par}"#; + let d = import(rtf).unwrap(); + let f = fields_of(&d.body); + assert_eq!(f[0].1, [("PAGEREF _Toc1 \\h".to_string(), "3".to_string(), false)], "{f:?}"); + assert_eq!(f[1].1, [("PAGEREF _Toc2 \\h".to_string(), "5".to_string(), false)], "{f:?}"); + assert!(f[0].0.starts_with("One\t") && f[1].0.starts_with("Two\t"), "{f:?}"); + // The entry text still links to its heading. + let p = d.body[0].as_para().unwrap(); + assert!(p.props_at(0).link.is_some(), "{:?}", p.runs); +} + +#[test] +fn hidden_styleref_tracked_and_object_results_stay_as_read() { + let rtf = br#"{\rtf1\ansi{\*\revtbl{Unknown;}{Ann;}} +\pard a{\v {\field{\*\fldinst PAGE}{\fldrslt 2}}}b\par +\pard {\field{\*\fldinst STYLEREF "heading 1"}{\fldrslt Intro}}\par +\pard {\field{\*\fldinst PAGE}{\fldrslt {\revised\revauth1 2}}}\par +\pard {\field{\*\fldinst PAGE}{\fldrslt A{\*\bkmkstart m}B{\*\bkmkend m}}}\par}"#; + let d = import(rtf).unwrap(); + let f = fields_of(&d.body); + // Hidden: neither the result nor a field. + assert_eq!((f[0].0.as_str(), f[0].1.len()), ("ab", 0), "{f:?}"); + // STYLEREF keeps Word's text. + assert_eq!((f[1].0.as_str(), f[1].1.len()), ("Intro", 0), "{f:?}"); + // A tracked result and one holding a bookmark stay text. + assert_eq!((f[2].0.as_str(), f[2].1.len()), ("2", 0), "{f:?}"); + // (The bookmark's start and end are object characters in the paragraph's text.) + assert_eq!((f[3].0.replace('\u{FFFC}', ""), f[3].1.len()), ("AB".to_string(), 0), "{f:?}"); +} + +#[test] +fn the_page_number_symbol_is_a_page_field() { + let d = import(br"{\rtf1\ansi{\footer \pard Page \chpgn\par}\pard Body\par}").unwrap(); + let f = footer(&d); + assert_eq!(f[0].1, [("PAGE".to_string(), String::new(), false)], "{f:?}"); +} + +#[test] +fn truncated_and_hostile_fields_do_not_crash() { + for rtf in [ + &br"{\rtf1{\field{\*\fldinst PAGE}{\fldrslt 2"[..], + br"{\rtf1{\field{\*\fldinst PAGE}{\fldrslt 2}", + br"{\rtf1{\field\field\field{\*\fldinst PAGE}}}}", + br"{\rtf1{\field{\fldrslt x}{\*\fldinst PAGE}}\par}", + br"{\rtf1 a{\field{\*\fldinst PAGE}{\fldrslt 1\par 2}}\par}", + ] { + let _ = import(rtf); + } + let mut deep = String::from(r"{\rtf1 "); + for _ in 0..300 { + deep.push_str(r"{\field{\*\fldinst PAGE}{\fldrslt "); + } + deep.push('x'); + let _ = import(deep.as_bytes()); +} + +#[test] +fn the_flow_reader_keeps_field_results_as_text() { + // `parse` asks for no fields, as before: the result is the paragraph's text. + let f = parse(br"{\rtf1\ansi\pard Pag. {\field{\*\fldinst PAGE}{\fldrslt 2}}\par}").unwrap(); + match &f.blocks[0] { + FBlock::Para(p) => { + assert!(p.inlines.iter().all(|i| matches!(i, Inline::Text(..))), "{:?}", p.inlines); + assert_eq!(p.text(), "Pag. 2"); + } + b => panic!("{b:?}"), + } +} + +#[test] +fn a_tracked_page_symbol_keeps_its_insertion_and_deletion() { + let rtf = br"{\rtf1\ansi{\*\revtbl{Unknown;}{Ann;}} +\pard Page {\revised\revauth1 \chpgn}\par +\pard Page {\deleted\revauthdel1 \chpgn}\par}"; + let d = import(rtf).unwrap(); + let f = fields_of(&d.body); + assert_eq!(f[0].1.len(), 1, "{f:?}"); + assert_eq!(f[1].1.len(), 1, "{f:?}"); + // Each field sits in a run carrying its tracked change, so Accept and Reject apply to it. + let marked = |i: usize, ins: bool| { + let p = d.body[i].as_para().unwrap(); + p.runs.iter().any(|r| if ins { r.props.ins.is_some() } else { r.props.del.is_some() }) + }; + assert!(marked(0, true), "{:?}", d.body[0].as_para().unwrap().runs); + assert!(marked(1, false), "{:?}", d.body[1].as_para().unwrap().runs); +} + +#[test] +fn a_result_whose_text_is_hidden_inside_it_stays_as_read() { + // `\v` inside the result: what showed was nothing, so no field that would show a number. + let rtf = br"{\rtf1\ansi +\pard x{\field{\*\fldinst PAGE}{\fldrslt \v 2}}y\par +\pard x{\field{\*\fldinst PAGE}{\fldrslt }}y\par}"; + let d = import(rtf).unwrap(); + let f = fields_of(&d.body); + assert_eq!((f[0].0.as_str(), f[0].1.len()), ("xy", 0), "{f:?}"); + // A result that is really empty is still a field. + assert_eq!(f[1].1.len(), 1, "{f:?}"); +} diff --git a/crates/rtf/src/doc/text.rs b/crates/rtf/src/doc/text.rs index dceaef6d0..ad997c680 100644 --- a/crates/rtf/src/doc/text.rs +++ b/crates/rtf/src/doc/text.rs @@ -189,31 +189,39 @@ impl Reader { } } + /// The current formatting with its tracked changes (insertion, deletion, formatting change). + pub(super) fn text_fmt(&mut self) -> Fmt { + let mut f = self.st.fmt.clone(); + let r = self.st.rev; + if r.ins { + f.ins = Some(self.rev_mark(r.auth, r.dttm)); + } + if r.del { + f.del = Some(self.rev_mark(r.authdel, r.dttmdel)); + } + let c = &self.st.chg_c; + if let Some(words) = c.old.clone() { + let mark = self.rev_mark(c.auth, c.date); + let old = self.old_fmt(&words); + f.fmt_change = Some(Box::new(model::FmtChange { mark, old })); + } + f + } + pub(super) fn text(&mut self, s: &str) { match self.st.dest { Dest::Body => { if self.st.hidden { + self.hidden_text_dropped(); return; } - let mut f = self.st.fmt.clone(); if s.contains([MARK_OPEN, MARK_CLOSE]) { + let f = self.st.fmt.clone(); self.para.push_text(&s.replace([MARK_OPEN, MARK_CLOSE], "\u{FFFD}"), &f); self.para_has = true; return; } - let r = self.st.rev; - if r.ins { - f.ins = Some(self.rev_mark(r.auth, r.dttm)); - } - if r.del { - f.del = Some(self.rev_mark(r.authdel, r.dttmdel)); - } - let c = &self.st.chg_c; - if let Some(words) = c.old.clone() { - let mark = self.rev_mark(c.auth, c.date); - let old = self.old_fmt(&words); - f.fmt_change = Some(Box::new(model::FmtChange { mark, old })); - } + let f = self.text_fmt(); self.para.push_text(s, &f); self.para_has = true; } diff --git a/crates/rtf/src/doc/word.rs b/crates/rtf/src/doc/word.rs index 2eb86692f..49367a7d1 100644 --- a/crates/rtf/src/doc/word.rs +++ b/crates/rtf/src/doc/word.rs @@ -75,6 +75,7 @@ impl Reader { "row" => self.end_row(), "line" | "softline" => self.ch('\n'), "tab" => self.ch('\t'), + "chpgn" => self.page_number_symbol(), "page" | "softpage" => self.ch('\u{000C}'), "column" => self.ch('\u{000E}'), "emdash" => self.ch('—'), @@ -283,8 +284,13 @@ impl Reader { self.defs.push(d); } } - "field" => self.start_field(), + "field" => { + self.start_field(); + self.open_field(); + } + "fldlock" => self.field_word(w), "fldrslt" => { + self.field_word(w); let link = self.st.field.and_then(|i| self.fields.get(i)).and_then(|s| hyperlink(s)); if link.is_some() { self.st.fmt.link = link.as_deref().and_then(model::kept_link); From a62ce81f2447b1791a8d8c0aa6317fb6388f189b Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 11:54:40 -0500 Subject: [PATCH 070/183] Expose consuming parsed certificate and revocation components --- crates/pkcs7/src/revocation.rs | 53 ++++++++++++++++++- crates/pkcs7/src/x509.rs | 90 +++++++++++++++++++++++++++++++++ crates/pkcs7/tests/it/crypto.rs | 53 +++++++++++++++++++ 3 files changed, 194 insertions(+), 2 deletions(-) diff --git a/crates/pkcs7/src/revocation.rs b/crates/pkcs7/src/revocation.rs index 0aa9be9c6..dfb398cae 100644 --- a/crates/pkcs7/src/revocation.rs +++ b/crates/pkcs7/src/revocation.rs @@ -63,6 +63,27 @@ pub struct CertificateList { pub revoked: Vec<(Vec, Time)>, } +/// Owned parsed components for adapters. This is not a signature or trust verdict. +/// Consuming conversion moves buffers without reparsing or cloning signed material. +pub struct CertificateListParts { + pub tbs: Vec, + pub sig_alg: Vec, + pub signature: Vec, + pub issuer_raw: Vec, + pub this_update: Time, + pub next_update: Option
  • APLu9scg*cbeZ_`p)4y@9*x;a0B4(^7!R%mKQB=Sl+*4_KFoNHm%sT z;_!--D>PSJTH&z5d&S)q@hje}C|c35qJQP=l`B?mTDfcG;gu&>YOcJr(qX0d%DXG$ zSH4+Uw6bAk|Ek%mR;=2zYS*g6t4^-cTy<%c!z%ApcUQ%)db6r%Rl}*W_8i(hSmLRX0KVXX49HoYYwkDxkhu%r8N#~yw}`a z6TjxonxZugYx-Gcv#em*#IlR!Fw036O_ob64lLd*cUj_D-mnz0G_dru&SqV~x`}lc z>tWWDteUKsSRGisS?{vOv%X<1Vr^jUUpss4inW{8?pk|z?a8&8YcH*JSnCb`D`oL( z->fZK+pxBuZ8qBqwoPoi*bcLuWYc83#OA=}&32b9p6v}=5nBUWKl^O<73`bXcd;L4 zKgq7ieu>?I-JAU`dp!Fa_9FHM_I{4p94k0BaqQwa%yE)Klf#6=k;8}M9!CO48b>il zBgeqHIqO!g+q{mn?#MdXbz198);X^8S$A(;!n(9|#p@c^4XmHDe&zbj>q+a6te0J{ zwccdC<9eU<_tqz@Pg`HSzH$A)hB+HnZrHqmwBg7G*$rA7Og1=f@Y!&0L&Ao%4aFN8 zHw+ zHWzPh+&sWJhjS(8W=<045l&f7Elv|oM@}Ekdz=ZJX`IEJjhq8qbGTM=ZRR3z9pRGY z(&94Va^&*iy2q8kmBv-f)yOrlWzLqBTQ+YYZ8@?)7H@6bI>0-J zcO~y;UJ~ySURho(UK3tNULW3jya~K%yv4kYyaU_jY+J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eg$mTLrCeO3UmxUc~&@MIs#~O)jS%Ew5 zO}fWb7db=gm{&r~EX^Wgy~w>PKg>)hFGfUe%k=#vG*vXj3{_V%6;Tg{Ht#NH4%-b{ zBs^j@Ta8STdTi=1a?+zD2Vr8aRHgr+Sn3n2#|6=P<#F8urbo;r=Z_`l6d-*q$T9VW zVdp=XNv@&RA5s|dSn$x!A+EpyOJp?s$<4k)h=czw=w;~oKmml)#a(Q!_|d@lx45)pO;?JZ`_Si z7QBA=ct?@1XMcW5c)^zXoX~!Ms0`&;D{}i0a_vlVxgJ-|i=Z5ESh&EE(yW{0BsbDi z^(Hc>DBtFYQBB4>%1)M+w-$)}d#THhh3U4XAQw5#s8JB~()E9-4AZY|C2vNMx2ut< zMahS{KYbGY`w~fcnP6)pe7kI*YEiGZ1*w{P*O39`-IH_UElFl;uvDKUPH+gJD%Yo, /// Tone value increase at 50 % for C, M, Y, K. pub tvi: [f64; 4], /// Grid points of the AToB (4D) and BToA (3D) tables. @@ -60,6 +68,32 @@ pub struct CmykParams { /// encoding and separates to a trace of ink. Off by default, which keeps the bytes of the /// shipped Photocraft profile. pub white_on_node: bool, + /// How the BToA tables bring colours into the gamut. [`GamutMapping::Legacy`] by default, + /// which keeps the bytes of the shipped Photocraft profile. + pub mapping: GamutMapping, +} + +/// How the BToA tables map colours the printer cannot reach. +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum GamutMapping { + /// The shipped Photocraft profile: out-of-gamut colours land on the closest reachable + /// colour (ΔE76); perceptual scales L* onto the device black and compresses Lab chroma; + /// saturation shares the perceptual table. + Legacy, + /// Gamut mapping in Oklab, whose hue lines stay perceptually constant (a CIELAB hue line + /// from a saturated blue toward grey drifts toward purple; an Oklab one does not): + /// + /// * **Colorimetric**: in-gamut colours separate exactly. An out-of-gamut colour takes the + /// closest colour the printer reaches in Oklab, lightness and hue weighted above chroma, + /// and more so the further outside it is; black is generated from the clipped colour, so + /// inks the clip drives to 100 % stay there. + /// * **Perceptual** and **saturation**: the ICC v4 perceptual reference black is mapped + /// onto the device black linearly in XYZ (as black point compensation does) for neutrals, + /// fading out with Oklab chroma, so greys separate as with colorimetric + BPC and colourful + /// colours keep their lightness. Perceptual then compresses Oklab chroma above `knee` × + /// the gamut boundary into the boundary; saturation scales Oklab chroma by `saturation` + /// and clips as colorimetric does. + Oklab { knee: f64, saturation: f64 }, } impl Default for CmykParams { @@ -71,10 +105,12 @@ impl Default for CmykParams { gcr_start: 0.2, k_max: 0.95, gcr_gamma: 1.1, + gcr_curve: Vec::new(), tvi: [0.14, 0.14, 0.14, 0.17], grid_a2b: 11, grid_b2a: 21, white_on_node: false, + mapping: GamutMapping::Legacy, } } } @@ -183,6 +219,11 @@ impl Forward for TableForward { /// Bounded least-squares solve for C, M, Y given K, minimising ΔE76 to `target`, subject to /// `C + M + Y ≤ limit` (projected Levenberg–Marquardt with a numerical Jacobian). fn solve_cmy(model: &F, target: [f64; 3], k: f64, limit: f64, seeds: &[[f64; 3]]) -> ([f64; 3], f64) { + solve_cmy_by(model, k, limit, seeds, |l| [l[0] - target[0], l[1] - target[1], l[2] - target[2]]) +} + +/// [`solve_cmy`] minimising the norm of `residual(lab)` instead of ΔE76. +fn solve_cmy_by(model: &F, k: f64, limit: f64, seeds: &[[f64; 3]], residual: impl Fn([f64; 3]) -> [f64; 3]) -> ([f64; 3], f64) { let project = |mut x: [f64; 3]| { for _ in 0..4 { for v in &mut x { @@ -202,10 +243,7 @@ fn solve_cmy(model: &F, target: [f64; 3], k: f64, limit: f6 } x }; - let err = |x: [f64; 3]| { - let l = model.lab([x[0], x[1], x[2], k]); - [l[0] - target[0], l[1] - target[1], l[2] - target[2]] - }; + let err = |x: [f64; 3]| residual(model.lab([x[0], x[1], x[2], k])); let norm2 = |e: [f64; 3]| e[0] * e[0] + e[1] * e[1] + e[2] * e[2]; let mut best = ([0.0; 3], f64::INFINITY); for seed in seeds { @@ -275,13 +313,32 @@ fn solve_cmy(model: &F, target: [f64; 3], k: f64, limit: f6 const SEEDS: [[f64; 3]; 5] = [[0.3, 0.3, 0.3], [0.05, 0.05, 0.05], [0.8, 0.8, 0.8], [0.9, 0.2, 0.2], [0.2, 0.9, 0.9]]; +/// Black for a gray component `g` (the smallest of C, M, Y without black). +fn gcr(p: &CmykParams, g: f64) -> f64 { + let Some(first) = p.gcr_curve.first() else { + // The Photocraft profile's curve. + return if g <= p.gcr_start { 0.0 } else { p.k_max * ((g - p.gcr_start) / (1.0 - p.gcr_start)).powf(p.gcr_gamma) }; + }; + let mut k = first[1]; + for w in p.gcr_curve.windows(2) { + let ([g0, k0], [g1, k1]) = (w[0], w[1]); + if g >= g1 { + k = k1; + } else if g > g0 { + k = k0 + (k1 - k0) * (g - g0) / (g1 - g0); + break; + } + } + k.clamp(0.0, 1.0) +} + /// Colorimetric separation of a relative Lab target: GCR black generation then a CMY solve. pub fn separate(model: &F, p: &CmykParams, target: [f64; 3], warm: Option<[f64; 4]>) -> ([f64; 4], f64) { let mut seeds: Vec<[f64; 3]> = warm.map(|w| vec![[w[0], w[1], w[2]]]).unwrap_or_default(); seeds.extend_from_slice(&SEEDS); let (cmy0, _) = solve_cmy(model, target, 0.0, 3.0, &seeds); let g = cmy0[0].min(cmy0[1]).min(cmy0[2]); - let k = if g <= p.gcr_start { 0.0 } else { p.k_max * ((g - p.gcr_start) / (1.0 - p.gcr_start)).powf(p.gcr_gamma) }; + let k = gcr(p, g); let mut seeds2 = vec![[(cmy0[0] - k).max(0.0), (cmy0[1] - k).max(0.0), (cmy0[2] - k).max(0.0)], cmy0]; seeds2.extend_from_slice(&seeds); let (cmy, de) = solve_cmy(model, target, k, (p.tac - k).max(0.0), &seeds2); @@ -383,6 +440,187 @@ impl Gbd { } } +/// ΔE76 under which a separation counts as reaching its target. +const REACH: f64 = 1.5; +/// Oklab chroma beyond any printable colour: the top of the boundary search. +const OKLAB_CHROMA_MAX: f64 = 0.5; +/// Oklab chroma above which the perceptual and saturation tables no longer lift black: they lift +/// neutrals fully, and less the more colourful a colour is. +const LIFT_CHROMA: f64 = 0.1; +/// Weight of lightness and hue against chroma when a colour just outside the gamut is clipped. +const CLIP_WEIGHT: f64 = 1.5; +/// Growth of that weight with the squared share of chroma the clip loses. +const CLIP_WEIGHT_GROWTH: f64 = 200.0; + +// Oklab (Björn Ottosson, 2020): XYZ (D65) → cone response → cube root → Lab-like axes. +const OKLAB_M1: math::Mat3 = + [[0.8189330101, 0.3618667424, -0.1288597137], [0.0329845436, 0.9293118715, 0.0361456387], [0.0482003018, 0.2643662691, 0.6338517070]]; +const OKLAB_M2: math::Mat3 = + [[0.2104542553, 0.7936177850, -0.0040720468], [1.9779984951, -2.4285922050, 0.4505937099], [0.0259040371, 0.7827717662, -0.8086757660]]; +const OKLAB_M1_INV: math::Mat3 = + [[1.2270138511, -0.5577999807, 0.2812561490], [-0.0405801784, 1.1122568696, -0.0716766787], [-0.0763812845, -0.4214819784, 1.5861632204]]; +const OKLAB_M2_INV: math::Mat3 = [[1.0, 0.3963377774, 0.2158037573], [1.0, -0.1055613458, -0.0638541728], [1.0, -0.0894841775, -1.2914855480]]; + +/// The [`GamutMapping::Oklab`] separations of one forward model. +struct OklabMapper<'a, F: Forward + ?Sized> { + model: &'a F, + p: &'a CmykParams, + knee: f64, + saturation: f64, + /// XYZ scale that maps the v4 perceptual reference black onto the device black (the white + /// stays fixed): `v' = a·v + w·(1 − a)`. + black_scale: f64, + to_d65: math::Mat3, + to_d50: math::Mat3, +} + +impl<'a, F: Forward + ?Sized> OklabMapper<'a, F> { + fn new(model: &'a F, p: &'a CmykParams, knee: f64, saturation: f64) -> Self { + let d65 = math::xy_to_xyz(math::D65_XY); + // The darkest neutral the printer reaches. + let (black, _) = separate(model, p, [0.0, 0.0, 0.0], None); + let device = math::lab_to_xyz([model.lab(black)[0], 0.0, 0.0], math::D50)[1]; + let reference = crate::transform::PERCEPTUAL_BLACK[1]; + OklabMapper { + model, + p, + knee, + saturation, + black_scale: (1.0 - device) / (1.0 - reference), + to_d65: math::bradford(math::D50, d65), + to_d50: math::bradford(d65, math::D50), + } + } + + fn oklab(&self, lab: [f64; 3]) -> [f64; 3] { + let xyz = math::apply(&self.to_d65, math::lab_to_xyz(lab, math::D50)); + math::apply(&OKLAB_M2, math::apply(&OKLAB_M1, xyz).map(f64::cbrt)) + } + + fn lab(&self, ok: [f64; 3]) -> [f64; 3] { + let lms = math::apply(&OKLAB_M2_INV, ok).map(|v| v * v * v); + math::xyz_to_lab(math::apply(&self.to_d50, math::apply(&OKLAB_M1_INV, lms)), math::D50) + } + + /// The most chroma (scale of `ok`'s chroma in `[0, top]`) the printer reaches at `ok`'s + /// lightness and hue, and its separation; `None` when even the neutral is out of reach. + fn boundary(&self, ok: [f64; 3], top: f64, warm: Option<[f64; 4]>) -> Option<(f64, [f64; 4])> { + let (grey, d) = separate(self.model, self.p, self.lab([ok[0], 0.0, 0.0]), warm); + if d > REACH { + return None; + } + let (mut lo, mut hi, mut best) = (0.0, top, grey); + for _ in 0..14 { + let mid = 0.5 * (lo + hi); + let (c, d) = separate(self.model, self.p, self.lab([ok[0], ok[1] * mid, ok[2] * mid]), Some(best)); + if d <= REACH { + lo = mid; + best = c; + } else { + hi = mid; + } + } + Some((lo, best)) + } + + /// Colorimetric: exact in gamut; outside, the closest colour the printer reaches in Oklab, + /// lightness and hue weighted above chroma, and more so the further outside the colour is. + fn clip(&self, lab: [f64; 3], warm: Option<[f64; 4]>) -> [f64; 4] { + let (cmyk, de) = separate(self.model, self.p, lab, warm); + if de <= REACH { + return cmyk; + } + let ok = self.oklab(lab); + let c0 = ok[1].hypot(ok[2]); + // Unit vectors along the colour's chroma and hue directions. + let (u, v) = if c0 > 1e-9 { ([ok[1] / c0, ok[2] / c0], [-ok[2] / c0, ok[1] / c0]) } else { ([1.0, 0.0], [0.0, 1.0]) }; + // Lightness and hue errors weighted by `w`, chroma error by 1; scaled by 100 so the + // solver's step tolerances suit it as they suit ΔE76. + let residual = |w: f64| { + move |l: [f64; 3]| { + let o = self.oklab(l); + let (da, db) = (o[1] - ok[1], o[2] - ok[2]); + [100.0 * w * (o[0] - ok[0]), 100.0 * (da * u[0] + db * u[1]), 100.0 * w * (da * v[0] + db * v[1])] + } + }; + let solve = |w: f64, k: f64, from: [f64; 3]| { + let mut seeds = vec![from]; + seeds.extend_from_slice(&SEEDS); + solve_cmy_by(self.model, k, (self.p.tac - k).max(0.0), &seeds, residual(w)).0 + }; + // A first clip without black measures how far outside the colour is. A colour just + // outside may give up a little lightness and hue to keep its chroma (a red reaches the + // full magenta and yellow edge); one far outside keeps its lightness and hue and loses + // chroma (a saturated blue does not slide along the gamut surface). + let first = solve(CLIP_WEIGHT, 0.0, [cmyk[0], cmyk[1], cmyk[2]]); + let o = self.oklab(self.model.lab([first[0], first[1], first[2], 0.0])); + let loss = if c0 > 1e-9 { (1.0 - o[1].hypot(o[2]) / c0).clamp(0.0, 1.0) } else { 0.0 }; + let w = CLIP_WEIGHT * (1.0 + CLIP_WEIGHT_GROWTH * loss * loss); + let free = solve(w, 0.0, first); + let norm = |c: [f64; 4]| residual(w)(self.model.lab(c)).iter().map(|v| v * v).sum::(); + // Candidates, the closest kept: the separation itself (a colour it nearly reaches stays + // continuous with its in-gamut neighbours), the clip with the separation's black, and + // the clip with black generated from the black-free clip's gray component (inks the + // clip drives to 100 % stay there and black replaces the rest). + let mut best = (norm(cmyk), cmyk); + for k in [cmyk[3], gcr(self.p, free[0].min(free[1]).min(free[2]))] { + for from in [[cmyk[0], cmyk[1], cmyk[2]], free] { + let cmy = solve(w, k, from); + let c = [cmy[0], cmy[1], cmy[2], k]; + let n = norm(c); + if n < best.0 { + best = (n, c); + } + } + } + // Near paper white the gamut narrows to a point: the separation's closest colour keeps + // light tints' chroma where holding lightness would drop them toward bare paper, and + // the table nodes there carry the in-gamut tints between them. The inks blend from the + // clip at L* 85 to the separation at L* 95. + let clip_share = ((95.0 - lab[0]) / 10.0).clamp(0.0, 1.0); + std::array::from_fn(|i| clip_share * best.1[i] + (1.0 - clip_share) * cmyk[i]) + } + + /// Maps the v4 perceptual reference black onto the device black, linearly in XYZ, for + /// neutrals; colourful colours keep their lightness. + fn lift_black(&self, lab: [f64; 3]) -> [f64; 3] { + let ok = self.oklab(lab); + let neutral = (1.0 - ok[1].hypot(ok[2]) / LIFT_CHROMA).clamp(0.0, 1.0); + let a = 1.0 - neutral * (1.0 - self.black_scale); + let xyz = math::lab_to_xyz(lab, math::D50); + math::xyz_to_lab(std::array::from_fn(|i| a * xyz[i] + math::D50[i] * (1.0 - a)), math::D50) + } + + fn perceptual(&self, lab: [f64; 3], warm: Option<[f64; 4]>) -> [f64; 4] { + let lab = self.lift_black(lab); + let ok = self.oklab(lab); + let c = ok[1].hypot(ok[2]); + if c < 1e-9 { + return self.clip(lab, warm); + } + let Some((s, edge)) = self.boundary(ok, OKLAB_CHROMA_MAX / c, warm) else { + return self.clip(lab, warm); + }; + // Chroma above the knee is compressed smoothly into the boundary chroma `cb`. + let cb = s * c; + let knee = self.knee * cb; + if c <= knee { + return self.clip(lab, warm); + } + let c2 = knee + (cb - knee) * ((c - knee) / (cb - knee).max(1e-9)).tanh(); + let f = c2 / c; + if f >= s { + return edge; + } + self.clip(self.lab([ok[0], ok[1] * f, ok[2] * f]), Some(edge)) + } + + fn saturation(&self, lab: [f64; 3], warm: Option<[f64; 4]>) -> [f64; 4] { + let ok = self.oklab(self.lift_black(lab)); + self.clip(self.lab([ok[0], ok[1] * self.saturation, ok[2] * self.saturation]), warm) + } +} + fn lab_node_legacy(i: usize, n: usize) -> f64 { i as f64 / (n - 1) as f64 } @@ -419,6 +657,18 @@ fn white_node_curve(l_axis: bool, x: f64) -> f64 { } fn b2a_table(model: &F, p: &CmykParams, gbd: Option<&Gbd>) -> Result { + b2a_table_with(p, |lab, warm| { + let target = match gbd { + Some(g) => g.compress(lab), + None => lab, + }; + separate(model, p, target, warm).0 + }) +} + +/// Samples a BToA table: `node` separates each relative Lab node, warm-started from the +/// previous node along b. +fn b2a_table_with(p: &CmykParams, node: impl Fn([f64; 3], Option<[f64; 4]>) -> [f64; 4] + Sync) -> Result { let n = p.grid_b2a.max(2); let nodes = n * n * n; let step = (n - 1) as f64; @@ -434,11 +684,7 @@ fn b2a_table(model: &F, p: &CmykParams, gbd: Option<&Gbd>) } else { decode_v2([lab_node_legacy(li, n), lab_node_legacy(ai, n), lab_node_legacy(bi, n)]) }; - let target = match gbd { - Some(g) => g.compress(lab), - None => lab, - }; - let (cmyk, _) = if p.white_on_node && lab == [100.0, 0.0, 0.0] { ([0.0; 4], 0.0) } else { separate(model, p, target, warm) }; + let cmyk = if p.white_on_node && lab == [100.0, 0.0, 0.0] { [0.0; 4] } else { node(lab, warm) }; warm = Some(cmyk); out.extend(cmyk.map(|v| v as f32)); } @@ -460,6 +706,15 @@ fn check_grids(p: &CmykParams) -> Result<(), CmsError> { if p.white_on_node && p.grid_b2a.is_multiple_of(2) { return Err(invalid_arg(format!("white on a node needs an odd BToA grid, not {}", p.grid_b2a))); } + let valid = |v: &[f64; 2]| v.iter().all(|x| (0.0..=1.0).contains(x)); + if !p.gcr_curve.iter().all(valid) || p.gcr_curve.windows(2).any(|w| w[1][0] <= w[0][0]) { + return Err(invalid_arg(format!("black generation curve {:?} needs points in [0, 1] with increasing gray components", p.gcr_curve))); + } + if let GamutMapping::Oklab { knee, saturation } = p.mapping + && !((0.0..1.0).contains(&knee) && saturation.is_finite() && saturation > 0.0) + { + return Err(invalid_arg(format!("Oklab gamut mapping needs a knee in [0, 1) and a positive saturation, not {knee} and {saturation}"))); + } Ok(()) } @@ -518,11 +773,23 @@ pub fn cmyk_profile_from_model(model: &F, paper: [f64; 3], } fn lut_profile(model: &F, a2b: Clut, paper: [f64; 3], p: &CmykParams) -> Result { - let gbd = Gbd::new(model, p); - let colorimetric = b2a_table(model, p, None)?; - let perceptual = b2a_table(model, p, Some(&gbd))?; + let (perceptual, colorimetric, saturation) = match p.mapping { + GamutMapping::Legacy => { + let gbd = Gbd::new(model, p); + let colorimetric = b2a_table(model, p, None)?; + let perceptual = b2a_table(model, p, Some(&gbd))?; + (perceptual.clone(), colorimetric, perceptual) + } + GamutMapping::Oklab { knee, saturation } => { + let m = OklabMapper::new(model, p, knee, saturation); + let colorimetric = b2a_table_with(p, |lab, warm| m.clip(lab, warm))?; + let perceptual = b2a_table_with(p, |lab, warm| m.perceptual(lab, warm))?; + let saturation = b2a_table_with(p, |lab, warm| m.saturation(lab, warm))?; + (perceptual, colorimetric, saturation) + } + }; let a2b = lut16(a2b, false); - let (b0, b1) = (lut16(perceptual, p.white_on_node), lut16(colorimetric, p.white_on_node)); + let (b0, b1, b2) = (lut16(perceptual, p.white_on_node), lut16(colorimetric, p.white_on_node), lut16(saturation, p.white_on_node)); Ok(Profile { version: (4, 0x30), class: ProfileClass::Output, @@ -538,7 +805,7 @@ fn lut_profile(model: &F, a2b: Clut, paper: [f64; 3], p: &C trc: None, gray_trc: None, a2b: [Some(a2b.clone()), Some(a2b.clone()), Some(a2b)], - b2a: [Some(b0.clone()), Some(b1), Some(b0)], + b2a: [Some(b0), Some(b1), Some(b2)], bytes: None, hash: Default::default(), } @@ -576,6 +843,46 @@ mod tests { } } + #[test] + fn oklab_mapping_refuses_bad_parameters() { + for (knee, saturation) in [(1.0, 1.0), (-0.1, 1.0), (f64::NAN, 1.0), (0.5, 0.0), (0.5, f64::INFINITY), (0.5, f64::NAN)] { + let p = CmykParams { grid_a2b: 2, grid_b2a: 2, mapping: GamutMapping::Oklab { knee, saturation }, ..CmykParams::default() }; + assert!(cmyk_profile(&p).is_err(), "knee {knee}, saturation {saturation}"); + } + } + + #[test] + fn black_generation_curve() { + let p = CmykParams { gcr_curve: vec![[0.0, 0.0], [0.5, 0.2], [1.0, 0.9]], ..CmykParams::default() }; + for (g, k) in [(-1.0, 0.0), (0.0, 0.0), (0.25, 0.1), (0.5, 0.2), (0.75, 0.55), (1.0, 0.9), (2.0, 0.9)] { + assert!((gcr(&p, g) - k).abs() < 1e-12, "g {g}: {} != {k}", gcr(&p, g)); + } + for curve in [vec![[0.5, 0.2], [0.5, 0.3]], vec![[0.5, 0.2], [0.2, 0.3]], vec![[0.0, 1.5]], vec![[f64::NAN, 0.0]]] { + let p = CmykParams { grid_a2b: 2, grid_b2a: 2, gcr_curve: curve.clone(), ..CmykParams::default() }; + assert!(cmyk_profile(&p).is_err(), "{curve:?}"); + } + } + + #[test] + fn oklab_round_trips() { + let m = CmykModel::coated(CmykParams::default().tvi); + let p = CmykParams::default(); + let mapper = OklabMapper::new(&m, &p, 0.65, 1.05); + for lab in [[50.0, 0.0, 0.0], [44.0, 63.7, 47.0], [31.9, 32.9, -76.8], [90.0, -5.0, 80.0]] { + let back = mapper.lab(mapper.oklab(lab)); + // The published matrices carry 10 digits, so the inverses are exact to about 1e-5 ΔE. + assert!(math::delta_e76(lab, back) < 1e-3, "{lab:?} -> {back:?}"); + } + } + + #[test] + fn oklab_profile_has_three_tables() { + let p = CmykParams { grid_a2b: 5, grid_b2a: 5, mapping: GamutMapping::Oklab { knee: 0.65, saturation: 1.05 }, ..CmykParams::default() }; + let profile = cmyk_profile(&p).unwrap(); + let [Some(b0), Some(b1), Some(b2)] = &profile.b2a else { panic!("missing BToA tables") }; + assert!(b0 != b1 && b0 != b2, "perceptual shares a table"); + } + #[test] fn separation_hits_in_gamut_targets() { let m = CmykModel::coated(CmykParams::default().tvi); diff --git a/crates/cms/src/transform.rs b/crates/cms/src/transform.rs index c4f6e11cc..38a3223d9 100644 --- a/crates/cms/src/transform.rs +++ b/crates/cms/src/transform.rs @@ -46,7 +46,7 @@ const OUT_TABLE: usize = GpuMatrixShaper::OUTPUT_ENTRIES; const _: () = assert!(OUT_TABLE.is_power_of_two()); /// ICC v4 perceptual reference medium black (ICC.1:2010 §6.3.4.4), XYZ. -const PERCEPTUAL_BLACK: [f64; 3] = [0.00336, 0.0034731, 0.00287]; +pub(crate) const PERCEPTUAL_BLACK: [f64; 3] = [0.00336, 0.0034731, 0.00287]; /// Accelerated representation of a transform. #[derive(Debug)] diff --git a/crates/cms/tests/fogra39.rs b/crates/cms/tests/fogra39.rs index f958ffc51..d08e3bae6 100644 --- a/crates/cms/tests/fogra39.rs +++ b/crates/cms/tests/fogra39.rs @@ -12,7 +12,7 @@ //! ([`synth::cmyk_profile_from_model`]). use craft_cms::math::{self, delta_e2000}; -use craft_cms::synth::{self, CmykParams, Forward}; +use craft_cms::synth::{self, CmykParams, Forward, GamutMapping}; use craft_cms::{Builtin, Intent, Profile, Transform}; const DATA: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/data/FOGRA39.txt"); @@ -346,8 +346,10 @@ fn regen_coated_fogra39() { description: Builtin::CoatedFogra39.description().into(), copyright: craft_cms::builtin::COATED_FOGRA39_COPYRIGHT.into(), tac: 3.3, + gcr_curve: vec![[0.0, 0.0], [0.2, 0.05], [0.5, 0.205], [0.67, 0.5], [1.0, 0.95]], grid_b2a: 33, white_on_node: true, + mapping: GamutMapping::Oklab { knee: 0.65, saturation: 1.05 }, ..CmykParams::default() }; let profile = synth::cmyk_profile_from_model(&f, paper(&p), ¶ms).unwrap(); @@ -564,3 +566,60 @@ fn stand_in_separations_respect_the_ink_limit() { } } } + +/// sRGB patches and their separations by the reference application (Convert to Profile to +/// Coated FOGRA39, dither on), CMYK % per intent: relative + BPC, relative, perceptual, +/// saturation, absolute. Measured for storytold/photocraft#14267. +const REFERENCE_SEPARATIONS: [([u8; 3], [[f32; 4]; 5]); 3] = [ + ( + [200, 30, 30], + [[14.5, 97.7, 95.3, 4.3], [13.3, 100.0, 100.0, 5.5], [18.0, 96.9, 92.9, 8.6], [14.9, 100.0, 100.0, 5.9], [8.6, 100.0, 100.0, 2.4]], + ), + ([30, 60, 200], [[91.8, 75.3, 0.0, 0.0], [94.5, 76.5, 0.0, 0.0], [94.5, 77.7, 0.0, 0.0], [93.7, 76.9, 0.0, 0.0], [92.6, 74.9, 0.0, 0.0]]), + ( + [128, 128, 128], + [[49.0, 38.4, 38.4, 20.0], [49.8, 39.2, 38.8, 21.2], [49.0, 38.4, 38.4, 20.0], [49.0, 38.4, 38.4, 20.0], [46.7, 36.9, 38.4, 18.4]], + ), +]; + +const SEPARATION_INTENTS: [(Intent, bool); 5] = [ + (Intent::RelativeColorimetric, true), + (Intent::RelativeColorimetric, false), + (Intent::Perceptual, true), + (Intent::Saturation, true), + (Intent::AbsoluteColorimetric, false), +]; + +fn separation(intent: Intent, bpc: bool, rgb: [u8; 3]) -> [f32; 4] { + let t = Transform::new(Builtin::Srgb.profile(), fogra39(), intent, bpc).unwrap(); + let mut o = [0.0f32; 4]; + t.eval(&rgb.map(|v| v as f32 / 255.0), &mut o).unwrap(); + o.map(|v| v * 100.0) +} + +/// sRGB → Coated FOGRA39 matches the reference application's inks on a red, a saturated blue +/// and a mid grey for every intent. Most land within 2 % per ink; red at the magenta–yellow +/// edge lands between table nodes that are and are not clipped, which costs up to 2.2 % with +/// the 33³ BToA tables. +#[test] +fn separates_like_the_reference_application() { + let mut worst = 0.0f32; + for (rgb, want) in REFERENCE_SEPARATIONS { + for ((intent, bpc), want) in SEPARATION_INTENTS.into_iter().zip(want) { + let got = separation(intent, bpc, rgb); + let diff = (0..4).map(|i| (got[i] - want[i]).abs()).fold(0.0f32, f32::max); + eprintln!("{rgb:?} {intent:?} bpc {bpc}: {got:.1?} reference {want:?} (max {diff:.1})"); + worst = worst.max(diff); + } + } + assert!(worst <= 2.5, "worst ink difference {worst} %"); +} + +/// Saturation has its own table: a red separates with more magenta and yellow than +/// perceptual, whose chroma compression takes some back. +#[test] +fn saturation_and_perceptual_separate_differently() { + let red = [200, 30, 30]; + let (perceptual, saturation) = (separation(Intent::Perceptual, true, red), separation(Intent::Saturation, true, red)); + assert!(saturation[1] > perceptual[1] + 1.0 && saturation[2] > perceptual[2] + 1.0, "perceptual {perceptual:?}, saturation {saturation:?}"); +} diff --git a/crates/prepress/src/output.rs b/crates/prepress/src/output.rs index 9bc9a0296..428597d33 100644 --- a/crates/prepress/src/output.rs +++ b/crates/prepress/src/output.rs @@ -191,10 +191,12 @@ mod tests { let p = Plates { inks, unseparated: Vec::new(), width: 2, height: 1, dpi: 72.0, conversion: Conversion::DeviceFormulas, planes }; let output = Output::new(fogra39(), fogra39(), Intent::RelativeColorimetric, false).unwrap(); let cmyk = p.composite_to(&[], &output); - // Magenta's round trip through the profile adds a little yellow. - assert!(near(&cmyk[0..4], &[255, 255, 8, 0], 8), "spot over cyan: {:?}", &cmyk[0..4]); - assert!(near(&cmyk[4..8], &[0, 255, 8, 0], 8), "spot alone: {:?}", &cmyk[4..8]); - assert!(near(&p.composite_to(&[true, true, true, true, false], &output)[0..4], &[255, 0, 0, 0], 6), "spot hidden"); + // The press profile's round trip: its BToA tables generate their own black, so a + // full-tone ink comes back a little short with a trace of black, as a printer would + // separate it. The tolerance is the profile's own round trip, not an exchange total. + assert!(near(&cmyk[0..4], &[250, 247, 17, 2], 8), "spot over cyan: {:?}", &cmyk[0..4]); + assert!(near(&cmyk[4..8], &[8, 247, 11, 1], 8), "spot alone: {:?}", &cmyk[4..8]); + assert!(near(&p.composite_to(&[true, true, true, true, false], &output)[0..4], &[250, 7, 6, 1], 8), "spot hidden"); } #[test] From 7107fb8daf5a1255706bc13da805b36fd3b9e9b6 Mon Sep 17 00:00:00 2001 From: Ken Mantle Date: Tue, 17 Nov 2026 14:14:51 -0500 Subject: [PATCH 104/183] =?UTF-8?q?cms:=20keep=20black-only=20CMYK=20black?= =?UTF-8?q?-only=20across=20CMYK=20=E2=86=92=20CMYK=20transforms=20(#2029)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * cms: keep black-only CMYK black-only across CMYK to CMYK transforms Opt-in BlackPreserving: a colour with exactly zero C, M and Y converts to exactly (0, 0, 0, K'), K' matching the source K-only L* in the destination (both ramps sampled at construction with the transform's intent and BPC). Transform itself is unchanged. Adapted from icccer (MIT, same author) black_preserve.rs at 08ca16ab. Co-Authored-By: Claude Opus 5.5 * cms: map black past the destination maximum to exactly K = 1 between samples Co-Authored-By: Claude Opus 5.5 * cms: README says the K-ramp check is sampled Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: KenM76 Co-authored-by: Claude Opus 5.5 --- crates/cms/README.md | 6 + crates/cms/src/black.rs | 205 ++++++++++++++++++++++++++++++++++ crates/cms/src/black_tests.rs | 149 ++++++++++++++++++++++++ crates/cms/src/lib.rs | 2 + 4 files changed, 362 insertions(+) create mode 100644 crates/cms/src/black.rs create mode 100644 crates/cms/src/black_tests.rs diff --git a/crates/cms/README.md b/crates/cms/README.md index 71f3146d5..cbee391cd 100644 --- a/crates/cms/README.md +++ b/crates/cms/README.md @@ -81,6 +81,12 @@ Buffers are checked once per call, before any pixel is written. the exact and float paths compare each pixel with white; all other colours are left as the profiles give them. With a profile whose white falls between its nodes (`coated-cmyk`: 0.4 % C), the last step to white is that much larger than its neighbours. +* Black preservation (opt-in, `BlackPreserving`): for CMYK → CMYK, a colour with exactly zero + C, M and Y comes out as exactly `(0, 0, 0, K')`, where `K'` is the destination black whose + K-only L* equals the source's (both K ramps sampled at 1024 points when the transform is + built, with its intent and BPC). The test is exact zero, so an input with any chromatic ink + takes the ordinary path. Absolute colorimetric, non-CMYK profiles and K ramps that reverse at + one of the 1024 samples are refused (a reversal between samples is not detected). ## Built-in profiles (all CC0-1.0, generated by this crate) diff --git a/crates/cms/src/black.rs b/crates/cms/src/black.rs new file mode 100644 index 000000000..f80defeef --- /dev/null +++ b/crates/cms/src/black.rs @@ -0,0 +1,205 @@ +//! K-only black preservation for CMYK → CMYK transforms. +//! +//! A CMYK → CMYK transform goes through the three-component PCS, so black alone (C = M = Y = 0) +//! comes out as a four-ink mix. ISO 32000-2 §8.6.5.7 notes that this loses fidelity in the black +//! component. ICC defines no black preservation; this is a named policy the caller opts into. +//! +//! [`BlackPreserving`] converts like its [`Transform`], except that a colour with exactly zero +//! cyan, magenta and yellow becomes exactly `(0, 0, 0, K')`. `K'` is the destination black whose +//! K-only L* equals the source's, both measured to Lab with the transform's own intent and BPC +//! setting: both ramps are sampled once, at construction, and the destination ramp is inverted. +//! A source black darker than the destination's maximum black maps to K = 1. The test is exact zero, so the transform is discontinuous at C = M = Y = 0: an input +//! with any chromatic ink takes the ordinary path. + +use crate::transform::{Transform, TransformOptions}; +use crate::{Builtin, CmsError, ColorSpace, Intent, Profile, invalid_arg}; + +/// Samples along each K-only ramp. Linear interpolation between samples of a smooth ramp is far +/// below the 16-bit quantum. +const K_SAMPLES: usize = 1024; +/// Slack for the monotonicity checks (L* units, K units). +const MONOTONIC_EPS: f64 = 1e-6; + +/// A CMYK → CMYK transform that keeps black-only colours black-only. +#[derive(Debug)] +pub struct BlackPreserving { + transform: Transform, + /// Destination K for source K at `i / (K_SAMPLES - 1)`; `K_SAMPLES` values in `[0, 1]`. + curve: Vec, + /// Source K from which the source black is at least as dark as the destination's darkest: + /// mapped to exactly 1. Infinite when the destination's black is the darker. + saturate: f32, + /// The mapping at the 256 8-bit source codes, already quantised. + curve8: [u8; 256], +} + +impl BlackPreserving { + /// Transform from `src` to `dst` with black preservation. + /// + /// Errors with [`CmsError::InvalidArgument`] when either profile is not CMYK or the intent is + /// absolute colorimetric (which reproduces the source's paper and black, so there is no + /// black to map), and with [`CmsError::Unsupported`] when a profile's K-only ramp is not + /// monotonic at its 1024 samples (black that gets lighter as K rises has no equal-lightness + /// inverse; a reversal between samples is not detected). Other errors + /// are those of [`Transform::with_options`]. + pub fn new(src: &Profile, dst: &Profile, opts: TransformOptions) -> Result { + if src.color_space != ColorSpace::Cmyk || dst.color_space != ColorSpace::Cmyk { + return Err(invalid_arg("black preservation needs CMYK source and destination profiles")); + } + if opts.intent == Intent::AbsoluteColorimetric { + return Err(invalid_arg("black preservation does not apply to absolute colorimetric")); + } + let transform = Transform::with_options(src, dst, opts)?; + let src_l = k_ramp_lightness(src, opts)?; + let dst_l = k_ramp_lightness(dst, opts)?; + let (curve, saturate) = k_curve(&src_l, &dst_l)?; + let mut curve8 = [0u8; 256]; + for (code, slot) in curve8.iter_mut().enumerate() { + *slot = quantise(map(&curve, saturate, code as f32 / 255.0), 255.0) as u8; + } + Ok(BlackPreserving { transform, curve, saturate, curve8 }) + } + + /// The ordinary transform, which every colour with chromatic ink goes through. Converting with + /// it directly does not preserve black. + pub fn transform(&self) -> &Transform { + &self.transform + } + + /// Destination K for a black-only source colour of `k` (clamped to `[0, 1]`). + pub fn map_k(&self, k: f32) -> f32 { + map(&self.curve, self.saturate, k) + } + + /// Exact evaluation of one colour; slices as in [`Transform::eval`]. + pub fn eval(&self, input: &[f32], out: &mut [f32]) -> Result<(), CmsError> { + self.transform.eval(input, out)?; + self.patch_one(input, out); + Ok(()) + } + + /// Lookup-table evaluation of one colour; slices as in [`Transform::eval`]. + pub fn eval_fast(&self, input: &[f32], out: &mut [f32]) -> Result<(), CmsError> { + self.transform.eval_fast(input, out)?; + self.patch_one(input, out); + Ok(()) + } + + /// Converts float pixels; layout and errors as in [`Transform::convert_f32`]. + pub fn convert_f32(&self, src: &[f32], src_stride: usize, dst: &mut [f32], dst_stride: usize, copy_extra: bool) -> Result<(), CmsError> { + self.transform.convert_f32(src, src_stride, dst, dst_stride, copy_extra)?; + for (s, d) in src.chunks_exact(src_stride).zip(dst.chunks_exact_mut(dst_stride)) { + self.patch_one(s, d); + } + Ok(()) + } + + /// Converts 8-bit pixels; layout and errors as in [`Transform::convert_u8`]. + pub fn convert_u8(&self, src: &[u8], src_stride: usize, dst: &mut [u8], dst_stride: usize, copy_extra: bool) -> Result<(), CmsError> { + self.transform.convert_u8(src, src_stride, dst, dst_stride, copy_extra)?; + for (s, d) in src.chunks_exact(src_stride).zip(dst.chunks_exact_mut(dst_stride)) { + if let ([0, 0, 0, k, ..], [c, m, y, kd, ..]) = (s, d) { + (*c, *m, *y) = (0, 0, 0); + *kd = self.curve8[usize::from(*k)]; + } + } + Ok(()) + } + + /// Converts 16-bit pixels; layout and errors as in [`Transform::convert_u16`]. + pub fn convert_u16(&self, src: &[u16], src_stride: usize, dst: &mut [u16], dst_stride: usize, copy_extra: bool) -> Result<(), CmsError> { + self.transform.convert_u16(src, src_stride, dst, dst_stride, copy_extra)?; + for (s, d) in src.chunks_exact(src_stride).zip(dst.chunks_exact_mut(dst_stride)) { + if let ([0, 0, 0, k, ..], [c, m, y, kd, ..]) = (s, d) { + (*c, *m, *y) = (0, 0, 0); + *kd = quantise(self.map_k(f32::from(*k) / 65535.0), 65535.0) as u16; + } + } + Ok(()) + } + + fn patch_one(&self, input: &[f32], out: &mut [f32]) { + if let ([0.0, 0.0, 0.0, k, ..], [c, m, y, kd, ..]) = (input, out) { + (*c, *m, *y) = (0.0, 0.0, 0.0); + *kd = self.map_k(*k); + } + } +} + +/// The sampled mapping from the source to the destination K-only ramp, and the source K at +/// which the destination's darkest black is reached (the `saturate` field). +fn k_curve(src_l: &[f64], dst_l: &[f64]) -> Result<(Vec, f32), CmsError> { + let curve: Vec = src_l.iter().map(|&l| invert(dst_l, l) as f32).collect(); + if !curve.windows(2).all(|w| f64::from(w[0]) - f64::from(w[1]) <= MONOTONIC_EPS) { + return Err(CmsError::Unsupported("black preservation: the K mapping is not monotonic".into())); + } + let saturate = match (src_l.last(), dst_l.last()) { + (Some(&s), Some(&d)) if s < d => invert(src_l, d) as f32, + _ => f32::INFINITY, + }; + Ok((curve, saturate)) +} + +/// L* of `p`'s K-only ramp at `K_SAMPLES` points, light to dark; refused when it is not +/// non-increasing. +fn k_ramp_lightness(p: &Profile, opts: TransformOptions) -> Result, CmsError> { + let to_lab = Transform::with_options(p, Builtin::LabD50.profile(), TransformOptions { precise_float: true, ..opts })?; + let mut ramp = Vec::with_capacity(K_SAMPLES); + let mut lab = [0.0f32; 3]; + for i in 0..K_SAMPLES { + let k = i as f32 / (K_SAMPLES - 1) as f32; + to_lab.eval(&[0.0, 0.0, 0.0, k], &mut lab)?; + ramp.push(f64::from(lab[0]) * 100.0); + } + if !ramp.iter().all(|l| l.is_finite()) || !ramp.windows(2).all(|w| w[1] - w[0] <= MONOTONIC_EPS) { + return Err(CmsError::Unsupported("black preservation: a K-only ramp is not monotonic".into())); + } + Ok(ramp) +} + +/// The K in `[0, 1]` at which the non-increasing `ramp` reaches `target`, clamped to its ends. +fn invert(ramp: &[f64], target: f64) -> f64 { + let (Some(&first), Some(&last)) = (ramp.first(), ramp.last()) else { return 0.0 }; + if ramp.len() < 2 || target >= first { + return 0.0; + } + if target <= last { + return 1.0; + } + // ramp[lo] > target >= ramp[hi] + let (mut lo, mut hi) = (0usize, ramp.len() - 1); + while hi - lo > 1 { + let mid = lo + (hi - lo) / 2; + if ramp.get(mid).is_some_and(|&v| v > target) { + lo = mid; + } else { + hi = mid; + } + } + let (a, b) = (ramp.get(lo).copied().unwrap_or(first), ramp.get(hi).copied().unwrap_or(last)); + let t = if a - b > MONOTONIC_EPS { (a - target) / (a - b) } else { 0.0 }; + (lo as f64 + t) / (ramp.len() - 1) as f64 +} + +/// Linear interpolation in `curve` (samples over `[0, 1]`) at `k`, clamped; 1 from `saturate`. +fn map(curve: &[f32], saturate: f32, k: f32) -> f32 { + let Some(&last) = curve.last() else { return 0.0 }; + let k = if k.is_nan() { 0.0 } else { k.clamp(0.0, 1.0) }; + if k >= saturate { + return 1.0; + } + let x = k * (curve.len() - 1) as f32; + let i = x.floor() as usize; + match (curve.get(i), curve.get(i + 1)) { + (Some(&a), Some(&b)) => a + (b - a) * (x - i as f32), + _ => last, + } +} + +fn quantise(v: f32, max: f32) -> f32 { + (v.clamp(0.0, 1.0) * max + 0.5).floor() +} + +#[cfg(test)] +#[path = "black_tests.rs"] +mod tests; diff --git a/crates/cms/src/black_tests.rs b/crates/cms/src/black_tests.rs new file mode 100644 index 000000000..8752cdaa2 --- /dev/null +++ b/crates/cms/src/black_tests.rs @@ -0,0 +1,149 @@ +use super::*; + +fn coated() -> &'static Profile { + Builtin::CoatedCmyk.profile() +} +fn fogra() -> &'static Profile { + Builtin::CoatedFogra39.profile() +} +fn opts() -> TransformOptions { + TransformOptions::default() +} + +/// L* of a CMYK colour under `p`, measured as the transform with `o` measures it. +fn lightness(p: &Profile, o: TransformOptions, cmyk: [f32; 4]) -> f32 { + let t = Transform::with_options(p, Builtin::LabD50.profile(), o).unwrap(); + let mut lab = [0.0f32; 3]; + t.eval(&cmyk, &mut lab).unwrap(); + lab[0] * 100.0 +} + +#[test] +fn the_plain_transform_turns_black_into_four_inks() { + // What the policy is for: without it, black alone gains chromatic ink across presses. + let t = Transform::with_options(coated(), fogra(), opts()).unwrap(); + let mut out = [0.0f32; 4]; + t.eval(&[0.0, 0.0, 0.0, 0.5], &mut out).unwrap(); + assert!(out[..3].iter().any(|v| *v > 0.01), "{out:?}"); +} + +#[test] +fn black_only_stays_black_only_on_every_path() { + for (src, dst) in [(coated(), fogra()), (fogra(), coated()), (fogra(), fogra())] { + let bp = BlackPreserving::new(src, dst, opts()).unwrap(); + for k in [0.0f32, 0.1, 0.5, 0.9, 1.0] { + for fast in [false, true] { + let mut out = [1.0f32; 4]; + if fast { bp.eval_fast(&[0.0, 0.0, 0.0, k], &mut out) } else { bp.eval(&[0.0, 0.0, 0.0, k], &mut out) }.unwrap(); + assert_eq!(out[..3], [0.0; 3], "k {k} fast {fast}"); + assert_eq!(out[3], bp.map_k(k)); + } + } + let src8: Vec = (0..=255u8).flat_map(|k| [0, 0, 0, k, 7]).collect(); + let mut dst8 = vec![0u8; src8.len()]; + bp.convert_u8(&src8, 5, &mut dst8, 5, true).unwrap(); + for (k, px) in dst8.as_chunks::<5>().0.iter().enumerate() { + assert_eq!(px[..3], [0; 3], "u8 k {k}"); + assert!((f32::from(px[3]) - bp.map_k(k as f32 / 255.0) * 255.0).abs() <= 0.5, "u8 k {k}: {}", px[3]); + assert_eq!(px[4], 7, "extra channel copied"); + } + let src16: Vec = (0..=64u16).flat_map(|k| [0, 0, 0, k * 1023]).collect(); + let mut dst16 = vec![0u16; src16.len()]; + bp.convert_u16(&src16, 4, &mut dst16, 4, false).unwrap(); + for (px, k) in dst16.as_chunks::<4>().0.iter().zip(src16.as_chunks::<4>().0) { + assert_eq!(px[..3], [0; 3], "u16 {k:?}"); + assert!((f32::from(px[3]) - bp.map_k(f32::from(k[3]) / 65535.0) * 65535.0).abs() <= 0.5, "u16 {k:?}: {}", px[3]); + } + let srcf: Vec = (0..=10).flat_map(|k| [0.0, 0.0, 0.0, k as f32 / 10.0]).collect(); + let mut dstf = vec![0.0f32; srcf.len()]; + bp.convert_f32(&srcf, 4, &mut dstf, 4, false).unwrap(); + for (px, k) in dstf.as_chunks::<4>().0.iter().zip(srcf.as_chunks::<4>().0) { + assert_eq!(*px, [0.0, 0.0, 0.0, bp.map_k(k[3])], "f32 {k:?}"); + } + } +} + +#[test] +fn the_destination_black_matches_the_source_lightness() { + // Measured worst error over 201 K steps, both directions, both intents, BPC on and off: + // 0.007 L*. + for intent in [Intent::RelativeColorimetric, Intent::Perceptual] { + for bpc in [true, false] { + let o = TransformOptions { intent, bpc, ..opts() }; + for (src, dst) in [(coated(), fogra()), (fogra(), coated())] { + let bp = BlackPreserving::new(src, dst, o).unwrap(); + let dst_black = lightness(dst, o, [0.0, 0.0, 0.0, 1.0]); + for k in [0.1f32, 0.3, 0.5, 0.7, 0.9, 1.0] { + let want = lightness(src, o, [0.0, 0.0, 0.0, k]); + if want <= dst_black { + assert_eq!(bp.map_k(k), 1.0, "darker than the destination's black clamps to K = 1"); + continue; + } + let got = lightness(dst, o, [0.0, 0.0, 0.0, bp.map_k(k)]); + assert!((got - want).abs() < 0.02, "{intent:?} bpc {bpc} k {k}: L* {got} for {want}"); + } + assert_eq!(bp.map_k(0.0), 0.0, "paper stays paper"); + assert!(bp.map_k(1.0) > 0.95, "full black stays near full black: {}", bp.map_k(1.0)); + assert!(bp.map_k(0.25) < bp.map_k(0.75)); + } + } + } + let same = BlackPreserving::new(fogra(), fogra(), opts()).unwrap(); + for k in [0.0f32, 0.2, 0.6, 1.0] { + assert!((same.map_k(k) - k).abs() < 1e-3, "{k} -> {}", same.map_k(k)); + } +} + +#[test] +fn colours_with_any_chromatic_ink_take_the_ordinary_path() { + let bp = BlackPreserving::new(coated(), fogra(), opts()).unwrap(); + for input in [[1e-6f32, 0.0, 0.0, 0.5], [0.0, 0.2, 0.0, 0.5], [0.3, 0.3, 0.3, 0.0], [0.0, 0.0, 1.0, 1.0]] { + let (mut a, mut b) = ([0.0f32; 4], [0.0f32; 4]); + bp.eval(&input, &mut a).unwrap(); + bp.transform().eval(&input, &mut b).unwrap(); + assert_eq!(a, b, "{input:?}"); + } + let src = [1u8, 0, 0, 128, 0, 1, 0, 128]; + let (mut a, mut b) = ([0u8; 8], [0u8; 8]); + bp.convert_u8(&src, 4, &mut a, 4, false).unwrap(); + bp.transform().convert_u8(&src, 4, &mut b, 4, false).unwrap(); + assert_eq!(a, b); +} + +#[test] +fn refusals_and_hostile_values() { + let srgb = Builtin::Srgb.profile(); + assert!(matches!(BlackPreserving::new(srgb, fogra(), opts()), Err(CmsError::InvalidArgument(_)))); + assert!(matches!(BlackPreserving::new(fogra(), srgb, opts()), Err(CmsError::InvalidArgument(_)))); + let abs = TransformOptions { intent: Intent::AbsoluteColorimetric, ..opts() }; + assert!(matches!(BlackPreserving::new(fogra(), coated(), abs), Err(CmsError::InvalidArgument(_)))); + let bp = BlackPreserving::new(coated(), fogra(), opts()).unwrap(); + for k in [f32::NAN, f32::INFINITY, f32::NEG_INFINITY, -1.0, 2.0] { + assert!((0.0..=1.0).contains(&bp.map_k(k)), "{k}"); + } + let mut out = [0.0f32; 4]; + assert!(bp.eval(&[0.0; 3], &mut out).is_err(), "short input"); + assert!(bp.convert_u8(&[0, 0, 0, 9, 0], 4, &mut [0u8; 4], 4, false).is_err(), "partial pixel"); + assert_eq!(invert(&[], 50.0), 0.0); + assert_eq!(invert(&[100.0], 50.0), 0.0); + assert_eq!(invert(&[100.0, 0.0], 150.0), 0.0); + assert_eq!(invert(&[100.0, 0.0], -5.0), 1.0); + assert!((invert(&[100.0, 50.0, 0.0], 25.0) - 0.75).abs() < 1e-12); + assert_eq!(map(&[], f32::INFINITY, 0.5), 0.0); +} + +#[test] +fn black_beyond_the_destination_maximum_maps_to_full_black_between_samples() { + // Source L* = 100 (1 - K), destination L* = 100 - 50 K: from K = 0.5 the source is darker + // than any destination black, and 0.5 falls between the 1024 samples. + let ramp = |f: fn(f64) -> f64| (0..K_SAMPLES).map(|i| f(i as f64 / (K_SAMPLES - 1) as f64)).collect::>(); + let (src, dst) = (ramp(|k| 100.0 * (1.0 - k)), ramp(|k| 100.0 - 50.0 * k)); + let (curve, saturate) = k_curve(&src, &dst).unwrap(); + assert!((saturate - 0.5).abs() < 1e-6, "{saturate}"); + for k in [0.5001f32, 0.6, 1.0] { + assert_eq!(map(&curve, saturate, k), 1.0, "{k}"); + } + assert!((map(&curve, saturate, 0.25) - 0.5).abs() < 1e-4); + let (_, never) = k_curve(&dst, &src).unwrap(); + assert_eq!(never, f32::INFINITY, "a lighter source never saturates"); +} diff --git a/crates/cms/src/lib.rs b/crates/cms/src/lib.rs index b082f67a5..38f926dcf 100644 --- a/crates/cms/src/lib.rs +++ b/crates/cms/src/lib.rs @@ -19,6 +19,7 @@ //! CIE 15, and Adobe's published black point compensation paper. #![forbid(unsafe_code)] +pub mod black; pub mod builtin; mod builtin_v2; pub mod clut; @@ -39,6 +40,7 @@ pub mod transform; mod write; pub mod write_v2; +pub use black::BlackPreserving; pub use builtin::Builtin; pub use clut::Clut; pub use curve::Curve; From 7983b10f94b0c77f2568172154daad183b0daac3 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 14:17:25 -0500 Subject: [PATCH 105/183] dex: bound retained handler descriptors and reject overflowing offsets --- crates/dex/src/dex.rs | 129 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 122 insertions(+), 7 deletions(-) diff --git a/crates/dex/src/dex.rs b/crates/dex/src/dex.rs index e578dc397..e25acb859 100644 --- a/crates/dex/src/dex.rs +++ b/crates/dex/src/dex.rs @@ -18,6 +18,9 @@ const MAX_MEMBERS: usize = 65_536; /// Most try blocks / handlers per method. const MAX_TRIES: usize = 4096; const MAX_HANDLERS: usize = 256; +/// Most handler descriptor bytes retained while reading one code item, however many try blocks +/// share a handler list. +const MAX_HANDLER_DESCRIPTOR_BYTES: usize = 1 << 20; #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize)] pub struct Header { @@ -469,10 +472,11 @@ impl<'a> Dex<'a> { } let n = r.u32_le(set_off as usize).unwrap_or(0) as usize; for i in 0..n.min(256) { - let Some(item) = r.u32_le(set_off as usize + 4 + i * 4) else { break }; + let Some(item_at) = (set_off as usize).checked_add(4).and_then(|base| base.checked_add(i * 4)) else { break }; + let Some(item) = r.u32_le(item_at) else { break }; // visibility u8, then encoded_annotation: uleb type_idx … - let vis = r.u8(item as usize).unwrap_or(0); - if let Some((t, _)) = r.uleb128(item as usize + 1) { + let (Some(vis), Some(annotation_at)) = (r.u8(item as usize), (item as usize).checked_add(1)) else { continue }; + if let Some((t, _)) = r.uleb128(annotation_at) { let v = match vis { 0 => "build", 1 => "runtime", @@ -500,8 +504,8 @@ impl<'a> Dex<'a> { }; let (Some(sf), Some(inf), Some(dm), Some(vm)) = (next(&mut pos), next(&mut pos), next(&mut pos), next(&mut pos)) else { return cd }; let remaining = self.data.len().saturating_sub(pos); - let total = [sf, inf, dm, vm].iter().map(|&x| x as usize).sum::(); - if total > remaining || total > MAX_MEMBERS * 4 { + let total: u64 = [sf, inf, dm, vm].iter().map(|&x| u64::from(x)).sum(); + if total > remaining as u64 || total > MAX_MEMBERS as u64 * 4 { return cd; } for (count, is_method, slot) in [(sf, false, 0), (inf, false, 1), (dm, true, 2), (vm, true, 3)] { @@ -559,7 +563,8 @@ impl<'a> Dex<'a> { t_off += 2; } let handlers_base = t_off + tries_size * 8; - for i in 0..tries_size.min(MAX_TRIES) { + let mut retained = 0usize; + 'tries: for i in 0..tries_size.min(MAX_TRIES) { let at = t_off + i * 8; let (Some(start), Some(count), Some(h_off)) = (r.u32_le(at), r.u16_le(at + 4), r.u16_le(at + 6)) else { break }; let mut handlers = Vec::new(); @@ -570,7 +575,13 @@ impl<'a> Dex<'a> { let Some((t, k1)) = r.uleb128(p) else { break }; let Some((addr, k2)) = r.uleb128(p + k1) else { break }; p += k1 + k2; - handlers.push(Handler { exception: Some(self.type_desc(t as u32)), address: addr as u32 }); + let desc = self.type_desc(t as u32); + let Some(next) = retained.checked_add(desc.len()) else { break 'tries }; + if next > MAX_HANDLER_DESCRIPTOR_BYTES { + break 'tries; + } + retained = next; + handlers.push(Handler { exception: Some(desc), address: addr as u32 }); } if size <= 0 && handlers.len() as u64 == size.unsigned_abs() @@ -812,4 +823,108 @@ mod tests { } } } + + fn bare_dex<'a>(data: &'a [u8], strings: Vec, types: Vec) -> Dex<'a> { + Dex { + data, + header: Header { + version: "035".into(), + checksum: String::new(), + checksum_ok: false, + signature: String::new(), + file_size: data.len() as u32, + header_size: 0x70, + endian_tag: String::new(), + string_ids: 0, + type_ids: 0, + proto_ids: 0, + field_ids: 0, + method_ids: 0, + class_defs: 0, + data_size: 0, + }, + strings, + types, + protos: Vec::new(), + fields: Vec::new(), + methods: Vec::new(), + classes: Vec::new(), + warnings: Vec::new(), + } + } + + #[test] + fn repeated_handler_lists_stop_at_the_descriptor_budget() { + let desc = format!("L{};", "a".repeat(16 * 1024)); + let mut data = vec![0u8; 4]; + data.extend_from_slice(&0u16.to_le_bytes()); + data.extend_from_slice(&0u16.to_le_bytes()); + data.extend_from_slice(&0u16.to_le_bytes()); + data.extend_from_slice(&(MAX_TRIES as u16).to_le_bytes()); + data.extend_from_slice(&0u32.to_le_bytes()); + data.extend_from_slice(&0u32.to_le_bytes()); + for _ in 0..MAX_TRIES { + data.extend_from_slice(&0u32.to_le_bytes()); + data.extend_from_slice(&1u16.to_le_bytes()); + data.extend_from_slice(&0u16.to_le_bytes()); + } + data.push(0x01); // sleb128: one typed handler + data.push(0x00); // type index 0 + data.push(0x00); // handler address + let d = bare_dex(&data, vec![desc.clone()], vec![0]); + let code = d.code(4).expect("code item"); + assert!(!code.tries.is_empty()); + assert!(code.tries.len() < MAX_TRIES, "read {} tries", code.tries.len()); + assert_eq!(code.tries[0].handlers[0].exception.as_deref(), Some(desc.as_str())); + let retained: usize = code.tries.iter().flat_map(|t| &t.handlers).filter_map(|h| h.exception.as_ref()).map(String::len).sum(); + assert!(retained <= MAX_HANDLER_DESCRIPTOR_BYTES, "{retained}"); + } + + #[test] + fn annotations_reject_an_unrepresentable_item_offset() { + let mut data = vec![0u8; 4]; + data.extend_from_slice(&8u32.to_le_bytes()); + data.extend_from_slice(&1u32.to_le_bytes()); + data.extend_from_slice(&u32::MAX.to_le_bytes()); + let d = bare_dex(&data, Vec::new(), Vec::new()); + let c = ClassDef { + class_idx: 0, + access: 0, + superclass_idx: 0, + interfaces_off: 0, + source_file_idx: 0, + annotations_off: 4, + class_data_off: 0, + static_values_off: 0, + }; + assert!(d.annotations(&c).is_empty()); + } + + #[test] + fn class_data_counts_do_not_overflow() { + let mut data = vec![0u8; 4]; + for mut x in [u32::MAX, 1, 0, 0] { + loop { + let b = (x & 0x7f) as u8; + x >>= 7; + if x == 0 { + data.push(b); + break; + } + data.push(b | 0x80); + } + } + let d = bare_dex(&data, Vec::new(), Vec::new()); + let c = ClassDef { + class_idx: 0, + access: 0, + superclass_idx: 0, + interfaces_off: 0, + source_file_idx: 0, + annotations_off: 0, + class_data_off: 4, + static_values_off: 0, + }; + assert!(!d.class_data(&c).complete); + } } From e1d883e444fe23a518feeab9f9c6b8a96774731b Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 17 Nov 2026 14:23:06 -0500 Subject: [PATCH 106/183] psd: share legacy guide record prefix decoding Adapt PhotoCraft parse_guides from 16941f7198, retaining signed-position semantics from 1a54384d80. Allocation-free framing preserves complete-prefix recovery. Co-authored-by: Dylan M. Taylor --- crates/psd/src/guides.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/crates/psd/src/guides.rs b/crates/psd/src/guides.rs index 5f100c480..a9d566e21 100644 --- a/crates/psd/src/guides.rs +++ b/crates/psd/src/guides.rs @@ -5,6 +5,29 @@ //! Unknown direction values retain PhotoCraft's vertical interpretation. Grid cycles, reserved //! bytes and trailing data are not interpreted. Resource 1097 remains opaque except its count. +/// One legacy Grid and Guides record (resource 1032). +/// Position is signed 1/32 pixel; direction 1 is horizontal, all others vertical. +/// Adapted from PhotoCraft's reader by Brandon Thomas and writer by aiongg. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct GuideV1 { + /// Signed position in units of 1/32 pixel. + pub location: i32, + /// Raw direction byte, retained without normalization. + pub direction: u8, +} + +/// Read complete legacy records, preserving the valid prefix on truncation. +/// Matches PhotoCraft recovery: version/grid fields are ignored. Declared counts +/// cannot drive allocation or scanning beyond complete records in the input. +pub fn parse_v1_prefix(data: &[u8]) -> impl Iterator + '_ { + let count = be_u32(data, 12).unwrap_or(0); + data.get(16..) + .unwrap_or_default() + .chunks_exact(5) + .zip(0..count) + .map(|(g, _)| GuideV1 { location: i32::from_be_bytes([g[0], g[1], g[2], g[3]]), direction: g[4] }) +} + /// Grid and Guides version 2 resource ID. pub const GUIDES_V2: u16 = 1092; /// Associated guide identifiers resource ID. From d55beb8f612bcedfe2af1907b8d2bef9fc548187 Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 17 Nov 2026 14:23:06 -0500 Subject: [PATCH 107/183] psd: share legacy guide header and record encoding Extract PhotoCraft guide framing from 2aa88b0956; leave rounding and document ordering with callers. Add fixed-byte and hostile-prefix coverage. Co-authored-by: Dylan M. Taylor --- crates/psd/src/guides.rs | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/crates/psd/src/guides.rs b/crates/psd/src/guides.rs index a9d566e21..f122c7805 100644 --- a/crates/psd/src/guides.rs +++ b/crates/psd/src/guides.rs @@ -16,6 +16,23 @@ pub struct GuideV1 { pub direction: u8, } +impl GuideV1 { + /// Encode exactly one five-byte record without allocation. + pub fn to_bytes(self) -> [u8; 5] { + let p = self.location.to_be_bytes(); + [p[0], p[1], p[2], p[3], self.direction] + } +} + +/// Encode a legacy resource header. Grid cycles and count are caller supplied. +pub fn header_v1(horizontal_cycle: u32, vertical_cycle: u32, count: u32) -> [u8; 16] { + let mut out = [0; 16]; + for (chunk, value) in out.chunks_exact_mut(4).zip([1u32, horizontal_cycle, vertical_cycle, count]) { + chunk.copy_from_slice(&value.to_be_bytes()); + } + out +} + /// Read complete legacy records, preserving the valid prefix on truncation. /// Matches PhotoCraft recovery: version/grid fields are ignored. Declared counts /// cannot drive allocation or scanning beyond complete records in the input. @@ -124,3 +141,31 @@ mod tests { assert_eq!(ids_count(&[0, 0, 0]), None); } } + +#[cfg(test)] +mod v1_tests { + use super::*; + + #[test] + fn wire_roundtrip_and_signed_unknown_direction() { + let entries = [GuideV1 { location: -33, direction: 1 }, GuideV1 { location: i32::MAX, direction: 255 }]; + let mut data = header_v1(576, 576, 2).to_vec(); + assert_eq!(data, [0, 0, 0, 1, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 0, 2]); + for e in entries { + data.extend(e.to_bytes()); + } + assert_eq!(&data[16..21], &[255, 255, 255, 223, 1]); + assert_eq!(parse_v1_prefix(&data).collect::>(), entries); + for end in 0..=data.len() { + assert_eq!(parse_v1_prefix(&data[..end]).count(), end.saturating_sub(16) / 5); + } + data[..4].copy_from_slice(&99u32.to_be_bytes()); + data[12..16].copy_from_slice(&u32::MAX.to_be_bytes()); + data.extend([9, 9, 9, 9]); + assert_eq!(parse_v1_prefix(&data).collect::>(), entries); + data[12..16].copy_from_slice(&1u32.to_be_bytes()); + assert_eq!(parse_v1_prefix(&data).collect::>(), &entries[..1]); + data[12..16].fill(0); + assert_eq!(parse_v1_prefix(&data).count(), 0); + } +} From ea0218294591cef788a8efe9e5b31f1d8dafc6a6 Mon Sep 17 00:00:00 2001 From: Martin Ball <98639962+benandez@users.noreply.github.com> Date: Tue, 17 Nov 2026 20:27:49 +0100 Subject: [PATCH 108/183] image-codecs: add jpeg_worst_case_coefficients (#778) (#2063) A conservative pre-decode coefficient budget for hostile JPEG headers: the larger of JpegInfo::held_coefficients and a whole-picture estimate over every progressive frame header (SOF2/6/10/14, any precision, sampling clamped to 1..=4), with the costliest frame charged at the first frame's size when the header can't be followed. held_coefficients is unchanged. Co-authored-by: Claude Opus 5.5 --- crates/image-codecs/src/codecs/jpeg.rs | 241 +++++++++++++++++++++++++ crates/image-codecs/src/lib.rs | 9 + 2 files changed, 250 insertions(+) diff --git a/crates/image-codecs/src/codecs/jpeg.rs b/crates/image-codecs/src/codecs/jpeg.rs index 415a5d717..56593a5f5 100644 --- a/crates/image-codecs/src/codecs/jpeg.rs +++ b/crates/image-codecs/src/codecs/jpeg.rs @@ -86,6 +86,83 @@ fn held_coefficients(marker: u8, seg: &[u8], scan_components: Option) -> u64 factors.iter().map(|&(fh, fv)| mcus * fh * fv * 64 * 2).sum() } +/// Bytes of DCT coefficients to budget for before decoding hostile `b`: the larger of +/// [`crate::JpegInfo::held_coefficients`]'s rule (first frame; SOF2, or SOF0/SOF1 whose first +/// scan lacks components; 8-bit only; sampling factors as written) and a coarser one that +/// keeps a progressive JPEG's coefficients for the whole picture: +/// - every SOF2, SOF6, SOF10 and SOF14 header before the first scan counts, at any precision, and +/// the largest wins; each charges 2 bytes a coefficient: per component, `2 * 64 * h * v` per +/// MCU, with `h` and `v` clamped to 1..=4 and the MCUs covering the frame at the largest `h`, `v`; +/// - a header that can't be followed (a segment that is cut, a length under 2, a frame header +/// without its components, no `0xFF` where a marker belongs) charges the costliest frame, +/// four components sampled 4 × 4, at the first frame's size (as `scan_metadata` reads it), and 0 without one. +/// +/// Never less than either rule. Frames `craft-jpeg` decodes (arithmetic, lossless, 12-bit) +/// enforce `max_alloc` on their own buffers, and SOF6/SOF14 (hierarchical) are not decoded at all, +/// so charging them is only a conservative budget. Arithmetic saturates; the scan is linear. +pub(crate) fn worst_case_coefficients(b: &[u8]) -> u64 { + let m = scan_metadata(b); + let mut at = 2usize; + let mut most = 0u64; + let first: Option<(u64, u64)> = m.frame.map(|(w, h, _)| (u64::from(w), u64::from(h))); + let mut broken = false; + while !broken { + if b.get(at) != Some(&0xFF) { + broken = true; + break; + } + while b.get(at) == Some(&0xFF) { + at += 1; + } + let Some(&code) = b.get(at) else { + broken = true; + break; + }; + at += 1; + match code { + 0xD8 | 0x01 | 0xD0..=0xD7 => continue, + 0xD9 | 0xDA => break, + _ => {} + } + let len = match (b.get(at), b.get(at + 1)) { + (Some(&hi), Some(&lo)) => usize::from(u16::from_be_bytes([hi, lo])), + _ => 0, + }; + let Some(seg) = (len >= 2).then(|| b.get(at + 2..at + len)).flatten() else { + broken = true; + break; + }; + if matches!(code, 0xC2 | 0xC6 | 0xCA | 0xCE) { + match progressive_frame_coefficients(seg) { + Some(held) => most = most.max(held), + None => { + broken = true; + break; + } + } + } + at += len; + } + if broken && let Some((w, h)) = first { + let mcus = w.div_ceil(32).saturating_mul(h.div_ceil(32)); + most = most.max(mcus.saturating_mul(2 * 64 * 16 * 4)); + } + most.max(m.held_coefficients) +} + +/// [`worst_case_coefficients`]'s charge for one frame header `sof` (after its length). +fn progressive_frame_coefficients(sof: &[u8]) -> Option { + let height = u64::from(u16::from_be_bytes([*sof.get(1)?, *sof.get(2)?])); + let width = u64::from(u16::from_be_bytes([*sof.get(3)?, *sof.get(4)?])); + let n = usize::from(*sof.get(5)?); + let comps = sof.get(6..6usize.checked_add(n.checked_mul(3)?)?)?; + let factors: Vec<(u64, u64)> = + comps.as_chunks::<3>().0.iter().map(|&[_, f, _]| (u64::from(f >> 4).clamp(1, 4), u64::from(f & 15).clamp(1, 4))).collect(); + let (hmax, vmax) = factors.iter().fold((1, 1), |(h, v), &(a, b)| (h.max(a), v.max(b))); + let mcus = width.div_ceil(8 * hmax).saturating_mul(height.div_ceil(8 * vmax)); + Some(factors.iter().fold(0u64, |sum, &(h, v)| sum.saturating_add(mcus.saturating_mul(2 * 64 * h * v)))) +} + /// Walk the marker segments up to SOS and collect metadata. pub(crate) fn scan_metadata(b: &[u8]) -> JpegMeta { let mut m = JpegMeta::default(); @@ -825,6 +902,170 @@ mod tests { assert_eq!(held(&frame(0xC2, 12, &[0x11, 0x11, 0x11], None)), Some(0)); } + /// The consumer's own estimate (WordCraft's `jpeg_coefficients`), ported as the oracle that + /// `worst_case_coefficients` must never undercut. + fn oracle(bytes: &[u8]) -> u64 { + fn worst(bytes: &[u8]) -> u64 { + let Some((w, h)) = info(bytes).map(|i| (i.width, i.height)) else { return 0 }; + let mcus = u64::from(w).div_ceil(32) * u64::from(h).div_ceil(32); + mcus.saturating_mul(2 * 64 * 16 * 4) + } + fn frame(sof: &[u8]) -> Option { + let height = u64::from(u16::from_be_bytes([*sof.get(1)?, *sof.get(2)?])); + let width = u64::from(u16::from_be_bytes([*sof.get(3)?, *sof.get(4)?])); + let n = usize::from(*sof.get(5)?); + let s: Vec<(u64, u64)> = sof + .get(6..6 + 3 * n)? + .as_chunks::<3>() + .0 + .iter() + .map(|&[_, s, _]| (u64::from(s >> 4).clamp(1, 4), u64::from(s & 15).clamp(1, 4))) + .collect(); + let (hm, vm) = s.iter().fold((1, 1), |(h, v), &(a, b)| (h.max(a), v.max(b))); + let mcus = width.div_ceil(8 * hm).checked_mul(height.div_ceil(8 * vm))?; + s.iter().try_fold(0u64, |sum, &(h, v)| sum.checked_add(mcus.checked_mul(2 * 64 * h * v)?)) + } + let mut at = 2; + let mut most = 0u64; + loop { + if bytes.get(at) != Some(&0xFF) { + return worst(bytes).max(most); + } + while bytes.get(at) == Some(&0xFF) { + at += 1; + } + let Some(&code) = bytes.get(at) else { return worst(bytes).max(most) }; + at += 1; + match code { + 0xD8 | 0x01 | 0xD0..=0xD7 => continue, + 0xD9 | 0xDA => return most, + _ => {} + } + let len = match (bytes.get(at), bytes.get(at + 1)) { + (Some(&hi), Some(&lo)) => usize::from(u16::from_be_bytes([hi, lo])), + _ => 0, + }; + let Some(seg) = bytes.get(at + 2..at + len).filter(|_| len >= 2) else { return worst(bytes).max(most) }; + if matches!(code, 0xC2 | 0xC6 | 0xCA | 0xCE) { + let Some(h) = frame(seg) else { return worst(bytes).max(most) }; + most = most.max(h); + } + at += len; + } + } + + /// A JPEG header: each frame is (marker, precision, width, height, sampling bytes), then an + /// optional scan of `scan` components, then EOI. + fn header(frames: &[(u8, u8, u16, u16, &[u8])], scan: Option) -> Vec { + let mut b = vec![0xFF, 0xD8]; + for &(marker, precision, w, h, f) in frames { + b.extend_from_slice(&[0xFF, marker]); + b.extend_from_slice(&(8 + 3 * f.len() as u16).to_be_bytes()); + b.push(precision); + b.extend_from_slice(&h.to_be_bytes()); + b.extend_from_slice(&w.to_be_bytes()); + b.push(f.len() as u8); + for (i, &s) in f.iter().enumerate() { + b.extend_from_slice(&[i as u8 + 1, s, 0]); + } + } + if let Some(n) = scan { + b.extend_from_slice(&[0xFF, 0xDA, 0, 6 + 2 * n, n]); + (1..=n).for_each(|c| b.extend_from_slice(&[c, 0])); + b.extend_from_slice(&[0, 63, 0]); + } + b.extend_from_slice(&[0xFF, 0xD9]); + b + } + + /// Never less than the oracle or `held_coefficients`; equal to the larger on valid headers. + #[test] + fn worst_case_coefficients_covers_both_rule_sets() { + const C3: &[u8] = &[0x22, 0x11, 0x11]; + const G: &[u8] = &[0x11]; + let cases: Vec> = vec![ + header(&[(0xC0, 8, 640, 480, C3)], Some(3)), + header(&[(0xC0, 8, 640, 480, G)], Some(1)), + header(&[(0xC0, 8, 640, 480, C3)], Some(1)), + header(&[(0xC1, 8, 640, 480, C3)], None), + header(&[(0xC2, 8, 640, 480, C3)], Some(1)), + header(&[(0xC2, 12, 640, 480, C3)], Some(1)), + header(&[(0xC6, 8, 640, 480, C3)], None), + header(&[(0xCA, 8, 640, 480, C3)], None), + header(&[(0xCE, 8, 640, 480, C3)], None), + header(&[(0xC0, 8, 64, 64, G), (0xC2, 8, 6000, 4000, C3), (0xC2, 8, 100, 100, C3)], Some(1)), + header(&[(0xC2, 8, 640, 480, &[0x00, 0x00, 0x00])], None), + header(&[(0xC2, 8, 640, 480, &[0xFF, 0xFF, 0xFF, 0xFF])], None), + header(&[(0xC2, 8, 65535, 65535, &[0x44; 4])], None), + header(&[(0xC0, 8, 65535, 65535, &[0xFF; 4])], Some(1)), + header(&[], None), + vec![0xFF, 0xD8], + vec![], + b"not a jpeg at all".to_vec(), + ]; + for b in &cases { + let held = scan_metadata(b).held_coefficients; + let got = worst_case_coefficients(b); + assert!(got >= oracle(b) && got >= held, "{b:02x?}"); + assert!(got >= info(b).map_or(0, |i| i.held_coefficients)); + } + let at = |i: usize| worst_case_coefficients(&cases[i]); + // Equal to the oracle where the shared rule charges nothing extra. + for i in [0, 1, 6, 7, 8, 9, 10, 12, 14] { + assert_eq!(at(i), oracle(&cases[i]), "case {i}"); + } + // Where it does, the shared figure wins (the oracle misses a short first scan). + assert_eq!(oracle(&cases[2]), 0); + assert_eq!(at(2), scan_metadata(&cases[2]).held_coefficients); + // Unclamped factors (15 × 15) charge the shared rule more than the clamped oracle. + assert_eq!(at(11), scan_metadata(&cases[11]).held_coefficients); + assert!(at(11) > oracle(&cases[11])); + assert!(at(2) > 0 && at(3) == 0 && at(0) == 0); + // 12-bit and arithmetic progressive frames are charged though craft-jpeg limits itself. + assert_eq!(at(5), at(4)); + // Sampling factors clamp: 0 acts as 1, 15 as 4. + assert_eq!(at(10), 80 * 60 * 3 * 128); + assert_eq!(at(12), 2048 * 2048 * 4 * 2 * 64 * 16); + // The largest of several frames wins. + assert_eq!(at(9), oracle(&header(&[(0xC2, 8, 6000, 4000, C3)], None))); + } + + /// A cut header charges the costliest frame at its size; every prefix and random damage stays + /// bounded, never panics and never undercuts the oracle. + #[test] + fn worst_case_coefficients_hostile_input() { + let full = header(&[(0xC2, 8, 6000, 4000, &[0x22, 0x11, 0x11])], Some(1)); + let cut = &full[..full.len() - 8]; + // Cut inside the component list: a frame the scan can't read, at its own size. + let sof_cut = &full[..14]; + assert_eq!(worst_case_coefficients(sof_cut), oracle(sof_cut)); + assert_eq!(worst_case_coefficients(cut), oracle(cut)); + let mut bases = vec![full.clone(), header(&[(0xC0, 8, 6000, 4000, &[0x11; 3])], Some(1))]; + bases.push(header(&[(0xC2, 8, 65535, 65535, &[0xFF; 4])], None)); + let mut seed = 0x9E37_79B9_7F4A_7C15u64; + let mut next = move || { + seed = seed.wrapping_mul(6_364_136_223_846_793_005).wrapping_add(1_442_695_040_888_963_407); + (seed >> 33) as usize + }; + for base in &bases { + for n in 0..=base.len() { + let b = &base[..n]; + let got = worst_case_coefficients(b); + assert!(got >= oracle(b) && got < 1 << 50); + } + for _ in 0..2000 { + let mut b = base.clone(); + for _ in 0..=next() % 4 { + let i = next() % b.len(); + b[i] = next() as u8; + } + b.truncate(next() % (b.len() + 1)); + let got = worst_case_coefficients(&b); + assert!(got >= oracle(&b) && got >= scan_metadata(&b).held_coefficients && got < 1 << 50); + } + } + } + /// An APP1 Extended XMP fragment (GUID, total size, offset, data). fn extended_xmp(offset: u32) -> Vec { let mut seg = EXTENDED_XMP_HEADER.to_vec(); diff --git a/crates/image-codecs/src/lib.rs b/crates/image-codecs/src/lib.rs index dc2ac2933..47e3f12e3 100644 --- a/crates/image-codecs/src/lib.rs +++ b/crates/image-codecs/src/lib.rs @@ -307,6 +307,15 @@ pub fn jpeg_info(bytes: &[u8]) -> Option { jpeg::info(bytes) } +/// Bytes of DCT coefficients to budget for a JPEG before decoding it: never less than +/// [`JpegInfo::held_coefficients`] nor than the whole-picture estimate of every progressive +/// frame header (SOF2, SOF6, SOF10, SOF14 at any precision, sampling clamped to 1..=4), and the +/// costliest frame at the first size read when the header can't be followed. 0 without a +/// readable frame. See the function body's rules for the precise charges. +pub fn jpeg_worst_case_coefficients(bytes: &[u8]) -> u64 { + jpeg::worst_case_coefficients(bytes) +} + /// PCX's dimensions are available from its fixed-size header without decoding the RLE rows. pub fn pcx_dimensions(bytes: &[u8]) -> Option<(u32, u32)> { codecs::pcx::dimensions(bytes) From 1928693fbb7a4f8e6b945e614b2fac3e181476ea Mon Sep 17 00:00:00 2001 From: Martin Ball <98639962+benandez@users.noreply.github.com> Date: Tue, 17 Nov 2026 20:27:53 +0100 Subject: [PATCH 109/183] image-codecs: header-only PNG pixel model and WebP alpha probes (#778) (#2064) png_probe::pixel_model reads width, height, bit depth, colour type and tRNS presence from IHDR and the chunk headers before IDAT without inflating iCCP; PixelModel::bytes_per_pixel and has_alpha give a caller's pixel size and alpha. webp_probe::has_alpha reads the VP8X alpha flag, the VP8L alpha_is_used bit, and treats plain VP8 as opaque. Differential tests compare against WordCraft's png_chunks as an oracle. Co-authored-by: Claude Opus 5.5 --- crates/image-codecs/src/png_probe.rs | 223 ++++++++++++++++++++++++++ crates/image-codecs/src/webp_probe.rs | 54 +++++++ 2 files changed, 277 insertions(+) diff --git a/crates/image-codecs/src/png_probe.rs b/crates/image-codecs/src/png_probe.rs index 73f1199eb..e7af74334 100644 --- a/crates/image-codecs/src/png_probe.rs +++ b/crates/image-codecs/src/png_probe.rs @@ -136,6 +136,93 @@ pub fn color_chunks(b: &[u8]) -> Option { Some(result) } +/// Most chunks [`pixel_model`] walks before the image data; each chunk is at least 12 bytes. +const MAX_PROBE_CHUNKS: usize = 1 << 16; + +/// Pixel model of a PNG, from `IHDR` and the chunk headers before the first `IDAT`. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct PixelModel { + pub width: u32, + pub height: u32, + /// `IHDR` bit depth (1, 2, 4, 8 or 16). + pub bit_depth: u8, + /// `IHDR` colour type (0 grey, 2 RGB, 3 palette, 4 grey+alpha, 6 RGBA). + pub color_type: u8, + /// A `tRNS` chunk precedes the image data; it adds alpha to grey, RGB and palette images. + pub has_trns: bool, +} + +impl PixelModel { + /// Channels of the decoded buffer (palette expands to RGB; `tRNS` adds an alpha channel). + pub fn channels(&self) -> u8 { + let base = match self.color_type { + 0 => 1, + 2 | 3 => 3, + 4 => 2, + _ => 4, + }; + base + u8::from(self.has_trns && matches!(self.color_type, 0 | 2 | 3)) + } + + /// Bytes per pixel of the buffer a decoder that expands sub-byte samples to 8 bits gives: + /// `channels * (2 if bit_depth == 16 else 1)`. + pub fn bytes_per_pixel(&self) -> u8 { + self.channels() * if self.bit_depth == 16 { 2 } else { 1 } + } + + /// Whether the image has transparency (alpha colour type or `tRNS`). + pub fn has_alpha(&self) -> bool { + matches!(self.color_type, 4 | 6) || self.has_trns + } +} + +/// Dimensions, bit depth, colour type and `tRNS` presence without inflating anything (an `iCCP` +/// profile is skipped, not decompressed). Walks at most 65,536 chunk headers and stops at `IDAT`; +/// `IEND` or the end of the input before `IDAT` is an error. Does not validate CRCs. +/// A caller gets its `(width, height, bytes_per_pixel, alpha)` as +/// `(m.width, m.height, u64::from(m.bytes_per_pixel()), m.has_alpha())`. +pub fn pixel_model(b: &[u8]) -> Result { + if !b.starts_with(b"\x89PNG\r\n\x1a\n") { + return Err(err("bad signature")); + } + let be32 = |p: usize| b.get(p..p.checked_add(4)?).and_then(|v| <[u8; 4]>::try_from(v).ok()).map(u32::from_be_bytes); + if be32(8) != Some(13) || b.get(12..16) != Some(b"IHDR") { + return Err(err("missing IHDR")); + } + let ihdr = b.get(16..29).ok_or_else(|| err("truncated IHDR"))?; + let (width, height) = (be32(16).unwrap_or(0), be32(20).unwrap_or(0)); + let (bit_depth, color_type) = (ihdr[8], ihdr[9]); + if width == 0 || height == 0 || width > i32::MAX as u32 || height > i32::MAX as u32 { + return Err(err("dimensions out of range")); + } + let depth_ok = match color_type { + 0 => matches!(bit_depth, 1 | 2 | 4 | 8 | 16), + 3 => matches!(bit_depth, 1 | 2 | 4 | 8), + 2 | 4 | 6 => matches!(bit_depth, 8 | 16), + _ => false, + }; + if !depth_ok { + return Err(err("invalid IHDR")); + } + let mut has_trns = false; + let mut p = 8usize; + for _ in 0..MAX_PROBE_CHUNKS { + let len = be32(p).ok_or_else(|| err("truncated"))?; + let kind = p.checked_add(4).and_then(|k| b.get(k..k.checked_add(4)?)).ok_or_else(|| err("truncated"))?; + match kind { + b"IDAT" => return Ok(PixelModel { width, height, bit_depth, color_type, has_trns }), + b"IEND" => return Err(err("no image data")), + b"tRNS" => has_trns = true, + _ => {} + } + if len > i32::MAX as u32 { + return Err(err("chunk length out of range")); + } + p = p.checked_add(12).and_then(|q| q.checked_add(len as usize)).ok_or_else(|| err("truncated"))?; + } + Err(CodecError::LimitExceeded("PNG chunk count".into())) +} + #[cfg(test)] mod tests { use super::*; @@ -187,4 +274,140 @@ mod tests { assert!(!color.srgb); assert!(color_chunks(b"not png").is_none()); } + + /// WordCraft's `png_chunks` (crates/geom/src/picture.rs) as the differential oracle. + fn oracle(bytes: &[u8]) -> Option<(u32, u32, u64, bool)> { + let be = |at: usize| bytes.get(at..at.checked_add(4)?).and_then(|b| <[u8; 4]>::try_from(b).ok()).map(u32::from_be_bytes); + if bytes.get(12..16) != Some(b"IHDR".as_slice()) { + return None; + } + let (width, height) = (be(16)?, be(20)?); + let (depth, color) = (*bytes.get(24)?, *bytes.get(25)?); + let mut trns = false; + let mut at = 8usize; + loop { + let len = usize::try_from(be(at)?).ok()?; + match bytes.get(at.checked_add(4)?..at.checked_add(8)?)? { + b"IDAT" => break, + b"IEND" => return None, + b"tRNS" => trns = true, + _ => {} + } + at = at.checked_add(12)?.checked_add(len)?; + } + let (channels, alpha) = match color { + 0 => (1 + u64::from(trns), trns), + 2 | 3 => (3 + u64::from(trns), trns), + 4 => (2, true), + 6 => (4, true), + _ => return None, + }; + Some((width, height, channels * if depth == 16 { 2 } else { 1 }, alpha)) + } + + fn tuple(b: &[u8]) -> Option<(u32, u32, u64, bool)> { + pixel_model(b).ok().map(|m| (m.width, m.height, u64::from(m.bytes_per_pixel()), m.has_alpha())) + } + + fn png_with(depth: u8, color: u8, before_idat: &[(&[u8; 4], Vec)]) -> Vec { + let mut bytes = b"\x89PNG\r\n\x1a\n".to_vec(); + let mut ihdr = Vec::new(); + ihdr.extend_from_slice(&5u32.to_be_bytes()); + ihdr.extend_from_slice(&7u32.to_be_bytes()); + ihdr.extend_from_slice(&[depth, color, 0, 0, 0]); + chunk(&mut bytes, b"IHDR", &ihdr); + for (k, d) in before_idat { + chunk(&mut bytes, k, d); + } + chunk(&mut bytes, b"IDAT", &[1, 2, 3]); + chunk(&mut bytes, b"IEND", &[]); + bytes + } + + #[test] + fn pixel_model_matches_oracle_for_every_color_type_depth_and_trns() { + let valid: [(u8, &[u8]); 5] = [(0, &[1, 2, 4, 8, 16]), (2, &[8, 16]), (3, &[1, 2, 4, 8]), (4, &[8, 16]), (6, &[8, 16])]; + for (color, depths) in valid { + for &depth in depths { + for trns in [false, true] { + let extra: Vec<(&[u8; 4], Vec)> = if trns { vec![(b"tRNS", vec![0, 0])] } else { vec![] }; + let bytes = png_with(depth, color, &extra); + assert!(tuple(&bytes).is_some(), "color {color} depth {depth}"); + assert_eq!(tuple(&bytes), oracle(&bytes), "color {color} depth {depth} trns {trns}"); + } + } + } + } + + #[test] + fn pixel_model_known_values() { + let m = pixel_model(&png_with(16, 2, &[(b"tRNS", vec![0; 6])])).unwrap(); + assert_eq!((m.width, m.height, m.channels(), m.bytes_per_pixel(), m.has_alpha()), (5, 7, 4, 8, true)); + let m = pixel_model(&png_with(4, 3, &[])).unwrap(); + assert_eq!((m.bytes_per_pixel(), m.has_alpha()), (3, false)); + } + + #[test] + fn pixel_model_skips_a_huge_iccp_without_inflating() { + let junk = vec![0xAB; 20 << 20]; + let bytes = png_with(8, 2, &[(b"iCCP", junk), (b"tRNS", vec![0; 6])]); + assert_eq!(tuple(&bytes), oracle(&bytes)); + assert_eq!(tuple(&bytes), Some((5, 7, 4, true))); + } + + #[test] + fn pixel_model_malformed_inputs_agree_with_oracle_and_never_panic() { + let full = png_with(8, 6, &[(b"tRNS", vec![0]), (b"gAMA", vec![0; 4])]); + for n in 0..=full.len() { + let cut = &full[..n]; + let got = tuple(cut); + // an Err where the oracle answers can only be a stricter header check + if got.is_some() { + assert_eq!(got, oracle(cut), "prefix {n}"); + } + } + assert!(pixel_model(&full[..33]).is_err()); + // missing IHDR + let mut bad = full.clone(); + bad[12..16].copy_from_slice(b"IHDX"); + assert!(pixel_model(&bad).is_err() && oracle(&bad).is_none()); + // chunk length overflow: a length past the input, then one past i32::MAX + for len in [u32::MAX, i32::MAX as u32, 0x7fff_fff0] { + let mut o = full.clone(); + o[33..37].copy_from_slice(&len.to_be_bytes()); + assert!(pixel_model(&o).is_err(), "len {len:#x}"); + assert_eq!(tuple(&o), oracle(&o)); + } + // IEND before IDAT, unknown colour type, zero size, bad signature + let mut iend = png_with(8, 2, &[]); + let at = iend.windows(4).position(|w| w == b"IDAT").unwrap(); + iend[at..at + 4].copy_from_slice(b"IEND"); + assert!(pixel_model(&iend).is_err() && oracle(&iend).is_none()); + assert!(pixel_model(&png_with(8, 5, &[])).is_err()); + let mut zero = png_with(8, 2, &[]); + zero[16..20].copy_from_slice(&0u32.to_be_bytes()); + assert!(pixel_model(&zero).is_err()); + assert!(pixel_model(b"not a png").is_err()); + // deterministic pseudo-random corruption + let mut s = 0x9e37_79b9u32; + for _ in 0..2000 { + let mut f = full.clone(); + for _ in 0..3 { + s = s.wrapping_mul(1_664_525).wrapping_add(1_013_904_223); + let i = (s >> 8) as usize % f.len(); + f[i] = (s >> 24) as u8; + } + let _ = pixel_model(&f); + } + } + + #[test] + fn pixel_model_many_tiny_chunks_and_the_chunk_cap() { + let many: Vec<(&[u8; 4], Vec)> = (0..10_000).map(|_| (b"tEXt", Vec::new())).chain([(b"tRNS", vec![0])]).collect(); + let bytes = png_with(8, 0, &many); + assert_eq!(tuple(&bytes), oracle(&bytes)); + assert_eq!(tuple(&bytes), Some((5, 7, 2, true))); + let over: Vec<(&[u8; 4], Vec)> = (0..MAX_PROBE_CHUNKS + 1).map(|_| (b"tEXt", Vec::new())).collect(); + assert!(matches!(pixel_model(&png_with(8, 0, &over)), Err(CodecError::LimitExceeded(_)))); + } } diff --git a/crates/image-codecs/src/webp_probe.rs b/crates/image-codecs/src/webp_probe.rs index 4a31def00..1c22411dc 100644 --- a/crates/image-codecs/src/webp_probe.rs +++ b/crates/image-codecs/src/webp_probe.rs @@ -32,6 +32,25 @@ pub fn header(bytes: &[u8]) -> Result<(u32, u32, u16), CodecError> { Ok((w, h, orientation)) } +/// Whether a WebP carries transparency, from the first chunk only (nothing is decoded): +/// `VP8X` flag bit 0x10, `VP8L` `alpha_is_used`, plain `VP8` never. +pub fn has_alpha(bytes: &[u8]) -> Result { + let err = |s: &str| CodecError::malformed(Format::WebP, s); + if bytes.get(..4) != Some(b"RIFF") || bytes.get(8..12) != Some(b"WEBP") { + return Err(err("bad signature")); + } + match bytes.get(12..16) { + Some(b"VP8X") => Ok(bytes.get(20).ok_or_else(|| err("truncated VP8X"))? & 0x10 != 0), + // 0x2f signature byte, then 14+14 size bits, then the alpha_is_used bit (bit 28) + Some(b"VP8L") => match bytes.get(20..25) { + Some([0x2f, a, b, c, d]) => Ok(u32::from_le_bytes([*a, *b, *c, *d]) >> 28 & 1 != 0), + _ => Err(err("bad VP8L header")), + }, + Some(b"VP8 ") => Ok(false), + _ => Err(err("no image data")), + } +} + #[cfg(test)] mod tests { use super::*; @@ -71,4 +90,39 @@ mod tests { bytes.push(0); assert!(header(&bytes).is_err()); } + + #[test] + fn has_alpha_reads_vp8x_vp8l_and_plain_vp8() { + for (layout, want) in [(crate::ChannelLayout::Rgb, false), (crate::ChannelLayout::Rgba, true)] { + let n = layout.channels(); + let image = crate::Image::from_u8(2, 3, layout, vec![42; 6 * n]).unwrap(); + let bytes = crate::encode(&image, Format::WebP, &crate::EncodeOptions::default()).unwrap(); + assert_eq!(has_alpha(&bytes).unwrap(), want); + } + let riff = |chunk: &[u8; 4], body: &[u8]| { + let mut v = b"RIFF\0\0\0\0WEBP".to_vec(); + v.extend_from_slice(chunk); + v.extend_from_slice(&(body.len() as u32).to_le_bytes()); + v.extend_from_slice(body); + v + }; + let mut x = [0u8; 10]; + assert!(!has_alpha(&riff(b"VP8X", &x)).unwrap()); + x[0] = 0x10; + assert!(has_alpha(&riff(b"VP8X", &x)).unwrap()); + assert!(!has_alpha(&riff(b"VP8 ", &[0; 10])).unwrap()); + assert!(has_alpha(&riff(b"VP8L", &[0x2f, 0, 0, 0, 0x10])).unwrap()); + assert!(!has_alpha(&riff(b"VP8L", &[0x2f, 0, 0, 0, 0])).unwrap()); + } + + #[test] + fn has_alpha_rejects_malformed_prefixes() { + let full = [b"RIFF\0\0\0\0WEBPVP8X\x0a\0\0\0".as_slice(), &[0x10; 10]].concat(); + for n in 0..20 { + assert!(has_alpha(&full[..n]).is_err(), "prefix {n}"); + } + assert!(has_alpha(&full[..21]).is_ok()); + assert!(has_alpha(b"RIFF\0\0\0\0WEBPVP8L\x05\0\0\0\x2e").is_err()); + assert!(has_alpha(b"junk").is_err()); + } } From 3e82d1719cb0c6a5e0e4978a73d6893072c2ce17 Mon Sep 17 00:00:00 2001 From: Martin Ball <98639962+benandez@users.noreply.github.com> Date: Tue, 17 Nov 2026 20:45:52 +0100 Subject: [PATCH 110/183] craft-mcp-server: options for apps that report argument errors as tool results (#2061) * craft-mcp-server: options for apps that report argument errors as tool results (#778) Add `Options` (default = today's behaviour) and `Server::with_options`: - `website_url`: sent as `serverInfo.websiteUrl` at `initialize`. - `tool_errors_as_results`: a `tools/call` whose arguments fail the schema check, or whose tool is unknown, returns a tool result with `isError: true` and the message as text, not -32602. - `strict_request_ids`: a request id that is not a string or number gets -32600 with a null id. `Info` is unchanged, so existing struct-literal callers still compile. Tests cover each option on and off, and hostile input with all options on. Co-Authored-By: Claude Opus 5.5 * craft-mcp-server: strict request ids also apply to the missing-method error (#778) With strict_request_ids, a message without `method` echoed an object, array or bool id in its -32600 reply. It now answers with a null id for any id that is not a string or number, as the later strict check does. Valid ids, absent ids and incoming responses behave as before. Co-Authored-By: Claude Sonnet 5.5 --------- Co-authored-by: Claude Opus 5.5 --- crates/mcp-server/src/lib.rs | 2 +- crates/mcp-server/src/server.rs | 45 +++++++++-- crates/mcp-server/src/tests.rs | 131 +++++++++++++++++++++++++++++++- 3 files changed, 171 insertions(+), 7 deletions(-) diff --git a/crates/mcp-server/src/lib.rs b/crates/mcp-server/src/lib.rs index 17e6827c4..66568fc05 100644 --- a/crates/mcp-server/src/lib.rs +++ b/crates/mcp-server/src/lib.rs @@ -15,7 +15,7 @@ mod server; pub use content::{Contents, base64, image_result, text_result}; pub use schema::{Effect, check_arguments, object, string, tool}; -pub use server::{Incoming, Info, PROTOCOL_VERSION, Reference, SUPPORTED_VERSIONS, Server, Tools, read_message, response}; +pub use server::{Incoming, Info, Options, PROTOCOL_VERSION, Reference, SUPPORTED_VERSIONS, Server, Tools, read_message, response}; #[cfg(test)] mod tests; diff --git a/crates/mcp-server/src/server.rs b/crates/mcp-server/src/server.rs index b7ed05027..e0d064da5 100644 --- a/crates/mcp-server/src/server.rs +++ b/crates/mcp-server/src/server.rs @@ -4,7 +4,7 @@ use std::io::{BufRead, Write}; use serde_json::{Value, json}; -use crate::content::Contents; +use crate::content::{Contents, text_result}; use crate::schema::{check_arguments, check_prompt_arguments}; /// The newest protocol revision we speak; offered when the client asks for one we don't know. @@ -88,9 +88,25 @@ pub struct Info { pub max_line: usize, } +/// Opt-in behaviour for apps with their own conventions; `Options::default()` is what [`Server::new`] +/// does. Set with [`Server::with_options`]. +#[derive(Clone, Debug, Default)] +pub struct Options { + /// Sent as `serverInfo.websiteUrl` at `initialize` (MCP 2025-06-18) when set. + pub website_url: Option, + /// Report a `tools/call` whose arguments fail the check against the tool's schema, or whose + /// tool is unknown, as a tool result with `isError: true` and the message as text, not as a + /// JSON-RPC -32602 error. For apps whose clients read every tool failure from the result. + pub tool_errors_as_results: bool, + /// Refuse a request whose `id` is neither a string nor a number (JSON-RPC 2.0) with -32600 and + /// a null id, instead of echoing the id back. + pub strict_request_ids: bool, +} + /// An MCP server over the app's [`Tools`]. pub struct Server { info: Info, + options: Options, tools: T, initialized: bool, } @@ -157,7 +173,13 @@ pub fn response(id: Value, result: Value) -> Value { impl Server { pub fn new(info: Info, tools: T) -> Self { - Self { info, tools, initialized: false } + Self { info, options: Options::default(), tools, initialized: false } + } + /// This server with `options` ([`Options`]) in place of the defaults. + #[must_use] + pub fn with_options(mut self, options: Options) -> Self { + self.options = options; + self } pub fn tools(&mut self) -> &mut T { &mut self.tools @@ -215,7 +237,11 @@ impl Server { if o.contains_key("result") || o.contains_key("error") { return None; } - return Some(error(id.unwrap_or(Value::Null), INVALID_REQUEST, "missing `method`")); + let echoed = match id { + Some(id) if !self.options.strict_request_ids || id.is_string() || id.is_number() => id, + _ => Value::Null, + }; + return Some(error(echoed, INVALID_REQUEST, "missing `method`")); }; let params = o.get("params").cloned().unwrap_or(Value::Null); let Some(id) = id else { @@ -224,6 +250,9 @@ impl Server { } return None; }; + if self.options.strict_request_ids && !(id.is_string() || id.is_number()) { + return Some(error(Value::Null, INVALID_REQUEST, "`id` must be a string or number")); + } Some(match self.request(method, ¶ms) { Ok(r) => response(id, r), Err((code, m)) => error(id, code, m), @@ -236,10 +265,14 @@ impl Server { let asked = params.get("protocolVersion").and_then(Value::as_str).unwrap_or(PROTOCOL_VERSION); let version = if SUPPORTED_VERSIONS.contains(&asked) { asked } else { PROTOCOL_VERSION }; let Info { name, title, version: server_version, .. } = self.info; + let mut server_info = json!({"name": name, "title": title, "version": server_version}); + if let Some(url) = &self.options.website_url { + server_info["websiteUrl"] = json!(url); + } Ok(json!({ "protocolVersion": version, "capabilities": self.capabilities(), - "serverInfo": {"name": name, "title": title, "version": server_version}, + "serverInfo": server_info, "instructions": self.tools.instructions(), })) } @@ -251,7 +284,9 @@ impl Server { None | Some(Value::Null) => json!({}), Some(a) => a.clone(), }; - check_arguments(&self.tools.list(), name, &args).map_err(|e| (INVALID_PARAMS, e))?; + if let Err(e) = check_arguments(&self.tools.list(), name, &args) { + return if self.options.tool_errors_as_results { Ok(text_result(e, true)) } else { Err((INVALID_PARAMS, e)) }; + } Ok(self.tools.call(name, &args)) } "resources/list" => Ok(json!({"resources": self.tools.resources()})), diff --git a/crates/mcp-server/src/tests.rs b/crates/mcp-server/src/tests.rs index b687ee2e8..3f8f8d315 100644 --- a/crates/mcp-server/src/tests.rs +++ b/crates/mcp-server/src/tests.rs @@ -1,7 +1,8 @@ use serde_json::{Value, json}; use crate::{ - Contents, Effect, Info, PROTOCOL_VERSION, Reference, SUPPORTED_VERSIONS, Server, Tools, check_arguments, object, string, text_result, tool, + Contents, Effect, Info, Options, PROTOCOL_VERSION, Reference, SUPPORTED_VERSIONS, Server, Tools, check_arguments, object, string, text_result, + tool, }; /// One app's tools: `echo` and `level`, nothing behind them (no engine, no design). `log` records @@ -366,3 +367,131 @@ fn every_call_runs_right_after_its_listing() { reply(&mut s, &json!([call("level", json!({})), call("echo", json!({"text": "b"}))])); assert_eq!(s.tools().log, ["list", "list", "call echo", "list", "list", "call level", "list", "call echo"]); } + +fn with(options: Options) -> Server { + Server::new(info(), Echo::default()).with_options(options) +} + +fn call_msg(id: u64, name: &str, args: Value) -> Value { + json!({"jsonrpc": "2.0", "id": id, "method": "tools/call", "params": {"name": name, "arguments": args}}) +} + +/// `websiteUrl` is sent only when set. +#[test] +fn website_url_is_sent_only_when_set() { + let init = json!({"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}}); + let off = reply(&mut with(Options::default()), &init).unwrap(); + assert!(off["result"]["serverInfo"].get("websiteUrl").is_none(), "{off}"); + let on = reply(&mut with(Options { website_url: Some("https://example.org/echo".into()), ..Options::default() }), &init).unwrap(); + assert_eq!(on["result"]["serverInfo"]["websiteUrl"], "https://example.org/echo"); + assert_eq!(on["result"]["serverInfo"]["name"], "echo"); +} + +/// With `tool_errors_as_results`, argument failures and unknown tools are `isError` results that +/// carry the message and never run the tool; other errors stay JSON-RPC errors. +#[test] +fn tool_errors_as_results_replaces_invalid_params() { + let mut s = with(Options { tool_errors_as_results: true, ..Options::default() }); + let bad = [ + call_msg(1, "echo", json!({})), + call_msg(2, "echo", json!({"text": 3})), + call_msg(3, "echo", json!({"text": "a", "loud": true})), + call_msg(4, "shout", json!({})), + call_msg(5, "echo", json!([])), + call_msg(6, "echo", json!("text")), + call_msg(7, "echo", json!(7)), + ]; + for msg in &bad { + let r = reply(&mut s, msg).unwrap(); + assert!(r.get("error").is_none(), "{r}"); + assert_eq!(r["result"]["isError"], true, "{r}"); + assert!(r["result"]["content"][0]["text"].as_str().is_some_and(|t| !t.is_empty()), "{r}"); + } + let r = reply(&mut s, &bad[0]).unwrap(); + assert_eq!(r["result"]["content"][0]["text"], "echo: missing required argument `text`"); + assert!(s.tools().calls.is_empty()); + let ok = reply(&mut s, &call_msg(8, "echo", json!({"text": "hi"}))).unwrap(); + assert_eq!(ok["result"], json!({"content": [{"type": "text", "text": "hi"}]})); + let nomethod = reply(&mut s, &json!({"jsonrpc": "2.0", "id": 9, "method": "nope"})).unwrap(); + assert_eq!(nomethod["error"]["code"], -32601); + let noname = reply(&mut s, &json!({"jsonrpc": "2.0", "id": 10, "method": "tools/call", "params": {}})).unwrap(); + assert_eq!(noname["error"]["code"], -32602); + // Unchanged with the option off. + let mut off = with(Options::default()); + for msg in &bad { + assert_eq!(reply(&mut off, msg).unwrap()["error"]["code"], -32602); + } +} + +/// With `strict_request_ids`, an id that is not a string or number is -32600 with a null id; the +/// tool never runs. Off, such ids are echoed as before. Notifications have no id and are unaffected. +#[test] +fn strict_request_ids_refuse_other_id_types() { + let odd = [json!(null), json!(true), json!({"a": 1}), json!([1])]; + let mut on = with(Options { strict_request_ids: true, ..Options::default() }); + let mut off = with(Options::default()); + for id in &odd { + let msg = json!({"jsonrpc": "2.0", "id": id, "method": "tools/call", "params": {"name": "echo", "arguments": {"text": "x"}}}); + let r = reply(&mut on, &msg).unwrap(); + assert_eq!(r["error"]["code"], -32600, "{id}: {r}"); + assert_eq!(r["id"], Value::Null); + let r = reply(&mut off, &json!({"jsonrpc": "2.0", "id": id, "method": "ping"})).unwrap(); + assert_eq!(r["id"], *id); + assert_eq!(r["result"], json!({})); + } + assert!(on.tools().calls.is_empty()); + for id in [json!("a"), json!(1), json!(1.5), json!(-3)] { + let r = reply(&mut on, &json!({"jsonrpc": "2.0", "id": id, "method": "ping"})).unwrap(); + assert_eq!(r["result"], json!({}), "{id}"); + } + assert!(reply(&mut on, ¬ification()).is_none()); +} + +/// The missing-`method` error follows the same id rule: strict mode echoes only string and number +/// ids and answers with a null id for the rest; off, ids are echoed as before. +#[test] +fn strict_request_ids_apply_to_the_missing_method_error() { + let mut on = with(Options { strict_request_ids: true, ..Options::default() }); + let mut off = with(Options::default()); + for id in [json!(true), json!({"a": 1}), json!([1])] { + let msg = json!({"jsonrpc": "2.0", "id": id}); + let r = reply(&mut on, &msg).unwrap(); + assert_eq!((r["error"]["code"].clone(), r["id"].clone()), (json!(-32600), Value::Null), "{id}"); + assert_eq!(reply(&mut off, &msg).unwrap()["id"], id); + } + for id in [json!("a"), json!(7)] { + assert_eq!(reply(&mut on, &json!({"jsonrpc": "2.0", "id": id})).unwrap()["id"], id); + } + assert_eq!(reply(&mut on, &json!({"jsonrpc": "2.0"})).unwrap()["id"], Value::Null); +} + +/// Hostile input with every option on: oversized and non-UTF-8 lines, odd ids and wrongly typed +/// arguments are answered and serving goes on, and nothing panics. +#[test] +fn every_option_on_survives_hostile_input() { + let mut input = vec![b'x'; (1 << 16) + 10]; + input.push(b'\n'); + input.extend_from_slice(b"\xff\xfe\n"); + for id in ["null", "true", "{}", "[]", "\"s\"", "1e999"] { + input.extend_from_slice( + format!( + "{{\"jsonrpc\":\"2.0\",\"id\":{id},\"method\":\"tools/call\",\"params\":{{\"name\":\"echo\",\"arguments\":{{\"text\":{id}}}}}}}\n" + ) + .as_bytes(), + ); + } + for args in ["null", "1", "\"a\"", "[]", "{\"text\":[1]}", "{\"text\":{}}"] { + input.extend_from_slice( + format!("{{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{{\"name\":\"level\",\"arguments\":{args}}}}}\n").as_bytes(), + ); + } + input.extend_from_slice(json!({"jsonrpc": "2.0", "id": 9, "method": "ping"}).to_string().as_bytes()); + let mut output = Vec::new(); + let options = Options { website_url: Some("https://example.org".into()), tool_errors_as_results: true, strict_request_ids: true }; + with(options).serve(std::io::Cursor::new(input), &mut output).unwrap(); + let replies: Vec = String::from_utf8(output).unwrap().lines().map(|l| serde_json::from_str(l).unwrap()).collect(); + assert_eq!(replies.len(), 2 + 6 + 6 + 1, "{replies:?}"); + assert_eq!(replies[0]["error"]["code"], -32600); + assert_eq!(replies[1]["error"]["code"], -32700); + assert_eq!(replies.last().map(|r| &r["result"]), Some(&json!({}))); +} From 93dac78c93a7f1fd66e2022edeb089233b1dc45a Mon Sep 17 00:00:00 2001 From: Martin Ball <98639962+benandez@users.noreply.github.com> Date: Tue, 17 Nov 2026 20:45:56 +0100 Subject: [PATCH 111/183] craft-image-codecs: wrap a clipboard DIB as a BMP (dib_to_bmp, dib_layout) (#2062) * image-codecs: wrap a clipboard DIB as a BMP (#778) Add bmp_probe::dib_to_bmp (prepend the 14-byte file header, pixel offset from the header with saturating arithmetic, try_reserve for the output) and bmp_probe::dib_layout (V4/V5 alpha-mask BI_RGB becomes BI_BITFIELDS, mask copy after the header). Both are ported from WordCraft's crates/geom/src/picture.rs so it can drop its local copies. Tests compare byte-for-byte with the originals over crafted DIBs and every prefix, and decode wrapped results. Co-Authored-By: Claude Opus 5.5 * image-codecs: fix DIB offsets for V2/V3 bitfields and ambiguous mask copies (#778) - dib_to_bmp no longer adds 12 appended-mask bytes to the pixel offset for 52- and 56-byte BI_BITFIELDS headers, which carry their masks inside the header; the decoder reads the pixels at bfOffBits, so the offset was 12 bytes too far. - dib_layout treats 12 bytes after the header that equal the masks as an existing copy only when more bytes follow than the pixels need, so an exact-length DIB whose pixels equal the masks gets its copy inserted. - dib_layout reserves the 12 bytes before changing compression or masks, so a failed reservation returns the DIB unchanged; the mask bytes are a [u8; 12] array, not a heap copy. The differential tests against the WordCraft originals now exclude exactly the 52/56-byte bitfields offset and the exact-length payload cases, and assert the new behaviour for them. Co-Authored-By: Claude Sonnet 5.5 --------- Co-authored-by: Claude Opus 5.5 --- crates/image-codecs/src/bmp_probe.rs | 442 +++++++++++++++++++++++++++ 1 file changed, 442 insertions(+) diff --git a/crates/image-codecs/src/bmp_probe.rs b/crates/image-codecs/src/bmp_probe.rs index 5b47721bc..89f6a3b97 100644 --- a/crates/image-codecs/src/bmp_probe.rs +++ b/crates/image-codecs/src/bmp_probe.rs @@ -1,5 +1,7 @@ //! Header-only BMP dimensions and pixel-data coverage, without allocating a canvas. +use crate::error::CodecError; + /// Recognize a BMP file header with a supported DIB header kind. /// /// This is a format-routing check, not full validation: dimensions and pixel data may still @@ -13,6 +15,115 @@ pub fn is_supported_header(b: &[u8]) -> bool { false } +/// Wrap a DIB (a BMP without its 14-byte `BITMAPFILEHEADER`, as the Windows clipboard holds one +/// for `CF_DIB` and `CF_DIBV5`) as a BMP file the decoders here read. The pixel offset is computed +/// from the header with saturating arithmetic, so a hostile header cannot overflow; whether the +/// pixel data exists is left to the decoder. Apply [`dib_layout`] first for clipboard DIBs. +/// +/// # Errors +/// +/// Returns [`CodecError::LimitExceeded`] when the output (`dib.len() + 14` bytes) cannot be allocated. +pub fn dib_to_bmp(dib: &[u8]) -> Result, CodecError> { + let u16_at = |at: usize| dib.get(at..at + 2).and_then(|b| b.try_into().ok()).map(u16::from_le_bytes); + let u32_at = |at: usize| dib.get(at..at + 4).and_then(|b| b.try_into().ok()).map(u32::from_le_bytes); + let bi_size = u32_at(0).unwrap_or(40); + let offset = if bi_size == 12 { + let bpp = u16_at(10).unwrap_or(24); + let palette = if bpp <= 8 { (1u32 << bpp) * 3 } else { 0 }; + 14 + bi_size + palette + } else { + let bpp = u16_at(14).unwrap_or(24); + let compression = u32_at(16).unwrap_or(0); + let clr_used = u32_at(32).unwrap_or(0); + let palette_entries = if clr_used != 0 { + clr_used + } else if bpp <= 8 { + 1u32 << bpp + } else { + 0 + }; + // The masks of a 52- or 56-byte (V2/V3) header are inside the header; only the other + // header kinds carry them as 12 further bytes before the pixels. + let masks = if compression == 3 && bi_size >= 40 && !matches!(bi_size, 52 | 56) { 12 } else { 0 }; + 14u32.saturating_add(bi_size).saturating_add(masks).saturating_add(palette_entries.saturating_mul(4)) + }; + let total = dib.len().saturating_add(14); + let file_size = u32::try_from(total).unwrap_or(u32::MAX); + let mut bmp = Vec::new(); + bmp.try_reserve_exact(total).map_err(|_| CodecError::LimitExceeded(format!("a {total}-byte BMP")))?; + bmp.extend_from_slice(b"BM"); + bmp.extend_from_slice(&file_size.to_le_bytes()); + bmp.extend_from_slice(&[0u8; 4]); + bmp.extend_from_slice(&offset.to_le_bytes()); + bmp.extend_from_slice(dib); + Ok(bmp) +} + +/// Put a clipboard DIB with a V4 or V5 header (108 bytes or more) in the layout the decoder reads. +/// A 32-bit one whose alpha mask is set but whose compression says `BI_RGB` is marked +/// `BI_BITFIELDS` (with the usual colour masks when it gives none), so its alpha is kept as +/// Windows programs mean it; arboard makes the same change. Bit fields then need the colour masks +/// after the header too, where Windows puts a copy and the decoder skips them; a DIB without that +/// copy gets it. Any other DIB comes back unchanged, as does one whose 12 extra bytes cannot be +/// allocated. +pub fn dib_layout(mut dib: Vec) -> Vec { + let u32_at = |d: &[u8], at: usize| d.get(at..at + 4).and_then(|b| b.try_into().ok()).map(u32::from_le_bytes); + let Some(size) = u32_at(&dib, 0).filter(|&s| s >= 108).and_then(|s| usize::try_from(s).ok()) else { return dib }; + let put = |d: &mut Vec, at: usize, v: u32| { + if let Some(b) = d.get_mut(at..at + 4) { + b.copy_from_slice(&v.to_le_bytes()); + } + }; + // Decide everything first and mutate only after the 12-byte reservation succeeded, so a failed + // allocation returns the DIB unchanged. + let promote = dib.get(14..16) == Some(&[32, 0]) && u32_at(&dib, 16) == Some(0) && u32_at(&dib, 52) == Some(0xFF00_0000); + let default_masks = promote && (40..52).step_by(4).all(|at| u32_at(&dib, at) == Some(0)); + let mut masks = dib.get(40..52).and_then(|b| <[u8; 12]>::try_from(b).ok()); + if default_masks { + let mut m = [0u8; 12]; + m[0..4].copy_from_slice(&0x00FF_0000u32.to_le_bytes()); + m[4..8].copy_from_slice(&0x0000_FF00u32.to_le_bytes()); + m[8..12].copy_from_slice(&0x0000_00FFu32.to_le_bytes()); + masks = Some(m); + } + let bitfields = promote || u32_at(&dib, 16) == Some(3); + // Bytes equal to the masks right after the header are a copy only when more bytes follow than + // the pixels need; otherwise they are the pixels (e.g. a 3x1 V5 DIB with pixels equal to the masks). + let has_copy = |m: &[u8; 12]| { + dib.get(size..size.saturating_add(12)) == Some(m.as_slice()) && pixel_bytes(&dib).is_none_or(|need| dib.len().saturating_sub(size) > need) + }; + let insert = match masks { + Some(m) if bitfields && size <= dib.len() && !has_copy(&m) => Some(m), + _ => None, + }; + if insert.is_some() && dib.try_reserve(12).is_err() { + return dib; + } + if promote { + put(&mut dib, 16, 3); + if default_masks { + put(&mut dib, 40, 0x00FF_0000); + put(&mut dib, 44, 0x0000_FF00); + put(&mut dib, 48, 0x0000_00FF); + } + } + if let Some(m) = insert { + dib.splice(size..size, m); + } + dib +} + +/// Bytes of pixel rows (4-byte aligned stride) the info-header dimensions of `dib` call for, or +/// `None` when width, height or bit count cannot be read. +fn pixel_bytes(dib: &[u8]) -> Option { + let i32_at = |at: usize| dib.get(at..at + 4).and_then(|b| b.try_into().ok()).map(i32::from_le_bytes); + let w = u64::try_from(i32_at(4)?).ok()?; + let h = u64::from(i32_at(8)?.unsigned_abs()); + let bpp = u64::from(u16::from_le_bytes(dib.get(14..16)?.try_into().ok()?)); + let stride = w.checked_mul(bpp)?.div_ceil(32).checked_mul(4)?; + usize::try_from(stride.checked_mul(h)?).ok() +} + /// Coverage of the declared pixel array. Row byte counts include row padding; RLE coverage /// counts the pixels drawn by commands and may be smaller than the canvas. #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -174,4 +285,335 @@ mod tests { b[0] = b'X'; assert!(!is_supported_header(&b)); } + + // The WordCraft originals, kept verbatim as the oracle. + fn oracle_dib_to_bmp(dib: &[u8]) -> Vec { + let u16_at = |at: usize| dib.get(at..at + 2).and_then(|b| b.try_into().ok()).map(u16::from_le_bytes); + let u32_at = |at: usize| dib.get(at..at + 4).and_then(|b| b.try_into().ok()).map(u32::from_le_bytes); + let bi_size = u32_at(0).unwrap_or(40); + let offset = if bi_size == 12 { + let bpp = u16_at(10).unwrap_or(24); + let palette = if bpp <= 8 { (1u32 << bpp) * 3 } else { 0 }; + 14 + bi_size + palette + } else { + let bpp = u16_at(14).unwrap_or(24); + let compression = u32_at(16).unwrap_or(0); + let clr_used = u32_at(32).unwrap_or(0); + let palette_entries = if clr_used != 0 { + clr_used + } else if bpp <= 8 { + 1u32 << bpp + } else { + 0 + }; + let masks = if compression == 3 && bi_size >= 40 { 12 } else { 0 }; + 14u32.saturating_add(bi_size).saturating_add(masks).saturating_add(palette_entries.saturating_mul(4)) + }; + let file_size = u32::try_from(14 + dib.len()).unwrap_or(u32::MAX); + let mut bmp = Vec::with_capacity(14 + dib.len()); + bmp.extend_from_slice(b"BM"); + bmp.extend_from_slice(&file_size.to_le_bytes()); + bmp.extend_from_slice(&[0u8; 4]); + bmp.extend_from_slice(&offset.to_le_bytes()); + bmp.extend_from_slice(dib); + bmp + } + + fn oracle_dib_layout(mut dib: Vec) -> Vec { + let u32_at = |d: &[u8], at: usize| d.get(at..at + 4).and_then(|b| b.try_into().ok()).map(u32::from_le_bytes); + let Some(size) = u32_at(&dib, 0).filter(|&s| s >= 108).and_then(|s| usize::try_from(s).ok()) else { return dib }; + let put = |d: &mut Vec, at: usize, v: u32| { + if let Some(b) = d.get_mut(at..at + 4) { + b.copy_from_slice(&v.to_le_bytes()); + } + }; + if dib.get(14..16) == Some(&[32, 0]) && u32_at(&dib, 16) == Some(0) && u32_at(&dib, 52) == Some(0xFF00_0000) { + put(&mut dib, 16, 3); + if (40..52).step_by(4).all(|at| u32_at(&dib, at) == Some(0)) { + put(&mut dib, 40, 0x00FF_0000); + put(&mut dib, 44, 0x0000_FF00); + put(&mut dib, 48, 0x0000_00FF); + } + } + if u32_at(&dib, 16) == Some(3) + && size <= dib.len() + && let Some(masks) = dib.get(40..52).map(<[u8]>::to_vec) + && dib.get(size..size + 12) != Some(masks.as_slice()) + { + dib.splice(size..size, masks); + } + dib + } + + fn core(bpp: u16) -> Vec { + let mut d = Vec::new(); + d.extend_from_slice(&12u32.to_le_bytes()); + d.extend_from_slice(&2u16.to_le_bytes()); + d.extend_from_slice(&2u16.to_le_bytes()); + d.extend_from_slice(&1u16.to_le_bytes()); + d.extend_from_slice(&bpp.to_le_bytes()); + d.resize(12 + 64, 7); + d + } + + #[allow(clippy::too_many_arguments)] + fn info(size: u32, bpp: u16, comp: u32, clr_used: u32, masks: [u32; 4], tail: usize) -> Vec { + let mut d = vec![0u8; size.clamp(40, 124) as usize]; + d[0..4].copy_from_slice(&size.to_le_bytes()); + d[4..8].copy_from_slice(&2i32.to_le_bytes()); + d[8..12].copy_from_slice(&2i32.to_le_bytes()); + d[12..14].copy_from_slice(&1u16.to_le_bytes()); + d[14..16].copy_from_slice(&bpp.to_le_bytes()); + d[16..20].copy_from_slice(&comp.to_le_bytes()); + d[32..36].copy_from_slice(&clr_used.to_le_bytes()); + for (i, m) in masks.iter().enumerate() { + if let Some(b) = d.get_mut(40 + 4 * i..44 + 4 * i) { + b.copy_from_slice(&m.to_le_bytes()); + } + } + d.extend((0..tail).map(|i| (i * 31 + 5) as u8)); + d + } + + fn corpus() -> Vec> { + let mut v = Vec::new(); + for bpp in [1, 4, 8, 24, 0, 99] { + v.push(core(bpp)); + } + for bpp in [1u16, 4, 8, 16, 24, 32, 0, 255] { + for clr in [0u32, 1, 5, 256, u32::MAX] { + v.push(info(40, bpp, 0, clr, [0; 4], 40)); + } + } + for (size, comp, masks) in [ + (40, 3, [0xFF0000, 0xFF00, 0xFF, 0]), + (40, 3, [0; 4]), + (52, 3, [0xFF0000, 0xFF00, 0xFF, 0]), + (108, 3, [0xFF0000, 0xFF00, 0xFF, 0xFF00_0000]), + (108, 0, [0xFF0000, 0xFF00, 0xFF, 0xFF00_0000]), + (108, 0, [0, 0, 0, 0xFF00_0000]), + (108, 0, [0; 4]), + (124, 3, [0xFF0000, 0xFF00, 0xFF, 0xFF00_0000]), + (124, 0, [0, 0, 0, 0xFF00_0000]), + (124, 0, [1, 0, 0, 0xFF00_0000]), + (124, 0, [0xFF0000, 0xFF00, 0xFF, 0]), + (124, 1, [0, 0, 0, 0xFF00_0000]), + (124, 3, [1, 2, 3, 4]), + (0, 0, [0; 4]), + (12, 0, [0; 4]), + (u32::MAX, 3, [0; 4]), + (u32::MAX, 0, [0; 4]), + (200, 3, [9; 4]), + ] { + for bpp in [8u16, 16, 32] { + for clr in [0u32, 2, u32::MAX] { + v.push(info(size, bpp, comp, clr, masks, 48)); + } + } + } + // 52/56-byte bitfields headers with and without a pixel tail, and 3x1 V5 DIBs. + for size in [52, 56] { + v.push(info(size, 32, 3, 0, [0xFF0000, 0xFF00, 0xFF, 0xFF00_0000], 4)); + v.push(info(size, 32, 3, 0, [0xFF0000, 0xFF00, 0xFF, 0xFF00_0000], 0)); + } + v.push(v5_3x1(false)); + v.push(v5_3x1(true)); + v + } + + /// 3x1 32-bit V5 BI_BITFIELDS whose three pixels equal the colour masks; with `copy` the DIB + /// also holds the real 12-byte mask copy before the pixels. + fn v5_3x1(copy: bool) -> Vec { + let masks = [0x00FF_0000u32, 0x0000_FF00, 0x0000_00FF]; + let mut d = info(124, 32, 3, 0, [masks[0], masks[1], masks[2], 0xFF00_0000], 0); + d[4..8].copy_from_slice(&3i32.to_le_bytes()); + d[8..12].copy_from_slice(&1i32.to_le_bytes()); + for _ in 0..usize::from(copy) + 1 { + for m in masks { + d.extend_from_slice(&m.to_le_bytes()); + } + } + d + } + + fn dib_u32(d: &[u8], at: usize) -> Option { + d.get(at..at + 4).and_then(|b| b.try_into().ok()).map(u32::from_le_bytes) + } + + /// Fixed case 1: a 52- or 56-byte BI_BITFIELDS header holds its masks itself, so `dib_to_bmp` + /// no longer adds the 12 appended-mask bytes the WordCraft original added to the pixel offset. + fn bmp_offset_fixed(dib: &[u8]) -> bool { + matches!(dib_u32(dib, 0).unwrap_or(40), 52 | 56) && dib_u32(dib, 16) == Some(3) + } + + /// Fixed case 2: the original read 12 pixel bytes equal to the masks (exact-length payload) as a + /// mask copy and inserted nothing. Returns the corrected output when `cut` is such a case. + fn exact_length_fixed(cut: &[u8]) -> Option> { + let o = oracle_dib_layout(cut.to_vec()); + let size = usize::try_from(dib_u32(&o, 0).filter(|&s| s >= 108)?).ok()?; + let need = pixel_bytes(&o)?; + let same = o.len() == cut.len() + && dib_u32(&o, 16) == Some(3) + && size <= o.len() + && o.get(size..size + 12).is_some() + && o.get(size..size + 12) == o.get(40..52) + && o.len() - size <= need; + if !same { + return None; + } + let mut want = o.clone(); + want.splice(size..size, o[40..52].to_vec()); + Some(want) + } + + #[test] + fn dib_helpers_match_the_wordcraft_originals_byte_for_byte() { + let (mut total, mut offset_cases, mut exact_cases) = (0usize, 0usize, 0usize); + for dib in corpus() { + for n in 0..=dib.len() { + let cut = &dib[..n]; + total += 1; + let fixed_layout = exact_length_fixed(cut); + match &fixed_layout { + Some(want) => { + exact_cases += 1; + assert_eq!(&dib_layout(cut.to_vec()), want, "exact-length layout len {n}"); + } + None => assert_eq!(dib_layout(cut.to_vec()), oracle_dib_layout(cut.to_vec()), "layout len {n}"), + } + if bmp_offset_fixed(cut) { + offset_cases += 1; + let (new, old) = (dib_to_bmp(cut).unwrap(), oracle_dib_to_bmp(cut)); + assert_eq!(new[..10], old[..10]); + assert_eq!(new[14..], old[14..]); + let (a, b) = (dib_u32(&new, 10).unwrap(), dib_u32(&old, 10).unwrap()); + assert_eq!(a.saturating_add(12), b, "offset len {n}"); + } else { + assert_eq!(dib_to_bmp(cut).unwrap(), oracle_dib_to_bmp(cut), "bmp len {n}"); + } + let both = dib_layout(cut.to_vec()); + let old_both = oracle_dib_layout(cut.to_vec()); + if fixed_layout.is_none() && !bmp_offset_fixed(&both) { + assert_eq!(dib_to_bmp(&both).unwrap(), oracle_dib_to_bmp(&old_both)); + } + } + } + eprintln!("corpus cases {total}: 52/56-byte bitfields offset {offset_cases}, exact-length payload {exact_cases}"); + assert!(offset_cases > 0 && exact_cases > 0); + } + + #[test] + fn dib_helpers_survive_pseudo_random_bytes() { + let mut x = 0x9E37_79B9_7F4A_7C15u64; + for len in 0..300usize { + let d: Vec = (0..len) + .map(|_| { + x ^= x << 13; + x ^= x >> 7; + x ^= x << 17; + x as u8 + }) + .collect(); + let laid = dib_layout(d.clone()); + if exact_length_fixed(&d).is_none() && !bmp_offset_fixed(&laid) { + assert_eq!(dib_to_bmp(&laid).unwrap(), oracle_dib_to_bmp(&oracle_dib_layout(d))); + } + } + } + + #[test] + fn huge_palette_count_saturates_the_offset() { + let b = dib_to_bmp(&info(40, 8, 0, u32::MAX, [0; 4], 8)).unwrap(); + assert_eq!(u32::from_le_bytes([b[10], b[11], b[12], b[13]]), u32::MAX); + let b = dib_to_bmp(&info(u32::MAX, 8, 3, u32::MAX, [0; 4], 8)).unwrap(); + assert_eq!(u32::from_le_bytes([b[10], b[11], b[12], b[13]]), u32::MAX); + } + + #[test] + fn wrapped_dibs_decode_and_keep_alpha() { + // 2x2 32-bit V5, BI_RGB with an alpha mask, bottom-up BGRA pixels. + let mut d = info(124, 32, 0, 0, [0, 0, 0, 0xFF00_0000], 0); + let px = [[1u8, 2, 3, 255], [4, 5, 6, 128], [7, 8, 9, 64], [10, 11, 12, 0]]; + for p in px { + d.extend_from_slice(&p); + } + let bmp = dib_to_bmp(&dib_layout(d)).unwrap(); + let img = crate::decode(&bmp).unwrap(); + let alphas: Vec = img.to_rgba8().chunks(4).map(|p| u16::from(p[3])).collect(); + assert_eq!(alphas, [64, 0, 255, 128]); + // 24-bit plain DIB and a 12-byte core 8-bit one open too. + let mut d = info(40, 24, 0, 0, [0; 4], 0); + d.extend_from_slice(&[0, 0, 255, 0, 255, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + assert!(crate::decode(&dib_to_bmp(&d).unwrap()).is_ok()); + let mut c = core(8); + c.truncate(12); + c.extend((0..256 * 3).map(|i| i as u8)); + c.extend_from_slice(&[0, 1, 0, 0, 2, 3, 0, 0]); + assert!(crate::decode(&dib_to_bmp(&c).unwrap()).is_ok()); + } + + /// 1x1 32-bit BI_BITFIELDS DIB, one pixel B=10 G=20 R=30 A=128, with the given header size. + fn one_pixel(size: u32) -> Vec { + let mut d = info(size, 32, 3, 0, [0xFF0000, 0xFF00, 0xFF, 0xFF00_0000], 0); + d[4..8].copy_from_slice(&1i32.to_le_bytes()); + d[8..12].copy_from_slice(&1i32.to_le_bytes()); + if size == 40 { + for m in [0xFF0000u32, 0xFF00, 0xFF] { + d.extend_from_slice(&m.to_le_bytes()); + } + } + d.extend_from_slice(&[10, 20, 30, 128]); + d + } + + #[test] + fn bitfields_pixel_offset_for_each_header_size_decodes() { + for size in [40u32, 52, 56] { + let bmp = dib_to_bmp(&one_pixel(size)).unwrap(); + let off = 14 + size + if size == 40 { 12 } else { 0 }; + assert_eq!(dib_u32(&bmp, 10), Some(off), "offset for {size}"); + let img = crate::decode(&bmp).unwrap_or_else(|e| panic!("{size}-byte header: {e:?}")); + let rgba = img.to_rgba8(); + assert_eq!(&rgba[..3], &[30, 20, 10], "size {size}"); + if size == 56 { + assert_eq!(rgba[3], 128); + } + } + // V5: the header's masks, a copy inserted by `dib_layout`, then the pixel. + let bmp = dib_to_bmp(&dib_layout(one_pixel(124))).unwrap(); + assert_eq!(&crate::decode(&bmp).unwrap().to_rgba8()[..4], &[30, 20, 10, 128]); + } + + #[test] + fn exact_length_pixels_equal_to_the_masks_are_not_a_mask_copy() { + let d = v5_3x1(false); + let laid = dib_layout(d.clone()); + assert_eq!(laid.len(), d.len() + 12); + assert_eq!(laid[124..136], d[40..52]); + assert_eq!(oracle_dib_layout(d).len(), laid.len() - 12, "the original skipped the insertion"); + let img = crate::decode(&dib_to_bmp(&laid).unwrap()).unwrap().to_rgba8(); + assert_eq!(img.len(), 12); + // pixel 0 is 0x00FF0000 (blue 0, green 0, red 255 under the masks). + assert_eq!(&img[..3], &[255, 0, 0]); + // A real copy followed by the pixels is left alone. + let real = v5_3x1(true); + assert_eq!(dib_layout(real.clone()), real); + assert!(crate::decode(&dib_to_bmp(&real).unwrap()).is_ok()); + } + + #[test] + fn layout_decides_before_it_mutates() { + // BI_RGB V5 with an alpha mask and no colour masks: promoted and given a copy together. + let mut d = info(124, 32, 0, 0, [0, 0, 0, 0xFF00_0000], 16); + d[4..8].copy_from_slice(&2i32.to_le_bytes()); + let laid = dib_layout(d.clone()); + assert_eq!(laid.len(), d.len() + 12); + assert_eq!(dib_u32(&laid, 16), Some(3)); + // Unreadable dimensions keep the byte-equality rule. + let mut odd = info(108, 32, 3, 0, [1, 2, 3, 0], 0); + odd[4..8].copy_from_slice(&(-1i32).to_le_bytes()); + let copy = odd[40..52].to_vec(); + odd.extend_from_slice(©); + assert_eq!(dib_layout(odd.clone()), odd); + } } From 8d5c939e203fbbd7cd7543f0d4e79043b9a500a5 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 14:46:32 -0500 Subject: [PATCH 112/183] psd: use fixed-size guide chunks for strict clippy --- crates/psd/src/guides.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/psd/src/guides.rs b/crates/psd/src/guides.rs index f122c7805..2b654ec8f 100644 --- a/crates/psd/src/guides.rs +++ b/crates/psd/src/guides.rs @@ -27,7 +27,7 @@ impl GuideV1 { /// Encode a legacy resource header. Grid cycles and count are caller supplied. pub fn header_v1(horizontal_cycle: u32, vertical_cycle: u32, count: u32) -> [u8; 16] { let mut out = [0; 16]; - for (chunk, value) in out.chunks_exact_mut(4).zip([1u32, horizontal_cycle, vertical_cycle, count]) { + for (chunk, value) in out.as_chunks_mut::<4>().0.iter_mut().zip([1u32, horizontal_cycle, vertical_cycle, count]) { chunk.copy_from_slice(&value.to_be_bytes()); } out @@ -40,7 +40,9 @@ pub fn parse_v1_prefix(data: &[u8]) -> impl Iterator + '_ { let count = be_u32(data, 12).unwrap_or(0); data.get(16..) .unwrap_or_default() - .chunks_exact(5) + .as_chunks::<5>() + .0 + .iter() .zip(0..count) .map(|(g, _)| GuideV1 { location: i32::from_be_bytes([g[0], g[1], g[2], g[3]]), direction: g[4] }) } From 408ab93329f35bb05b27883dfb6e966c0d788f95 Mon Sep 17 00:00:00 2001 From: Terra854 Date: Wed, 18 Nov 2026 04:01:51 +0800 Subject: [PATCH 113/183] Preserve SVG siblings and share embedded-image validation --- Cargo.lock | 1 - crates/image-codecs/src/codecs/jpeg.rs | 30 +++++ crates/image-codecs/src/lib.rs | 1 + crates/svg/Cargo.toml | 6 +- crates/svg/README.md | 47 ++++--- crates/svg/src/tree.rs | 138 ++++++++++++-------- crates/svg/src/tree/draw.rs | 2 + crates/svg/src/tree/draw/decoder_edges.rs | 13 +- crates/svg/src/tree/draw/raster.rs | 68 ++++------ crates/svg/src/tree/draw/raster_tests.rs | 4 - crates/svg/src/tree/image_href.rs | 40 +++++- crates/svg/src/tree/tests.rs | 10 +- crates/svg/src/tree/validated.rs | 141 +++++++++++---------- crates/svg/src/tree/validated/tests.rs | 78 +++++++----- crates/svg/src/tree/validated/xml_tests.rs | 30 +++++ 15 files changed, 370 insertions(+), 239 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4da6cf6c9..90f2450ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3103,7 +3103,6 @@ dependencies = [ "usvg 0.48.1", "vectorcraft-geom", "vectorcraft-pathops", - "zune-jpeg", ] [[package]] diff --git a/crates/image-codecs/src/codecs/jpeg.rs b/crates/image-codecs/src/codecs/jpeg.rs index 415a5d717..ef6601a58 100644 --- a/crates/image-codecs/src/codecs/jpeg.rs +++ b/crates/image-codecs/src/codecs/jpeg.rs @@ -46,6 +46,36 @@ pub(crate) struct JpegMeta { pub held_coefficients: u64, } +/// Validate a JPEG by decoding the 8-bit RGBA output used by renderers. +/// +/// This deliberately uses the existing zune backend's default decode policy. +/// Unlike general JPEG import it does not fall back to additional JPEG modes, +/// apply orientation, or retain pixels. The caller supplies the admitted pixel count. +pub fn validate_jpeg_rgba8(bytes: &[u8], max_pixels: u64) -> Result<(), CodecError> { + let decode = || { + let options = DecoderOptions::default().jpeg_set_out_colorspace(ColorSpace::RGBA); + let mut decoder = zune_jpeg::JpegDecoder::new_with_options(std::io::Cursor::new(bytes), options); + decoder.decode_headers().map_err(|error| CodecError::malformed(F, format_args!("{error:?}")))?; + let info = decoder.info().ok_or_else(|| CodecError::malformed(F, "missing frame dimensions"))?; + let pixels = u64::from(info.width) * u64::from(info.height); + if pixels == 0 { + return Err(CodecError::malformed(F, "empty frame")); + } + if pixels > max_pixels { + return Err(CodecError::LimitExceeded("JPEG exceeds the admitted pixel count".into())); + } + let length = usize::try_from(pixels * 4).map_err(|_| CodecError::LimitExceeded("JPEG RGBA output is too large".into()))?; + if decoder.output_colorspace() != Some(ColorSpace::RGBA) || decoder.output_buffer_size() != Some(length) { + return Err(CodecError::malformed(F, "unexpected RGBA output")); + } + let mut output = Vec::new(); + output.try_reserve_exact(length).map_err(|_| CodecError::LimitExceeded("could not allocate JPEG RGBA output".into()))?; + output.resize(length, 0); + decoder.decode_into(&mut output).map_err(|error| CodecError::malformed(F, format_args!("{error:?}"))) + }; + std::panic::catch_unwind(decode).map_err(|_| CodecError::malformed(F, "JPEG decoder failed on this frame"))? +} + /// The first frame of `b` as [`crate::JpegInfo`], from its markers alone (see [`crate::jpeg_info`]). pub(crate) fn info(b: &[u8]) -> Option { let m = scan_metadata(b); diff --git a/crates/image-codecs/src/lib.rs b/crates/image-codecs/src/lib.rs index dc2ac2933..231197b61 100644 --- a/crates/image-codecs/src/lib.rs +++ b/crates/image-codecs/src/lib.rs @@ -45,6 +45,7 @@ pub use crate::cicp::ContentLightLevel; pub use crate::codecs::avif::{HDR_REFERENCE_WHITE_NITS, HdrTransfer, encode_avif_hdr, encode_avif_with_speed}; pub use crate::codecs::exr_cryptomatte::{cryptomatte_id, cryptomatte_key, cryptomatte_preview_color}; pub use crate::codecs::gif_frames::{AnimationFrame, MAX_GIF_FRAMES}; +pub use crate::codecs::jpeg::validate_jpeg_rgba8; pub use crate::codecs::png::{ PngDecodeRows, PngExtras, PngHeader, PngPalette, PngRowSink, PngRows, SharedBytes, encode_indexed as encode_png_indexed, encode_pq as encode_png_pq, palette as png_palette, stereo as png_stereo, diff --git a/crates/svg/Cargo.toml b/crates/svg/Cargo.toml index 4b7e928a8..eb5e01c91 100644 --- a/crates/svg/Cargo.toml +++ b/crates/svg/Cargo.toml @@ -32,9 +32,7 @@ resvg = { version = "=0.48.1", default-features = false, features = ["text", "ra data-url = { version = "0.3.2", optional = true } # Renderer-specific validation uses the same resolved backends as resvg0.48.1. -# zune-jpeg is used under its MIT licence option. The locked edge-alignment -# regression must pass when changing this renderer/backend dependency group. -zune-jpeg = { version = "=0.5.15", optional = true } +# JPEG validation uses the existing backend in craft-image-codecs. gif = { version = "=0.14.2", optional = true } image-webp = { version = "=0.2.4", optional = true } @@ -52,7 +50,7 @@ tree-text = ["tree", "usvg/text"] # The system's fonts in `usvg::fontdb`. tree-system-fonts = ["tree-text", "usvg/system-fonts"] # Bounded rendering of a parsed tree through the matching resvg/tiny-skia versions. -tree-render = ["tree", "dep:resvg", "dep:zune-jpeg", "dep:gif", "dep:image-webp"] +tree-render = ["tree", "dep:resvg", "dep:gif", "dep:image-webp"] tree-render-system-fonts = ["tree-render", "resvg/system-fonts"] [dev-dependencies] diff --git a/crates/svg/README.md b/crates/svg/README.md index 519015c1b..a82d88028 100644 --- a/crates/svg/README.md +++ b/crates/svg/README.md @@ -26,20 +26,19 @@ raster validation. Existing `ImageResolver::new`/`resolver` and legacy parse ent points retain their behavior. Opt in explicitly: ```rust -# #[cfg(feature = "tree-render")] -# fn example() -> Result<(), craft_svg::tree::Error> { -use craft_svg::tree::{self, Limits, ValidatedImageResolver, usvg}; -let images = ValidatedImageResolver::new(Limits::default()); -let checked = tree::preflight( - "", - &images.limits(), -)?; -let drawing = images.parse_preflight(checked, usvg::Options::default())?; -let usage = images.usage(); -// Importers disclose usage's invalid_* and *_limit_images; strict consumers refuse them. -# let _ = (drawing, usage); -# Ok(()) -# } +fn example() -> Result<(), craft_svg::tree::Error> { + use craft_svg::tree::{self, Limits, ValidatedImageResolver, usvg}; + let images = ValidatedImageResolver::new(Limits::default()); + let checked = tree::preflight( + "", + &images.limits(), + )?; + let drawing = images.parse_preflight(checked, usvg::Options::default())?; + let usage = images.usage(); + // Importers disclose usage's invalid_* and *_limit_images; strict consumers refuse them. + let _ = (drawing, usage); + Ok(()) +} ``` The caller supplies fonts and a sufficient stack/worker for its depth policy. @@ -53,11 +52,14 @@ An overlapping root conversion on the same context is refused. Unchanged XML converts from its original checked DOM. A modified data URL requires one checked replacement DOM. Invalid URLs become bounded resolver-visible image -failures; hidden, unused and foreign elements do not acquire omission counts. +failures. The normal path counts only resolved images. If a repair cannot fit, +the checked original can still convert when all its MIME headers meet the work +limit. In that case malformed image declarations are counted conservatively. Original UTF-8 child bytes are charged before XML conversion or shorter repairs, -with per-document and aggregate bounds. Failed inflation/text work is not refunded; -separate bounded retry-classification work never admits another child. Encoded -raster callbacks spend at most `limits.bytes + limits.embedded_bytes` cumulatively, +with per-document and aggregate bounds. A malformed plain encoding spends its +input bytes and leaves the remaining work for siblings. Failed inflation can +exhaust its attempted allowance, and the separate bounded retry classification +never admits another child. Encoded raster callbacks spend at most `limits.bytes + limits.embedded_bytes` cumulatively, without retaining their sources. Pixel work and decoder allocation are admitted before decoding; attempted failures keep their charge. An oversized unattempted image does not prevent a later smaller image from fitting. @@ -67,9 +69,6 @@ context, rather than an unchecked DOM or a precharged-budget override. `usage()` reports omissions and work after conversion. The context is for one drawing, not a global rendering cache. -The renderer has no public decoded-pixel or decode-result hook. Validation therefore -still decodes raster pixels before later renderer painting. The shared validator -owns the backend dependencies; locked dependency-edge tests in both the shared -workspace and consumers must keep them aligned with the selected resvg/usvg graph. -This is a fail-fast maintenance check, not automatic access to private renderer -code or a decode-once performance claim. Direct zune-jpeg use selects its MIT option. +The validator uses the existing JPEG backend in craft-image-codecs. The lockfile +test checks that it and the other validation backends match the selected resvg +dependency edges. resvg decodes the image again when it paints. diff --git a/crates/svg/src/tree.rs b/crates/svg/src/tree.rs index 690320e82..3a549e773 100644 --- a/crates/svg/src/tree.rs +++ b/crates/svg/src/tree.rs @@ -22,10 +22,10 @@ //! 16 MB or so, and a 1 MB stack takes a depth of about 34. use std::borrow::Cow; +use std::collections::HashMap; use std::collections::hash_map::Entry; -use std::collections::{HashMap, HashSet}; use std::sync::atomic::{AtomicU64, AtomicUsize, Ordering}; -use std::sync::{Arc, Mutex, PoisonError}; +use std::sync::{Arc, Mutex, PoisonError, Weak}; pub use usvg; @@ -70,9 +70,9 @@ pub struct Limits { pub embedded_bytes: usize, /// SVG documents embedded inside one another, for [`image_resolver`]. pub embedded_depth: usize, - /// Decoded RGBA pixels retained across the raster images embedded in one drawing. Dimensions - /// are probed before usvg hands the bytes to a decoder; repeated references to the same data - /// URL share one charge. + /// Cumulative raster decode pixels for a drawing. usvg sends each data-URL + /// resolution separately, so repeated uses normally spend a separate charge. + /// The legacy resolver can share a charge for the same live input allocation. pub embedded_raster_pixels: u64, } @@ -437,7 +437,7 @@ struct Used { svg_count: AtomicUsize, svg_depth: AtomicUsize, raster_pixels: AtomicU64, - raster_data: Mutex>, + raster_data: Mutex>>>, invalid_raster: AtomicUsize, raster_limit: AtomicUsize, invalid_svg: AtomicUsize, @@ -493,7 +493,7 @@ impl ImageResolver { svg_count: AtomicUsize::new(0), svg_depth: AtomicUsize::new(0), raster_pixels: AtomicU64::new(0), - raster_data: Mutex::new(HashSet::new()), + raster_data: Mutex::new(HashMap::new()), invalid_raster: AtomicUsize::new(0), raster_limit: AtomicUsize::new(0), invalid_svg: AtomicUsize::new(0), @@ -561,28 +561,51 @@ fn account_invalid_data_urls(xml: &roxmltree::Document<'_>, used: &Used) { } } -fn raster_format(data: &[u8]) -> Option { - match craft_image_codecs::detect(data)? { - format @ (craft_image_codecs::Format::Png - | craft_image_codecs::Format::Jpeg - | craft_image_codecs::Format::Gif - | craft_image_codecs::Format::WebP) => Some(format), +#[derive(Clone, Copy)] +enum SvgRaster { + Png, + Jpeg, + Gif, + WebP, +} + +impl SvgRaster { + fn codec(self) -> craft_image_codecs::Format { + match self { + Self::Png => craft_image_codecs::Format::Png, + Self::Jpeg => craft_image_codecs::Format::Jpeg, + Self::Gif => craft_image_codecs::Format::Gif, + Self::WebP => craft_image_codecs::Format::WebP, + } + } + + fn image_kind(self, data: Arc>) -> usvg::ImageKind { + match self { + Self::Png => usvg::ImageKind::PNG(data), + Self::Jpeg => usvg::ImageKind::JPEG(data), + Self::Gif => usvg::ImageKind::GIF(data), + Self::WebP => usvg::ImageKind::WEBP(data), + } + } +} + +/// Match supported raster signatures to the MIME types both image resolvers accept. +fn declared_raster(mime: &str, data: &[u8]) -> Option { + use craft_image_codecs::Format; + match (mime, craft_image_codecs::detect(data)?) { + ("image/png" | "text/plain", Format::Png) => Some(SvgRaster::Png), + ("image/jpg" | "image/jpeg" | "text/plain", Format::Jpeg) => Some(SvgRaster::Jpeg), + ("image/gif" | "text/plain", Format::Gif) => Some(SvgRaster::Gif), + ("image/webp" | "text/plain", Format::WebP) => Some(SvgRaster::WebP), _ => None, } } -fn raster_image(used: &Used, limits: &Limits, data: Arc>, format: craft_image_codecs::Format) -> Option { +fn raster_image(used: &Used, limits: &Limits, data: Arc>, format: SvgRaster) -> Option { let Ok((width, height)) = craft_image_codecs::probe_allocation_size(&data) else { used.invalid_raster.fetch_add(1, Ordering::Relaxed); return None; }; - if !matches!( - format, - craft_image_codecs::Format::Png | craft_image_codecs::Format::Jpeg | craft_image_codecs::Format::Gif | craft_image_codecs::Format::WebP - ) { - used.invalid_raster.fetch_add(1, Ordering::Relaxed); - return None; - } let pixels = u64::from(width).checked_mul(u64::from(height))?; if pixels == 0 || pixels > limits.embedded_raster_pixels { used.raster_limit.fetch_add(1, Ordering::Relaxed); @@ -590,12 +613,11 @@ fn raster_image(used: &Used, limits: &Limits, data: Arc>, format: craft_ } let pointer = Arc::as_ptr(&data) as usize; let mut seen = used.raster_data.lock().unwrap_or_else(PoisonError::into_inner); - if seen.insert(pointer) { + if let Entry::Vacant(entry) = seen.entry(pointer) { let mut current = used.raster_pixels.load(Ordering::Relaxed); loop { let next = current.checked_add(pixels)?; if next > limits.embedded_raster_pixels { - seen.remove(&pointer); used.raster_limit.fetch_add(1, Ordering::Relaxed); return None; } @@ -604,13 +626,16 @@ fn raster_image(used: &Used, limits: &Limits, data: Arc>, format: craft_ Err(actual) => current = actual, } } + // The weak reference pins the allocation identity, not its encoded bytes. + // At most one entry is added for each nonrefundable pixel charge. + entry.insert(Arc::downgrade(&data)); } drop(seen); // A valid header is not proof of valid pixels. resvg can silently omit a damaged // image later; decode now under explicit limits so omission accounting is honest. let decode_limits = craft_image_codecs::Limits::new(width, height, pixels, limits.embedded_raster_pixels.saturating_mul(8)); let options = craft_image_codecs::DecodeOptions { limits: decode_limits, keep_orientation: true }; - if let Err(error) = craft_image_codecs::decode_as_with(format, &data, &options) { + if let Err(error) = craft_image_codecs::decode_as_with(format.codec(), &data, &options) { // No tree retains this allocation on failure. Forget its address before it // can be reused, but keep the pixel charge for the decode work already spent. used.raster_data.lock().unwrap_or_else(PoisonError::into_inner).remove(&pointer); @@ -624,15 +649,37 @@ fn raster_image(used: &Used, limits: &Limits, data: Arc>, format: craft_ } return None; } - Some(match format { - craft_image_codecs::Format::Png => usvg::ImageKind::PNG(data), - craft_image_codecs::Format::Jpeg => usvg::ImageKind::JPEG(data), - craft_image_codecs::Format::Gif => usvg::ImageKind::GIF(data), - craft_image_codecs::Format::WebP => usvg::ImageKind::WEBP(data), - _ => return None, + Some(format.image_kind(data)) +} + +/// Decode one child within the original byte allowance, including encoding expansion. +fn embedded_text<'a>(data: &'a [u8], room: usize, limits: &Limits) -> Result, svgz::Error> { + let text = svgz::text(data, room.min(limits.bytes))?; + if text.len() > room { + return Err(svgz::Error::TooLarge(room)); + } + Ok(text) +} + +enum ChildRefusal { + Depth, + Bytes, + Invalid, +} + +fn preflight_child<'a>(text: &'a str, limits: &Limits) -> Result, ChildRefusal> { + preflight(text, limits).map_err(|error| match error { + Error::TooDeep(_) => ChildRefusal::Depth, + Error::Text(svgz::Error::TooLarge(_)) => ChildRefusal::Bytes, + _ => ChildRefusal::Invalid, }) } +/// Reserve the complete checked height within the parent's remaining XML room. +fn child_total_depth(parent: usize, checked: &Preflight<'_>, limits: &Limits) -> Option { + parent.checked_add(checked.height).filter(|depth| *depth <= limits.tree_depth) +} + /// An embedded SVG document, if the budgets allow it. fn embedded(used: &Used, limits: &Limits, data: &[u8], options: &usvg::Options<'_>) -> Option { if used.depth.load(Ordering::Relaxed) >= limits.embedded_depth { @@ -641,7 +688,7 @@ fn embedded(used: &Used, limits: &Limits, data: &[u8], options: &usvg::Options<' return None; } let left = limits.embedded_bytes.saturating_sub(used.bytes.load(Ordering::Relaxed)); - let text = match svgz::text(data, left.min(limits.bytes)) { + let text = match embedded_text(data, left, limits) { Ok(text) => text, // What a refused document unpacked before it was refused was work too: it uses up what // is left, so the next image can't repeat it. @@ -654,25 +701,17 @@ fn embedded(used: &Used, limits: &Limits, data: &[u8], options: &usvg::Options<' return None; } }; - // The raw/inflated bytes can fit while UTF-16/Latin-1 decoding expands - // beyond the aggregate allowance. A refusal consumes the remaining work. - if text.len() > left { - used.bytes.fetch_add(left, Ordering::Relaxed); - used.svg_limit.fetch_add(1, Ordering::Relaxed); - used.svg_resource_limit.fetch_add(1, Ordering::Relaxed); - return None; - } used.bytes.fetch_add(text.len(), Ordering::Relaxed); - let checked = match preflight(&text, limits) { + let checked = match preflight_child(&text, limits) { Ok(checked) => checked, // Decoding UTF-16 or Latin-1 can exceed the text cap after the // raw/inflated bytes fitted. This is a resource refusal, not invalid XML. - Err(Error::Text(svgz::Error::TooLarge(_))) => { + Err(ChildRefusal::Bytes) => { used.svg_limit.fetch_add(1, Ordering::Relaxed); used.svg_resource_limit.fetch_add(1, Ordering::Relaxed); return None; } - Err(Error::TooDeep(_)) => { + Err(ChildRefusal::Depth) => { used.svg_limit.fetch_add(1, Ordering::Relaxed); return None; } @@ -682,9 +721,7 @@ fn embedded(used: &Used, limits: &Limits, data: &[u8], options: &usvg::Options<' } }; // The nesting usvg converts, references followed, not the source depth alone. - let xml_depth = checked.height; - let total_depth = used.xml_depth.load(Ordering::Relaxed).checked_add(xml_depth); - let Some(total_depth) = total_depth.filter(|depth| *depth <= limits.tree_depth) else { + let Some(total_depth) = child_total_depth(used.xml_depth.load(Ordering::Relaxed), &checked, limits) else { used.svg_limit.fetch_add(1, Ordering::Relaxed); return None; }; @@ -719,16 +756,7 @@ pub fn image_resolver(limits: Limits) -> usvg::ImageHrefResolver<'static> { fn image_resolver_for(limits: Limits, used: Arc) -> usvg::ImageHrefResolver<'static> { usvg::ImageHrefResolver { resolve_data: Box::new(move |mime, data, options| { - let detected = raster_format(&data); - let format = match mime { - "image/jpg" | "image/jpeg" => (detected == Some(craft_image_codecs::Format::Jpeg)).then_some(craft_image_codecs::Format::Jpeg), - "image/png" => (detected == Some(craft_image_codecs::Format::Png)).then_some(craft_image_codecs::Format::Png), - "image/gif" => (detected == Some(craft_image_codecs::Format::Gif)).then_some(craft_image_codecs::Format::Gif), - "image/webp" => (detected == Some(craft_image_codecs::Format::WebP)).then_some(craft_image_codecs::Format::WebP), - "text/plain" => detected, - _ => None, - }; - if let Some(format) = format { + if let Some(format) = declared_raster(mime, &data) { return raster_image(&used, &limits, data, format); } // usvg can decode only the raster variants above. Count every other declared diff --git a/crates/svg/src/tree/draw.rs b/crates/svg/src/tree/draw.rs index 8a8bb1a7a..642a3888b 100644 --- a/crates/svg/src/tree/draw.rs +++ b/crates/svg/src/tree/draw.rs @@ -33,6 +33,8 @@ pub use resvg::tiny_skia; mod raster; #[cfg(feature = "tree-render")] pub use raster::{RasterValidationFailure, validate_raster}; +#[cfg(feature = "tree-render")] +pub(super) use raster::{decode_raster, probe_raster_pixels}; /// Filter primitives per filter. A result of every primitive is kept; real filters have 1 to 12 /// (Inkscape's drop shadow has 5), and 64 leaves headroom for generated ones. diff --git a/crates/svg/src/tree/draw/decoder_edges.rs b/crates/svg/src/tree/draw/decoder_edges.rs index ce6543b81..f83130cec 100644 --- a/crates/svg/src/tree/draw/decoder_edges.rs +++ b/crates/svg/src/tree/draw/decoder_edges.rs @@ -73,9 +73,15 @@ impl LockGraph { pub(crate) fn assert_renderer_edges(graph: &LockGraph, svg: &PackageId) { let renderer = graph.dependency(svg, "resvg"); assert_eq!(graph.dependency(svg, "usvg"), graph.dependency(&renderer, "usvg"), "shared and renderer trees must be the same resolved package"); - for codec in ["gif", "image-webp", "zune-jpeg"] { + for codec in ["gif", "image-webp"] { assert_eq!(graph.dependency(svg, codec), graph.dependency(&renderer, codec), "validator and selected renderer differ for {codec}"); } + let codecs = graph.dependency(svg, "craft-image-codecs"); + assert_eq!( + graph.dependency(&codecs, "zune-jpeg"), + graph.dependency(&renderer, "zune-jpeg"), + "JPEG validator and renderer must use the same backend" + ); } #[test] @@ -116,7 +122,10 @@ dependencies = ["codec"] fn selected_renderer_graph_rejects_a_split_validator_backend() { use std::fmt::Write; let make = |split: bool| { - let mut text = String::from("[[package]]\nname='craft-svg'\nversion='1'\ndependencies=['resvg', 'usvg', 'gif', 'image-webp', '"); + let mut text = String::from( + "[[package]]\nname='craft-svg'\nversion='1'\ndependencies=['resvg', 'usvg', 'gif', 'image-webp', 'craft-image-codecs']\n\ + [[package]]\nname='craft-image-codecs'\nversion='1'\ndependencies=['", + ); text.push_str(if split { "zune-jpeg 2" } else { "zune-jpeg 1" }); text.push_str( "']\n[[package]]\nname='resvg'\nversion='1'\nsource='registry+one'\ndependencies=['usvg', 'gif', 'image-webp', 'zune-jpeg 1']\n", diff --git a/crates/svg/src/tree/draw/raster.rs b/crates/svg/src/tree/draw/raster.rs index ffeb0d684..48bff6ae9 100644 --- a/crates/svg/src/tree/draw/raster.rs +++ b/crates/svg/src/tree/draw/raster.rs @@ -6,7 +6,7 @@ use std::io::Cursor; use std::num::NonZeroU64; -use crate::tree::{draw::tiny_skia, usvg}; +use crate::tree::{SvgRaster, draw::tiny_skia, usvg}; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum RasterValidationFailure { @@ -20,28 +20,41 @@ pub enum RasterValidationFailure { /// Failed attempted decodes keep their pixel charge. No decoded pixels are retained. SVG /// children use the same wrapped resolver and need no second recursive walk. pub fn validate_raster(kind: &usvg::ImageKind, max_pixels: u64, pixels_left: &mut u64) -> Result<(), RasterValidationFailure> { - let data = match kind { - usvg::ImageKind::PNG(data) | usvg::ImageKind::JPEG(data) | usvg::ImageKind::GIF(data) | usvg::ImageKind::WEBP(data) => data, + let (format, data) = match kind { + usvg::ImageKind::PNG(data) => (SvgRaster::Png, data), + usvg::ImageKind::JPEG(data) => (SvgRaster::Jpeg, data), + usvg::ImageKind::GIF(data) => (SvgRaster::Gif, data), + usvg::ImageKind::WEBP(data) => (SvgRaster::WebP, data), usvg::ImageKind::SVG(_) => return Ok(()), }; - // The allocation probe includes oversized GIF/WebP frames, not merely their - // canvas. Reserve before asking any rendering decoder to allocate pixels. + let pixels = probe_raster_pixels(data, max_pixels)?; + *pixels_left = pixels_left.checked_sub(pixels).ok_or(RasterValidationFailure::Limit)?; + decode_raster(format, data, pixels) +} + +pub(in crate::tree) fn probe_raster_pixels(data: &[u8], max_pixels: u64) -> Result { + // The allocation probe accounts for oversized GIF/WebP frames as well as the canvas. let (width, height) = craft_image_codecs::probe_allocation_size(data).map_err(|_| RasterValidationFailure::Invalid)?; let pixels = area(width, height)?; if pixels > max_pixels { return Err(RasterValidationFailure::Limit); } - *pixels_left = pixels_left.checked_sub(pixels).ok_or(RasterValidationFailure::Limit)?; - match kind { - usvg::ImageKind::PNG(data) => { + Ok(pixels) +} + +pub(in crate::tree) fn decode_raster(format: SvgRaster, data: &[u8], pixels: u64) -> Result<(), RasterValidationFailure> { + match format { + SvgRaster::Png => { let decoded = tiny_skia::Pixmap::decode_png(data).map_err(|_| RasterValidationFailure::Invalid)?; rgba_bytes(decoded.width(), decoded.height(), pixels)?; Ok(()) } - usvg::ImageKind::JPEG(data) => jpeg(data, pixels), - usvg::ImageKind::GIF(data) => gif(data, pixels), - usvg::ImageKind::WEBP(data) => webp(data, pixels), - usvg::ImageKind::SVG(_) => Ok(()), + SvgRaster::Jpeg => craft_image_codecs::validate_jpeg_rgba8(data, pixels).map_err(|error| match error { + craft_image_codecs::CodecError::LimitExceeded(_) => RasterValidationFailure::Limit, + _ => RasterValidationFailure::Invalid, + }), + SvgRaster::Gif => gif(data, pixels), + SvgRaster::WebP => webp(data, pixels), } } @@ -68,24 +81,6 @@ fn buffer(length: usize) -> Result, RasterValidationFailure> { Ok(output) } -fn jpeg(data: &[u8], admitted: u64) -> Result<(), RasterValidationFailure> { - use zune_jpeg::zune_core::colorspace::ColorSpace; - use zune_jpeg::zune_core::options::DecoderOptions; - - // Preserve the rendering decoder's default limits and RGBA conversion; a - // general photo decoder may accept formats the SVG renderer cannot draw. - let options = DecoderOptions::default().jpeg_set_out_colorspace(ColorSpace::RGBA); - let mut decoder = zune_jpeg::JpegDecoder::new_with_options(Cursor::new(data), options); - decoder.decode_headers().map_err(|_| RasterValidationFailure::Invalid)?; - let info = decoder.info().ok_or(RasterValidationFailure::Invalid)?; - let length = rgba_bytes(u32::from(info.width), u32::from(info.height), admitted)?; - if decoder.output_colorspace() != Some(ColorSpace::RGBA) || decoder.output_buffer_size() != Some(length) { - return Err(RasterValidationFailure::Invalid); - } - let mut output = buffer(length)?; - decoder.decode_into(&mut output).map_err(|_| RasterValidationFailure::Invalid) -} - fn gif(data: &[u8], admitted: u64) -> Result<(), RasterValidationFailure> { let bytes = admitted.checked_mul(4).ok_or(RasterValidationFailure::Limit)?; // Do not loosen the renderer's default 50 MB GIF frame limit. Smaller @@ -115,19 +110,12 @@ fn webp(data: &[u8], admitted: u64) -> Result<(), RasterValidationFailure> { let (width, height) = decoder.dimensions(); let rgba = rgba_bytes(width, height, admitted)?; let channels = if decoder.has_alpha() { 4 } else { 3 }; - let expected = usize::try_from(area(width, height)?.checked_mul(channels).ok_or(RasterValidationFailure::Limit)?) - .map_err(|_| RasterValidationFailure::Limit)?; - if expected > rgba { - return Err(RasterValidationFailure::Limit); - } + let expected = rgba / 4 * channels; if decoder.output_buffer_size() != Some(expected) { return Err(RasterValidationFailure::Invalid); } - // A small valid image can have a compressed chunk larger than its pixels. - // Bound decoder scratch without rejecting that ordinary encoding overhead. - let admitted_bytes = - usize::try_from(admitted.checked_mul(4).ok_or(RasterValidationFailure::Limit)?).map_err(|_| RasterValidationFailure::Limit)?; - decoder.set_memory_limit(admitted_bytes.max(data.len())); + // The decoder's metadata memory limit does not cap read_image scratch. + // Admit the frame and exact output buffer before calling read_image. let mut output = buffer(expected)?; decoder.read_image(&mut output).map_err(webp_error) } diff --git a/crates/svg/src/tree/draw/raster_tests.rs b/crates/svg/src/tree/draw/raster_tests.rs index 273705744..be84e4738 100644 --- a/crates/svg/src/tree/draw/raster_tests.rs +++ b/crates/svg/src/tree/draw/raster_tests.rs @@ -132,10 +132,6 @@ fn renderer_validator_rejects_corrupt_pixels_after_valid_dimensions_without_refu for (format, data, dimensions) in cases { assert_eq!(craft_image_codecs::probe_allocation_size(&data).unwrap(), dimensions, "{format:?}"); match format { - Format::Jpeg => { - let mut headers = zune_jpeg::JpegDecoder::new(Cursor::new(&data)); - headers.decode_headers().expect("intact JPEG scan headers before unavailable pixel-decode table"); - } Format::Gif => { gif::DecodeOptions::new().read_info(data.as_slice()).expect("intact GIF headers before corrupt LZW pixels"); } diff --git a/crates/svg/src/tree/image_href.rs b/crates/svg/src/tree/image_href.rs index d33388846..620289a80 100644 --- a/crates/svg/src/tree/image_href.rs +++ b/crates/svg/src/tree/image_href.rs @@ -36,11 +36,7 @@ pub(super) fn normalize<'a>(checked: &super::Preflight<'a>) -> Result()).min(usize::try_from(limits.xml_nodes).unwrap_or(usize::MAX)); let mut patches: Vec = Vec::new(); for node in xml.descendants().filter(|node| node.is_element()) { @@ -99,6 +95,30 @@ pub(super) fn normalize<'a>(checked: &super::Preflight<'a>) -> Result) -> Option { + let mut work = checked.xml.input_text().len().saturating_add(checked.limits.entity_bytes).saturating_mul(6); + let mut omitted = 0usize; + for node in checked.xml.descendants().filter(|node| node.is_element() && matches!(node.tag_name().name(), "image" | "feImage")) { + for href in node.attributes().filter(|a| a.name() == "href" && matches!(a.namespace(), None | Some(XLINK_NS))) { + let value = href.value(); + work = work.checked_sub(value.len())?; + if !mime_header_admitted(value) { + return None; + } + } + if let Some(value) = node.attribute((XLINK_NS, "href")).or_else(|| node.attribute("href")) + && malformed_data_url_replacement(value, &mut work).ok()? == Some(INVALID_IMAGE) + { + omitted = omitted.saturating_add(1); + } + } + Some(omitted) +} + // The pinned MIME parser searches all earlier parameters for each new name. // Cap even quoted semicolons before invoking it: source-byte work is already // charged, so at most this constant times the bounded XML work reaches MIME @@ -295,6 +315,16 @@ mod tests { Limits { bytes: 1 << 20, depth: 32, tree_depth: 32, entity_bytes: 65_536, ..Default::default() } } + #[test] + fn original_dom_fallback_does_not_bypass_mime_admission() { + let ordinary = ""; + assert_eq!(unrepaired_image_omissions(&super::super::preflight(ordinary, &limits()).unwrap()), Some(1)); + + let header = "a=b;".repeat(MAX_MIME_SEPARATORS + 1); + let excessive = format!(""); + assert!(unrepaired_image_omissions(&super::super::preflight(&excessive, &limits()).unwrap()).is_none()); + } + #[test] fn malformed_image_urls_are_repaired_in_both_svg_namespaces_and_filter_resources() { for tag in ["image", "feImage"] { diff --git a/crates/svg/src/tree/tests.rs b/crates/svg/src/tree/tests.rs index abdf0f772..7663ab301 100644 --- a/crates/svg/src/tree/tests.rs +++ b/crates/svg/src/tree/tests.rs @@ -547,7 +547,7 @@ mod invalid_image_accounting { } #[test] - fn failed_decode_forgets_address_but_preserves_spent_budget() { + fn failed_decode_releases_input_but_preserves_spent_budget() { let valid = png(); let idat = valid.windows(4).position(|b| b == b"IDAT").unwrap(); let invalid = Arc::new(valid[..idat + 4].to_vec()); @@ -555,11 +555,12 @@ mod invalid_image_accounting { let limits = Limits { embedded_raster_pixels: 3, ..shallow() }; let resolver = ImageResolver::new(limits); let used = &resolver.used; - let format = craft_image_codecs::Format::Png; + let format = SvgRaster::Png; assert!(raster_image(used, &limits, invalid, format).is_none()); - assert!(!used.raster_data.lock().unwrap().contains(&pointer)); + assert!(!used.raster_data.lock().unwrap().contains_key(&pointer)); assert_eq!(resolver.usage().raster_pixels, 1); let first_data = Arc::new(valid.clone()); + let first_pointer = Arc::as_ptr(&first_data) as usize; let first = raster_image(used, &limits, first_data.clone(), format).unwrap(); assert_eq!(resolver.usage().raster_pixels, 2); let repeated = raster_image(used, &limits, first_data, format).unwrap(); @@ -569,6 +570,9 @@ mod invalid_image_accounting { assert!(raster_image(used, &limits, Arc::new(valid), format).is_none()); assert_eq!(resolver.usage().raster_limit_images, 1); drop((first, repeated, second)); + let seen = used.raster_data.lock().unwrap(); + let identity = seen.get(&first_pointer).expect("the cache holds the allocation identity"); + assert!(identity.upgrade().is_none(), "the cache must not retain encoded bytes"); } #[test] diff --git a/crates/svg/src/tree/validated.rs b/crates/svg/src/tree/validated.rs index a09aa3929..c6c591f5d 100644 --- a/crates/svg/src/tree/validated.rs +++ b/crates/svg/src/tree/validated.rs @@ -1,6 +1,10 @@ //! Opt-in complete image validation and checked-DOM normalization. //! Legacy ImageResolver entry points retain their existing behavior. -use super::{Error, ImageUsage, Limits, Preflight, image_href, preflight, raster_format, usvg}; +use super::draw::{RasterValidationFailure, decode_raster, probe_raster_pixels}; +use super::{ + ChildRefusal, Error, ImageUsage, Limits, Preflight, child_total_depth, declared_raster, embedded_text, image_href, preflight, preflight_child, + usvg, +}; use crate::svgz; use std::sync::{Arc, Mutex, PoisonError}; @@ -125,33 +129,6 @@ impl State { self.svg_resource_limits = self.svg_resource_limits.saturating_add(1); } } - - fn raster(&mut self, kind: &usvg::ImageKind) -> bool { - let encoded = match kind { - usvg::ImageKind::SVG(_) => return true, - usvg::ImageKind::PNG(data) | usvg::ImageKind::JPEG(data) | usvg::ImageKind::GIF(data) | usvg::ImageKind::WEBP(data) => data, - }; - // usvg supplies a fresh Arc for every data-URL resolution, including - // repeated instances. Charge each actual validation, never retain - // encoded buffers in an address-keyed memo that cannot hit this boundary. - let Some(left) = self.encoded_left.checked_sub(encoded.len()) else { - self.raster_limits = self.raster_limits.saturating_add(1); - return false; - }; - self.encoded_left = left; - let result = super::draw::validate_raster(kind, self.pixel_limit, &mut self.pixels_left); - match result { - Ok(()) => true, - Err(super::draw::RasterValidationFailure::Invalid) => { - self.invalid_raster = self.invalid_raster.saturating_add(1); - false - } - Err(super::draw::RasterValidationFailure::Limit) => { - self.raster_limits = self.raster_limits.saturating_add(1); - false - } - } - } } /// One opt-in drawing's image work, normalization and exact rendering validation. @@ -196,7 +173,7 @@ impl ValidatedImageResolver { // contributes its complete checked height, as in legacy child admission. let _scope = self.root_scope(checked.height.saturating_sub(1))?; options.image_href_resolver = self.resolver(); - convert_checked(checked, &options) + self.convert_checked(checked, &options) } /// Resolve an already-decoded child SVG, charging original text before XML @@ -224,24 +201,8 @@ impl ValidatedImageResolver { usvg::ImageHrefResolver { resolve_string: Box::new(|_, _| None), resolve_data: Box::new(move |mime, data, options| { - let detected = raster_format(&data); - let format = match mime { - "image/jpg" | "image/jpeg" => (detected == Some(craft_image_codecs::Format::Jpeg)).then_some(craft_image_codecs::Format::Jpeg), - "image/png" => (detected == Some(craft_image_codecs::Format::Png)).then_some(craft_image_codecs::Format::Png), - "image/gif" => (detected == Some(craft_image_codecs::Format::Gif)).then_some(craft_image_codecs::Format::Gif), - "image/webp" => (detected == Some(craft_image_codecs::Format::WebP)).then_some(craft_image_codecs::Format::WebP), - "text/plain" => detected, - _ => None, - }; - if let Some(format) = format { - let kind = match format { - craft_image_codecs::Format::Png => usvg::ImageKind::PNG(data), - craft_image_codecs::Format::Jpeg => usvg::ImageKind::JPEG(data), - craft_image_codecs::Format::Gif => usvg::ImageKind::GIF(data), - craft_image_codecs::Format::WebP => usvg::ImageKind::WEBP(data), - _ => return None, - }; - return this.state.lock().unwrap_or_else(PoisonError::into_inner).raster(&kind).then_some(kind); + if let Some(format) = declared_raster(mime, &data) { + return this.raster_with(&data, |pixels| decode_raster(format, &data, pixels)).then(|| format.image_kind(data)); } if !matches!(mime, "image/svg+xml" | "text/plain") { if mime.starts_with("image/") { @@ -255,6 +216,33 @@ impl ValidatedImageResolver { } } + fn raster_with(&self, data: &[u8], decode: impl FnOnce(u64) -> Result<(), RasterValidationFailure>) -> bool { + let result = self.reserve_raster(data).and_then(decode); + if let Err(error) = result { + let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); + match error { + RasterValidationFailure::Invalid => state.invalid_raster = state.invalid_raster.saturating_add(1), + RasterValidationFailure::Limit => state.raster_limits = state.raster_limits.saturating_add(1), + } + return false; + } + true + } + + fn reserve_raster(&self, data: &[u8]) -> Result { + { + let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); + // usvg uses a fresh Arc for each data-URL callback. Each actual validation + // spends encoded work, including when the header or decoder refuses it. + state.encoded_left = state.encoded_left.checked_sub(data.len()).ok_or(RasterValidationFailure::Limit)?; + } + let pixels = probe_raster_pixels(data, self.limits.embedded_raster_pixels)?; + let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); + state.pixels_left = state.pixels_left.checked_sub(pixels).ok_or(RasterValidationFailure::Limit)?; + // The caller decodes after releasing the mutex. The work stays charged. + Ok(pixels) + } + fn can_start_child(&self) -> bool { let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); if state.depth >= self.limits.embedded_depth { @@ -277,15 +265,24 @@ impl ValidatedImageResolver { } state.svg_bytes_left }; - let text = match svgz::text(data, room.min(self.limits.bytes)) { - Ok(text) if text.len() <= room => text, - error => { + let text = match embedded_text(data, room, &self.limits) { + Ok(text) => text, + Err(error) => { let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); + if matches!(error, svgz::Error::Encoding) && !crate::sniff::is_svgz(data) { + // Plain text validation can spend at most the input's bytes. + // An invalid encoding does not exhaust a later sibling's room. + state.svg_bytes_left = state.svg_bytes_left.saturating_sub(data.len()); + state.invalid_svg = state.invalid_svg.saturating_add(1); + return None; + } state.svg_bytes_left = 0; - if matches!(error, Err(svgz::Error::TooLarge(_))) || error.is_ok() { + if matches!(error, svgz::Error::TooLarge(_)) { state.svg_limits = state.svg_limits.saturating_add(1); state.svg_resource_limits = state.svg_resource_limits.saturating_add(1); } else { + // An unreadable compressed stream may have used the entire + // allowed inflation work. Later callbacks can only classify. state.invalid_svg = state.invalid_svg.saturating_add(1); state.svg_failure_exhausted = true; state.classification_content_left = room; @@ -316,24 +313,24 @@ impl ValidatedImageResolver { // an attribute or conversion subsequently fails. state.svg_bytes_left = left; } - let checked = match preflight(text, &self.limits) { + let checked = match preflight_child(text, &self.limits) { Ok(checked) => checked, Err(error) => { let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); match error { - Error::TooDeep(_) => state.svg_limits = state.svg_limits.saturating_add(1), - Error::Text(svgz::Error::TooLarge(_)) => { + ChildRefusal::Depth => state.svg_limits = state.svg_limits.saturating_add(1), + ChildRefusal::Bytes => { state.svg_limits = state.svg_limits.saturating_add(1); state.svg_resource_limits = state.svg_resource_limits.saturating_add(1); } - _ => state.invalid_svg = state.invalid_svg.saturating_add(1), + ChildRefusal::Invalid => state.invalid_svg = state.invalid_svg.saturating_add(1), } return None; } }; let scope = { let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); - let Some(total) = state.xml_depth.checked_add(checked.height).filter(|depth| *depth <= self.limits.tree_depth) else { + let Some(total) = child_total_depth(state.xml_depth, &checked, &self.limits) else { state.svg_limits = state.svg_limits.saturating_add(1); return None; }; @@ -345,7 +342,7 @@ impl ValidatedImageResolver { state.svg_depth = state.svg_depth.max(state.depth); Scope { state: Arc::clone(&self.state), previous, child: true } }; - let result = convert_checked(checked, options); + let result = self.convert_checked(checked, options); drop(scope); let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); match result { @@ -359,6 +356,25 @@ impl ValidatedImageResolver { } } } + fn convert_checked(&self, checked: Preflight<'_>, options: &usvg::Options<'_>) -> Result { + match image_href::normalize(&checked) { + Ok(std::borrow::Cow::Borrowed(_)) => checked.parse(options), + Ok(std::borrow::Cow::Owned(text)) => { + let limits = checked.limits; + drop(checked); + preflight(&text, &limits)?.parse(options) + } + Err(repair_error) => { + // Keep the original checked DOM if its URLs are safe to pass to + // usvg. Malformed optional URLs are dropped by its parser. + let omitted = image_href::unrepaired_image_omissions(&checked).ok_or(repair_error)?; + let tree = checked.parse(options)?; + let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner); + state.invalid_raster = state.invalid_raster.saturating_add(omitted); + Ok(tree) + } + } + } } struct Scope { @@ -378,17 +394,6 @@ impl Drop for Scope { } } -fn convert_checked(checked: Preflight<'_>, options: &usvg::Options<'_>) -> Result { - match image_href::normalize(&checked)? { - std::borrow::Cow::Borrowed(_) => checked.parse(options), - std::borrow::Cow::Owned(text) => { - let limits = checked.limits; - drop(checked); - preflight(&text, &limits)?.parse(options) - } - } -} - #[cfg(test)] mod tests; diff --git a/crates/svg/src/tree/validated/tests.rs b/crates/svg/src/tree/validated/tests.rs index c090d7ab6..7eaa47dab 100644 --- a/crates/svg/src/tree/validated/tests.rs +++ b/crates/svg/src/tree/validated/tests.rs @@ -15,9 +15,6 @@ fn test_limits(pixels: u64) -> Limits { ..Default::default() } } -fn test_state(pixels: u64) -> State { - State::new(test_limits(pixels)) -} fn wrapped_options(pixels: u64) -> (usvg::Options<'static>, Arc>, Arc) { let resolver = Arc::new(ValidatedImageResolver::new(test_limits(pixels))); let options = usvg::Options { image_href_resolver: resolver.resolver(), ..Default::default() }; @@ -184,40 +181,51 @@ fn failed_raster_callbacks_release_sources_and_keep_every_decode_charge() { let idat = broken.windows(4).position(|bytes| bytes == b"IDAT").unwrap(); broken[idat + 4] ^= 1; assert_eq!(craft_image_codecs::probe_allocation_size(&broken).unwrap(), (2, 2)); - let mut state = test_state(8); - let encoded_before = state.encoded_left; + let (options, state, resolver) = wrapped_options(8); + let encoded_before = state.lock().unwrap().encoded_left; for attempt in 1..=2 { // Match usvg's actual callback boundary: each href gets a new Arc. let encoded = Arc::new(broken.clone()); let weak = Arc::downgrade(&encoded); - let kind = usvg::ImageKind::PNG(Arc::clone(&encoded)); - assert!(!state.raster(&kind)); - assert_eq!(state.pixels_left, 8 - attempt * 4); - assert_eq!(state.encoded_left, encoded_before - attempt as usize * encoded.len()); - assert_eq!(state.invalid_raster, attempt as usize); - drop(kind); + assert!((options.image_href_resolver.resolve_data)("image/png", Arc::clone(&encoded), &options).is_none()); + let usage = resolver.usage(); + assert_eq!(usage.raster_pixels, attempt * 4); + assert_eq!(state.lock().unwrap().encoded_left, encoded_before - attempt as usize * encoded.len()); + assert_eq!(usage.invalid_raster_images, attempt as usize); drop(encoded); assert!(weak.upgrade().is_none(), "validation must not retain failed callback buffers until parse completion"); } - assert!(!state.raster(&usvg::ImageKind::PNG(Arc::new(png())))); - assert_eq!((state.invalid_raster, state.raster_limits), (2, 1)); - assert_eq!(state.usage().raster_pixels, 8); + assert!((options.image_href_resolver.resolve_data)("image/png", Arc::new(png()), &options).is_none()); + let usage = resolver.usage(); + assert_eq!((usage.invalid_raster_images, usage.raster_limit_images, usage.raster_pixels), (2, 1, 8)); } #[test] fn valid_raster_callbacks_spend_exact_pixel_and_encoded_allowances_per_call() { let encoded = Arc::new(png()); - let kind = usvg::ImageKind::PNG(Arc::clone(&encoded)); - let mut state = test_state(8); - state.encoded_left = encoded.len() * 2; - assert!(state.raster(&kind)); - assert_eq!((state.pixels_left, state.encoded_left), (4, encoded.len())); - assert!(state.raster(&kind), "even a directly reused Arc is a new actual validation call"); - assert_eq!((state.pixels_left, state.encoded_left), (0, 0)); - assert!(!state.raster(&kind)); - assert_eq!((state.invalid_raster, state.raster_limits), (0, 1)); - let usage = state.usage(); - assert_eq!((usage.raster_pixels, usage.raster_limit_images), (8, 1)); + let (options, state, resolver) = wrapped_options(8); + let call = || (options.image_href_resolver.resolve_data)("image/png", Arc::clone(&encoded), &options); + state.lock().unwrap().encoded_left = encoded.len() * 2; + assert!(call().is_some()); + assert_eq!(resolver.usage().raster_pixels, 4); + assert_eq!(state.lock().unwrap().encoded_left, encoded.len()); + assert!(call().is_some(), "even a directly reused Arc is a new actual validation call"); + assert_eq!(state.lock().unwrap().encoded_left, 0); + assert!(call().is_none()); + let usage = resolver.usage(); + assert_eq!((usage.raster_pixels, usage.invalid_raster_images, usage.raster_limit_images), (8, 0, 1)); +} + +#[test] +fn raster_decode_happens_after_the_work_is_charged_and_mutex_released() { + let (_, state, resolver) = wrapped_options(4); + let image = png(); + assert!(resolver.raster_with(&image, |admitted| { + assert_eq!(admitted, 4); + assert!(state.try_lock().is_ok(), "a usage snapshot must not wait for the raster decode"); + assert_eq!(resolver.usage().raster_pixels, 4); + Ok(()) + })); } #[test] @@ -237,13 +245,14 @@ fn encoded_raster_refusal_is_per_image_and_does_not_consume_unattempted_work() { let bytes = png(); let mut oversized = bytes.clone(); oversized.extend([0; 32]); - let mut state = test_state(4); - state.encoded_left = bytes.len(); - assert!(!state.raster(&usvg::ImageKind::PNG(Arc::new(oversized)))); - assert_eq!((state.encoded_left, state.pixels_left), (bytes.len(), 4)); - assert!(state.raster(&usvg::ImageKind::PNG(Arc::new(bytes)))); - assert_eq!((state.encoded_left, state.pixels_left), (0, 0)); - let usage = state.usage(); + let (options, state, resolver) = wrapped_options(4); + state.lock().unwrap().encoded_left = bytes.len(); + assert!((options.image_href_resolver.resolve_data)("image/png", Arc::new(oversized), &options).is_none()); + assert_eq!(state.lock().unwrap().encoded_left, bytes.len()); + assert_eq!(resolver.usage().raster_pixels, 0); + assert!((options.image_href_resolver.resolve_data)("image/png", Arc::new(bytes), &options).is_some()); + assert_eq!(state.lock().unwrap().encoded_left, 0); + let usage = resolver.usage(); assert_eq!((usage.raster_pixels, usage.raster_limit_images, usage.invalid_raster_images), (4, 1, 0)); } @@ -285,7 +294,10 @@ fn plain_legacy_encoding_rechecks_have_a_separate_bounded_work_allowance() { bytes.to_vec() } }; - assert!((options.image_href_resolver.resolve_data)("image/svg+xml", Arc::new(encode(&[0xff])), &options).is_none()); + // A failed compressed decode exhausts the primary pool. The + // callbacks under test may use plain or compressed encodings. + let invalid = Arc::new(crate::svgz::compress(&[0xff])); + assert!((options.image_href_resolver.resolve_data)("image/svg+xml", invalid, &options).is_none()); state.lock().unwrap_or_else(PoisonError::into_inner).classification_text_bytes_left = xml.len(); assert!((options.image_href_resolver.resolve_data)("image/svg+xml", Arc::new(encode(xml)), &options).is_none()); { diff --git a/crates/svg/src/tree/validated/xml_tests.rs b/crates/svg/src/tree/validated/xml_tests.rs index e0ea41aca..e156c42e6 100644 --- a/crates/svg/src/tree/validated/xml_tests.rs +++ b/crates/svg/src/tree/validated/xml_tests.rs @@ -42,6 +42,36 @@ fn parse_count(text: &str, limits: Limits) -> (super::super::ImageUsage, usize) (context.usage(), PREFLIGHT_PASSES.with(|count| count.get())) } +#[test] +fn malformed_plain_child_leaves_work_for_valid_siblings() { + let child = drawing(""); + for invalid in [&[0xff][..], &[0xff, 0xfe, 0xd8][..]] { + let contents = format!("{}{}", image(&url(invalid)), image(&url(child.as_bytes()))); + let root = drawing(&contents); + let limits = Limits { embedded_bytes: invalid.len() + child.len(), ..Default::default() }; + let context = ValidatedImageResolver::new(limits); + let tree = context.parse_preflight(preflight(&root, &limits).unwrap(), usvg::Options::default()).unwrap(); + let usage = context.usage(); + assert_eq!((usage.invalid_svg_images, usage.embedded_svg_count, usage.svg_limit_images), (1, 1, 0)); + assert_eq!(usage.embedded_svg_bytes, limits.embedded_bytes); + let mut pixmap = super::super::draw::tiny_skia::Pixmap::new(4, 4).unwrap(); + super::super::draw::resvg::render(&tree, Default::default(), &mut pixmap.as_mut()); + assert_eq!(pixmap.pixel(2, 2).unwrap().red(), 255); + } +} + +#[test] +fn a_malformed_image_at_the_svg_byte_cap_does_not_drop_the_drawing() { + let root = drawing(""); + let limits = Limits { bytes: root.len(), ..Default::default() }; + let context = ValidatedImageResolver::new(limits); + let tree = context.parse_preflight(preflight(&root, &limits).unwrap(), usvg::Options::default()).unwrap(); + assert_eq!(context.usage().invalid_raster_images, 1); + let mut pixmap = super::super::draw::tiny_skia::Pixmap::new(4, 4).unwrap(); + super::super::draw::resvg::render(&tree, Default::default(), &mut pixmap.as_mut()); + assert_eq!(pixmap.pixel(2, 2).unwrap().red(), 255); +} + #[test] fn validated_root_reuses_checked_xml_and_rechecks_only_changed_attributes() { let ordinary = drawing(""); From 6413cbb8060d55d0514adfe8e883904b441426d5 Mon Sep 17 00:00:00 2001 From: Terra854 Date: Wed, 18 Nov 2026 04:34:32 +0800 Subject: [PATCH 114/183] Guard SVG JPEG validation on panic-abort builds --- crates/image-codecs/src/codecs/jpeg.rs | 53 ++++++++++++++++++++------ 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/crates/image-codecs/src/codecs/jpeg.rs b/crates/image-codecs/src/codecs/jpeg.rs index ef6601a58..7f9cdaeaa 100644 --- a/crates/image-codecs/src/codecs/jpeg.rs +++ b/crates/image-codecs/src/codecs/jpeg.rs @@ -52,6 +52,15 @@ pub(crate) struct JpegMeta { /// Unlike general JPEG import it does not fall back to additional JPEG modes, /// apply orientation, or retain pixels. The caller supplies the admitted pixel count. pub fn validate_jpeg_rgba8(bytes: &[u8], max_pixels: u64) -> Result<(), CodecError> { + validate_jpeg_rgba8_with_panic_policy(bytes, max_pixels, cfg!(panic = "abort")) +} + +fn validate_jpeg_rgba8_with_panic_policy(bytes: &[u8], max_pixels: u64, panic_aborts: bool) -> Result<(), CodecError> { + // The decoder can assert while upsampling these frames. On abort builds the + // unwind guard below cannot turn that assertion into an image omission. + if panic_aborts && first_component_subsampled(bytes) { + return Err(CodecError::malformed(F, "JPEG first component is subsampled below the frame maximum")); + } let decode = || { let options = DecoderOptions::default().jpeg_set_out_colorspace(ColorSpace::RGBA); let mut decoder = zune_jpeg::JpegDecoder::new_with_options(std::io::Cursor::new(bytes), options); @@ -1103,25 +1112,45 @@ mod tests { (v * 65535.0 / 4095.0).round() as u16 } + fn progressive_frame_header(comps: &[(u8, u8)]) -> Vec { + let mut s = vec![0xFF, 0xD8, 0xFF, 0xE0, 0, 4, 0, 0, 0xFF, 0xC2, 0, (8 + 3 * comps.len()) as u8, 8, 0, 8, 0, 8, comps.len() as u8]; + for (i, &(h, v)) in comps.iter().enumerate() { + s.extend([i as u8 + 1, (h << 4) | v, 0]); + } + s + } + #[test] fn first_component_subsampling() { - let sof = |comps: &[(u8, u8)]| { - let mut s = vec![0xFF, 0xD8, 0xFF, 0xE0, 0, 4, 0, 0, 0xFF, 0xC2, 0, (8 + 3 * comps.len()) as u8, 8, 0, 8, 0, 8, comps.len() as u8]; - for (i, &(h, v)) in comps.iter().enumerate() { - s.extend([i as u8 + 1, (h << 4) | v, 0]); - } - s - }; - assert!(first_component_subsampled(&sof(&[(1, 1), (1, 1), (1, 1), (2, 2)]))); - assert!(first_component_subsampled(&sof(&[(1, 2), (1, 2), (2, 1)]))); - assert!(!first_component_subsampled(&sof(&[(2, 2), (1, 1), (1, 1)]))); - assert!(!first_component_subsampled(&sof(&[(1, 1); 4]))); - assert!(!first_component_subsampled(&sof(&[]))); + assert!(first_component_subsampled(&progressive_frame_header(&[(1, 1), (1, 1), (1, 1), (2, 2)]))); + assert!(first_component_subsampled(&progressive_frame_header(&[(1, 2), (1, 2), (2, 1)]))); + assert!(!first_component_subsampled(&progressive_frame_header(&[(2, 2), (1, 1), (1, 1)]))); + assert!(!first_component_subsampled(&progressive_frame_header(&[(1, 1); 4]))); + assert!(!first_component_subsampled(&progressive_frame_header(&[]))); assert!(!first_component_subsampled(&[0xFF, 0xD8, 0xFF, 0xDA, 0, 2])); assert!(!first_component_subsampled(&[0xFF, 0xD8, 0xFF, 0xC0, 0, 20, 8])); assert!(!first_component_subsampled(b"not a jpeg")); } + #[test] + fn renderer_validation_refuses_unsafe_sampling_under_abort_policy() { + // The frame header alone exercises refusal before any pixel decode. + let header = progressive_frame_header(&[(1, 1), (1, 1), (1, 1), (2, 2)]); + let refuses_sampling = |result| { + matches!( + result, + Err(CodecError::Malformed { format: Format::Jpeg, message }) + if message == "JPEG first component is subsampled below the frame maximum" + ) + }; + assert!(refuses_sampling(validate_jpeg_rgba8_with_panic_policy(&header, 64, true))); + assert!(!refuses_sampling(validate_jpeg_rgba8_with_panic_policy(&header, 64, false))); + + let mut ordinary = Vec::new(); + jpeg_encoder::Encoder::new(&mut ordinary, 90).encode(&[128], 1, 1, jpeg_encoder::ColorType::Luma).unwrap(); + validate_jpeg_rgba8_with_panic_policy(&ordinary, 1, true).unwrap(); + } + #[test] fn routing() { assert!(!uses_craft_jpeg(&[0xFF, 0xD8, 0xFF, 0xC0, 0, 11, 8, 0, 8, 0, 8, 1, 1, 0x11, 0])); From 1d5255e07f2463ea784860505e1f7ce68d6adffd Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 15:48:26 -0500 Subject: [PATCH 115/183] vectordrawable: bound configurable XML depth with iterative writing --- crates/vectordrawable/src/write.rs | 135 +++++++++++++++++++++++++---- 1 file changed, 116 insertions(+), 19 deletions(-) diff --git a/crates/vectordrawable/src/write.rs b/crates/vectordrawable/src/write.rs index ec14fca97..5a883df77 100644 --- a/crates/vectordrawable/src/write.rs +++ b/crates/vectordrawable/src/write.rs @@ -13,6 +13,10 @@ use crate::model::{Cap, Color, Fill, GradientKind, Group, Item, ItemKind, Join, /// never recurses without bound. Android Studio's own drawables nest a handful of levels. pub const MAX_DEPTH: usize = 256; +/// Hard ceiling for [`document_with_depth_limit`]. A caller may need extra XML groups for +/// transforms and clips around each bounded application layer, but cannot disable the guard. +pub const MAX_CONFIGURED_DEPTH: usize = 1024; + const ANDROID: &str = "http://schemas.android.com/apk/res/android"; const AAPT: &str = "http://schemas.android.com/aapt"; @@ -110,18 +114,37 @@ impl Out { } /// Whether a path that is written (see [`MAX_DEPTH`]) has a gradient fill. -fn uses_gradient(items: &[Item], depth: usize) -> bool { - items.iter().any(|it| match &it.kind { - ItemKind::Path(p) => matches!(p.fill, Some(Fill::Gradient(_))), - ItemKind::Group(g) => depth < MAX_DEPTH && uses_gradient(&g.children, depth + 1), - }) +fn uses_gradient(items: &[Item], max_depth: usize) -> bool { + let mut pending = vec![(1, items.iter())]; + while let Some((depth, items)) = pending.last_mut() { + let depth = *depth; + match items.next().map(|it| &it.kind) { + Some(ItemKind::Path(p)) if matches!(p.fill, Some(Fill::Gradient(_))) => return true, + Some(ItemKind::Group(g)) if depth < max_depth => pending.push((depth + 1, g.children.iter())), + Some(_) => {} + None => { + pending.pop(); + } + } + } + false } /// The whole file: a `width`×`height` dp drawable with a viewport of the same size. pub fn document(width: f64, height: f64, items: &[Item]) -> String { + document_with_depth_limit(width, height, items, MAX_DEPTH) +} + +/// Write with a caller-selected XML group depth cap, clamped to `1..=MAX_CONFIGURED_DEPTH`. +/// +/// A group at the cap keeps its attributes and clip but not its children. The default +/// [`document`] cap is unchanged. Use this when one bounded source layer projects to several +/// XML wrapper groups; the caller must include those wrappers in its depth calculation. +pub fn document_with_depth_limit(width: f64, height: f64, items: &[Item], max_depth: usize) -> String { + let max_depth = max_depth.clamp(1, MAX_CONFIGURED_DEPTH); let mut o = Out { s: String::from("\n") }; let mut attrs = vec![("xmlns:android", ANDROID.to_string())]; - if uses_gradient(items, 1) { + if uses_gradient(items, max_depth) { attrs.push(("xmlns:aapt", AAPT.to_string())); } attrs.extend([ @@ -135,21 +158,35 @@ pub fn document(width: f64, height: f64, items: &[Item]) -> String { // Android refuses a without a ("no path defined"): one empty, unfilled path. o.open(1, "path", &[("android:pathData", "M0,0".to_string())], true); } - for it in items { - item(&mut o, 1, it); - } + write_items(&mut o, items, max_depth); o.close(0, "vector"); o.s } -fn item(o: &mut Out, depth: usize, it: &Item) { - match &it.kind { - ItemKind::Path(p) => path(o, depth, p), - ItemKind::Group(g) => group(o, depth, g), +fn write_items(o: &mut Out, items: &[Item], max_depth: usize) { + // One iterator per open group, not one pending entry per sibling. The configured depth + // bounds this stack, and wide documents do not require a second list of their items. + let mut pending = vec![(1, items.iter())]; + while let Some((depth, items)) = pending.last_mut() { + let depth = *depth; + match items.next().map(|it| &it.kind) { + Some(ItemKind::Path(p)) => path(o, depth, p), + Some(ItemKind::Group(g)) => { + if group(o, depth, g, max_depth) { + pending.push((depth + 1, g.children.iter())); + } + } + None => { + pending.pop(); + if depth > 1 { + o.close(depth - 1, "group"); + } + } + } } } -fn group(o: &mut Out, depth: usize, g: &Group) { +fn group(o: &mut Out, depth: usize, g: &Group, max_depth: usize) -> bool { let mut attrs = Vec::new(); if let Some(n) = &g.name { attrs.push(("android:name", esc(n))); @@ -172,19 +209,21 @@ fn group(o: &mut Out, depth: usize, g: &Group) { attrs.push(("android:translateY", num(x.translate.1))); } } - let children: &[Item] = if depth < MAX_DEPTH { &g.children } else { &[] }; + let children: &[Item] = if depth < max_depth { &g.children } else { &[] }; if children.is_empty() && g.clip.is_none() { o.open(depth, "group", &attrs, true); - return; + return false; } o.open(depth, "group", &attrs, false); if let Some(c) = &g.clip { o.open(depth + 1, "clip-path", &[("android:pathData", path_data(c))], true); } - for c in children { - item(o, depth + 1, c); + if children.is_empty() { + o.close(depth, "group"); + false + } else { + true } - o.close(depth, "group"); } fn stroke_attrs(attrs: &mut Vec<(&str, String)>, s: &Stroke) { @@ -445,3 +484,61 @@ mod tests { assert!(xml.contains(" Item { + let mut item = Item { + bbox: Rect::ZERO, + kind: ItemKind::Path(Path { + name: Some("deep".into()), + data: BezPath::new(), + stroke: None, + even_odd: false, + fill: Some(Fill::Gradient(Gradient { kind: GradientKind::Sweep { center: (0.0, 0.0) }, stops: vec![] })), + }), + }; + for _ in 0..groups { + item = Item { bbox: Rect::ZERO, kind: ItemKind::Group(Group { name: None, transform: None, clip: None, children: vec![item] }) }; + } + item + } + + #[test] + fn expanded_source_layers_keep_their_leaf_and_namespace() { + let items = [nested(514)]; + assert!(!document(1.0, 1.0, &items).contains("aapt")); + let xml = document_with_depth_limit(1.0, 1.0, &items, 516); + assert_eq!(xml.matches(" Date: Tue, 17 Nov 2026 15:49:47 -0500 Subject: [PATCH 116/183] Deduplicate JUMP destination resolution in the payability walkers --- crates/evm/src/lib.rs | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/crates/evm/src/lib.rs b/crates/evm/src/lib.rs index 502e451e1..2b1b089d5 100644 --- a/crates/evm/src/lib.rs +++ b/crates/evm/src/lib.rs @@ -677,6 +677,13 @@ pub fn analyze(code: &[u8]) -> Result { }) } +/// Resolve the destination of a JUMP to an instruction index, when the PUSH right before it is +/// readable and lands on an instruction boundary. +fn jump_destination(code: &[u8], ins: &[Ins], k: usize, index_of: &dyn Fn(usize) -> Option) -> Option { + let push = k.checked_sub(1).and_then(|p| ins.get(p)).filter(|p| is_push(p.op))?; + index_of(usize::try_from(imm_u64(code, push)?).ok()?) +} + /// Follow a function's entry for a few instructions (and up to two unconditional jumps) looking /// for a CALLVALUE check. fn payability(code: &[u8], ins: &[Ins], start: usize, index_of: &dyn Fn(usize) -> Option) -> (&'static str, String) { @@ -686,17 +693,14 @@ fn payability(code: &[u8], ins: &[Ins], start: usize, index_of: &dyn Fn(usize) - let Some(i) = ins.get(k) else { break }; match i.op { 0x34 if rejects_value(code, ins, k, index_of) => return ("nonpayable", format!("rejects nonzero CALLVALUE at {:#x}", i.off)), - 0x56 => { - let target = k.checked_sub(1).and_then(|p| ins.get(p)).filter(|p| is_push(p.op)).and_then(|p| imm_u64(code, p)); - match target.and_then(|t| index_of(usize::try_from(t).ok()?)) { - Some(t) if hops < 2 => { - hops += 1; - k = t; - continue; - } - _ => return ("unknown", "jumps somewhere we cannot follow before any CALLVALUE check".into()), + 0x56 => match jump_destination(code, ins, k, index_of) { + Some(t) if hops < 2 => { + hops += 1; + k = t; + continue; } - } + _ => return ("unknown", "jumps somewhere we cannot follow before any CALLVALUE check".into()), + }, 0x57 => return ("unknown", "branches before any CALLVALUE check".into()), 0xfd | 0xfe => return ("unknown", "halts with an error before any CALLVALUE check".into()), 0x00 | 0xf3 | 0xff | 0x35 | 0x37 | 0x54 | 0x55 | 0xf1 | 0xf4 | 0xfa | 0xa0..=0xa4 => { @@ -735,17 +739,14 @@ fn reverts_soon(code: &[u8], ins: &[Ins], mut k: usize, index_of: &dyn Fn(usize) let Some(i) = ins.get(k) else { return false }; match i.op { 0xfd | 0xfe => return true, - 0x56 => { - let target = k.checked_sub(1).and_then(|p| ins.get(p)).filter(|p| is_push(p.op)).and_then(|p| imm_u64(code, p)); - match target.and_then(|t| index_of(usize::try_from(t).ok()?)) { - Some(t) if hops < 2 => { - hops += 1; - k = t; - continue; - } - _ => return false, + 0x56 => match jump_destination(code, ins, k, index_of) { + Some(t) if hops < 2 => { + hops += 1; + k = t; + continue; } - } + _ => return false, + }, 0x5b | 0x50 | 0x80..=0x9f | 0x5f | 0x60..=0x7f => {} _ => return false, } From 6815dd6b7c1c5b5df02cc4d8c24201a830c57625 Mon Sep 17 00:00:00 2001 From: Terra854 Date: Wed, 18 Nov 2026 04:58:02 +0800 Subject: [PATCH 117/183] Find JPEG sampling headers after marker padding --- crates/image-codecs/src/codecs/jpeg.rs | 27 ++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/crates/image-codecs/src/codecs/jpeg.rs b/crates/image-codecs/src/codecs/jpeg.rs index 7f9cdaeaa..d14974d7e 100644 --- a/crates/image-codecs/src/codecs/jpeg.rs +++ b/crates/image-codecs/src/codecs/jpeg.rs @@ -379,10 +379,17 @@ fn first_component_subsampled(b: &[u8]) -> bool { return false; } let mut i = 2; - while let (Some(&0xFF), Some(&m)) = (b.get(i), b.get(i + 1)) { + while let Some(&prefix) = b.get(i) { + // The decoder searches forward between segments. Stray bytes and + // stuffed FF 00 pairs must not hide a frame from the abort-build guard. + if prefix != 0xFF { + i += 1; + continue; + } + let Some(&m) = b.get(i + 1) else { return false }; match m { 0xFF => i += 1, - 0x01 | 0xD0..=0xD8 => i += 2, + 0x00 | 0x01 | 0xD0..=0xD8 => i += 2, 0xD9 | 0xDA => return false, _ => { let Some(len) = b.get(i + 2..i + 4).map(|l| usize::from(u16::from_be_bytes([l[0], l[1]]))) else { return false }; @@ -1151,6 +1158,22 @@ mod tests { validate_jpeg_rgba8_with_panic_policy(&ordinary, 1, true).unwrap(); } + #[test] + fn jpeg_sampling_guard_finds_frame_after_marker_padding() { + let header = progressive_frame_header(&[(1, 1), (1, 1), (1, 1), (2, 2)]); + // Exercise the shared header guard, without a pixel payload. + for split in [2, 8] { + let (before, after) = header.split_at(split); + for padding in [&[0][..], &[0x7F, 0][..], &[0xFF, 0][..], &[0xFF][..]] { + let padded = [before, padding, after].concat(); + assert!(first_component_subsampled(&padded), "offset {split}, padding {padding:?}"); + let got = validate_jpeg_rgba8_with_panic_policy(&padded, 64, true); + assert!(matches!(got, Err(CodecError::Malformed { message, .. }) if message.contains("frame maximum"))); + } + } + assert!(!first_component_subsampled(&[0xFF, 0xD8, 0, 0xFF])); + } + #[test] fn routing() { assert!(!uses_craft_jpeg(&[0xFF, 0xD8, 0xFF, 0xC0, 0, 11, 8, 0, 8, 0, 8, 1, 1, 0x11, 0])); From 971e8ad8f8f3dee5d171516c28ffbccef665cf03 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 16:00:45 -0500 Subject: [PATCH 118/183] jpeg: add tokenless two-pass baseline encoding --- crates/jpeg/src/encode.rs | 127 ++++++++++++++--- crates/jpeg/src/encode_low_memory_tests.rs | 155 +++++++++++++++++++++ crates/jpeg/src/lib.rs | 2 +- 3 files changed, 261 insertions(+), 23 deletions(-) create mode 100644 crates/jpeg/src/encode_low_memory_tests.rs diff --git a/crates/jpeg/src/encode.rs b/crates/jpeg/src/encode.rs index 548f4c9f9..fb5fe183c 100644 --- a/crates/jpeg/src/encode.rs +++ b/crates/jpeg/src/encode.rs @@ -419,6 +419,34 @@ pub fn encode_baseline( sub: ChromaSubsampling, app_segments: &[(u8, Vec)], ) -> Result, EncodeError> { + validate_encode(data, width, height, channels, app_segments)?; + Ok(encode(data, width, height, channels, quality, sub, app_segments)) +} + +/// Encode the same optimized baseline JPEG as [`encode_baseline`], trading a second DCT pass +/// for working memory independent of image height. This path is sequential even when the +/// `parallel` feature is enabled. It retains only one MCU row of conversion planes and writes +/// directly into the returned encoded buffer: no image-wide tokens or duplicate coded buffer. +/// +/// Scratch consists of at most `24 * width + 8` floats (odd-width 4:2:0), plus fixed-size coding tables. +/// The caller still owns the input pixels and the returned JPEG; this is not a cap on output +/// size or a replacement for the caller's image/admission budget. Geometry, quality, metadata, +/// Huffman tables and restart boundaries match [`encode_baseline`] byte for byte. +#[allow(clippy::too_many_arguments)] +pub fn encode_baseline_low_memory( + data: &[u8], + width: usize, + height: usize, + channels: usize, + quality: u8, + sub: ChromaSubsampling, + app_segments: &[(u8, Vec)], +) -> Result, EncodeError> { + validate_encode(data, width, height, channels, app_segments)?; + Ok(encode_impl(data, width, height, channels, quality, sub, app_segments, true, true)) +} + +fn validate_encode(data: &[u8], width: usize, height: usize, channels: usize, app_segments: &[(u8, Vec)]) -> Result<(), EncodeError> { let fits = width.checked_mul(height).and_then(|n| n.checked_mul(channels)).is_some_and(|n| n <= data.len()); if !fits || width == 0 || height == 0 || width > 65_535 || height > 65_535 || !matches!(channels, 1 | 3 | 4) { return Err(EncodeError::InvalidInput(format!("{width}x{height}, {channels} channels, {} bytes", data.len()))); @@ -426,7 +454,7 @@ pub fn encode_baseline( if app_segments.iter().any(|(marker, payload)| !(0xE0..=0xEF).contains(marker) || payload.len() > 65_533) { return Err(EncodeError::InvalidInput("APP markers must be 0xE0..=0xEF with payloads no larger than 65533 bytes".into())); } - Ok(encode(data, width, height, channels, quality, sub, app_segments)) + Ok(()) } /// [`encode`], with optimized Huffman tables or (`optimize` false) the Annex K example tables. @@ -440,6 +468,21 @@ fn encode_with( sub: ChromaSubsampling, app_segments: &[(u8, Vec)], optimize: bool, +) -> Vec { + encode_impl(data, width, height, channels, quality, sub, app_segments, optimize, false) +} + +#[allow(clippy::too_many_arguments)] +fn encode_impl( + data: &[u8], + width: usize, + height: usize, + channels: usize, + quality: u8, + sub: ChromaSubsampling, + app_segments: &[(u8, Vec)], + optimize: bool, + low_memory: bool, ) -> Vec { // The public entry takes caller-sized dimensions: refuse (an empty output) what would size an allocation from // them or index past `data`, rather than panic or allocate for them. @@ -509,6 +552,8 @@ fn encode_with( planes.push(Plane { w: cw, h: crows.len(), data: cb }); planes.push(Plane { w: cw, h: crows.len(), data: cr }); } + #[cfg(test)] + low_memory_tests::record_planes(planes.iter().map(|p| p.data.len()).sum()); planes }; @@ -519,45 +564,58 @@ fn encode_with( let (mx, my) = (width.div_ceil(mcu_w), height.div_ceil(mcu_h)); // restart interval: whole MCU rows per band, ≤ 65535 MCUs, enough bands to keep all cores busy let rows_per_band = (my / 64).clamp(1, (65_535 / mx.max(1)).max(1)); - let bands: Vec = (0..my.div_ceil(rows_per_band)).collect(); + let num_bands = my.div_ceil(rows_per_band); + let bands: Vec = if low_memory { Vec::new() } else { (0..num_bands).collect() }; // first pass: each band's quantized blocks as symbols, with their counts per table (DC // prediction restarts per band, as the restart markers say) - let tokenize_band = |band: &usize| -> (Vec, [Freq; 4]) { + let visit_band = |band: &usize, emit: &mut dyn FnMut(&[i16; 64], &mut i32, bool)| { let (mut blk, mut q) = ([0f32; 64], [0i16; 64]); - let (mut tokens, mut freq) = (Vec::new(), [[0u64; 256]; 4]); let mut pred = [0i32; 3]; let (m0, m1) = (band * rows_per_band, ((band + 1) * rows_per_band).min(my)); - // the band's planes, its MCU row `m0` at their top (blocks past the image's bottom repeat its last row, - // which is the band's last row then) - let planes = convert(m0 * mcu_h..(m1 * mcu_h).min(height), m0 * 8..(m1 * 8).min(ch)); for mcu_y in m0..m1 { - let mcu_y = mcu_y - m0; + // Convert only the current MCU row. DC predictors still span the original band, + // so its symbols/restart decisions are identical to whole-band conversion. + let planes = convert(mcu_y * mcu_h..((mcu_y + 1) * mcu_h).min(height), mcu_y * 8..((mcu_y + 1) * 8).min(ch)); for mcu_x in 0..mx { for vy in 0..vs { for hx in 0..hs { - planes[0].block(mcu_x * hs + hx, mcu_y * vs + vy, &mut blk); + planes[0].block(mcu_x * hs + hx, vy, &mut blk); fdct_quant(&blk, &rl, &mut q); - tokenize_block(&q, &mut pred[0], false, &mut tokens, &mut freq); + emit(&q, &mut pred[0], false); } } if !gray { for (plane, pred) in planes.iter().zip(pred.iter_mut()).take(3).skip(1) { - plane.block(mcu_x, mcu_y, &mut blk); + plane.block(mcu_x, 0, &mut blk); fdct_quant(&blk, &rc, &mut q); - tokenize_block(&q, pred, true, &mut tokens, &mut freq); + emit(&q, pred, true); } } } } + }; + let tokenize_band = |band: &usize| -> (Vec, [Freq; 4]) { + let (mut tokens, mut freq) = (Vec::new(), [[0u64; 256]; 4]); + visit_band(band, &mut |q, pred, chroma| tokenize_block(q, pred, chroma, &mut tokens, &mut freq)); + #[cfg(test)] + low_memory_tests::record_tokens(tokens.len()); (tokens, freq) }; #[cfg(feature = "parallel")] - let tokenized: Vec<(Vec, [Freq; 4])> = bands.par_iter().map(tokenize_band).collect(); + let tokenized: Vec<(Vec, [Freq; 4])> = if low_memory { Vec::new() } else { bands.par_iter().map(tokenize_band).collect() }; #[cfg(not(feature = "parallel"))] - let tokenized: Vec<(Vec, [Freq; 4])> = bands.iter().map(tokenize_band).collect(); + let tokenized: Vec<(Vec, [Freq; 4])> = if low_memory { Vec::new() } else { bands.iter().map(tokenize_band).collect() }; // the tables: DC luma, AC luma, DC chroma, AC chroma let tables: [([u8; 16], Vec); 4] = if optimize { let mut total = [[0u64; 256]; 4]; + if low_memory { + for band in 0..num_bands { + visit_band(&band, &mut |q, pred, chroma| { + let base = if chroma { 2 } else { 0 }; + block_symbols(q, pred, |ac, symbol, _, _| total[base + ac as usize][symbol & 0xFF] += 1); + }); + } + } for (_, f) in &tokenized { for (t, f) in total.iter_mut().zip(f) { for (t, f) in t.iter_mut().zip(f) { @@ -577,9 +635,9 @@ fn encode_with( let huff = tables.each_ref().map(|(bits, vals)| Huff::new(bits, vals)); // second pass: code the symbols #[cfg(feature = "parallel")] - let coded: Vec> = tokenized.into_par_iter().map(|(t, _)| write_tokens(&t, &huff)).collect(); + let coded: Vec> = if low_memory { Vec::new() } else { tokenized.into_par_iter().map(|(t, _)| write_tokens(&t, &huff)).collect() }; #[cfg(not(feature = "parallel"))] - let coded: Vec> = tokenized.into_iter().map(|(t, _)| write_tokens(&t, &huff)).collect(); + let coded: Vec> = if low_memory { Vec::new() } else { tokenized.into_iter().map(|(t, _)| write_tokens(&t, &huff)).collect() }; // headers let mut out = Vec::with_capacity(coded.iter().map(Vec::len).sum::() + 4096); @@ -617,7 +675,7 @@ fn encode_with( dht(&mut out, 0x11, acb, acv); } let interval = (rows_per_band * mx) as u16; - if coded.len() > 1 { + if num_bands > 1 { segment(&mut out, 0xDD, &interval.to_be_bytes()); } if gray { @@ -625,11 +683,32 @@ fn encode_with( } else { segment(&mut out, 0xDA, &[3, 1, 0x00, 2, 0x11, 3, 0x11, 0, 63, 0]); } - let last = coded.len().saturating_sub(1); - for (i, c) in coded.iter().enumerate() { - out.extend_from_slice(c); - if i < last { - out.extend_from_slice(&[0xFF, 0xD0 + (i % 8) as u8]); + if low_memory { + let last = num_bands.saturating_sub(1); + for i in 0..num_bands { + // Continue directly in the final buffer, resetting entropy bits at the same band + // boundaries as the retained-token path. Only the output grows with image height. + let mut bits = Bits { out, acc: 0, n: 0 }; + visit_band(&i, &mut |q, pred, chroma| { + let base = if chroma { 2 } else { 0 }; + block_symbols(q, pred, |ac, symbol, extra, n| { + let (code, len) = huff[base + ac as usize].code[symbol & 0xFF]; + bits.put(code as u32, len as u32); + bits.put(extra & 0xFFFF, n & 0xF); + }); + }); + out = bits.finish(); + if i < last { + out.extend_from_slice(&[0xFF, 0xD0 + (i % 8) as u8]); + } + } + } else { + let last = coded.len().saturating_sub(1); + for (i, c) in coded.iter().enumerate() { + out.extend_from_slice(c); + if i < last { + out.extend_from_slice(&[0xFF, 0xD0 + (i % 8) as u8]); + } } } out.extend_from_slice(&[0xFF, 0xD9]); @@ -877,3 +956,7 @@ mod tests { assert!(psnr(&src, &px) > 35.0); } } + +#[cfg(test)] +#[path = "encode_low_memory_tests.rs"] +mod low_memory_tests; diff --git a/crates/jpeg/src/encode_low_memory_tests.rs b/crates/jpeg/src/encode_low_memory_tests.rs new file mode 100644 index 000000000..de45f8dfe --- /dev/null +++ b/crates/jpeg/src/encode_low_memory_tests.rs @@ -0,0 +1,155 @@ +use super::*; +use std::cell::Cell; + +thread_local! { + static STATS: Cell<(usize, usize)> = const { Cell::new((0, 0)) }; +} + +pub(super) fn record_planes(samples: usize) { + STATS.with(|s| { + let (peak, tokens) = s.get(); + s.set((peak.max(samples), tokens)); + }); +} +pub(super) fn record_tokens(count: usize) { + STATS.with(|s| { + let (peak, tokens) = s.get(); + s.set((peak, tokens + count)); + }); +} + +fn noise(len: usize) -> Vec { + let mut seed = 0x89ab_cdefu32; + (0..len) + .map(|_| { + seed ^= seed << 13; + seed ^= seed >> 17; + seed ^= seed << 5; + seed as u8 + }) + .collect() +} + +fn compare(src: &[u8], w: usize, h: usize, ch: usize, q: u8, sub: ChromaSubsampling, app: &[(u8, Vec)]) { + let expected = encode_baseline(src, w, h, ch, q, sub, app).unwrap(); + STATS.with(|s| s.set((0, 0))); + let actual = encode_baseline_low_memory(src, w, h, ch, q, sub, app).unwrap(); + assert_eq!(actual, expected, "{w}x{h} channels={ch} quality={q} subsampling={sub:?}"); + let (peak, tokens) = STATS.with(Cell::get); + assert!(peak <= 24 * w + 8, "MCU-row scratch exceeded: {peak}"); + assert_eq!(tokens, 0, "low-memory mode retained entropy tokens"); +} + +#[test] +fn all_sampling_and_channels_match_retained_tokens_byte_for_byte() { + for (w, h) in [(1, 1), (7, 9), (17, 31), (33, 65), (17, 1025)] { + for ch in [1, 3, 4] { + let src = noise(w * h * ch); + for sub in [ChromaSubsampling::S444, ChromaSubsampling::S422, ChromaSubsampling::S420] { + for q in [0, 1, 25, 50, 90, 100, 255] { + compare(&src, w, h, ch, q, sub, &[]); + } + } + } + } +} + +#[test] +fn high_entropy_hd_and_wide_frames_keep_only_one_mcu_row() { + for (w, h) in [(1920, 1080), (65_535, 1)] { + let src = noise(w * h * 3); + compare(&src, w, h, 3, 100, ChromaSubsampling::S444, &[]); + } +} + +#[test] +fn metadata_empty_tables_and_extra_source_bytes_keep_exact_output() { + let app = [(0xe0, b"custom density".to_vec()), (0xe2, vec![73; 65_533])]; + for ch in [1, 3, 4] { + let src = vec![127; 19 * 23 * ch + 5]; + compare(&src, 19, 23, ch, 75, ChromaSubsampling::S420, &app); + } +} + +#[test] +fn checked_admission_matches_original_without_panics() { + for (w, h, ch) in [(0, 1, 3), (1, 0, 3), (1, 1, 0), (1, 1, 2), (usize::MAX, 2, 4), (65_536, 1, 1), (1, 65_536, 1), (4, 4, 3)] { + let src = vec![0; if w == 65_536 || h == 65_536 { 65_536 } else { 8 }]; + let old = encode_baseline(&src, w, h, ch, 90, ChromaSubsampling::S444, &[]); + let new = encode_baseline_low_memory(&src, w, h, ch, 90, ChromaSubsampling::S444, &[]); + assert!(new.is_err()); + assert_eq!(new, old); + } + for app in [vec![(0xdf, vec![])], vec![(0xf0, vec![])], vec![(0xe1, vec![0; 65_534])]] { + assert_eq!( + encode_baseline_low_memory(&[0; 3], 1, 1, 3, 90, ChromaSubsampling::S444, &app), + encode_baseline(&[0; 3], 1, 1, 3, 90, ChromaSubsampling::S444, &app) + ); + } +} + +// Generated with the immutable pre-change encoder at craft-libs +// 937ac93c5cf3cd4b6a81e195b078fe161eb081b9, not the refactored token-retaining path. +// Odd chroma edges and 1025/2049-row inputs exercise multi-row restart bands. +#[test] +fn prechange_encoded_bytes_remain_pinned_across_band_boundaries() { + let cases = [ + (1, 1, 1, 1, 444, 159, 0xe3bd59145381ba57), + (1, 1, 1, 75, 422, 159, 0xcb2b103914bbdbd3), + (1, 1, 1, 100, 420, 160, 0xd9f640613efb6abf), + (1, 1, 3, 1, 444, 284, 0x61d2772b8fd9df17), + (1, 1, 3, 75, 422, 286, 0xa0e03ab7efa23296), + (1, 1, 3, 100, 420, 288, 0x5660667f1abd0a63), + (1, 1, 4, 1, 444, 284, 0x61d2772b8fd9df17), + (1, 1, 4, 75, 422, 286, 0xa0e03ab7efa23296), + (1, 1, 4, 100, 420, 288, 0x5660667f1abd0a63), + (17, 31, 1, 1, 444, 240, 0xf8d277e9499253d4), + (17, 31, 1, 75, 422, 515, 0xa6946d4f144bf243), + (17, 31, 1, 100, 420, 793, 0xbb3db259708d8951), + (17, 31, 3, 1, 444, 363, 0xff2b5b41ffb3f81b), + (17, 31, 3, 75, 422, 877, 0x0374ffb527378dfe), + (17, 31, 3, 100, 420, 1220, 0x2feeedfa90885737), + (17, 31, 4, 1, 444, 366, 0xde7f8d1330e436eb), + (17, 31, 4, 75, 422, 879, 0xb1559fbfc3ee0cf6), + (17, 31, 4, 100, 420, 1214, 0xaf5dcf12d28c8e88), + (33, 65, 1, 1, 444, 388, 0xbee80491e42c8fd2), + (33, 65, 1, 75, 422, 1470, 0x284f4eb78b785ca5), + (33, 65, 1, 100, 420, 2576, 0xa81cc94015f326dc), + (33, 65, 3, 1, 444, 526, 0xf75b4036acc30874), + (33, 65, 3, 75, 422, 2322, 0x6fbc56bd9a1eec70), + (33, 65, 3, 100, 420, 3796, 0xcad25051562ac816), + (33, 65, 4, 1, 444, 527, 0x4bfedc11153de4c1), + (33, 65, 4, 75, 422, 2309, 0x47bf11bf32bac6a4), + (33, 65, 4, 100, 420, 3775, 0x64c2303fde273cd1), + (17, 1025, 1, 1, 444, 2017, 0x242f4a95d8579612), + (17, 1025, 1, 75, 422, 10728, 0xfe49408f379bdffb), + (17, 1025, 1, 100, 420, 19686, 0x1355b995e38d6467), + (17, 1025, 3, 1, 444, 2137, 0x4e319440cb6946c2), + (17, 1025, 3, 75, 422, 17682, 0xf456c63b731dde8f), + (17, 1025, 3, 100, 420, 29015, 0x0631001154b128cf), + (17, 1025, 4, 1, 444, 2155, 0xa2de9c1d77e62aa6), + (17, 1025, 4, 75, 422, 17648, 0x7d85fbdf56061f0c), + (17, 1025, 4, 100, 420, 29010, 0x4848eeb93daf1df2), + (19, 2049, 1, 1, 444, 3531, 0x9b93cf219ff85796), + (19, 2049, 1, 75, 422, 26283, 0xb160523444397608), + (19, 2049, 1, 100, 420, 51883, 0xc5c26836c0a976c6), + (19, 2049, 3, 1, 444, 3303, 0x26eaac2272e1fdb8), + (19, 2049, 3, 75, 422, 42745, 0x38b9843fb54db698), + (19, 2049, 3, 100, 420, 79868, 0xd6a7917af19682f7), + (19, 2049, 4, 1, 444, 3343, 0x6bf577903528692f), + (19, 2049, 4, 75, 422, 42706, 0x0e62366274593a93), + (19, 2049, 4, 100, 420, 79804, 0x867d05cf9d944599), + ]; + for (w, h, ch, q, sampling, len, hash) in cases { + let sub = match sampling { + 444 => ChromaSubsampling::S444, + 422 => ChromaSubsampling::S422, + _ => ChromaSubsampling::S420, + }; + let src = noise(w * h * ch); + for actual in [encode_baseline(&src, w, h, ch, q, sub, &[]).unwrap(), encode_baseline_low_memory(&src, w, h, ch, q, sub, &[]).unwrap()] { + let actual_hash = actual.iter().fold(0xcbf29ce484222325u64, |h, b| (h ^ u64::from(*b)).wrapping_mul(0x100000001b3)); + assert_eq!((actual.len(), actual_hash), (len, hash), "{w}x{h} channels={ch} quality={q} sampling={sampling}"); + } + } +} diff --git a/crates/jpeg/src/lib.rs b/crates/jpeg/src/lib.rs index 23434fdd0..ed2ee1988 100644 --- a/crates/jpeg/src/lib.rs +++ b/crates/jpeg/src/lib.rs @@ -1705,7 +1705,7 @@ mod tests; /// Baseline JPEG encoder (8-bit, Huffman-coded sequential DCT). mod encode; -pub use encode::{ChromaSubsampling, EncodeError, encode_baseline}; +pub use encode::{ChromaSubsampling, EncodeError, encode_baseline, encode_baseline_low_memory}; mod app14; pub use app14::adobe_transform; From d118983bf922ac96c68b885dc55da30435adbc7d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 16:13:18 -0500 Subject: [PATCH 119/183] Extract Java class reader and JVM opcode decoder (#2048) * Port Java class source: Craft Anything Source: storytold/craft-anything@f64ae3bf3c8863a982af1304e06de20653803968 * Port Java class source: Find class usage in multidimensional object arrays (R0.5) (#437) Source: storytold/craft-anything@ffe15c916574aa0ba6ba4d548c4f1a0f871a5689 * Port Java class source: More format parsers keep to their declared lengths and refuse impossible values (#722) Source: storytold/craft-anything@b9ca099903aeef5d4b33a7e83e8e7062ab94c65a * Port Java class source: Address the parser review findings from #722 (#766) Source: storytold/craft-anything@eab6a0f01bf9fc3a36798d322e4442e169394dfc * Port Java class source: Read JVM method parameters containing parentheses in class names (R3.12) (#1342) Source: storytold/craft-anything@fb4c437fe613f7c29fd8d32033c9574cd48107dc * Port Java class source: Reject Java constants that exceed the constant-pool slots (R3.12) (#1373) Source: storytold/craft-anything@1c4f233f08caf2c54391d611d2f5781229d89ee6 * Port Java class source: Validate JVM switch tables before allocating decoded pairs (R3.12) (#1503) Source: storytold/craft-anything@b40c56ef5cb52d377d6e8a2078235ce6e98bef57 * Port Java class source: Reuse constant-pool names while reading Java attributes (R3.12) (#1549) Source: storytold/craft-anything@76fcdaadb776ce692aa27e1262c9c71f4c8d3c80 * Port Java class source: Trace JVM bootstrap dependencies at their bytecode use sites (R3.12) (#1648) Source: storytold/craft-anything@c5e524dd084fb265d0aad9991188d76c77eaf233 * Port Java class source: Reject impossible JVM array allocation operands (R3.12) (#1675) Source: storytold/craft-anything@f04d7456e00aea406a86a6e468d0b68fbb934edb * Port Java class source: Report truncated Java class attribute tables (R3.12) Source: storytold/craft-anything@420552ff7473f4859985f53ae57d3214209d8415 * Expose neutral Java class API and retain checked reader and synthetic fixtures * Retain Java regression: java_array_operands Source: storytold/craft-anything@f04d7456e00aea406a86a6e468d0b68fbb934edb * Retain Java regression: java_attribute_names Source: storytold/craft-anything@76fcdaadb776ce692aa27e1262c9c71f4c8d3c80 * Retain Java regression: java_constant_pool_slots Source: storytold/craft-anything@1c4f233f08caf2c54391d611d2f5781229d89ee6 * Retain Java regression: java_invoke_operands Source: storytold/craft-anything@eab6a0f01bf9fc3a36798d322e4442e169394dfc * Retain Java regression: java_linkage_references Source: storytold/craft-anything@c5e524dd084fb265d0aad9991188d76c77eaf233 * Retain Java regression: java_truncated_attributes Source: storytold/craft-anything@420552ff7473f4859985f53ae57d3214209d8415 * Retain Java regression: java_wide_opcodes Source: storytold/craft-anything@b9ca099903aeef5d4b33a7e83e8e7062ab94c65a * Register Java class reader and retain source regression coverage --------- Co-authored-by: Brandon Thomas Co-authored-by: Afloat <132809511+Afloat16@users.noreply.github.com> Co-authored-by: BFlat Co-authored-by: Afloat Co-authored-by: RRFZ <247457381+Plastic-time@users.noreply.github.com> --- ATTRIBUTION.md | 4 + Cargo.lock | 8 + Cargo.toml | 1 + crates/java-class/Cargo.toml | 13 + crates/java-class/src/bytes.rs | 51 + crates/java-class/src/descriptor.rs | 19 + crates/java-class/src/java_class.rs | 1082 +++++++++++++++++ crates/java-class/src/java_ops.rs | 711 +++++++++++ crates/java-class/src/lib.rs | 50 + .../src/regressions/java_array_operands.rs | 48 + .../src/regressions/java_attribute_names.rs | 132 ++ .../regressions/java_constant_pool_slots.rs | 53 + .../src/regressions/java_invoke_operands.rs | 76 ++ .../regressions/java_linkage_references.rs | 97 ++ .../regressions/java_truncated_attributes.rs | 46 + .../src/regressions/java_wide_opcodes.rs | 33 + crates/java-class/src/test_support.rs | 316 +++++ 17 files changed, 2740 insertions(+) create mode 100644 crates/java-class/Cargo.toml create mode 100644 crates/java-class/src/bytes.rs create mode 100644 crates/java-class/src/descriptor.rs create mode 100644 crates/java-class/src/java_class.rs create mode 100644 crates/java-class/src/java_ops.rs create mode 100644 crates/java-class/src/lib.rs create mode 100644 crates/java-class/src/regressions/java_array_operands.rs create mode 100644 crates/java-class/src/regressions/java_attribute_names.rs create mode 100644 crates/java-class/src/regressions/java_constant_pool_slots.rs create mode 100644 crates/java-class/src/regressions/java_invoke_operands.rs create mode 100644 crates/java-class/src/regressions/java_linkage_references.rs create mode 100644 crates/java-class/src/regressions/java_truncated_attributes.rs create mode 100644 crates/java-class/src/regressions/java_wide_opcodes.rs create mode 100644 crates/java-class/src/test_support.rs diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 07e84f37b..ae72ae851 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -143,6 +143,10 @@ Sanitization, animation fitting and numeric output policy remain caller-owned. `crates/jsonc` is extracted from Craft Anything `crates/formats/src/jsonc.rs` at `e5c9c94106747ed44b9a3fb0decce867c2285f93` (MIT OR Apache-2.0). The original implementation and hardening by BFlat, newline preservation by NetterSilver, and subsequent RRFZ/Afloat correctness fixes retain separate primary-author port commits with immutable source revisions. Shared API wiring and optional input-byte admission are subsequent changes. Compatibility parsing and all existing formatting/editing tests are retained; application file I/O and policy are not imported. +## Java class inspection + +`crates/java-class` extracts Craft Anything `java_class.rs` and `java_ops.rs` at `5979f9b13f16dcf1df3c7ae7f8e7735f452866f2` (MIT OR Apache-2.0), preserving separate primary-author source-history ports by Brandon Thomas, BFlat, Afloat and RRFZ. The checked byte-reader, modified UTF-8 unit decoder, descriptor display helper and synthetic class fixtures come from the same source snapshot. Seven regression files retain their source authors. Neutral error wiring and shared crate integration are subsequent changes. No JAR archive, application I/O or bytecode execution is imported. + ## WebAssembly inspection `crates/wasm` extracts Craft Anything `crates/formats/src/wasm.rs` at `5979f9b13f16dcf1df3c7ae7f8e7735f452866f2`, with its checked byte-reader subset and original synthetic WASM/testkit fixtures (MIT OR Apache-2.0). Eight core-history ports preserve Brandon Thomas, Afloat and RRFZ as primary authors; component, repeated-custom-section and referenced-string regression imports retain source authors and commit references. Fixtures come from `crates/testkit/src/formats.rs` and deterministic mutation helpers from `crates/testkit/src/lib.rs`; no third-party binaries. Shared error naming and workspace wiring are subsequent changes. Existing inspection limits and report behavior are unchanged; this crate validates/inspects/renders, never executes modules. diff --git a/Cargo.lock b/Cargo.lock index c1eb3006b..cc0965d17 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2292,6 +2292,14 @@ dependencies = [ "widestring", ] +[[package]] +name = "craft-java-class" +version = "0.1.0" +dependencies = [ + "serde", + "thiserror 2.0.21", +] + [[package]] name = "craft-jmap" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 3468f29f6..fd9ccf7a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ rust-version = "1.95" repository = "https://github.com/storytold/craft-libs" [workspace.dependencies] +craft-java-class = { path = "crates/java-class" } craft-sourcemap = { path = "crates/sourcemap" } craft-pcap = { path = "crates/pcap" } craft-har = { path = "crates/har" } diff --git a/crates/java-class/Cargo.toml b/crates/java-class/Cargo.toml new file mode 100644 index 000000000..6dfbd16e5 --- /dev/null +++ b/crates/java-class/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name="craft-java-class" +description="Java class-file inspection and JVM bytecode decoding with retained bounds and partial reports" +version.workspace=true +edition.workspace=true +license.workspace=true +rust-version.workspace=true +repository.workspace=true +[lints] +workspace=true +[dependencies] +serde={workspace=true} +thiserror={workspace=true} diff --git a/crates/java-class/src/bytes.rs b/crates/java-class/src/bytes.rs new file mode 100644 index 000000000..bc26aea19 --- /dev/null +++ b/crates/java-class/src/bytes.rs @@ -0,0 +1,51 @@ +//! Checked little/big-endian reads over untrusted bytes. Every read returns `None` when out of range. + +#[derive(Debug, Clone, Copy)] +pub struct Reader<'a> { + data: &'a [u8], +} + +impl<'a> Reader<'a> { + pub fn new(data: &'a [u8]) -> Self { + Reader { data } + } + + pub fn slice(&self, off: usize, len: usize) -> Option<&'a [u8]> { + let end = off.checked_add(len)?; + self.data.get(off..end) + } + + pub fn u8(&self, off: usize) -> Option { + self.data.get(off).copied() + } + + fn arr(&self, off: usize) -> Option<[u8; N]> { + self.slice(off, N)?.try_into().ok() + } + + pub fn u16_be(&self, off: usize) -> Option { + self.arr(off).map(u16::from_be_bytes) + } + + pub fn u32_be(&self, off: usize) -> Option { + self.arr(off).map(u32::from_be_bytes) + } + + pub fn u64_be(&self, off: usize) -> Option { + self.arr(off).map(u64::from_be_bytes) + } +} + +/// Decode one modified UTF-8 code unit. Invalid bytes consume only themselves, +/// so a damaged sequence cannot hide valid text or borrow missing bytes. +pub(crate) fn mutf8_unit(bytes: &[u8]) -> (u16, usize) { + match bytes { + [a @ 0x00..=0x7f, ..] => (u16::from(*a), 1), + [0xc0, 0x80, ..] => (0, 2), + [a @ 0xc2..=0xdf, b @ 0x80..=0xbf, ..] => ((u16::from(*a & 0x1f) << 6) | u16::from(*b & 0x3f), 2), + [a @ 0xe0..=0xef, b @ 0x80..=0xbf, c @ 0x80..=0xbf, ..] if *a != 0xe0 || *b >= 0xa0 => { + ((u16::from(*a & 0x0f) << 12) | (u16::from(*b & 0x3f) << 6) | u16::from(*c & 0x3f), 3) + } + _ => (0xfffd, 1), + } +} diff --git a/crates/java-class/src/descriptor.rs b/crates/java-class/src/descriptor.rs new file mode 100644 index 000000000..3f4b32bd7 --- /dev/null +++ b/crates/java-class/src/descriptor.rs @@ -0,0 +1,19 @@ +// Descriptor display helper retained from the source DEX reader. +pub fn java_name(desc: &str) -> String { + let dims = desc.chars().take_while(|&c| c == '[').count(); + let base = desc.get(dims..).unwrap_or(""); + let name = match base { + "V" => "void".to_string(), + "Z" => "boolean".to_string(), + "B" => "byte".to_string(), + "S" => "short".to_string(), + "C" => "char".to_string(), + "I" => "int".to_string(), + "J" => "long".to_string(), + "F" => "float".to_string(), + "D" => "double".to_string(), + b if b.starts_with('L') && b.ends_with(';') => b.get(1..b.len() - 1).unwrap_or("").replace('/', "."), + b => b.to_string(), + }; + format!("{name}{}", "[]".repeat(dims.min(255))) +} diff --git a/crates/java-class/src/java_class.rs b/crates/java-class/src/java_class.rs new file mode 100644 index 000000000..4b751ec3e --- /dev/null +++ b/crates/java-class/src/java_class.rs @@ -0,0 +1,1082 @@ +//! Java `.class` files (JVMS): the magic and version, the constant pool (every tag including +//! `MethodHandle`/`MethodType`/`Dynamic`/`InvokeDynamic`/`Module`/`Package`), access flags, the +//! this/super class and interfaces, fields and methods with their attributes (`Code` with its +//! exception table and line numbers, `ConstantValue`, `Exceptions`, `Signature`), and the +//! class-level `SourceFile`, `InnerClasses` and annotation attributes (type names, best-effort). +//! +//! Counts and lengths are checked against the file size, strings are decoded from modified UTF-8, +//! and every read is bounds-checked, so hostile input yields warnings, not panics. + +use crate::bytes::Reader; +use crate::java_ops::{self, Insn}; +use crate::{FormatError, descriptor as dex}; +use serde::Serialize; + +/// Most constant-pool entries, fields, methods, attributes or interfaces we read from one file. +const MAX_ITEMS: usize = 1 << 20; +/// Most attributes per element. +const MAX_ATTRS: usize = 64 * 1024; +/// Deepest annotation/element-value nesting we walk. +const MAX_ANNO_DEPTH: usize = 32; + +/// One constant-pool entry. Index 0 and the slot after a `Long`/`Double` are `Unusable`. +#[derive(Debug, Clone, PartialEq)] +pub enum Const { + Unusable, + Utf8(String), + Integer(i32), + Float(f32), + Long(i64), + Double(f64), + /// `name_index` → a Utf8 internal name. + Class(u16), + /// `string_index` → a Utf8. + String(u16), + /// `class_index`, `name_and_type_index`. + FieldRef(u16, u16), + MethodRef(u16, u16), + InterfaceMethodRef(u16, u16), + /// `name_index`, `descriptor_index`. + NameAndType(u16, u16), + /// `reference_kind`, `reference_index`. + MethodHandle(u8, u16), + /// `descriptor_index`. + MethodType(u16), + /// `bootstrap_method_attr_index`, `name_and_type_index`. + Dynamic(u16, u16), + InvokeDynamic(u16, u16), + Module(u16), + Package(u16), +} + +/// The class-file version. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] +pub struct Version { + pub major: u16, + pub minor: u16, +} + +impl Version { + /// A friendly Java platform label (`Java 8`, `Java 17`, `Java 1.3`). + pub fn java_label(self) -> String { + match self.major { + 45..=48 => format!("Java 1.{}", self.major - 44), + m if m >= 49 => format!("Java {}", m - 44), + m => format!("pre-standard (major {m})"), + } + } +} + +/// An exception-table row of a `Code` attribute. +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct ExceptionEntry { + pub start_pc: u16, + pub end_pc: u16, + pub handler_pc: u16, + /// Dotted caught type; `None` is catch-all (a `finally` or `catch (Throwable)` with index 0). + pub catch_type: Option, +} + +/// A parsed `Code` attribute. +#[derive(Debug, Clone, Default, PartialEq, Eq)] +pub struct Code { + pub max_stack: u16, + pub max_locals: u16, + pub bytecode: Vec, + pub exceptions: Vec, + /// `(start_pc, line)` from the `LineNumberTable`. + pub line_numbers: Vec<(u16, u16)>, +} + +/// A field or method. +#[derive(Debug, Clone, Default, PartialEq)] +pub struct Member { + pub access: u16, + pub name: String, + pub descriptor: String, + /// The generic `Signature` attribute, if present. + pub signature: Option, + /// A field's `ConstantValue`, rendered to text. + pub constant_value: Option, + /// A method's declared `throws` types (dotted). + pub exceptions: Vec, + /// A method's code. + pub code: Option, + pub deprecated: bool, + /// The `Synthetic` attribute (separate from the access flag). + pub synthetic_attr: bool, +} + +/// An `InnerClasses` row. +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct InnerClass { + pub inner: Option, + pub outer: Option, + /// Simple name; `None` for an anonymous class. + pub name: Option, + pub access: u16, +} + +/// A parsed class file. +#[derive(Debug, Clone)] +pub struct ClassFile { + pub version: Version, + pub access: u16, + /// Internal name of this class (`com/example/Main`). + pub this_class: String, + /// Internal name of the superclass; `None` only for `java/lang/Object` and modules. + pub super_class: Option, + /// Internal names of the implemented interfaces. + pub interfaces: Vec, + pub fields: Vec, + pub methods: Vec, + pub source_file: Option, + pub signature: Option, + pub inner_classes: Vec, + /// Class-level annotation types (dotted), with `(runtime)`/`(class)` visibility. + pub annotations: Vec, + /// Bootstrap method handle and static arguments, indexed by dynamic pool constants. + pub bootstrap_methods: Vec<(u16, Vec)>, + pub pool: Vec, + pub warnings: Vec, +} + +// --------------------------------------------------------------------------------------------- +// Names, descriptors and access flags + +/// `java/lang/String` → `java.lang.String`; `[Ljava/lang/String;` → `java.lang.String[]`. +pub fn internal_to_dotted(name: &str) -> String { + if name.starts_with('[') { dex::java_name(name) } else { name.replace('/', ".") } +} + +/// A field descriptor (`Ljava/lang/String;`, `[I`, `I`) as a Java type. +pub fn field_type(desc: &str) -> String { + dex::java_name(desc) +} + +/// Read parameter descriptors up to the closing parenthesis and return the remaining return descriptor. +fn split_types(s: &str) -> Option<(Vec, &str)> { + let b = s.as_bytes(); + let mut out = Vec::new(); + let mut i = 0usize; + while i < b.len() && out.len() < MAX_ITEMS { + if b.get(i) == Some(&b')') { + return Some((out, s.get(i + 1..)?)); + } + let start = i; + while b.get(i) == Some(&b'[') { + i += 1; + } + match b.get(i) { + Some(b'L') => match s.get(i..).and_then(|r| r.find(';')) { + Some(semi) => i = i + semi + 1, + None => i = b.len(), + }, + Some(_) => i += 1, + None => break, + } + match s.get(start..i) { + Some(t) if !t.is_empty() => out.push(t.to_string()), + _ => break, + } + } + None +} + +/// Parameter types and return type of a method descriptor (`(Ljava/lang/String;I)V`). +pub fn method_params(desc: &str) -> (Vec, String) { + let Some(rest) = desc.strip_prefix('(') else { return (Vec::new(), "?".into()) }; + let Some((params, ret)) = split_types(rest) else { return (Vec::new(), "?".into()) }; + (params.iter().map(|t| field_type(t)).collect(), field_type(ret)) +} + +/// What a set of access flags belongs to. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum AccessKind { + Class, + Field, + Method, + InnerClass, +} + +/// Human names of the set access flags. +pub fn access_flags(flags: u16, kind: AccessKind) -> Vec<&'static str> { + let mut v = Vec::new(); + let common: &[(u16, &str)] = &[(0x0001, "public"), (0x0002, "private"), (0x0004, "protected"), (0x0008, "static"), (0x0010, "final")]; + for (bit, name) in common { + if flags & bit != 0 { + v.push(*name); + } + } + match kind { + AccessKind::Method => { + for (bit, name) in [ + (0x0020u16, "synchronized"), + (0x0040, "bridge"), + (0x0080, "varargs"), + (0x0100, "native"), + (0x0400, "abstract"), + (0x0800, "strictfp"), + (0x1000, "synthetic"), + ] { + if flags & bit != 0 { + v.push(name); + } + } + } + AccessKind::Field => { + for (bit, name) in [(0x0040u16, "volatile"), (0x0080, "transient"), (0x1000, "synthetic"), (0x4000, "enum")] { + if flags & bit != 0 { + v.push(name); + } + } + } + AccessKind::Class | AccessKind::InnerClass => { + for (bit, name) in [ + (0x0020u16, "super"), + (0x0200, "interface"), + (0x0400, "abstract"), + (0x1000, "synthetic"), + (0x2000, "annotation"), + (0x4000, "enum"), + (0x8000, "module"), + ] { + if flags & bit != 0 { + // "super" is an internal marker on classes; hide it unless it is the only flag of note. + if name == "super" && kind == AccessKind::Class { + continue; + } + v.push(name); + } + } + } + } + v +} + +/// A resolved reference to a field or method. +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct Ref { + /// Internal owner name (`java/lang/System`). + pub owner: String, + pub name: String, + pub descriptor: String, +} + +impl Ref { + /// `java.lang.System.out:java.io.PrintStream` style display. A field descriptor is shown as a + /// Java type; a method descriptor is left in its raw `(args)ret` form. + pub fn display(&self) -> String { + let ty = if self.descriptor.starts_with('(') { self.descriptor.clone() } else { field_type(&self.descriptor) }; + format!("{}.{}:{}", internal_to_dotted(&self.owner), self.name, ty) + } +} + +// --------------------------------------------------------------------------------------------- +// Modified UTF-8 + +/// Decode a modified-UTF-8 byte run (class-file `Utf8` content) to a String. +fn decode_mutf8(bytes: &[u8]) -> String { + let mut units: Vec = Vec::new(); + let mut i = 0usize; + while i < bytes.len() { + let (unit, consumed) = crate::bytes::mutf8_unit(bytes.get(i..).unwrap_or_default()); + units.push(unit); + i += consumed; + } + String::from_utf16_lossy(&units) +} + +// --------------------------------------------------------------------------------------------- +// Cursor + +struct Cursor<'a> { + r: Reader<'a>, + pos: usize, +} + +impl<'a> Cursor<'a> { + fn new(data: &'a [u8]) -> Self { + Cursor { r: Reader::new(data), pos: 0 } + } + fn u8(&mut self) -> Option { + let v = self.r.u8(self.pos)?; + self.pos += 1; + Some(v) + } + fn u16(&mut self) -> Option { + let v = self.r.u16_be(self.pos)?; + self.pos += 2; + Some(v) + } + fn u32(&mut self) -> Option { + let v = self.r.u32_be(self.pos)?; + self.pos += 4; + Some(v) + } + fn u64(&mut self) -> Option { + let v = self.r.u64_be(self.pos)?; + self.pos += 8; + Some(v) + } + fn take(&mut self, n: usize) -> Option<&'a [u8]> { + let s = self.r.slice(self.pos, n)?; + self.pos += n; + Some(s) + } +} + +// --------------------------------------------------------------------------------------------- +// Parsing + +/// True when the bytes begin a Java class file (0xCAFEBABE and a plausible major version). +/// A big-endian Mach-O fat binary shares the magic but has a small arch count where the version +/// is, so it fails the major-version check. +pub fn is_class(data: &[u8]) -> bool { + if !data.starts_with(&[0xca, 0xfe, 0xba, 0xbe]) { + return false; + } + let r = Reader::new(data); + matches!(r.u16_be(6), Some(major) if (45..=255).contains(&major)) +} + +fn utf8_of(pool: &[Const], idx: u16) -> &str { + match pool.get(idx as usize) { + Some(Const::Utf8(s)) => s.as_str(), + _ => "", + } +} + +/// Parse a class file. +pub fn parse(data: &[u8]) -> Result { + if !data.starts_with(&[0xca, 0xfe, 0xba, 0xbe]) { + return Err(FormatError::Malformed("not a Java class file (no 0xCAFEBABE magic)".into())); + } + let mut c = Cursor::new(data); + let mut warnings = Vec::new(); + let _magic = c.u32(); + let minor = c.u16().ok_or_else(|| FormatError::Truncated("version".into()))?; + let major = c.u16().ok_or_else(|| FormatError::Truncated("version".into()))?; + if major < 45 { + return Err(FormatError::Unsupported(format!("class major version {major} is below 45 (not a standard class file)"))); + } + let version = Version { major, minor }; + let cp_count = c.u16().ok_or_else(|| FormatError::Truncated("constant pool count".into()))?; + if cp_count == 0 { + return Err(FormatError::Malformed("constant pool count is zero".into())); + } + let pool = parse_pool(&mut c, cp_count, &mut warnings)?; + let access = c.u16().ok_or_else(|| FormatError::Truncated("access flags".into()))?; + let this_idx = c.u16().ok_or_else(|| FormatError::Truncated("this_class".into()))?; + let super_idx = c.u16().ok_or_else(|| FormatError::Truncated("super_class".into()))?; + let this_class = class_name_at(&pool, this_idx); + let super_class = if super_idx == 0 { None } else { Some(class_name_at(&pool, super_idx)) }; + // Interfaces + let n_iface = c.u16().ok_or_else(|| FormatError::Truncated("interfaces count".into()))? as usize; + let mut interfaces = Vec::new(); + for _ in 0..n_iface.min(MAX_ITEMS) { + let Some(i) = c.u16() else { + warnings.push("interface list ended early".into()); + break; + }; + interfaces.push(class_name_at(&pool, i)); + } + // Fields + let fields = parse_members(&mut c, &pool, &mut warnings, "field")?; + // Methods + let methods = parse_members(&mut c, &pool, &mut warnings, "method")?; + // Class attributes + let (attrs, complete) = read_attrs(&mut c, &pool); + if !complete { + warnings.push("class attribute table ended early".into()); + } + let mut source_file = None; + let mut signature = None; + let mut inner_classes = Vec::new(); + let mut annotations = Vec::new(); + let mut bootstrap_methods = Vec::new(); + for a in &attrs { + match a.name { + "SourceFile" => { + if let Some(i) = Reader::new(a.info).u16_be(0) { + source_file = Some(utf8_of(&pool, i).to_string()); + } + } + "Signature" => { + if let Some(i) = Reader::new(a.info).u16_be(0) { + signature = Some(utf8_of(&pool, i).to_string()); + } + } + "BootstrapMethods" => match bootstrap_table(a.info) { + Some(table) => bootstrap_methods = table, + None => warnings.push("invalid BootstrapMethods table".into()), + }, + "InnerClasses" => inner_classes = parse_inner_classes(a.info, &pool), + "RuntimeVisibleAnnotations" => annotations.extend(parse_annotation_types(a.info, &pool, "runtime")), + "RuntimeInvisibleAnnotations" => annotations.extend(parse_annotation_types(a.info, &pool, "class")), + _ => {} + } + } + Ok(ClassFile { + version, + access, + this_class, + super_class, + interfaces, + fields, + methods, + source_file, + signature, + inner_classes, + annotations, + bootstrap_methods, + pool, + warnings, + }) +} + +fn parse_pool(c: &mut Cursor<'_>, cp_count: u16, warnings: &mut Vec) -> Result, FormatError> { + let mut pool = vec![Const::Unusable]; // index 0 + let mut i = 1u16; + while i < cp_count { + let tag = c.u8().ok_or_else(|| FormatError::Truncated("constant pool entry".into()))?; + let entry = match tag { + 1 => { + let len = c.u16().ok_or_else(|| FormatError::Truncated("Utf8 length".into()))? as usize; + let bytes = c.take(len).ok_or_else(|| FormatError::Truncated("Utf8 bytes".into()))?; + Const::Utf8(decode_mutf8(bytes)) + } + 3 => Const::Integer(c.u32().ok_or_else(|| trunc("Integer"))? as i32), + 4 => Const::Float(f32::from_bits(c.u32().ok_or_else(|| trunc("Float"))?)), + 5 => Const::Long(c.u64().ok_or_else(|| trunc("Long"))? as i64), + 6 => Const::Double(f64::from_bits(c.u64().ok_or_else(|| trunc("Double"))?)), + 7 => Const::Class(c.u16().ok_or_else(|| trunc("Class"))?), + 8 => Const::String(c.u16().ok_or_else(|| trunc("String"))?), + 9 => Const::FieldRef(c.u16().ok_or_else(|| trunc("Fieldref"))?, c.u16().ok_or_else(|| trunc("Fieldref"))?), + 10 => Const::MethodRef(c.u16().ok_or_else(|| trunc("Methodref"))?, c.u16().ok_or_else(|| trunc("Methodref"))?), + 11 => Const::InterfaceMethodRef(c.u16().ok_or_else(|| trunc("InterfaceMethodref"))?, c.u16().ok_or_else(|| trunc("InterfaceMethodref"))?), + 12 => Const::NameAndType(c.u16().ok_or_else(|| trunc("NameAndType"))?, c.u16().ok_or_else(|| trunc("NameAndType"))?), + 15 => Const::MethodHandle(c.u8().ok_or_else(|| trunc("MethodHandle"))?, c.u16().ok_or_else(|| trunc("MethodHandle"))?), + 16 => Const::MethodType(c.u16().ok_or_else(|| trunc("MethodType"))?), + 17 => Const::Dynamic(c.u16().ok_or_else(|| trunc("Dynamic"))?, c.u16().ok_or_else(|| trunc("Dynamic"))?), + 18 => Const::InvokeDynamic(c.u16().ok_or_else(|| trunc("InvokeDynamic"))?, c.u16().ok_or_else(|| trunc("InvokeDynamic"))?), + 19 => Const::Module(c.u16().ok_or_else(|| trunc("Module"))?), + 20 => Const::Package(c.u16().ok_or_else(|| trunc("Package"))?), + other => { + return Err(FormatError::Malformed(format!("unknown constant pool tag {other} at index {i}"))); + } + }; + let wide = matches!(entry, Const::Long(_) | Const::Double(_)); + let next = i + .checked_add(if wide { 2 } else { 1 }) + .filter(|next| *next <= cp_count) + .ok_or_else(|| FormatError::Malformed(format!("constant pool entry {i} has no reserved second slot")))?; + pool.push(entry); + if wide { + pool.push(Const::Unusable); + } + i = next; + } + if pool.len() > MAX_ITEMS { + warnings.push("constant pool is unusually large".into()); + } + Ok(pool) +} + +fn trunc(what: &str) -> FormatError { + FormatError::Truncated(format!("constant pool {what}")) +} + +struct RawAttr<'a, 'p> { + // Many attributes can reference one long constant-pool name. The pool + // already owns it for the entire parse; a per-attribute copy amplifies it. + name: &'p str, + info: &'a [u8], +} + +/// Return the complete attributes in the readable prefix and whether the whole table was read. +fn read_attrs<'a, 'p>(c: &mut Cursor<'a>, pool: &'p [Const]) -> (Vec>, bool) { + let mut out = Vec::new(); + let Some(n) = c.u16().map(usize::from) else { return (out, false) }; + for _ in 0..n.min(MAX_ATTRS) { + let (Some(ni), Some(len)) = (c.u16(), c.u32()) else { return (out, false) }; + let Some(info) = c.take(len as usize) else { return (out, false) }; + out.push(RawAttr { name: utf8_of(pool, ni), info }); + } + (out, n <= MAX_ATTRS) +} + +fn bootstrap_table(data: &[u8]) -> Option)>> { + let mut cursor = Cursor::new(data); + let mut table = Vec::new(); + for _ in 0..cursor.u16()? { + let handle = cursor.u16()?; + let count = usize::from(cursor.u16()?); + let args = cursor.take(count * 2)?.as_chunks::<2>().0.iter().map(|b| u16::from_be_bytes(*b)).collect(); + table.push((handle, args)); + } + (cursor.pos == data.len()).then_some(table) +} + +fn parse_members(c: &mut Cursor<'_>, pool: &[Const], warnings: &mut Vec, what: &str) -> Result, FormatError> { + let n = c.u16().ok_or_else(|| FormatError::Truncated(format!("{what} count")))? as usize; + let mut out = Vec::new(); + for _ in 0..n.min(MAX_ITEMS) { + let (Some(access), Some(name_idx), Some(desc_idx)) = (c.u16(), c.u16(), c.u16()) else { + warnings.push(format!("{what} table ended early")); + break; + }; + let mut m = + Member { access, name: utf8_of(pool, name_idx).to_string(), descriptor: utf8_of(pool, desc_idx).to_string(), ..Default::default() }; + let (attrs, _) = read_attrs(c, pool); + for a in attrs { + match a.name { + "Code" => m.code = parse_code(a.info, pool), + "ConstantValue" => { + if let Some(i) = Reader::new(a.info).u16_be(0) { + m.constant_value = Some(const_display(pool, i)); + } + } + "Exceptions" => m.exceptions = parse_exceptions_attr(a.info, pool), + "Signature" => { + if let Some(i) = Reader::new(a.info).u16_be(0) { + m.signature = Some(utf8_of(pool, i).to_string()); + } + } + "Deprecated" => m.deprecated = true, + "Synthetic" => m.synthetic_attr = true, + _ => {} + } + } + out.push(m); + } + Ok(out) +} + +fn parse_code(info: &[u8], pool: &[Const]) -> Option { + let mut c = Cursor::new(info); + let max_stack = c.u16()?; + let max_locals = c.u16()?; + let code_len = c.u32()? as usize; + let bytecode = c.take(code_len)?.to_vec(); + let n_exc = c.u16()? as usize; + let mut exceptions = Vec::new(); + for _ in 0..n_exc.min(MAX_ITEMS) { + let (Some(start_pc), Some(end_pc), Some(handler_pc), Some(catch)) = (c.u16(), c.u16(), c.u16(), c.u16()) else { break }; + exceptions.push(ExceptionEntry { start_pc, end_pc, handler_pc, catch_type: (catch != 0).then(|| class_name_at(pool, catch)) }); + } + let mut line_numbers = Vec::new(); + let (attrs, _) = read_attrs(&mut c, pool); + for a in attrs { + if a.name == "LineNumberTable" { + let mut lc = Cursor::new(a.info); + let n = lc.u16().unwrap_or(0) as usize; + for _ in 0..n.min(MAX_ITEMS) { + let (Some(pc), Some(line)) = (lc.u16(), lc.u16()) else { break }; + line_numbers.push((pc, line)); + } + } + } + Some(Code { max_stack, max_locals, bytecode, exceptions, line_numbers }) +} + +fn parse_exceptions_attr(info: &[u8], pool: &[Const]) -> Vec { + let mut c = Cursor::new(info); + let n = c.u16().unwrap_or(0) as usize; + let mut out = Vec::new(); + for _ in 0..n.min(MAX_ITEMS) { + let Some(i) = c.u16() else { break }; + out.push(class_name_at(pool, i)); + } + out +} + +fn parse_inner_classes(info: &[u8], pool: &[Const]) -> Vec { + let mut c = Cursor::new(info); + let n = c.u16().unwrap_or(0) as usize; + let mut out = Vec::new(); + for _ in 0..n.min(MAX_ITEMS) { + let (Some(inner), Some(outer), Some(name), Some(access)) = (c.u16(), c.u16(), c.u16(), c.u16()) else { break }; + out.push(InnerClass { + inner: (inner != 0).then(|| class_name_at(pool, inner)), + outer: (outer != 0).then(|| class_name_at(pool, outer)), + name: (name != 0).then(|| utf8_of(pool, name).to_string()), + access, + }); + } + out +} + +/// Extract annotation type names (dotted) from a `Runtime*Annotations` attribute, best-effort. +fn parse_annotation_types(info: &[u8], pool: &[Const], visibility: &str) -> Vec { + let mut c = Cursor::new(info); + let n = c.u16().unwrap_or(0) as usize; + let mut out = Vec::new(); + for _ in 0..n.min(MAX_ITEMS) { + match read_annotation(&mut c, pool, 0) { + Some(t) => out.push(format!("{t} ({visibility})")), + None => break, + } + } + out +} + +/// Read one `annotation` structure, returning its (dotted) type name; advances past its values. +fn read_annotation(c: &mut Cursor<'_>, pool: &[Const], depth: usize) -> Option { + if depth > MAX_ANNO_DEPTH { + return None; + } + let type_idx = c.u16()?; + let n_pairs = c.u16()? as usize; + let type_name = field_type(utf8_of(pool, type_idx)); + for _ in 0..n_pairs.min(MAX_ITEMS) { + let _name_idx = c.u16()?; + skip_element_value(c, pool, depth + 1)?; + } + Some(type_name) +} + +fn skip_element_value(c: &mut Cursor<'_>, pool: &[Const], depth: usize) -> Option<()> { + if depth > MAX_ANNO_DEPTH { + return None; + } + let tag = c.u8()?; + match tag { + b'B' | b'C' | b'D' | b'F' | b'I' | b'J' | b'S' | b'Z' | b's' | b'c' => { + c.u16()?; + } + b'e' => { + c.u16()?; + c.u16()?; + } + b'@' => { + read_annotation(c, pool, depth + 1)?; + } + b'[' => { + let n = c.u16()? as usize; + for _ in 0..n.min(MAX_ITEMS) { + skip_element_value(c, pool, depth + 1)?; + } + } + _ => return None, + } + Some(()) +} + +/// Internal class name at a `Class` constant index (`java/lang/String` or `[I`). +fn class_name_at(pool: &[Const], idx: u16) -> String { + match pool.get(idx as usize) { + Some(Const::Class(name_idx)) => utf8_of(pool, *name_idx).to_string(), + _ => format!(""), + } +} + +/// Render a loadable constant (for `ldc`/`ConstantValue`) to text. +fn const_display(pool: &[Const], idx: u16) -> String { + match pool.get(idx as usize) { + Some(Const::Integer(v)) => v.to_string(), + Some(Const::Float(v)) => format!("{v}f"), + Some(Const::Long(v)) => format!("{v}L"), + Some(Const::Double(v)) => v.to_string(), + Some(Const::String(s)) => format!("{:?}", utf8_of(pool, *s)), + Some(Const::Class(n)) => format!("{}.class", internal_to_dotted(utf8_of(pool, *n))), + Some(Const::MethodHandle(k, _)) => format!("MethodHandle(kind {k})"), + Some(Const::MethodType(d)) => format!("MethodType({})", utf8_of(pool, *d)), + _ => format!("#{idx}"), + } +} + +// --------------------------------------------------------------------------------------------- +// Resolution and formatting on a parsed class + +impl ClassFile { + /// The Utf8 at `idx`, or an empty string. + pub fn utf8(&self, idx: u16) -> &str { + utf8_of(&self.pool, idx) + } + + /// The dotted name of this class. + pub fn name_dotted(&self) -> String { + internal_to_dotted(&self.this_class) + } + + /// Resolve a `Fieldref`/`Methodref`/`InterfaceMethodref` index to owner, name and descriptor. + pub fn resolve_ref(&self, idx: u16) -> Option { + let (class_idx, nat_idx) = match self.pool.get(idx as usize)? { + Const::FieldRef(c, n) | Const::MethodRef(c, n) | Const::InterfaceMethodRef(c, n) => (*c, *n), + _ => return None, + }; + let owner = class_name_at(&self.pool, class_idx); + let (name, descriptor) = self.name_and_type(nat_idx); + Some(Ref { owner, name, descriptor }) + } + + /// Resolve a `NameAndType` index to (name, descriptor). + pub fn name_and_type(&self, idx: u16) -> (String, String) { + match self.pool.get(idx as usize) { + Some(Const::NameAndType(n, d)) => (self.utf8(*n).to_string(), self.utf8(*d).to_string()), + _ => (format!(""), String::new()), + } + } + + /// The (name, descriptor) of an `InvokeDynamic` (or `Dynamic`) constant's `NameAndType`. + pub fn name_and_type_of_indy(&self, idx: u16) -> Option<(String, String)> { + match self.pool.get(idx as usize)? { + Const::InvokeDynamic(_, nat) | Const::Dynamic(_, nat) => Some(self.name_and_type(*nat)), + _ => None, + } + } + + /// Dotted class name at a `Class` constant index. + pub fn class_dotted(&self, idx: u16) -> String { + internal_to_dotted(&class_name_at(&self.pool, idx)) + } + + /// A Java-style method signature (`public static void log(java.lang.String)`). + pub fn method_signature(&self, m: &Member) -> String { + let (params, ret) = method_params(&m.descriptor); + let flags = access_flags(m.access, AccessKind::Method).join(" "); + let params = params.join(", "); + if m.name == "" || m.name == "" { + format!("{}{}{}({params})", flags, if flags.is_empty() { "" } else { " " }, m.name).trim().to_string() + } else { + format!("{}{}{} {}({params})", flags, if flags.is_empty() { "" } else { " " }, ret, m.name).trim().to_string() + } + } + + /// Render one decoded instruction with its constant-pool reference resolved. + pub fn format_insn(&self, i: &Insn) -> String { + let mut operand = String::new(); + if let Some(cp) = i.cp_index { + operand = match i.opcode { + 0x12..=0x14 => const_display(&self.pool, cp), + 0xb2..=0xb5 => self.resolve_ref(cp).map(|r| r.display()).unwrap_or_else(|| format!("#{cp}")), + 0xb6..=0xb9 => self + .resolve_ref(cp) + .map(|r| format!("{}.{}{}", internal_to_dotted(&r.owner), r.name, r.descriptor)) + .unwrap_or_else(|| format!("#{cp}")), + 0xba => { + // invokedynamic: show the bootstrap name:descriptor + match self.pool.get(cp as usize) { + Some(Const::InvokeDynamic(_, nat)) => { + let (n, d) = self.name_and_type(*nat); + format!("{n}{d}") + } + _ => format!("#{cp}"), + } + } + 0xbb | 0xbd | 0xc0 | 0xc1 | 0xc5 => self.class_dotted(cp), + _ => format!("#{cp}"), + }; + } else if i.opcode == 0xbc { + // newarray + operand = java_ops::array_type(i.int.unwrap_or(0)).to_string(); + } else if i.opcode == 0x84 { + // iinc local, const + operand = format!("{}, {}", i.local.unwrap_or(0), i.int.unwrap_or(0)); + } else if let Some(l) = i.local { + operand = l.to_string(); + } else if let Some(v) = i.int { + operand = v.to_string(); + } else if let Some(b) = i.branch { + operand = format!("{b}"); + } + if i.opcode == 0xc5 { + // multianewarray class, dims + operand = format!("{}, {}", operand, i.int.unwrap_or(0)); + } + let mut s = if operand.is_empty() { i.name.to_string() } else { format!("{} {}", i.name, operand) }; + if let Some(sw) = &i.switch { + let cases: Vec = sw.pairs.iter().take(32).map(|(k, t)| format!("{k} -> {t}")).collect(); + s.push_str(&format!(" # default -> {}; {}", sw.default, cases.join(", "))); + } + s + } +} + +// --------------------------------------------------------------------------------------------- +// References + +/// One place a method's bytecode refers to a class, method or field. +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct Reference { + /// The calling method, `owner.name:descriptor`. + pub caller: String, + /// Byte offset in the caller's code. + pub pc: u32, + pub instruction: &'static str, + /// Direct member/type use or a method handle, method type or bootstrap linkage. + pub kind: &'static str, + pub target: String, +} + +fn class_component(name: &str) -> Option<&str> { + if name.starts_with('[') { name.trim_start_matches('[').strip_prefix('L')?.strip_suffix(';') } else { Some(name) } +} + +fn descriptor_mentions(mut descriptor: &str, owner: &str) -> bool { + while let Some((_, rest)) = descriptor.split_once('L') { + let Some((class, tail)) = rest.split_once(';') else { return false }; + if class == owner { + return true; + } + descriptor = tail; + } + false +} + +/// Resolve a loadable constant to its named dependency, retaining the linkage role. +fn constant_dependency(cf: &ClassFile, idx: u16, owner: &str, method: Option<&str>, bootstrap: bool) -> Option<(&'static str, String)> { + match cf.pool.get(usize::from(idx))? { + Const::Class(utf) if method.is_none() => { + let name = cf.utf8(*utf); + (class_component(name) == Some(owner)).then(|| ("type", internal_to_dotted(name))) + } + Const::MethodType(utf) if method.is_none() => { + let desc = cf.utf8(*utf); + descriptor_mentions(desc, owner).then(|| ("method-type", desc.to_owned())) + } + Const::MethodHandle(kind, target) => { + let member = cf.pool.get(usize::from(*target))?; + let valid = matches!( + (kind, member), + (1..=4, Const::FieldRef(..)) + | (5 | 8, Const::MethodRef(..)) + | (6 | 7, Const::MethodRef(..) | Const::InterfaceMethodRef(..)) + | (9, Const::InterfaceMethodRef(..)) + ); + let target = cf.resolve_ref(*target)?; + (valid && (!bootstrap || matches!(*kind, 6 | 8)) && target.owner == owner && method.is_none_or(|m| *kind >= 5 && target.name == m)) + .then(|| (if bootstrap { "bootstrap-method" } else { "method-handle" }, target.display())) + } + _ => None, + } +} + +/// Every instruction in `cf` that refers to the internal class `owner` (optionally only calls to +/// its methods named `method`). The bool is true when decoding or the reference limit stops a scan early. +pub fn references(cf: &ClassFile, owner: &str, method: Option<&str>, max: usize) -> (Vec, bool) { + let mut out = Vec::new(); + let mut incomplete = false; + // A single bootstrap record may be referenced by every instruction in a class. + let mut linkage_budget = 200_000usize; + for m in &cf.methods { + let Some(code) = &m.code else { continue }; + let caller = Ref { owner: cf.this_class.clone(), name: m.name.clone(), descriptor: m.descriptor.clone() }.display(); + let (insns, complete) = java_ops::decode(&code.bytecode, 200_000); + incomplete |= !complete; + for i in &insns { + let Some(cp) = i.cp_index else { continue }; + if matches!(i.opcode, 0x12..=0x14 | 0xba) { + let link = match (cf.pool.get(usize::from(cp)), i.opcode) { + (Some(Const::Dynamic(n, _)), 0x12..=0x14) | (Some(Const::InvokeDynamic(n, _)), 0xba) => Some(*n), + (Some(Const::Class(_) | Const::MethodType(_) | Const::MethodHandle(..)), 0x12 | 0x13) => None, + _ => continue, + }; + let record = link.and_then(|idx| cf.bootstrap_methods.get(usize::from(idx))); + let (handle, args): (u16, &[u16]) = record.map_or((cp, &[][..]), |(h, a)| (*h, a)); + let mut seen = std::collections::BTreeSet::new(); + for (index, &operand) in std::iter::once(&handle).chain(args).enumerate() { + let Some(left) = linkage_budget.checked_sub(1) else { return (out, true) }; + linkage_budget = left; + let is_bootstrap = index == 0 && record.is_some(); + if seen.insert((operand, is_bootstrap)) + && let Some((kind, target)) = constant_dependency(cf, operand, owner, method, is_bootstrap) + { + if out.len() >= max { + return (out, true); + } + out.push(Reference { caller: caller.clone(), pc: i.pc, instruction: i.name, kind, target }); + } + } + continue; + } + let hit = match i.opcode { + 0xb6..=0xb9 => { + cf.resolve_ref(cp).and_then(|r| (r.owner == owner && method.is_none_or(|n| r.name == n)).then(|| ("method", r.display()))) + } + 0xb2..=0xb5 if method.is_none() => cf.resolve_ref(cp).and_then(|r| (r.owner == owner).then(|| ("field", r.display()))), + 0xbb | 0xbd | 0xc0 | 0xc1 | 0xc5 if method.is_none() => { + let name = class_name_at(&cf.pool, cp); + (class_component(&name) == Some(owner)).then_some(("type", internal_to_dotted(&name))) + } + _ => None, + }; + if let Some((kind, target)) = hit { + if out.len() >= max { + return (out, true); + } + out.push(Reference { caller: caller.clone(), pc: i.pc, instruction: i.name, kind, target }); + } + } + } + (out, incomplete) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::test_support::java as fx; + + /// Two valid static methods: a one-dimensional allocation and a two-dimensional one. + fn array_reference_class(component: &str, array: &str) -> ClassFile { + let utf8 = |s: &str| { + let mut bytes = vec![1]; + bytes.extend_from_slice(&(s.len() as u16).to_be_bytes()); + bytes.extend_from_slice(s.as_bytes()); + bytes + }; + let pool = [ + utf8("sample/ArrayUses"), + vec![7, 0, 1], + utf8("java/lang/Object"), + vec![7, 0, 3], + utf8("Code"), + utf8("row"), + utf8(&format!("()[L{component};")), + utf8("grid"), + utf8(&format!("(){array}")), + utf8(component), + vec![7, 0, 10], + utf8(array), + vec![7, 0, 12], + ]; + let mut bytes = vec![0xca, 0xfe, 0xba, 0xbe, 0, 0, 0, 52, 0, 14]; + bytes.extend(pool.into_iter().flatten()); + // public/super, this, super, no interfaces or fields, two methods. + bytes.extend_from_slice(&[0, 0x21, 0, 2, 0, 4, 0, 0, 0, 0, 0, 2]); + for (name, descriptor, code) in [(6u16, 7u16, vec![4, 0xbd, 0, 11, 0xb0]), (8, 9, vec![4, 4, 0xc5, 0, 13, 2, 0xb0])] { + for word in [9u16, name, descriptor, 1, 5] { + bytes.extend_from_slice(&word.to_be_bytes()); + } + bytes.extend_from_slice(&(12u32 + code.len() as u32).to_be_bytes()); + bytes.extend_from_slice(&[0, 2, 0, 0]); // max_stack, max_locals + bytes.extend_from_slice(&(code.len() as u32).to_be_bytes()); + bytes.extend_from_slice(&code); + bytes.extend_from_slice(&[0, 0, 0, 0]); // exception table and nested attributes + } + bytes.extend_from_slice(&[0, 0]); // class attributes + let cf = parse(&bytes).unwrap(); + assert!(cf.warnings.is_empty(), "{:?}", cf.warnings); + cf + } + + #[test] + fn parentheses_in_reference_types_are_part_of_the_class_name() { + let (params, result) = method_params("(Lpkg/A)B;[Lpkg/C(D;J)Lpkg/R)S;"); + assert_eq!(params, ["pkg.A)B", "pkg.C(D[]", "long"]); + assert_eq!(result, "pkg.R)S"); + } + + #[test] + fn object_arrays_reference_the_component_class() { + let cf = array_reference_class("java/lang/String", "[[Ljava/lang/String;"); + let (refs, more) = references(&cf, "java/lang/String", None, 10); + assert!(!more); + assert_eq!(refs.len(), 2, "{refs:?}"); + assert_eq!((refs[0].instruction, refs[0].pc), ("anewarray", 1)); + assert_eq!((refs[1].instruction, refs[1].pc), ("multianewarray", 2)); + assert_eq!(refs[1].target, "java.lang.String[][]"); + let (limited, more) = references(&cf, "java/lang/String", None, 1); + assert_eq!(limited, refs[..1]); + assert!(more); + assert_eq!(references(&cf, "java/lang/String", Some("grid"), 10), (Vec::new(), false)); + assert_eq!(references(&cf, "java/lang/Integer", None, 10), (Vec::new(), false)); + } + + #[test] + fn array_components_keep_class_names_beginning_with_l() { + for component in ["Leaf", "LLeaf"] { + let cf = array_reference_class(component, &format!("[[L{component};")); + let (refs, more) = references(&cf, component, None, 10); + assert_eq!(refs.len(), 2, "{component}: {refs:?}"); + assert!(!more); + } + } + + #[test] + fn primitive_arrays_do_not_reference_a_class_named_after_the_descriptor() { + let cf = array_reference_class("I", "[[I"); + let (refs, more) = references(&cf, "I", None, 10); + assert!(!more); + assert_eq!(refs.len(), 1, "{refs:?}"); + assert_eq!(refs[0].instruction, "anewarray"); + } + + #[test] + fn parses_fixture() { + let data = fx::hello_class(); + let cf = parse(&data).unwrap(); + assert!(cf.warnings.is_empty(), "{:?}", cf.warnings); + assert_eq!(cf.this_class, "com/example/Hello"); + assert_eq!(cf.super_class.as_deref(), Some("java/lang/Object")); + assert_eq!(cf.interfaces, vec!["java/lang/Runnable"]); + assert_eq!(cf.source_file.as_deref(), Some("Hello.java")); + assert!(cf.version.major >= 45); + // field + let f = cf.fields.iter().find(|f| f.name == "count").unwrap(); + assert_eq!(field_type(&f.descriptor), "int"); + // run() loads a string and calls println + let run = cf.methods.iter().find(|m| m.name == "run").unwrap(); + assert_eq!(cf.method_signature(run), "public void run()"); + let code = run.code.as_ref().unwrap(); + let (ins, complete) = java_ops::decode(&code.bytecode, 1000); + assert!(complete, "{ins:?}"); + let text: Vec = ins.iter().map(|i| cf.format_insn(i)).collect(); + assert!(text.iter().any(|t| t == "getstatic java.lang.System.out:java.io.PrintStream"), "{text:?}"); + assert!(text.iter().any(|t| t.starts_with("ldc \"Hello")), "{text:?}"); + assert!(text.iter().any(|t| t == "invokevirtual java.io.PrintStream.println(Ljava/lang/String;)V"), "{text:?}"); + // references to System from this class + let (refs, more) = references(&cf, "java/lang/System", None, 100); + assert!(!more); + assert!(refs.iter().any(|r| r.kind == "field" && r.target.contains("out")), "{refs:?}"); + } + + #[test] + fn helpers() { + assert_eq!(internal_to_dotted("java/lang/String"), "java.lang.String"); + assert_eq!(internal_to_dotted("[Ljava/lang/String;"), "java.lang.String[]"); + assert_eq!(method_params("(Ljava/lang/String;I)V"), (vec!["java.lang.String".to_string(), "int".to_string()], "void".to_string())); + assert_eq!(method_params("()I"), (Vec::new(), "int".to_string())); + assert_eq!(Version { major: 52, minor: 0 }.java_label(), "Java 8"); + assert_eq!(Version { major: 65, minor: 0 }.java_label(), "Java 21"); + assert_eq!(decode_mutf8(&[0xc0, 0x80, 0x41]), "\0A"); + } + + #[test] + fn hostile() { + let data = fx::hello_class(); + let walk = |cf: &ClassFile| { + let _ = cf.name_dotted(); + for m in cf.methods.iter().chain(&cf.fields) { + let _ = cf.method_signature(m); + if let Some(code) = &m.code { + let (ins, _) = java_ops::decode(&code.bytecode, 10_000); + for i in &ins { + let _ = cf.format_insn(i); + } + } + } + let _ = references(cf, "java/lang/System", None, 100); + }; + for m in crate::test_support::mutations(&data) { + if let Ok(cf) = parse(&m) { + walk(&cf); + } + } + for len in 0..data.len() { + if let Ok(cf) = parse(&data[..len]) { + walk(&cf); + } + } + for seed in 0..64 { + let mut n = crate::test_support::noise(seed, 2048); + n[..4].copy_from_slice(&[0xca, 0xfe, 0xba, 0xbe]); + n[6] = 0; + n[7] = 52; + if let Ok(cf) = parse(&n) { + walk(&cf); + } + } + } +} diff --git a/crates/java-class/src/java_ops.rs b/crates/java-class/src/java_ops.rs new file mode 100644 index 000000000..46e5cdf30 --- /dev/null +++ b/crates/java-class/src/java_ops.rs @@ -0,0 +1,711 @@ +//! JVM bytecode: the opcode table (every defined opcode plus the `wide`, `tableswitch` and +//! `lookupswitch` variable-length forms) and a decoder for each instruction. Pure decoding; +//! constant-pool index operands are resolved by the caller (see [`crate::java_class`]). + +use serde::Serialize; + +/// The shape of an opcode's operands. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] +pub enum Operands { + /// No operands. + None, + /// One signed byte immediate (`bipush`). + Byte, + /// One signed short immediate (`sipush`). + Short, + /// A one-byte local-variable index. + Local, + /// `iinc`: a one-byte local index and a signed byte increment. + LocalConst, + /// A two-byte signed branch offset. + Branch2, + /// A four-byte signed branch offset (`goto_w`, `jsr_w`). + Branch4, + /// A one-byte constant-pool index (`ldc`). + Cp1, + /// A two-byte constant-pool index. + Cp2, + /// `newarray`: a one-byte primitive array type. + NewArray, + /// `invokeinterface`: a two-byte index, a count byte and a zero byte. + InvokeInterface, + /// `invokedynamic`: a two-byte index and two zero bytes. + InvokeDynamic, + /// `multianewarray`: a two-byte class index and a dimension byte. + MultiANewArray, + /// `tableswitch` (variable length, 4-byte aligned). + TableSwitch, + /// `lookupswitch` (variable length, 4-byte aligned). + LookupSwitch, + /// `wide`: a prefix that widens the following load/store/ret/iinc. + Wide, + /// A reserved or unknown opcode. + Reserved, +} + +/// One opcode slot. +#[derive(Debug, Clone, Copy)] +pub struct Op { + pub name: &'static str, + pub operands: Operands, +} + +const fn op(name: &'static str, operands: Operands) -> Op { + Op { name, operands } +} + +/// The opcode table entry for `b`. +pub fn opcode(b: u8) -> Op { + use Operands as O; + match b { + 0x00 => op("nop", O::None), + 0x01 => op("aconst_null", O::None), + 0x02 => op("iconst_m1", O::None), + 0x03 => op("iconst_0", O::None), + 0x04 => op("iconst_1", O::None), + 0x05 => op("iconst_2", O::None), + 0x06 => op("iconst_3", O::None), + 0x07 => op("iconst_4", O::None), + 0x08 => op("iconst_5", O::None), + 0x09 => op("lconst_0", O::None), + 0x0a => op("lconst_1", O::None), + 0x0b => op("fconst_0", O::None), + 0x0c => op("fconst_1", O::None), + 0x0d => op("fconst_2", O::None), + 0x0e => op("dconst_0", O::None), + 0x0f => op("dconst_1", O::None), + 0x10 => op("bipush", O::Byte), + 0x11 => op("sipush", O::Short), + 0x12 => op("ldc", O::Cp1), + 0x13 => op("ldc_w", O::Cp2), + 0x14 => op("ldc2_w", O::Cp2), + 0x15 => op("iload", O::Local), + 0x16 => op("lload", O::Local), + 0x17 => op("fload", O::Local), + 0x18 => op("dload", O::Local), + 0x19 => op("aload", O::Local), + 0x1a => op("iload_0", O::None), + 0x1b => op("iload_1", O::None), + 0x1c => op("iload_2", O::None), + 0x1d => op("iload_3", O::None), + 0x1e => op("lload_0", O::None), + 0x1f => op("lload_1", O::None), + 0x20 => op("lload_2", O::None), + 0x21 => op("lload_3", O::None), + 0x22 => op("fload_0", O::None), + 0x23 => op("fload_1", O::None), + 0x24 => op("fload_2", O::None), + 0x25 => op("fload_3", O::None), + 0x26 => op("dload_0", O::None), + 0x27 => op("dload_1", O::None), + 0x28 => op("dload_2", O::None), + 0x29 => op("dload_3", O::None), + 0x2a => op("aload_0", O::None), + 0x2b => op("aload_1", O::None), + 0x2c => op("aload_2", O::None), + 0x2d => op("aload_3", O::None), + 0x2e => op("iaload", O::None), + 0x2f => op("laload", O::None), + 0x30 => op("faload", O::None), + 0x31 => op("daload", O::None), + 0x32 => op("aaload", O::None), + 0x33 => op("baload", O::None), + 0x34 => op("caload", O::None), + 0x35 => op("saload", O::None), + 0x36 => op("istore", O::Local), + 0x37 => op("lstore", O::Local), + 0x38 => op("fstore", O::Local), + 0x39 => op("dstore", O::Local), + 0x3a => op("astore", O::Local), + 0x3b => op("istore_0", O::None), + 0x3c => op("istore_1", O::None), + 0x3d => op("istore_2", O::None), + 0x3e => op("istore_3", O::None), + 0x3f => op("lstore_0", O::None), + 0x40 => op("lstore_1", O::None), + 0x41 => op("lstore_2", O::None), + 0x42 => op("lstore_3", O::None), + 0x43 => op("fstore_0", O::None), + 0x44 => op("fstore_1", O::None), + 0x45 => op("fstore_2", O::None), + 0x46 => op("fstore_3", O::None), + 0x47 => op("dstore_0", O::None), + 0x48 => op("dstore_1", O::None), + 0x49 => op("dstore_2", O::None), + 0x4a => op("dstore_3", O::None), + 0x4b => op("astore_0", O::None), + 0x4c => op("astore_1", O::None), + 0x4d => op("astore_2", O::None), + 0x4e => op("astore_3", O::None), + 0x4f => op("iastore", O::None), + 0x50 => op("lastore", O::None), + 0x51 => op("fastore", O::None), + 0x52 => op("dastore", O::None), + 0x53 => op("aastore", O::None), + 0x54 => op("bastore", O::None), + 0x55 => op("castore", O::None), + 0x56 => op("sastore", O::None), + 0x57 => op("pop", O::None), + 0x58 => op("pop2", O::None), + 0x59 => op("dup", O::None), + 0x5a => op("dup_x1", O::None), + 0x5b => op("dup_x2", O::None), + 0x5c => op("dup2", O::None), + 0x5d => op("dup2_x1", O::None), + 0x5e => op("dup2_x2", O::None), + 0x5f => op("swap", O::None), + 0x60 => op("iadd", O::None), + 0x61 => op("ladd", O::None), + 0x62 => op("fadd", O::None), + 0x63 => op("dadd", O::None), + 0x64 => op("isub", O::None), + 0x65 => op("lsub", O::None), + 0x66 => op("fsub", O::None), + 0x67 => op("dsub", O::None), + 0x68 => op("imul", O::None), + 0x69 => op("lmul", O::None), + 0x6a => op("fmul", O::None), + 0x6b => op("dmul", O::None), + 0x6c => op("idiv", O::None), + 0x6d => op("ldiv", O::None), + 0x6e => op("fdiv", O::None), + 0x6f => op("ddiv", O::None), + 0x70 => op("irem", O::None), + 0x71 => op("lrem", O::None), + 0x72 => op("frem", O::None), + 0x73 => op("drem", O::None), + 0x74 => op("ineg", O::None), + 0x75 => op("lneg", O::None), + 0x76 => op("fneg", O::None), + 0x77 => op("dneg", O::None), + 0x78 => op("ishl", O::None), + 0x79 => op("lshl", O::None), + 0x7a => op("ishr", O::None), + 0x7b => op("lshr", O::None), + 0x7c => op("iushr", O::None), + 0x7d => op("lushr", O::None), + 0x7e => op("iand", O::None), + 0x7f => op("land", O::None), + 0x80 => op("ior", O::None), + 0x81 => op("lor", O::None), + 0x82 => op("ixor", O::None), + 0x83 => op("lxor", O::None), + 0x84 => op("iinc", O::LocalConst), + 0x85 => op("i2l", O::None), + 0x86 => op("i2f", O::None), + 0x87 => op("i2d", O::None), + 0x88 => op("l2i", O::None), + 0x89 => op("l2f", O::None), + 0x8a => op("l2d", O::None), + 0x8b => op("f2i", O::None), + 0x8c => op("f2l", O::None), + 0x8d => op("f2d", O::None), + 0x8e => op("d2i", O::None), + 0x8f => op("d2l", O::None), + 0x90 => op("d2f", O::None), + 0x91 => op("i2b", O::None), + 0x92 => op("i2c", O::None), + 0x93 => op("i2s", O::None), + 0x94 => op("lcmp", O::None), + 0x95 => op("fcmpl", O::None), + 0x96 => op("fcmpg", O::None), + 0x97 => op("dcmpl", O::None), + 0x98 => op("dcmpg", O::None), + 0x99 => op("ifeq", O::Branch2), + 0x9a => op("ifne", O::Branch2), + 0x9b => op("iflt", O::Branch2), + 0x9c => op("ifge", O::Branch2), + 0x9d => op("ifgt", O::Branch2), + 0x9e => op("ifle", O::Branch2), + 0x9f => op("if_icmpeq", O::Branch2), + 0xa0 => op("if_icmpne", O::Branch2), + 0xa1 => op("if_icmplt", O::Branch2), + 0xa2 => op("if_icmpge", O::Branch2), + 0xa3 => op("if_icmpgt", O::Branch2), + 0xa4 => op("if_icmple", O::Branch2), + 0xa5 => op("if_acmpeq", O::Branch2), + 0xa6 => op("if_acmpne", O::Branch2), + 0xa7 => op("goto", O::Branch2), + 0xa8 => op("jsr", O::Branch2), + 0xa9 => op("ret", O::Local), + 0xaa => op("tableswitch", O::TableSwitch), + 0xab => op("lookupswitch", O::LookupSwitch), + 0xac => op("ireturn", O::None), + 0xad => op("lreturn", O::None), + 0xae => op("freturn", O::None), + 0xaf => op("dreturn", O::None), + 0xb0 => op("areturn", O::None), + 0xb1 => op("return", O::None), + 0xb2 => op("getstatic", O::Cp2), + 0xb3 => op("putstatic", O::Cp2), + 0xb4 => op("getfield", O::Cp2), + 0xb5 => op("putfield", O::Cp2), + 0xb6 => op("invokevirtual", O::Cp2), + 0xb7 => op("invokespecial", O::Cp2), + 0xb8 => op("invokestatic", O::Cp2), + 0xb9 => op("invokeinterface", O::InvokeInterface), + 0xba => op("invokedynamic", O::InvokeDynamic), + 0xbb => op("new", O::Cp2), + 0xbc => op("newarray", O::NewArray), + 0xbd => op("anewarray", O::Cp2), + 0xbe => op("arraylength", O::None), + 0xbf => op("athrow", O::None), + 0xc0 => op("checkcast", O::Cp2), + 0xc1 => op("instanceof", O::Cp2), + 0xc2 => op("monitorenter", O::None), + 0xc3 => op("monitorexit", O::None), + 0xc4 => op("wide", O::Wide), + 0xc5 => op("multianewarray", O::MultiANewArray), + 0xc6 => op("ifnull", O::Branch2), + 0xc7 => op("ifnonnull", O::Branch2), + 0xc8 => op("goto_w", O::Branch4), + 0xc9 => op("jsr_w", O::Branch4), + 0xca => op("breakpoint", O::None), + 0xfe => op("impdep1", O::None), + 0xff => op("impdep2", O::None), + _ => op("unknown", O::Reserved), + } +} + +/// The primitive array type for a `newarray` atype operand. +pub fn array_type(atype: i32) -> &'static str { + match atype { + 4 => "boolean", + 5 => "char", + 6 => "float", + 7 => "double", + 8 => "byte", + 9 => "short", + 10 => "int", + 11 => "long", + _ => "?", + } +} + +/// A decoded `tableswitch`/`lookupswitch`. +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct Switch { + /// Absolute byte offset of the default branch. + pub default: i64, + /// `(key, absolute target)` pairs in listing order. + pub pairs: Vec<(i32, i64)>, +} + +/// One decoded instruction. +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct Insn { + /// Byte offset from the start of the method's code. + pub pc: u32, + pub opcode: u8, + pub name: &'static str, + /// Total length in bytes, including operands. + pub len: u32, + /// Local-variable index operand (load/store/ret/iinc). + #[serde(skip_serializing_if = "Option::is_none")] + pub local: Option, + /// Integer immediate (`bipush`/`sipush`/`iinc` increment/`newarray` type/`multianewarray` dims). + #[serde(skip_serializing_if = "Option::is_none")] + pub int: Option, + /// Constant-pool index operand (resolved by the caller). + #[serde(skip_serializing_if = "Option::is_none")] + pub cp_index: Option, + /// Absolute byte offset of a branch target. + #[serde(skip_serializing_if = "Option::is_none")] + pub branch: Option, + /// A switch table when the opcode is `tableswitch`/`lookupswitch`. + #[serde(skip_serializing_if = "Option::is_none")] + pub switch: Option, + /// True when this instruction was prefixed by `wide`. + #[serde(skip_serializing_if = "std::ops::Not::not")] + pub wide: bool, +} + +/// Most entries decoded from one switch table. +const MAX_SWITCH: usize = 1 << 20; + +fn s8(code: &[u8], at: usize) -> Option { + code.get(at).map(|&b| i32::from(b as i8)) +} +fn u16b(code: &[u8], at: usize) -> Option { + Some(u16::from(*code.get(at)?) << 8 | u16::from(*code.get(at + 1)?)) +} +fn s16(code: &[u8], at: usize) -> Option { + u16b(code, at).map(|v| i32::from(v as i16)) +} +fn s32(code: &[u8], at: usize) -> Option { + Some(i32::from(*code.get(at)?) << 24 | i32::from(*code.get(at + 1)?) << 16 | i32::from(*code.get(at + 2)?) << 8 | i32::from(*code.get(at + 3)?)) +} + +fn base(pc: usize, opcode: u8, name: &'static str) -> Insn { + Insn { pc: pc as u32, opcode, name, len: 1, local: None, int: None, cp_index: None, branch: None, switch: None, wide: false } +} + +/// Decode one instruction at `pc`, or `None` for invalid or incomplete operands. +pub fn decode_one(code: &[u8], pc: usize) -> Option { + let b = *code.get(pc)?; + let o = opcode(b); + let mut insn = base(pc, b, o.name); + let rel = |d: i32| pc as i64 + i64::from(d); + match o.operands { + Operands::None | Operands::Reserved => {} + Operands::Byte => { + insn.int = Some(s8(code, pc + 1)?); + insn.len = 2; + } + Operands::Short => { + insn.int = Some(s16(code, pc + 1)?); + insn.len = 3; + } + Operands::Local => { + insn.local = Some(u16::from(*code.get(pc + 1)?)); + insn.len = 2; + } + Operands::LocalConst => { + insn.local = Some(u16::from(*code.get(pc + 1)?)); + insn.int = Some(s8(code, pc + 2)?); + insn.len = 3; + } + Operands::Branch2 => { + insn.branch = Some(rel(s16(code, pc + 1)?)); + insn.len = 3; + } + Operands::Branch4 => { + insn.branch = Some(rel(s32(code, pc + 1)?)); + insn.len = 5; + } + Operands::Cp1 => { + insn.cp_index = Some(u16::from(*code.get(pc + 1)?)); + insn.len = 2; + } + Operands::Cp2 => { + insn.cp_index = Some(u16b(code, pc + 1)?); + insn.len = 3; + } + Operands::NewArray => { + let atype = *code.get(pc + 1)?; + if !(4..=11).contains(&atype) { + return None; + } + insn.int = Some(i32::from(atype)); + insn.len = 2; + } + Operands::InvokeInterface => { + insn.cp_index = Some(u16b(code, pc + 1)?); + if *code.get(pc + 3)? == 0 || *code.get(pc + 4)? != 0 { + return None; + } + insn.len = 5; + } + Operands::InvokeDynamic => { + insn.cp_index = Some(u16b(code, pc + 1)?); + if *code.get(pc + 3)? != 0 || *code.get(pc + 4)? != 0 { + return None; + } + insn.len = 5; + } + Operands::MultiANewArray => { + insn.cp_index = Some(u16b(code, pc + 1)?); + let dimensions = *code.get(pc + 3)?; + if dimensions == 0 { + return None; + } + insn.int = Some(i32::from(dimensions)); + insn.len = 4; + } + Operands::Wide => return decode_wide(code, pc), + Operands::TableSwitch => return decode_tableswitch(code, pc), + Operands::LookupSwitch => return decode_lookupswitch(code, pc), + } + if pc.checked_add(insn.len as usize)? > code.len() { + return None; + } + Some(insn) +} + +fn decode_wide(code: &[u8], pc: usize) -> Option { + let real = *code.get(pc + 1)?; + if !matches!(real, 0x15..=0x19 | 0x36..=0x3a | 0x84 | 0xa9) { + return None; + } + let o = opcode(real); + let mut insn = base(pc, real, o.name); + insn.wide = true; + if real == 0x84 { + // wide iinc: 2-byte local, 2-byte signed const + insn.local = Some(u16b(code, pc + 2)?); + insn.int = Some(s16(code, pc + 4)?); + insn.len = 6; + } else { + // wide load/store/ret: 2-byte local + insn.local = Some(u16b(code, pc + 2)?); + insn.len = 4; + } + if pc.checked_add(insn.len as usize)? > code.len() { + return None; + } + Some(insn) +} + +/// Padding so the operand word after a switch opcode is 4-byte aligned from the code start. +fn switch_pad(pc: usize) -> usize { + (4 - ((pc + 1) % 4)) % 4 +} + +fn decode_tableswitch(code: &[u8], pc: usize) -> Option { + let mut at = pc + 1 + switch_pad(pc); + let default = rel_i64(pc, s32(code, at)?); + let low = s32(code, at + 4)?; + let high = s32(code, at + 8)?; + at += 12; + if high < low { + return None; + } + let count = usize::try_from(i64::from(high) - i64::from(low) + 1).ok()?; + if count > MAX_SWITCH { + return None; + } + let end = at.checked_add(count.checked_mul(4)?)?; + code.get(at..end)?; + let mut pairs = Vec::with_capacity(count); + for i in 0..count { + let off = s32(code, at + i * 4)?; + pairs.push((low.wrapping_add(i as i32), rel_i64(pc, off))); + } + let mut insn = base(pc, 0xaa, "tableswitch"); + insn.switch = Some(Switch { default, pairs }); + insn.len = (end - pc) as u32; + Some(insn) +} + +fn decode_lookupswitch(code: &[u8], pc: usize) -> Option { + let mut at = pc + 1 + switch_pad(pc); + let default = rel_i64(pc, s32(code, at)?); + let npairs = s32(code, at + 4)?; + at += 8; + if npairs < 0 { + return None; + } + let count = npairs as usize; + if count > MAX_SWITCH { + return None; + } + let end = at.checked_add(count.checked_mul(8)?)?; + code.get(at..end)?; + let mut pairs = Vec::with_capacity(count); + let mut previous = None; + for i in 0..count { + let key = s32(code, at + i * 8)?; + if previous.is_some_and(|previous| key <= previous) { + return None; + } + previous = Some(key); + let off = s32(code, at + i * 8 + 4)?; + pairs.push((key, rel_i64(pc, off))); + } + let mut insn = base(pc, 0xab, "lookupswitch"); + insn.switch = Some(Switch { default, pairs }); + insn.len = (end - pc) as u32; + Some(insn) +} + +fn rel_i64(pc: usize, off: i32) -> i64 { + pc as i64 + i64::from(off) +} + +/// Decode a whole method body, stopping at `max` instructions. `complete` is false when a +/// instruction has invalid/incomplete operands or the cap was hit. +pub fn decode(code: &[u8], max: usize) -> (Vec, bool) { + let mut out = Vec::new(); + let mut pc = 0usize; + let mut complete = true; + while pc < code.len() { + if out.len() >= max { + complete = false; + break; + } + match decode_one(code, pc) { + Some(i) => { + pc += (i.len as usize).max(1); + out.push(i); + } + None => { + complete = false; + break; + } + } + } + (out, complete) +} + +#[cfg(test)] +mod tests { + use super::*; + + fn lookup(pc: usize, keys: &[i32]) -> Vec { + let mut code = vec![0; pc]; + code.push(0xab); + while !code.len().is_multiple_of(4) { + code.push(0); + } + code.extend_from_slice(&0i32.to_be_bytes()); + code.extend_from_slice(&(keys.len() as i32).to_be_bytes()); + for key in keys { + code.extend_from_slice(&key.to_be_bytes()); + code.extend_from_slice(&0i32.to_be_bytes()); + } + code + } + + #[test] + fn lookup_keys_must_increase_strictly() { + for keys in [&[1, 1][..], &[1, 0], &[0, -1], &[i32::MIN, i32::MAX, i32::MIN]] { + for pc in 0..4 { + let mut code = lookup(pc, keys); + code.push(0xb1); + assert!(decode_one(&code, pc).is_none(), "pc {pc}, keys {keys:?}"); + let (decoded, complete) = decode(&code, 100); + assert!(!complete); + assert_eq!(decoded.len(), pc, "preserve preceding nops, stop before the bad switch"); + } + } + } + + #[test] + fn lookup_keys_use_signed_order_at_every_alignment() { + for keys in [&[][..], &[i32::MIN, -1, 0, i32::MAX]] { + for pc in 0..4 { + let code = lookup(pc, keys); + let insn = decode_one(&code, pc).unwrap(); + assert_eq!(insn.len as usize, code.len() - pc); + let switch = insn.switch.unwrap(); + assert_eq!(switch.default, pc as i64); + assert_eq!(switch.pairs, keys.iter().map(|&key| (key, pc as i64)).collect::>()); + assert!(decode(&code, 100).1); + } + } + } + + #[test] + fn switch_payloads_must_be_complete() { + for pc in 0..4 { + let lookup = lookup(pc, &[-1, 1]); + let mut dense = vec![0; pc]; + dense.push(0xaa); + while !dense.len().is_multiple_of(4) { + dense.push(0); + } + for word in [0i32, i32::MAX - 1, i32::MAX, 0, 0] { + dense.extend_from_slice(&word.to_be_bytes()); + } + for code in [lookup, dense] { + assert!(decode_one(&code, pc).is_some()); + for end in pc + 1..code.len() { + assert!(decode_one(&code[..end], pc).is_none(), "pc {pc}, end {end}"); + } + } + } + } + + #[test] + fn switch_counts_cannot_reserve_an_absent_table() { + let mut lookup = lookup(0, &[]); + lookup[8..12].copy_from_slice(&(MAX_SWITCH as i32).to_be_bytes()); + assert!(decode_one(&lookup, 0).is_none()); + for (low, high) in [(0i32, MAX_SWITCH as i32 - 1), (i32::MIN, i32::MAX)] { + let mut dense = vec![0xaa, 0, 0, 0]; + for word in [0, low, high] { + dense.extend_from_slice(&word.to_be_bytes()); + } + assert!(decode_one(&dense, 0).is_none()); + } + } + + #[test] + fn table_covers_defined_opcodes() { + let mut named = 0; + for b in 0..=255u8 { + if opcode(b).name != "unknown" { + named += 1; + } + } + // 0x00..=0xca is 203 opcodes, plus impdep1/impdep2. + assert_eq!(named, 203 + 2); + assert_eq!(opcode(0xb6).name, "invokevirtual"); + assert_eq!(opcode(0x10).name, "bipush"); + assert_eq!(opcode(0xc4).name, "wide"); + } + + #[test] + fn decodes_core_formats() { + // iconst_1; bipush 7; istore_1; goto +3 ; (pad to reach len) return + let code = [0x04, 0x10, 0x07, 0x3c, 0xa7, 0x00, 0x03, 0xb1]; + let (ins, complete) = decode(&code, 100); + assert!(complete, "{ins:?}"); + assert_eq!(ins[0].name, "iconst_1"); + assert_eq!(ins[1].name, "bipush"); + assert_eq!(ins[1].int, Some(7)); + assert_eq!(ins[2].name, "istore_1"); + assert_eq!(ins[3].name, "goto"); + assert_eq!(ins[3].branch, Some(7)); // pc 4 + 3 + assert_eq!(ins[4].name, "return"); + } + + #[test] + fn decodes_invoke_and_wide() { + // invokevirtual #5 ; invokeinterface #6 count 2 ; wide iload 300 + let code = [0xb6, 0x00, 0x05, 0xb9, 0x00, 0x06, 0x02, 0x00, 0xc4, 0x15, 0x01, 0x2c]; + let (ins, complete) = decode(&code, 100); + assert!(complete); + assert_eq!(ins[0].name, "invokevirtual"); + assert_eq!(ins[0].cp_index, Some(5)); + assert_eq!(ins[0].len, 3); + assert_eq!(ins[1].name, "invokeinterface"); + assert_eq!(ins[1].cp_index, Some(6)); + assert_eq!(ins[1].len, 5); + assert_eq!(ins[2].name, "iload"); + assert!(ins[2].wide); + assert_eq!(ins[2].local, Some(300)); + assert_eq!(ins[2].len, 4); + } + + #[test] + fn decodes_switches() { + // tableswitch at pc 0: pad 3, default +40, low 1, high 2, offsets +10, +20 + let mut code = vec![0xaa, 0, 0, 0]; + code.extend_from_slice(&40i32.to_be_bytes()); + code.extend_from_slice(&1i32.to_be_bytes()); + code.extend_from_slice(&2i32.to_be_bytes()); + code.extend_from_slice(&10i32.to_be_bytes()); + code.extend_from_slice(&20i32.to_be_bytes()); + let i = decode_one(&code, 0).unwrap(); + assert_eq!(i.name, "tableswitch"); + let sw = i.switch.unwrap(); + assert_eq!(sw.default, 40); + assert_eq!(sw.pairs, vec![(1, 10), (2, 20)]); + assert_eq!(i.len as usize, code.len()); + + // lookupswitch at pc 0: pad 3, default +4, npairs 1, (key 99 -> +8) + let mut lk = vec![0xab, 0, 0, 0]; + lk.extend_from_slice(&4i32.to_be_bytes()); + lk.extend_from_slice(&1i32.to_be_bytes()); + lk.extend_from_slice(&99i32.to_be_bytes()); + lk.extend_from_slice(&8i32.to_be_bytes()); + let l = decode_one(&lk, 0).unwrap(); + let sw = l.switch.unwrap(); + assert_eq!(sw.default, 4); + assert_eq!(sw.pairs, vec![(99, 8)]); + } + + #[test] + fn hostile() { + for seed in 0..256 { + let n = crate::test_support::noise(seed, 512); + let _ = decode(&n, 10_000); + } + // truncated operands never panic + let _ = decode(&[0xb6, 0x00], 10); + let _ = decode(&[0xaa, 0, 0, 0, 0, 0, 0, 0], 10); + let _ = decode(&[0xab, 0, 0, 0, 0, 0, 0, 0, 0x7f, 0xff, 0xff, 0xff], 10); + let _ = decode(&[0xc4], 10); + } +} diff --git a/crates/java-class/src/lib.rs b/crates/java-class/src/lib.rs new file mode 100644 index 000000000..4d135e16b --- /dev/null +++ b/crates/java-class/src/lib.rs @@ -0,0 +1,50 @@ +#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] +#![forbid(unsafe_code)] +//! Java class-file inspection and JVM bytecode decoding. Never executes bytecode. +//! Retains source item, attribute and annotation-depth limits and partial reports. +mod bytes; +mod descriptor; +pub mod java_class; +pub mod java_ops; +pub use java_class::*; +#[cfg(test)] +mod test_support; +/// File admission errors; damaged optional structures retain partial-report warnings. +#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)] +pub enum JavaClassError { + #[error("the file ends early ({0})")] + Truncated(String), + #[error("the file is malformed ({0})")] + Malformed(String), + #[error("not supported: {0}")] + Unsupported(String), +} +use JavaClassError as FormatError; + +#[cfg(test)] +#[path = "regressions/java_array_operands.rs"] +mod java_array_operands; + +#[cfg(test)] +#[path = "regressions/java_attribute_names.rs"] +mod java_attribute_names; + +#[cfg(test)] +#[path = "regressions/java_constant_pool_slots.rs"] +mod java_constant_pool_slots; + +#[cfg(test)] +#[path = "regressions/java_invoke_operands.rs"] +mod java_invoke_operands; + +#[cfg(test)] +#[path = "regressions/java_linkage_references.rs"] +mod java_linkage_references; + +#[cfg(test)] +#[path = "regressions/java_truncated_attributes.rs"] +mod java_truncated_attributes; + +#[cfg(test)] +#[path = "regressions/java_wide_opcodes.rs"] +mod java_wide_opcodes; diff --git a/crates/java-class/src/regressions/java_array_operands.rs b/crates/java-class/src/regressions/java_array_operands.rs new file mode 100644 index 000000000..b5867db52 --- /dev/null +++ b/crates/java-class/src/regressions/java_array_operands.rs @@ -0,0 +1,48 @@ +use crate::java_ops::{decode, decode_one}; + +#[test] +fn invalid_primitive_array_types_stop_before_the_allocation() { + for atype in (0..=u8::MAX).filter(|value| !(4..=11).contains(value)) { + assert!(decode_one(&[0xbc, atype], 0).is_none(), "atype {atype}"); + let (instructions, complete) = decode(&[0, 0xbc, atype, 0xb1], 100); + assert!(!complete, "atype {atype}"); + assert_eq!(instructions.len(), 1); + assert_eq!(instructions[0].name, "nop"); + } +} + +#[test] +fn zero_dimension_multidimensional_allocations_are_not_complete_bytecode() { + assert!(decode_one(&[0xc5, 0, 1, 0], 0).is_none()); + let (instructions, complete) = decode(&[0, 0xc5, 0, 1, 0, 0xb1], 100); + assert!(!complete); + assert_eq!(instructions.len(), 1); + assert_eq!(instructions[0].name, "nop"); +} + +#[test] +fn every_defined_primitive_type_and_nonzero_dimension_remains_decodable() { + for atype in 4..=11 { + let (instructions, complete) = decode(&[0xbc, atype, 0xb1], 100); + assert!(complete); + assert_eq!(instructions.len(), 2); + assert_eq!(instructions[0].int, Some(i32::from(atype))); + assert_eq!(instructions[0].len, 2); + } + for dimensions in 1..=u8::MAX { + let instruction = decode_one(&[0, 0xc5, 0x12, 0x34, dimensions], 1).unwrap(); + assert_eq!(instruction.pc, 1); + assert_eq!(instruction.cp_index, Some(0x1234)); + assert_eq!(instruction.int, Some(i32::from(dimensions))); + assert_eq!(instruction.len, 4); + } +} + +#[test] +fn incomplete_array_operands_remain_rejected() { + for instruction in [&[0xbc, 10][..], &[0xc5, 0, 1, 2][..]] { + for end in 1..instruction.len() { + assert!(decode_one(&instruction[..end], 0).is_none()); + } + } +} diff --git a/crates/java-class/src/regressions/java_attribute_names.rs b/crates/java-class/src/regressions/java_attribute_names.rs new file mode 100644 index 000000000..c506ed0c9 --- /dev/null +++ b/crates/java-class/src/regressions/java_attribute_names.rs @@ -0,0 +1,132 @@ +use crate::java_class::{self, ClassFile, Const}; + +#[derive(Clone, Copy, Debug)] +enum Scope { + Class, + Field, + Method, + Code, +} + +fn u16b(out: &mut Vec, n: u16) { + out.extend_from_slice(&n.to_be_bytes()); +} + +fn u32b(out: &mut Vec, n: u32) { + out.extend_from_slice(&n.to_be_bytes()); +} + +fn utf8(out: &mut Vec, text: &str) { + out.push(1); + u16b(out, text.len() as u16); + out.extend_from_slice(text.as_bytes()); +} + +fn attr(name: u16, info: &[u8]) -> Vec { + let mut out = Vec::new(); + u16b(&mut out, name); + u32b(&mut out, info.len() as u32); + out.extend_from_slice(info); + out +} + +fn attributes(out: &mut Vec, repeated: u16, known: &[Vec]) { + u16b(out, repeated + known.len() as u16); + for _ in 0..repeated { + out.extend_from_slice(&attr(5, &[])); + } + for bytes in known { + out.extend_from_slice(bytes); + } +} + +// A valid shared CONSTANT_Utf8 is named by every unknown attribute. Known +// attributes follow it, so avoiding name copies must not discard their facts. +fn fixture(scope: Scope, repeated: u16) -> Vec { + let mut out = vec![0xca, 0xfe, 0xba, 0xbe, 0, 0, 0, 52]; + u16b(&mut out, 17); + utf8(&mut out, "AttributeFixture"); // 1 + out.push(7); + u16b(&mut out, 1); // 2: this class + utf8(&mut out, "java/lang/Object"); // 3 + out.push(7); + u16b(&mut out, 3); // 4: superclass + utf8(&mut out, &format!("org.example.{}", "A".repeat(usize::from(u16::MAX) - 12))); // 5 + for text in ["SourceFile", "AttributeFixture.java", "field", "I"] { + utf8(&mut out, text); // 6..9 + } + out.push(3); + u32b(&mut out, 42); // 10 + for text in ["ConstantValue", "run", "()V", "Code", "LineNumberTable", "Deprecated"] { + utf8(&mut out, text); // 11..16 + } + for word in [0x0021, 2, 4, 0, 1, 0x0019, 8, 9] { + u16b(&mut out, word); + } + attributes(&mut out, if matches!(scope, Scope::Field) { repeated } else { 0 }, &[attr(11, &10u16.to_be_bytes()), attr(16, &[])]); + for word in [1, 0x0009, 12, 13] { + u16b(&mut out, word); + } + let mut code = vec![0, 0, 0, 0, 0, 0, 0, 1, 0xb1, 0, 0]; + attributes(&mut code, if matches!(scope, Scope::Code) { repeated } else { 0 }, &[attr(15, &[0, 1, 0, 0, 0, 7])]); + attributes(&mut out, if matches!(scope, Scope::Method) { repeated } else { 0 }, &[attr(14, &code)]); + attributes(&mut out, if matches!(scope, Scope::Class) { repeated } else { 0 }, &[attr(6, &7u16.to_be_bytes())]); + out +} + +fn check_facts(parsed: &ClassFile) { + assert!(parsed.warnings.is_empty(), "{:?}", parsed.warnings); + assert_eq!(parsed.this_class, "AttributeFixture"); + assert_eq!(parsed.super_class.as_deref(), Some("java/lang/Object")); + assert_eq!(parsed.source_file.as_deref(), Some("AttributeFixture.java")); + assert_eq!(parsed.fields.len(), 1); + assert_eq!(parsed.fields[0].name, "field"); + assert_eq!(parsed.fields[0].constant_value.as_deref(), Some("42")); + assert!(parsed.fields[0].deprecated); + assert_eq!(parsed.methods.len(), 1); + assert_eq!(parsed.methods[0].name, "run"); + let code = parsed.methods[0].code.as_ref().unwrap(); + assert_eq!(code.bytecode, [0xb1]); + assert_eq!(code.line_numbers, [(0, 7)]); + assert!(matches!(&parsed.pool[5], Const::Utf8(name) if name.len() == usize::from(u16::MAX))); +} + +#[test] +fn known_attributes_survive_repeated_unknown_names_at_every_scope() { + for scope in [Scope::Class, Scope::Field, Scope::Method, Scope::Code] { + check_facts(&java_class::parse(&fixture(scope, 64)).unwrap()); + } +} + +fn memory_case(scope: Scope) { + let bytes = fixture(scope, 4096); + assert!(bytes.len() < 100_000); + check_facts(&java_class::parse(&bytes).unwrap()); +} + +// Run each ignored case separately with a 128 MiB process address-space limit. +// The original parser copies 256 MiB of one attribute name; the fixture itself +// is under 100 KiB. These checks deliberately make no timing assertion. +#[test] +#[ignore = "run separately under a process memory limit"] +fn repeated_class_attribute_names_fit_in_bounded_memory() { + memory_case(Scope::Class); +} + +#[test] +#[ignore = "run separately under a process memory limit"] +fn repeated_field_attribute_names_fit_in_bounded_memory() { + memory_case(Scope::Field); +} + +#[test] +#[ignore = "run separately under a process memory limit"] +fn repeated_method_attribute_names_fit_in_bounded_memory() { + memory_case(Scope::Method); +} + +#[test] +#[ignore = "run separately under a process memory limit"] +fn repeated_code_attribute_names_fit_in_bounded_memory() { + memory_case(Scope::Code); +} diff --git a/crates/java-class/src/regressions/java_constant_pool_slots.rs b/crates/java-class/src/regressions/java_constant_pool_slots.rs new file mode 100644 index 000000000..15ad88567 --- /dev/null +++ b/crates/java-class/src/regressions/java_constant_pool_slots.rs @@ -0,0 +1,53 @@ +use crate::{FormatError, java_class}; + +fn class_with_pool(count: u16, pool: &[u8]) -> Vec { + let mut bytes = vec![0xca, 0xfe, 0xba, 0xbe, 0, 0, 0, 52]; + bytes.extend_from_slice(&count.to_be_bytes()); + bytes.extend_from_slice(pool); + bytes.extend_from_slice(&[0; 14]); + bytes +} + +#[test] +fn a_wide_constant_needs_its_reserved_slot() { + for tag in [5, 6] { + let mut pool = vec![tag]; + pool.extend_from_slice(&[0; 8]); + let bytes = class_with_pool(2, &pool); + assert!(matches!(java_class::parse(&bytes), Err(FormatError::Malformed(message)) if message.contains("second slot"))); + } +} + +#[test] +fn the_largest_pool_cannot_overflow_on_a_trailing_wide_constant() { + for tag in [5, 6] { + let mut pool = [3, 0, 0, 0, 0].repeat(usize::from(u16::MAX) - 2); + pool.push(tag); + pool.extend_from_slice(&[0; 8]); + let bytes = class_with_pool(u16::MAX, &pool); + assert!(matches!(java_class::parse(&bytes), Err(FormatError::Malformed(message)) if message.contains("second slot"))); + } +} + +#[test] +fn a_wide_constant_with_two_remaining_slots_is_retained() { + for tag in [5, 6] { + for count in [3, u16::MAX] { + let mut pool = [3, 0, 0, 0, 0].repeat(usize::from(count) - 3); + pool.push(tag); + pool.extend_from_slice(&[0; 8]); + let parsed = java_class::parse(&class_with_pool(count, &pool)).unwrap(); + assert_eq!(parsed.pool.len(), usize::from(count)); + assert!(matches!(parsed.pool.last(), Some(java_class::Const::Unusable))); + assert!(matches!(parsed.pool[usize::from(count) - 2], java_class::Const::Long(_) | java_class::Const::Double(_))); + } + } +} + +#[test] +fn ordinary_final_constants_and_existing_classes_still_parse() { + let parsed = java_class::parse(&class_with_pool(2, &[3, 0, 0, 0, 7])).unwrap(); + assert_eq!(parsed.pool, vec![java_class::Const::Unusable, java_class::Const::Integer(7)]); + let parsed = java_class::parse(&crate::test_support::java::hello_class()).unwrap(); + assert!(!parsed.methods.is_empty()); +} diff --git a/crates/java-class/src/regressions/java_invoke_operands.rs b/crates/java-class/src/regressions/java_invoke_operands.rs new file mode 100644 index 000000000..a99d8803b --- /dev/null +++ b/crates/java-class/src/regressions/java_invoke_operands.rs @@ -0,0 +1,76 @@ +use crate::java_class; +use crate::java_ops::{decode, decode_one}; + +#[test] +fn invokeinterface_requires_a_count_and_zero_reserved_byte() { + for code in [[0xb9, 0, 1, 0, 0], [0xb9, 0, 1, 1, 1], [0xb9, 0, 1, 255, 255]] { + assert!(decode_one(&code, 0).is_none(), "{code:?}"); + assert!(!decode(&code, 16).1); + } +} + +#[test] +fn invokedynamic_requires_both_reserved_bytes_to_be_zero() { + for code in [[0xba, 0, 1, 1, 0], [0xba, 0, 1, 0, 1], [0xba, 0, 1, 255, 255]] { + assert!(decode_one(&code, 0).is_none(), "{code:?}"); + assert!(!decode(&code, 16).1); + } +} + +#[test] +fn valid_and_truncated_invocations_keep_their_boundaries() { + for count in [1, 2, 255] { + let instruction = decode_one(&[0xb9, 0x12, 0x34, count, 0], 0).unwrap(); + assert_eq!(instruction.cp_index, Some(0x1234)); + assert_eq!(instruction.len, 5); + } + let instruction = decode_one(&[0xba, 0x12, 0x34, 0, 0], 0).unwrap(); + assert_eq!(instruction.cp_index, Some(0x1234)); + for code in [[0xb9, 0, 1, 1, 0], [0xba, 0, 1, 0, 0]] { + for len in 1..5 { + assert!(decode_one(&code[..len], 0).is_none()); + } + } + let (instructions, complete) = decode(&[0xb9, 0, 1, 1, 0, 0xba, 0, 2, 0, 0, 0xb1], 16); + assert!(complete); + assert_eq!(instructions.len(), 3); + assert_eq!(instructions[2].pc, 10); +} + +fn reference_class() -> java_class::ClassFile { + let mut class = java_class::parse(&crate::test_support::java::hello_class()).unwrap(); + class.methods.retain(|method| method.name == "run"); + class +} + +#[test] +fn malformed_invocations_mark_reference_scans_incomplete() { + let valid = reference_class(); + let (expected, incomplete) = java_class::references(&valid, "java/io/PrintStream", None, 10); + assert!(!incomplete); + assert_eq!(expected.len(), 1); + for invalid in [[0xb9, 0, 1, 0, 0], [0xb9, 0, 1, 1, 1], [0xba, 0, 1, 1, 0], [0xba, 0, 1, 0, 1]] { + let mut class = valid.clone(); + let code = &mut class.methods[0].code.as_mut().unwrap().bytecode; + let later_reference = code.clone(); + *code = invalid.to_vec(); + code.extend_from_slice(&later_reference); + let (found, incomplete) = java_class::references(&class, "java/io/PrintStream", None, 10); + assert!(found.is_empty()); + assert!(incomplete, "invalid invocation must not hide an unfinished reference scan: {invalid:?}"); + } +} + +#[test] +fn incomplete_scans_keep_earlier_references_and_scan_other_methods() { + let mut class = reference_class(); + let mut later_method = class.methods[0].clone(); + later_method.name = "later".into(); + class.methods[0].code.as_mut().unwrap().bytecode.extend_from_slice(&[0xba, 0, 1, 1, 0]); + class.methods.push(later_method); + let (found, incomplete) = java_class::references(&class, "java/io/PrintStream", None, 10); + assert!(incomplete); + assert_eq!(found.len(), 2); + assert!(found[0].caller.contains(".run:(")); + assert!(found[1].caller.contains(".later:(")); +} diff --git a/crates/java-class/src/regressions/java_linkage_references.rs b/crates/java-class/src/regressions/java_linkage_references.rs new file mode 100644 index 000000000..7c05abe94 --- /dev/null +++ b/crates/java-class/src/regressions/java_linkage_references.rs @@ -0,0 +1,97 @@ +use crate::java_class::{parse, references}; + +/// A method with a chosen load or call, plus a dynamic call site and a dynamic constant with distinct bootstrap signatures. +fn class(code: &[u8]) -> Vec { + fn utf(s: &str) -> Vec { + let mut b = vec![1]; + b.extend((s.len() as u16).to_be_bytes()); + b.extend(s.bytes()); + b + } + let pool = [ + utf("Uses"), + vec![7, 0, 1], + utf("java/lang/Object"), + vec![7, 0, 3], + utf("run"), + utf("()V"), + utf("Code"), + utf("BootstrapMethods"), + utf("Target"), + vec![7, 0, 9], + utf("apply"), + vec![12, 0, 11, 0, 6], + vec![10, 0, 10, 0, 12], + vec![15, 6, 0, 13], + utf("Factory"), + vec![7, 0, 15], + utf("boot"), + vec![12, 0, 17, 0, 28], + vec![10, 0, 16, 0, 18], + vec![15, 6, 0, 19], + utf("([LTarget;)V"), + vec![16, 0, 21], + vec![18, 0, 0, 0, 12], + utf("value"), + utf("I"), + vec![12, 0, 24, 0, 25], + vec![17, 0, 1, 0, 26], + utf( + "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;)Ljava/lang/invoke/CallSite;", + ), + utf("(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;)I"), + vec![12, 0, 17, 0, 29], + vec![10, 0, 16, 0, 30], + vec![15, 6, 0, 31], + ]; + let mut bytes = vec![0xca, 0xfe, 0xba, 0xbe, 0, 0, 0, 55]; + bytes.extend((pool.len() as u16 + 1).to_be_bytes()); + for e in pool { + bytes.extend(e); + } + bytes.extend([0, 0x21, 0, 2, 0, 4, 0, 0, 0, 0, 0, 1, 0, 9, 0, 5, 0, 6, 0, 1, 0, 7]); + bytes.extend(((12 + code.len()) as u32).to_be_bytes()); + bytes.extend([0, 3, 0, 0]); + bytes.extend((code.len() as u32).to_be_bytes()); + bytes.extend(code); + bytes.extend([0, 0, 0, 0]); + let boots = [0, 2, 0, 20, 0, 1, 0, 14, 0, 32, 0, 0]; + bytes.extend([0, 1, 0, 8]); + bytes.extend((boots.len() as u32).to_be_bytes()); + bytes.extend(boots); + bytes +} +fn kinds(code: &[u8], owner: &str, method: Option<&str>) -> Vec<&'static str> { + let cf = parse(&class(code)).unwrap(); + let (hits, partial) = references(&cf, owner, method, 10); + assert!(!partial); + hits.into_iter().map(|r| r.kind).collect() +} +#[test] +fn class_literal_has_a_use_site() { + assert_eq!(kinds(&[0x12, 10, 0x57, 0xb1], "Target", None), ["type"]); +} +#[test] +fn literal_method_handle_finds_its_member() { + assert_eq!(kinds(&[0x12, 14, 0x57, 0xb1], "Target", Some("apply")), ["method-handle"]); +} +#[test] +fn method_type_mentions_object_array_components() { + assert_eq!(kinds(&[0x12, 22, 0x57, 0xb1], "Target", None), ["method-type"]); +} +#[test] +fn dynamic_call_exposes_factory_dependency() { + assert_eq!(kinds(&[0xba, 0, 23, 0, 0, 0xb1], "Factory", Some("boot")), ["bootstrap-method"]); +} +#[test] +fn dynamic_call_exposes_static_method_handle_argument() { + assert_eq!(kinds(&[0xba, 0, 23, 0, 0, 0xb1], "Target", Some("apply")), ["method-handle"]); +} +#[test] +fn dynamic_constant_exposes_bootstrap_dependency() { + assert_eq!(kinds(&[0x12, 27, 0x57, 0xb1], "Factory", Some("boot")), ["bootstrap-method"]); +} +#[test] +fn unused_bootstrap_does_not_introduce_a_reference() { + assert!(kinds(&[0xb1], "Factory", None).is_empty()); +} diff --git a/crates/java-class/src/regressions/java_truncated_attributes.rs b/crates/java-class/src/regressions/java_truncated_attributes.rs new file mode 100644 index 000000000..700640f33 --- /dev/null +++ b/crates/java-class/src/regressions/java_truncated_attributes.rs @@ -0,0 +1,46 @@ +use crate::java_class::parse; +use crate::test_support::java::hello_class; + +/// The fixture ends in a class attribute count and a single two-byte SourceFile attribute. +const ATTRIBUTE_TABLE_BYTES: usize = 10; + +/// Every cut of the attribute count, header or body leaves a partial class report. +#[test] +fn incomplete_class_attribute_table_reports_a_warning() { + let data = hello_class(); + let start = data.len() - ATTRIBUTE_TABLE_BYTES; + for end in start..data.len() { + let class = parse(&data[..end]).unwrap(); + assert_eq!(class.methods.len(), 4); + assert!(class.source_file.is_none()); + assert!(class.warnings.iter().any(|warning| warning.contains("class attribute table")), "cut at {}", end - start); + } +} + +/// A complete attribute stays available when a subsequent attribute is cut short. +#[test] +fn completed_class_attributes_survive_a_truncated_record() { + let mut data = hello_class(); + let start = data.len() - ATTRIBUTE_TABLE_BYTES; + data[start..start + 2].copy_from_slice(&2u16.to_be_bytes()); + data.extend_from_slice(&[0, 1, 0, 0, 0, 2, 0]); + let class = parse(&data).unwrap(); + assert_eq!(class.source_file.as_deref(), Some("Hello.java")); + assert!(class.warnings.iter().any(|warning| warning.contains("class attribute table"))); +} + +/// Complete, empty and unknown class attributes do not trigger a truncation warning. +#[test] +fn complete_class_attribute_tables_are_accepted() { + let mut data = hello_class(); + let start = data.len() - ATTRIBUTE_TABLE_BYTES; + let original = parse(&data).unwrap(); + assert_eq!(original.source_file.as_deref(), Some("Hello.java")); + assert!(original.warnings.is_empty()); + data[start..start + 2].copy_from_slice(&2u16.to_be_bytes()); + data.extend_from_slice(&[0, 1, 0, 0, 0, 1, 0]); + assert!(parse(&data).unwrap().warnings.is_empty()); + data.truncate(start + 2); + data[start..].fill(0); + assert!(parse(&data).unwrap().warnings.is_empty()); +} diff --git a/crates/java-class/src/regressions/java_wide_opcodes.rs b/crates/java-class/src/regressions/java_wide_opcodes.rs new file mode 100644 index 000000000..85c03ffaa --- /dev/null +++ b/crates/java-class/src/regressions/java_wide_opcodes.rs @@ -0,0 +1,33 @@ +use crate::java_ops::{decode, decode_one}; + +#[test] +fn only_defined_wide_opcodes_are_accepted() { + for op in 0..=255u8 { + let valid = matches!(op, 0x15..=0x19 | 0x36..=0x3a | 0x84 | 0xa9); + let code = [0xc4, op, 0x01, 0x2c, 0xff, 0xfe]; + assert_eq!(decode_one(&code, 0).is_some(), valid, "opcode {op:#x}"); + } +} + +#[test] +fn invalid_wide_does_not_invent_a_method_body() { + let (instructions, complete) = decode(&[0x00, 0xc4, 0xb1, 0, 1, 0xb1], 32); + assert!(!complete); + assert_eq!(instructions.len(), 1); + assert_eq!(instructions[0].name, "nop"); +} + +#[test] +fn wide_locals_and_signed_increments_are_preserved() { + for op in [0x15, 0x16, 0x17, 0x18, 0x19, 0x36, 0x37, 0x38, 0x39, 0x3a, 0xa9] { + let instruction = decode_one(&[0xc4, op, 0xff, 0xff], 0).unwrap(); + assert_eq!(instruction.local, Some(u16::MAX)); + assert_eq!(instruction.len, 4); + assert!(instruction.wide); + } + let instruction = decode_one(&[0xc4, 0x84, 0x01, 0x2c, 0xff, 0xfe], 0).unwrap(); + assert_eq!(instruction.local, Some(300)); + assert_eq!(instruction.int, Some(-2)); + assert_eq!(instruction.len, 6); + assert!(decode_one(&[0xc4, 0x84, 0x00, 1], 0).is_none()); +} diff --git a/crates/java-class/src/test_support.rs b/crates/java-class/src/test_support.rs new file mode 100644 index 000000000..45853e807 --- /dev/null +++ b/crates/java-class/src/test_support.rs @@ -0,0 +1,316 @@ +/// Deterministic pseudo-random bytes (xorshift) for fuzz-like loops. +pub fn noise(seed: u64, len: usize) -> Vec { + let mut x = seed.wrapping_mul(0x9e37_79b9_7f4a_7c15) | 1; + (0..len) + .map(|_| { + x ^= x << 13; + x ^= x >> 7; + x ^= x << 17; + x as u8 + }) + .collect() +} + +/// Every way to damage a sample used by robustness tests: truncations at many lengths and +/// single-byte corruptions spread across the file. +pub fn mutations(sample: &[u8]) -> Vec> { + let mut out = Vec::new(); + let n = sample.len(); + let step = (n / 64).max(1); + let mut len = 0; + while len < n { + out.push(sample[..len].to_vec()); + len += step; + } + for (i, seed) in (0..n).step_by(step).zip(1u64..) { + let mut m = sample.to_vec(); + let noise = noise(seed, 8); + for (j, v) in noise.iter().enumerate() { + if let Some(b) = m.get_mut(i + j) { + *b = *v; + } + } + out.push(m); + let mut m = sample.to_vec(); + if let Some(b) = m.get_mut(i) { + *b = 0xff; + } + out.push(m); + } + out +} + +pub mod java { + use std::collections::HashMap; + + /// A constant-pool builder that interns entries and tracks the double slot after `Long`/`Double`. + #[derive(Default)] + struct Pool { + items: Vec>, + /// Next free index (1-based; accounts for long/double taking two slots). + count: u16, + cache: HashMap, + } + + impl Pool { + fn new() -> Self { + Pool { items: Vec::new(), count: 1, cache: HashMap::new() } + } + fn add(&mut self, bytes: Vec, slots: u16) -> u16 { + let idx = self.count; + self.items.push(bytes); + self.count += slots; + idx + } + fn utf8(&mut self, s: &str) -> u16 { + let key = format!("u:{s}"); + if let Some(&i) = self.cache.get(&key) { + return i; + } + let mut b = vec![1u8]; + b.extend_from_slice(&(s.len() as u16).to_be_bytes()); + b.extend_from_slice(s.as_bytes()); + let i = self.add(b, 1); + self.cache.insert(key, i); + i + } + fn class(&mut self, name: &str) -> u16 { + let n = self.utf8(name); + let key = format!("c:{name}"); + if let Some(&i) = self.cache.get(&key) { + return i; + } + let mut b = vec![7u8]; + b.extend_from_slice(&n.to_be_bytes()); + let i = self.add(b, 1); + self.cache.insert(key, i); + i + } + fn string(&mut self, s: &str) -> u16 { + let u = self.utf8(s); + let mut b = vec![8u8]; + b.extend_from_slice(&u.to_be_bytes()); + self.add(b, 1) + } + fn nat(&mut self, name: &str, desc: &str) -> u16 { + let n = self.utf8(name); + let d = self.utf8(desc); + let mut b = vec![12u8]; + b.extend_from_slice(&n.to_be_bytes()); + b.extend_from_slice(&d.to_be_bytes()); + self.add(b, 1) + } + fn reff(&mut self, tag: u8, owner: &str, name: &str, desc: &str) -> u16 { + let c = self.class(owner); + let nt = self.nat(name, desc); + let mut b = vec![tag]; + b.extend_from_slice(&c.to_be_bytes()); + b.extend_from_slice(&nt.to_be_bytes()); + self.add(b, 1) + } + fn long(&mut self, v: i64) -> u16 { + let mut b = vec![5u8]; + b.extend_from_slice(&v.to_be_bytes()); + self.add(b, 2) + } + /// The serialized constant pool and the count field. + fn finish(&self) -> (Vec, u16) { + (self.items.concat(), self.count) + } + } + + fn u16b(v: &mut Vec, x: u16) { + v.extend_from_slice(&x.to_be_bytes()); + } + fn u32b(v: &mut Vec, x: u32) { + v.extend_from_slice(&x.to_be_bytes()); + } + + /// Build an attribute: name_index, length, body. + fn attr(name_idx: u16, body: Vec) -> Vec { + let mut v = Vec::new(); + u16b(&mut v, name_idx); + u32b(&mut v, body.len() as u32); + v.extend_from_slice(&body); + v + } + + /// A method's `Code` attribute body (max_stack, max_locals, code, exception table, no nested attrs). + fn code_body(max_stack: u16, max_locals: u16, code: &[u8], exc: &[(u16, u16, u16, u16)]) -> Vec { + let mut v = Vec::new(); + u16b(&mut v, max_stack); + u16b(&mut v, max_locals); + u32b(&mut v, code.len() as u32); + v.extend_from_slice(code); + u16b(&mut v, exc.len() as u16); + for (s, e, h, t) in exc { + u16b(&mut v, *s); + u16b(&mut v, *e); + u16b(&mut v, *h); + u16b(&mut v, *t); + } + u16b(&mut v, 0); // nested attributes count + v + } + + /// A method_info: access, name, descriptor, and one already-built Code attribute. + fn method(p: &mut Pool, access: u16, name: &str, desc: &str, code_attribute: Vec) -> Vec { + let name_idx = p.utf8(name); + let desc_idx = p.utf8(desc); + let mut v = Vec::new(); + u16b(&mut v, access); + u16b(&mut v, name_idx); + u16b(&mut v, desc_idx); + u16b(&mut v, 1); // one attribute + v.extend_from_slice(&code_attribute); + v + } + + /// Assemble a whole class from its parts. + #[allow(clippy::too_many_arguments)] + fn assemble( + pool: &Pool, + access: u16, + this_c: u16, + super_c: u16, + interfaces: &[u16], + fields: &[Vec], + methods: &[Vec], + class_attrs: &[Vec], + ) -> Vec { + let (cp, count) = pool.finish(); + let mut v = Vec::new(); + v.extend_from_slice(&[0xca, 0xfe, 0xba, 0xbe]); + u16b(&mut v, 0); // minor + u16b(&mut v, 52); // major (Java 8) + u16b(&mut v, count); + v.extend_from_slice(&cp); + u16b(&mut v, access); + u16b(&mut v, this_c); + u16b(&mut v, super_c); + u16b(&mut v, interfaces.len() as u16); + for i in interfaces { + u16b(&mut v, *i); + } + u16b(&mut v, fields.len() as u16); + for f in fields { + v.extend_from_slice(f); + } + u16b(&mut v, methods.len() as u16); + for m in methods { + v.extend_from_slice(m); + } + u16b(&mut v, class_attrs.len() as u16); + for a in class_attrs { + v.extend_from_slice(a); + } + v + } + + pub const HELLO: &str = "Hello, Craft!"; + + /// `public class com.example.Hello implements Runnable` with a `count` field, a `BIG` long + /// constant, ``, `run()` (System.out.println("Hello, Craft!")), `pick(int)` (a tableswitch) + /// and `guarded()` (a try/catch over the println call). + pub fn hello_class() -> Vec { + let mut p = Pool::new(); + let this_c = p.class("com/example/Hello"); + let obj_c = p.class("java/lang/Object"); + let runnable_c = p.class("java/lang/Runnable"); + let code_attr = p.utf8("Code"); + + // fields: int count; static final long BIG; + let count_name = p.utf8("count"); + let i_desc = p.utf8("I"); + let big_name = p.utf8("BIG"); + let j_desc = p.utf8("J"); + let constval_attr = p.utf8("ConstantValue"); + let big_val = p.long(0x1122_3344_5566_7788); + + // refs used by code + let obj_init = p.reff(10, "java/lang/Object", "", "()V"); + let sysout = p.reff(9, "java/lang/System", "out", "Ljava/io/PrintStream;"); + let hello = p.string(HELLO); + let println = p.reff(10, "java/io/PrintStream", "println", "(Ljava/lang/String;)V"); + let rt_exc = p.class("java/lang/RuntimeException"); + + // (): aload_0; invokespecial Object.; return + let mut init = vec![0x2a, 0xb7]; + init.extend_from_slice(&obj_init.to_be_bytes()); + init.push(0xb1); + let init_m = method(&mut p, 0x0001, "", "()V", attr(code_attr, code_body(1, 1, &init, &[]))); + + // run(): getstatic System.out; ldc "Hello"; invokevirtual println; return + let mut run = vec![0xb2]; + run.extend_from_slice(&sysout.to_be_bytes()); + run.push(0x12); + run.push(hello as u8); // ldc (1-byte index; pool is small) + run.push(0xb6); + run.extend_from_slice(&println.to_be_bytes()); + run.push(0xb1); + let run_m = method(&mut p, 0x0001, "run", "()V", attr(code_attr, code_body(2, 1, &run, &[]))); + + // pick(int): iload_0; tableswitch{0->L0,1->L1,default->Ldef}; L0: bipush 10; ireturn; L1: bipush 20; ireturn; Ldef: iconst_m1; ireturn + // offsets: iload_1@0; tableswitch@1 (pad 2) ends @24; L0@24; L1@27; Ldef@30 + let mut pick = vec![0x1b, 0xaa, 0x00, 0x00]; + u32b(&mut pick, 29); // default -> 1+29 = 30 + u32b(&mut pick, 0); // low + u32b(&mut pick, 1); // high + u32b(&mut pick, 23); // case 0 -> 1+23 = 24 + u32b(&mut pick, 26); // case 1 -> 1+26 = 27 + debug_assert_eq!(pick.len(), 24); + pick.extend_from_slice(&[0x10, 10, 0xac]); // @24: bipush 10; ireturn + pick.extend_from_slice(&[0x10, 20, 0xac]); // @27: bipush 20; ireturn + pick.extend_from_slice(&[0x02, 0xac]); // @30: iconst_m1; ireturn + let pick_m = method(&mut p, 0x0001, "pick", "(I)I", attr(code_attr, code_body(1, 1, &pick, &[]))); + + // guarded(): try { System.out.println("Hello"); } catch (RuntimeException e) {} (then return) + // 0: getstatic(3) ; 3: ldc(2) ; 5: invokevirtual(3) ; 8: goto +5 ->13 ; 11: astore_1 ; 12: return ; 13: return + let mut g = vec![0xb2]; + g.extend_from_slice(&sysout.to_be_bytes()); + g.push(0x12); + g.push(hello as u8); + g.push(0xb6); + g.extend_from_slice(&println.to_be_bytes()); + g.extend_from_slice(&[0xa7, 0x00, 0x05]); // @8 goto -> 13 + g.push(0x4c); // @11 astore_1 + g.push(0xb1); // @12 return + g.push(0xb1); // @13 return + let guarded_m = method(&mut p, 0x0001, "guarded", "()V", attr(code_attr, code_body(2, 2, &g, &[(0, 8, 11, rt_exc)]))); + + // field infos + let field = |p: &mut Pool, access: u16, name_idx: u16, desc_idx: u16, attrs: &[Vec]| -> Vec { + let _ = p; + let mut v = Vec::new(); + u16b(&mut v, access); + u16b(&mut v, name_idx); + u16b(&mut v, desc_idx); + u16b(&mut v, attrs.len() as u16); + for a in attrs { + v.extend_from_slice(a); + } + v + }; + let count_f = field(&mut p, 0x0002, count_name, i_desc, &[]); // private int count + let mut cv = Vec::new(); + u16b(&mut cv, big_val); + let big_f = field(&mut p, 0x0019, big_name, j_desc, &[attr(constval_attr, cv)]); // public static final long BIG + + let source_attr = p.utf8("SourceFile"); + let source_val = p.utf8("Hello.java"); + let mut sf = Vec::new(); + u16b(&mut sf, source_val); + let source = attr(source_attr, sf); + + assemble( + &p, + 0x0021, // public super + this_c, + obj_c, + &[runnable_c], + &[count_f, big_f], + &[init_m, run_m, pick_m, guarded_m], + &[source], + ) + } +} From 65e38419d770ffdb67d6064a3baa391ad984d01b Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 16:44:09 -0500 Subject: [PATCH 120/183] testkit: share the sampled-damage corpus with WASM and Java class --- Cargo.lock | 2 ++ crates/java-class/Cargo.toml | 2 ++ crates/java-class/src/test_support.rs | 42 +-------------------------- crates/wasm/Cargo.toml | 2 ++ crates/wasm/src/test_support.rs | 42 +-------------------------- 5 files changed, 8 insertions(+), 82 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4d32c4f1c..1fb437385 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2306,6 +2306,7 @@ dependencies = [ name = "craft-java-class" version = "0.1.0" dependencies = [ + "craft-testkit", "serde", "thiserror 2.0.21", ] @@ -3389,6 +3390,7 @@ dependencies = [ name = "craft-wasm" version = "0.1.0" dependencies = [ + "craft-testkit", "serde", "thiserror 2.0.21", "wasmparser 0.261.0", diff --git a/crates/java-class/Cargo.toml b/crates/java-class/Cargo.toml index 6dfbd16e5..1a5144fc3 100644 --- a/crates/java-class/Cargo.toml +++ b/crates/java-class/Cargo.toml @@ -11,3 +11,5 @@ workspace=true [dependencies] serde={workspace=true} thiserror={workspace=true} +[dev-dependencies] +craft-testkit = { workspace = true } diff --git a/crates/java-class/src/test_support.rs b/crates/java-class/src/test_support.rs index 45853e807..e2e13ddbd 100644 --- a/crates/java-class/src/test_support.rs +++ b/crates/java-class/src/test_support.rs @@ -1,44 +1,4 @@ -/// Deterministic pseudo-random bytes (xorshift) for fuzz-like loops. -pub fn noise(seed: u64, len: usize) -> Vec { - let mut x = seed.wrapping_mul(0x9e37_79b9_7f4a_7c15) | 1; - (0..len) - .map(|_| { - x ^= x << 13; - x ^= x >> 7; - x ^= x << 17; - x as u8 - }) - .collect() -} - -/// Every way to damage a sample used by robustness tests: truncations at many lengths and -/// single-byte corruptions spread across the file. -pub fn mutations(sample: &[u8]) -> Vec> { - let mut out = Vec::new(); - let n = sample.len(); - let step = (n / 64).max(1); - let mut len = 0; - while len < n { - out.push(sample[..len].to_vec()); - len += step; - } - for (i, seed) in (0..n).step_by(step).zip(1u64..) { - let mut m = sample.to_vec(); - let noise = noise(seed, 8); - for (j, v) in noise.iter().enumerate() { - if let Some(b) = m.get_mut(i + j) { - *b = *v; - } - } - out.push(m); - let mut m = sample.to_vec(); - if let Some(b) = m.get_mut(i) { - *b = 0xff; - } - out.push(m); - } - out -} +pub use craft_testkit::sample_damage::{mutations, noise}; pub mod java { use std::collections::HashMap; diff --git a/crates/wasm/Cargo.toml b/crates/wasm/Cargo.toml index c9a1cdcf3..ea07add48 100644 --- a/crates/wasm/Cargo.toml +++ b/crates/wasm/Cargo.toml @@ -13,3 +13,5 @@ serde = { workspace = true } thiserror = { workspace = true } wasmparser = { version = "0.261", default-features = false, features = ["std", "validate", "features", "component-model", "simd"] } wasmprinter = { version = "0.261", default-features = false, features = ["component-model"] } +[dev-dependencies] +craft-testkit = { workspace = true } diff --git a/crates/wasm/src/test_support.rs b/crates/wasm/src/test_support.rs index 58e7783a0..800f368fd 100644 --- a/crates/wasm/src/test_support.rs +++ b/crates/wasm/src/test_support.rs @@ -1,45 +1,5 @@ // Synthetic fixtures and mutations from Craft Anything testkit, same source revision. -/// Deterministic pseudo-random bytes (xorshift) for fuzz-like loops. -pub fn noise(seed: u64, len: usize) -> Vec { - let mut x = seed.wrapping_mul(0x9e37_79b9_7f4a_7c15) | 1; - (0..len) - .map(|_| { - x ^= x << 13; - x ^= x >> 7; - x ^= x << 17; - x as u8 - }) - .collect() -} - -/// Every way to damage a sample used by robustness tests: truncations at many lengths and -/// single-byte corruptions spread across the file. -pub fn mutations(sample: &[u8]) -> Vec> { - let mut out = Vec::new(); - let n = sample.len(); - let step = (n / 64).max(1); - let mut len = 0; - while len < n { - out.push(sample[..len].to_vec()); - len += step; - } - for (i, seed) in (0..n).step_by(step).zip(1u64..) { - let mut m = sample.to_vec(); - let noise = noise(seed, 8); - for (j, v) in noise.iter().enumerate() { - if let Some(b) = m.get_mut(i + j) { - *b = *v; - } - } - out.push(m); - let mut m = sample.to_vec(); - if let Some(b) = m.get_mut(i) { - *b = 0xff; - } - out.push(m); - } - out -} +pub use craft_testkit::sample_damage::{mutations, noise}; pub mod formats { fn leb(mut v: u32, out: &mut Vec) { From 019d54bfffb429b3f10778a8bf7a318a9843455d Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 17 Nov 2026 22:07:49 +0000 Subject: [PATCH 121/183] ci(jpeg): the uncached wasm check gets a 20-minute limit --- .github/workflows/jpeg.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/jpeg.yml b/.github/workflows/jpeg.yml index c49c03581..495af8b23 100644 --- a/.github/workflows/jpeg.yml +++ b/.github/workflows/jpeg.yml @@ -19,7 +19,8 @@ concurrency: jobs: check: - timeout-minutes: 10 + # Uncached: the wasm check builds its dependencies on every run (about 10 minutes with setup). + timeout-minutes: 20 # fmt, clippy and the tests run in the Workspace gate on every OS. name: JPEG WASM runs-on: ubuntu-latest From e5f00f5bf658ef2cce7bf96fbbd769a6fff5bc72 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 17:47:23 -0500 Subject: [PATCH 122/183] Extract bounded XFDF field-value reader (#2056) * Extract bounded XFDF field-value reader * Record retained XFDF source contributor provenance --------- Co-authored-by: Brandon Thomas --- ATTRIBUTION.md | 6 ++ Cargo.lock | 8 ++ Cargo.toml | 1 + crates/xfdf/Cargo.toml | 13 +++ crates/xfdf/README.md | 11 +++ crates/xfdf/src/lib.rs | 177 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 216 insertions(+) create mode 100644 crates/xfdf/Cargo.toml create mode 100644 crates/xfdf/README.md create mode 100644 crates/xfdf/src/lib.rs diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index ae72ae851..232635e98 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -157,3 +157,9 @@ Sanitization, animation fitting and numeric output policy remain caller-owned. ## HTTP Archive reader `crates/har` preserves Craft Anything `crates/formats/src/har.rs` from `5979f9b13f16dcf1df3c7ae7f8e7735f452866f2` (MIT OR Apache-2.0). Brandon Thomas introduced the typed reader in `f64ae3bf3c8863a982af1304e06de20653803968`; BFlat added UTF-8 BOM compatibility in `cb0bb9d8fa4536ba44ef2c86f5ed759b879cc2d3`. Both source snapshots retain primary author attribution. Shared wiring, explicit byte admission and its tests are subsequent Dylan M. Taylor changes. Redaction and analysis remain app-owned. + +## XFDF field reader + +`crates/xfdf` extracts PDFCraft field reading from #5937 refresh `cb564fd827f572818e9ddb0ea5989a432b1f39fd` (MIT OR Apache-2.0). App-side annotation and form policy remains local; source history is retained in the original repository. + +Retained XFDF source contributors (move-aware blame): Brandon Thomas, Marco Arnulfo, pkibiego and storybored379; module split by aiongg. Subsequent budget/integration work by Dylan M. Taylor. diff --git a/Cargo.lock b/Cargo.lock index cc0965d17..d7561e563 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3458,6 +3458,14 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-xfdf" +version = "0.1.0" +dependencies = [ + "craft-xml", + "thiserror 2.0.21", +] + [[package]] name = "craft-xfl" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index fd9ccf7a6..159c22ad4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,7 @@ craft-java-class = { path = "crates/java-class" } craft-sourcemap = { path = "crates/sourcemap" } craft-pcap = { path = "crates/pcap" } craft-har = { path = "crates/har" } +craft-xfdf = { path = "crates/xfdf" } craft-jsonc = { path = "crates/jsonc" } craft-palette = { path = "crates/palette" } craft-score = { path = "crates/score" } diff --git a/crates/xfdf/Cargo.toml b/crates/xfdf/Cargo.toml new file mode 100644 index 000000000..9b1304d89 --- /dev/null +++ b/crates/xfdf/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "craft-xfdf" +description = "Bounded XFDF field-value reader without PDF or form policy" +version.workspace = true +edition.workspace = true +license.workspace = true +rust-version.workspace = true +repository.workspace = true +[lints] +workspace = true +[dependencies] +craft-xml = { workspace = true } +thiserror = { workspace = true } diff --git a/crates/xfdf/README.md b/crates/xfdf/README.md new file mode 100644 index 000000000..ce8c2802e --- /dev/null +++ b/crates/xfdf/README.md @@ -0,0 +1,11 @@ +# craft-xfdf + +Scoped XFDF field-value reader extracted from PDFCraft #5937 refresh cb564fd82. Does not read FDF/PDF, parse annotations or apply field values. PDF application, permissions, calculations and password filtering stay caller-owned. + +Preserves local-name matching, duplicate field order, dotted names, empty leaf clearing and ignored rich-text-only fields, direct split text concatenation and source UTF-8 replacement policy. XML depth1024, field depth64,2million nodes and64MiB charged expanded names/text. Names and values are charged before copying; temporary parents and emitted name copies both count. XML input/tree memory remains governed by craft-xml defaults, not this output budget alone. + +Current strict craft-xml also rejects duplicate raw/expanded attributes and more than1024 active inherited namespace declarations; older app XML accepted those. These deliberate tighter admissions must be disclosed by consumers. No complete XFDF or corpus parity claim. + +Source history remains in PDFCraft. Shared move and preallocation budget reconciliation by Dylan M. Taylor, MIT OR Apache-2.0. No assets are imported. + +Retained source contributors (move-aware blame): Brandon Thomas, Marco Arnulfo, pkibiego and storybored379; module split by aiongg. Subsequent budget/integration work by Dylan M. Taylor. diff --git a/crates/xfdf/src/lib.rs b/crates/xfdf/src/lib.rs new file mode 100644 index 000000000..002376106 --- /dev/null +++ b/crates/xfdf/src/lib.rs @@ -0,0 +1,177 @@ +//! Bounded XFDF field values; PDF annotations and form application remain caller-owned. +#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] +#![forbid(unsafe_code)] +const MAX_NODES: u32 = 2_000_000; +const MAX_DEPTH: usize = 64; +const MAX_XML_DEPTH: usize = 1024; +const MAX_XFDF_TEXT: usize = 64 << 20; +#[derive(Debug, thiserror::Error, PartialEq, Eq)] +pub enum Error { + #[error("this file isn't XFDF, FDF, XML or text form data")] + UnknownFormat, + #[error("the file can't be read: {0}")] + Malformed(String), +} +/// Read field names and values in file order. This does not apply values to a PDF. +/// UTF-8 replacement and leading BOM/space handling retain the source app policy. +pub fn read_fields(bytes: &[u8]) -> Result)>, Error> { + let text = String::from_utf8_lossy(bytes); + let text = text.trim_start_matches('\u{feff}').trim_start(); + check_form_xml_depth(text)?; + let root = parse_form_xml(text).map_err(|_| Error::UnknownFormat)?; + if root.local() != "xfdf" { + return Err(Error::UnknownFormat); + } + let mut values = Vec::new(); + if let Some(fields) = root.child(craft_xml::Local("fields")) { + walk_xfdf(fields, "", &mut values, 0, &mut 0)?; + } + Ok(values) +} +fn xml_nesting_depth(text: &str) -> usize { + fn find(hay: &[u8], from: usize, needle: &[u8]) -> Option { + (from..hay.len()).find(|&p| hay[p..].starts_with(needle)) + } + let b = text.as_bytes(); + let (mut i, mut depth, mut max) = (0usize, 0usize, 0usize); + while i < b.len() { + if b[i] != b'<' { + i += 1; + } else if b[i..].starts_with(b"").map_or(b.len(), |p| p + 3); + } else if b[i..].starts_with(b"").map_or(b.len(), |p| p + 3); + } else if b[i..].starts_with(b"").map_or(b.len(), |p| p + 2); + } else if b[i..].starts_with(b"").map_or(b.len(), |p| p + 1); + } else if b[i..].starts_with(b"").map_or(b.len(), |p| p + 1); + } else { + depth += 1; + max = max.max(depth); + // Skip the rest of the start tag, over any quoted attribute value, and remember its last + // significant byte: a tag that ends in `/` closes itself, so it is one level deep while it + // is read rather than a level left open. + i += 1; + let mut quote = 0u8; + let mut last = 0u8; + while i < b.len() { + let c = b[i]; + if quote != 0 { + if c == quote { + quote = 0; + } + } else if c == b'"' || c == b'\'' { + quote = c; + } else if c == b'>' { + i += 1; + break; + } else if !c.is_ascii_whitespace() { + last = c; + } + i += 1; + } + if last == b'/' { + depth -= 1; + } + } + } + max +} + +fn check_form_xml_depth(text: &str) -> Result<(), Error> { + let depth = xml_nesting_depth(text); + if depth > MAX_XML_DEPTH { + return Err(Error::Malformed(format!("the file nests XML elements {depth} deep, past the {MAX_XML_DEPTH} the reader accepts"))); + } + Ok(()) +} + +fn parse_form_xml(text: &str) -> Result { + let mut opts = craft_xml::Options { strict: true, doctype: craft_xml::Doctype::Reject, ..Default::default() }; + opts.limits.max_nodes = MAX_NODES as usize; + opts.limits.max_depth = MAX_XML_DEPTH.max(1024); + opts.parse(text.as_bytes()) +} + +fn el_text(el: &craft_xml::El) -> String { + el.children + .iter() + .filter_map(|n| match n { + craft_xml::Node::Text(t) => Some(t.as_str()), + _ => None, + }) + .collect() +} + +fn walk_xfdf(node: &craft_xml::El, prefix: &str, out: &mut Vec<(String, Vec)>, depth: usize, bytes: &mut usize) -> Result<(), Error> { + if depth > MAX_DEPTH { + return Err(Error::Malformed(format!("XFDF fields nest more than {MAX_DEPTH} deep"))); + } + for f in node.children(craft_xml::Local("field")) { + let Some(name) = f.attr("name") else { continue }; + // Charge temporary parent names too, before allocation/recursion can amplify them. + let full_len = if prefix.is_empty() { name.len() } else { prefix.len().saturating_add(1).saturating_add(name.len()) }; + charge_xfdf_text(bytes, full_len)?; + let full = if prefix.is_empty() { name.to_string() } else { format!("{prefix}.{name}") }; + let mut vals = Vec::new(); + for value in f.children(craft_xml::Local("value")) { + let len = value + .children + .iter() + .filter_map(|n| match n { + craft_xml::Node::Text(t) => Some(t.len()), + _ => None, + }) + .fold(0, usize::saturating_add); + charge_xfdf_text(bytes, len)?; + vals.push(el_text(value)); + } + // A leaf with no `` is an empty field (the export writes one that way), so it + // clears the field like FDF's `/V ()`; a field with kids only names their parent. A + // leaf holding only `` is not read yet, so it leaves the field alone. + let names_kids_or_rich = f.elements().any(|c| matches!(c.local(), "field" | "value-richtext")); + if !vals.is_empty() || !names_kids_or_rich { + charge_xfdf_text(bytes, full.len())?; // The emitted name is a second owned copy. + out.push((full.clone(), vals)); + } + walk_xfdf(f, &full, out, depth + 1, bytes)?; + } + Ok(()) +} + +fn charge_xfdf_text(bytes: &mut usize, amount: usize) -> Result<(), Error> { + *bytes = bytes.saturating_add(amount); + if *bytes > MAX_XFDF_TEXT { + return Err(Error::Malformed(format!("the file expands to more than {} MiB of field names and values", MAX_XFDF_TEXT >> 20))); + } + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn field_order_empty_rich_and_split_values() { + let xml = b"abcskiplast"; + assert_eq!( + read_fields(xml).unwrap(), + vec![("parent.child".into(), vec!["ab".into(), "c".into()]), ("empty".into(), vec![]), ("parent.child".into(), vec!["last".into()])] + ); + } + #[test] + fn bounds_and_strict_xml_hardening() { + assert_eq!(read_fields(b""), Err(Error::UnknownFormat)); + assert!(read_fields(b"").is_err()); + assert!(read_fields(b"").is_err()); + let text = format!("{}{}{}", "".repeat(65), "x", "".repeat(65)); + assert!(read_fields(text.as_bytes()).is_err()); + let fields = parse_form_xml("").unwrap(); + let mut out = Vec::new(); + assert!(walk_xfdf(&fields, "", &mut out, 0, &mut (MAX_XFDF_TEXT - 5)).is_err()); + assert!(out.is_empty()); + walk_xfdf(&fields, "", &mut out, 0, &mut (MAX_XFDF_TEXT - 6)).unwrap(); + } +} From 6589b3c83e69cd60901065de24af3655f270cad3 Mon Sep 17 00:00:00 2001 From: FredApps Date: Tue, 17 Nov 2026 23:51:18 +0100 Subject: [PATCH 123/183] ci: add opt-in uncapped three-platform full validation --- .github/workflows/full-validation.yml | 64 ++++++++++++++++++++++ docs/full-validation.md | 28 ++++++++++ scripts/ci-full-validation.sh | 13 +++++ scripts/test-full-validation.py | 76 +++++++++++++++++++++++++++ 4 files changed, 181 insertions(+) create mode 100644 .github/workflows/full-validation.yml create mode 100644 docs/full-validation.md create mode 100644 scripts/ci-full-validation.sh create mode 100644 scripts/test-full-validation.py diff --git a/.github/workflows/full-validation.yml b/.github/workflows/full-validation.yml new file mode 100644 index 000000000..85ad96f2f --- /dev/null +++ b/.github/workflows/full-validation.yml @@ -0,0 +1,64 @@ +name: Full validation + +# Add full-validation to a PR for uncapped validation of its merge ref. Keep the label across pushes. +# Fast Workspace checks are not substitutes for these six completed native/PDF gate checks. +on: + pull_request: + types: [opened, synchronize, reopened, labeled] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + # An unrelated label event must not cancel an active full run. + group: full-validation-${{ github.event.action == 'labeled' && github.event.label.name != 'full-validation' && github.run_id || github.event.pull_request.number || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + native: + if: >- + github.event_name == 'workflow_dispatch' || + (contains(github.event.pull_request.labels.*.name, 'full-validation') && + (github.event.action != 'labeled' || github.event.label.name == 'full-validation')) + name: Full native + uses: storytold/craft-common-actions/.github/workflows/gate.yml@main + with: + os: '["ubuntu-latest","windows-latest","macos-latest"]' + select-os: '[]' + timeout-minutes: 120 + tools: "" + packages: mesa-vulkan-drivers libvulkan1 + craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 + linux-env: WGPU_BACKEND=vulkan + windows-env: CRAFT_PRINT_REQUIRE_QUEUE=1 + env: CRAFT_PRINT_REQUIRE_QUEUE=0 + setup-command: bash scripts/ci-test-inputs.sh + command: | + python scripts/test-full-validation.py + bash scripts/ci-full-validation.sh + + pdf-contracts: + if: >- + github.event_name == 'workflow_dispatch' || + (contains(github.event.pull_request.labels.*.name, 'full-validation') && + (github.event.action != 'labeled' || github.event.label.name == 'full-validation')) + name: Full PDF contracts + uses: storytold/craft-common-actions/.github/workflows/gate.yml@main + with: + os: '["ubuntu-latest","windows-latest","macos-latest"]' + select-os: '[]' + timeout-minutes: 120 + tools: "" + craft-fonts-ref: "" + require-craft-fonts: false + env: RUSTFLAGS=--cfg craft_pdf_unicode_fixtures + setup-command: | + python scripts/test-fetch-pdf-test-fonts.py + python scripts/fetch-pdf-test-fonts.py "$RUNNER_TEMP/craft-pdf-test-fonts" + echo "CRAFT_PDF_TEST_FONT_DIR=$RUNNER_TEMP/craft-pdf-test-fonts" >> "$GITHUB_ENV" + command: | + unset CRAFT_HOSTILE_DIVISOR PROPTEST_CASES + cargo clippy -p craft-pdf --all-targets --all-features --locked -- -D warnings + cargo test -p craft-pdf --all-features --locked + cargo test --manifest-path crates/pdf/read-only-contract/Cargo.toml --locked diff --git a/docs/full-validation.md b/docs/full-validation.md new file mode 100644 index 000000000..dfa3d8a75 --- /dev/null +++ b/docs/full-validation.md @@ -0,0 +1,28 @@ +# Full validation + +The fast Workspace workflow intentionally samples hostile-input/proptest cases and primarily +runs all features. It is not evidence of full default-feature runtime or doctest coverage. + +Add the `full-validation` label to a pull request to start the separate Full validation workflow. +Keep it on the pull request so each new push receives full checks. The workflow checks the PR +merge ref using `pull_request`, never `pull_request_target`, and does not inherit secrets. +A workflow dispatch validates the selected repository ref; it is not evidence for another PR SHA. + +Before treating a candidate as fully validated, verify on its current head/merge ref: + +- All three `Full native / gate` checks actually ran and succeeded (Linux, Windows, macOS). +- Both workspace test configurations ran with `cargo test`: default and all features, including + their doctests and Cargo's ordinary example compilation/linking. Both clippy configurations + and formatting checks also pass. No hostile divisor or proptest case override is set. +- All three `Full PDF contracts / gate` checks ran and succeeded, including the Unicode fixture + cfg and the separate read-only-contract manifest. Linux-only generic tests do not replace them. +- The normal MSRV, WASM and applicable specialized workflow checks pass too. This optional + workflow does not replace those checks, Sonar analysis, independent review, or branch rules. + +An unlabelled PR's skipped Full validation jobs are not a full-validation pass. The label is an +opt-in mechanism, not a branch-protection change or a merge authorization. A new base/head may +need a fresh full run. Do not dispatch another copy when the matching run is already active. + +The existing fast path and nightly workflow are left unchanged. This workflow is separate from +platform-selection and lint/cache optimization work in #2113. Its native commands deliberately +retain the repository's `cargo test --workspace` pre-merge requirement. diff --git a/scripts/ci-full-validation.sh b/scripts/ci-full-validation.sh new file mode 100644 index 000000000..6e9509b5e --- /dev/null +++ b/scripts/ci-full-validation.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# Restore both runtime feature configurations, docs and ordinary example linking, without fuzz caps. +set -euo pipefail +unset CRAFT_HOSTILE_DIVISOR PROPTEST_CASES +if [ "${RUNNER_OS:-}" = Windows ]; then + powershell.exe -NoProfile -Command '$ErrorActionPreference = "Stop"; Start-Service Spooler; Add-PrinterDriver -Name "Generic / Text Only"' +fi +cargo fmt --check +cargo clippy --workspace --all-targets --locked -- -D warnings +cargo clippy --workspace --all-targets --all-features --locked -- -D warnings +# cargo test includes docs and ordinary example linking, as required by AGENTS.md. +cargo test --workspace --locked +cargo test --workspace --all-features --locked diff --git a/scripts/test-full-validation.py b/scripts/test-full-validation.py new file mode 100644 index 000000000..c1729dbfb --- /dev/null +++ b/scripts/test-full-validation.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""Exercise the full gate's command sequence without building Rust locally.""" +import os +from pathlib import Path +import subprocess +import unittest + +ROOT = Path(__file__).resolve().parents[1] +SCRIPT = ROOT / "scripts/ci-full-validation.sh" +COMMANDS = [ + "fmt --check", + "clippy --workspace --all-targets --locked -- -D warnings", + "clippy --workspace --all-targets --all-features --locked -- -D warnings", + "test --workspace --locked", + "test --workspace --all-features --locked", +] + + +def run(os_name, fail=""): + env = dict(os.environ, RUNNER_OS=os_name, FAIL=fail, + CRAFT_HOSTILE_DIVISOR="8", PROPTEST_CASES="64") + mock = r""" +cargo() { + test -z "${CRAFT_HOSTILE_DIVISOR+x}" && test -z "${PROPTEST_CASES+x}" || return 29 + printf '%s\n' "$*" + if [ "$*" = "$FAIL" ]; then return 17; fi +} +powershell.exe() { printf 'print-queue\n'; } +""" + return subprocess.run(["bash", "-c", mock + SCRIPT.read_text()], env=env, + capture_output=True, text=True, check=False) + + +class FullValidation(unittest.TestCase): + def test_every_os_runs_both_full_configurations(self): + for name in ["Linux", "macOS", "Windows"]: + with self.subTest(os=name): + p = run(name) + self.assertEqual(p.returncode, 0, p.stderr) + self.assertEqual(p.stdout.splitlines(), + (["print-queue"] if name == "Windows" else []) + COMMANDS) + + def test_every_failure_stops_the_gate(self): + for i, command in enumerate(COMMANDS): + with self.subTest(command=command): + p = run("Linux", command) + self.assertEqual(p.returncode, 17) + self.assertEqual(p.stdout.splitlines(), COMMANDS[:i + 1]) + + def test_workflow_preserves_fork_and_platform_boundaries(self): + text = (ROOT / ".github/workflows/full-validation.yml").read_text() + self.assertIn("os: '[\"ubuntu-latest\",\"windows-latest\",\"macos-latest\"]'", text) + self.assertIn("select-os: '[]'", text) + self.assertIn("contents: read", text) + self.assertNotIn("pull_request_target", text) + self.assertNotIn("secrets:", text) + self.assertIn("bash scripts/ci-full-validation.sh", text) + self.assertIn("github.event.label.name != 'full-validation' && github.run_id", text) + self.assertIn("github.event.action != 'labeled' || github.event.label.name == 'full-validation'", text) + self.assertNotIn("CRAFT_HOSTILE_DIVISOR=", text) + self.assertNotIn("PROPTEST_CASES=", text) + + def test_pdf_contracts_are_separate_and_uncapped(self): + text = (ROOT / ".github/workflows/full-validation.yml").read_text() + pdf = text.split(" pdf-contracts:", 1)[1] + self.assertIn("RUSTFLAGS=--cfg craft_pdf_unicode_fixtures", pdf) + self.assertIn("unset CRAFT_HOSTILE_DIVISOR PROPTEST_CASES", pdf) + self.assertIn("cargo test -p craft-pdf --all-features --locked", pdf) + self.assertIn("cargo test --manifest-path crates/pdf/read-only-contract/Cargo.toml --locked", pdf) + self.assertIn("select-os: '[]'", pdf) + self.assertIn("windows-latest", pdf) + self.assertIn("macos-latest", pdf) + + +if __name__ == "__main__": + unittest.main() From 373d0e1683adcf9cb26e15bd1d05c16cbda3f73d Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 18 Nov 2026 00:07:54 +0100 Subject: [PATCH 124/183] test(ci): use Git Bash explicitly on Windows --- scripts/test-full-validation.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/test-full-validation.py b/scripts/test-full-validation.py index c1729dbfb..f0e4153af 100644 --- a/scripts/test-full-validation.py +++ b/scripts/test-full-validation.py @@ -3,10 +3,14 @@ import os from pathlib import Path import subprocess +import sys import unittest ROOT = Path(__file__).resolve().parents[1] SCRIPT = ROOT / "scripts/ci-full-validation.sh" +# Actions uses Git Bash on Windows; Python's PATH search can instead select the WSL launcher. +BASH = (str(Path(os.environ.get("ProgramFiles", r"C:\Program Files")) / "Git/bin/bash.exe") + if sys.platform == "win32" else "bash") COMMANDS = [ "fmt --check", "clippy --workspace --all-targets --locked -- -D warnings", @@ -27,7 +31,7 @@ cargo() { } powershell.exe() { printf 'print-queue\n'; } """ - return subprocess.run(["bash", "-c", mock + SCRIPT.read_text()], env=env, + return subprocess.run([BASH, "-c", mock + SCRIPT.read_text()], env=env, capture_output=True, text=True, check=False) @@ -36,7 +40,7 @@ class FullValidation(unittest.TestCase): for name in ["Linux", "macOS", "Windows"]: with self.subTest(os=name): p = run(name) - self.assertEqual(p.returncode, 0, p.stderr) + self.assertEqual(p.returncode, 0, p.stdout + p.stderr) self.assertEqual(p.stdout.splitlines(), (["print-queue"] if name == "Windows" else []) + COMMANDS) @@ -44,7 +48,7 @@ class FullValidation(unittest.TestCase): for i, command in enumerate(COMMANDS): with self.subTest(command=command): p = run("Linux", command) - self.assertEqual(p.returncode, 17) + self.assertEqual(p.returncode, 17, p.stdout + p.stderr) self.assertEqual(p.stdout.splitlines(), COMMANDS[:i + 1]) def test_workflow_preserves_fork_and_platform_boundaries(self): From 29ce80e136b1c58e1c1c50cef77581af8781d710 Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 18 Nov 2026 01:44:16 +0100 Subject: [PATCH 125/183] ci: register full validation in generated actions lockfile --- .github/workflows/actions.lock | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock index 46d7b8d3c..e78310f7f 100644 --- a/.github/workflows/actions.lock +++ b/.github/workflows/actions.lock @@ -46,6 +46,7 @@ workflows: - 'actions/checkout@v7.0.1' - 'dtolnay/rust-toolchain@stable' - 'step-security/harden-runner@v2.22.4' + '.github/workflows/full-validation.yml': [] '.github/workflows/house-rules.yml': [] '.github/workflows/jpeg.yml': - 'actions/checkout@v7.0.1' @@ -144,18 +145,8 @@ dependencies: commit: 'sha1-1d88384fd173af6ecb012dfd0264a306b711241a' owner_id: 88700172 repo_id: 422287306 - 'step-security/rust-cache@v2.9.2': - ref: 'v2.9.2' - commit: 'sha1-8871c8ba063416da7c32246932ea6ae08700453e' - owner_id: 88700172 - repo_id: 822636713 'step-security/taiki-e-install-action@v2.87.32': ref: 'v2.87.32' commit: 'sha1-76747d22a7567cc4438546a84f11bdf18e670ab8' owner_id: 88700172 repo_id: 1382753260 - 'swatinem/rust-cache@v2.9.3': - ref: 'v2.9.3' - commit: 'sha1-d1527c8f67ef9af357290475d4af4b0fab8f12e0' - owner_id: 580492 - repo_id: 298565987 From 17f1b5d20fe9a25007682e25e7a7308e0f00af85 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 19:45:22 -0500 Subject: [PATCH 126/183] Keep uncertain EVM fallback and jump payability unknown --- crates/evm/src/lib.rs | 5 ++++- crates/evm/tests/evm_selector_dedup.rs | 31 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/crates/evm/src/lib.rs b/crates/evm/src/lib.rs index 2b1b089d5..29d254b40 100644 --- a/crates/evm/src/lib.rs +++ b/crates/evm/src/lib.rs @@ -628,7 +628,10 @@ pub fn analyze(code: &[u8]) -> Result { let (short_calldata, receive) = short_calldata_path(body, &ins, disp_start); let mut fallback = "unknown"; + // At the selector cap the remaining dispatcher has not been scanned. + // Its next comparison is not evidence that a fallback body exists. if let Some(j) = last_jumpi + && functions.len() < MAX_FUNCTIONS && solc_like > 0 { fallback = if reverts_soon(body, &ins, j + 1, &index_of) { "absent" } else { "present" }; @@ -694,7 +697,7 @@ fn payability(code: &[u8], ins: &[Ins], start: usize, index_of: &dyn Fn(usize) - match i.op { 0x34 if rejects_value(code, ins, k, index_of) => return ("nonpayable", format!("rejects nonzero CALLVALUE at {:#x}", i.off)), 0x56 => match jump_destination(code, ins, k, index_of) { - Some(t) if hops < 2 => { + Some(t) if hops < 2 && ins.get(t).is_some_and(|target| target.op == 0x5b) => { hops += 1; k = t; continue; diff --git a/crates/evm/tests/evm_selector_dedup.rs b/crates/evm/tests/evm_selector_dedup.rs index 2761a23d3..99aac44ba 100644 --- a/crates/evm/tests/evm_selector_dedup.rs +++ b/crates/evm/tests/evm_selector_dedup.rs @@ -82,3 +82,34 @@ fn repeated_comparisons_keep_fallback_scan_after_the_last_dispatch() { assert_eq!(report.fallback, expected); } } + +#[test] +fn selector_cap_leaves_fallback_unknown() { + for ending in [&[0x5f, 0x5f, 0xfd][..], &[0x00][..]] { + let mut code = prefix(); + for selector in 0..4097 { + comparison(&mut code, selector, 4, 0); + } + code.extend_from_slice(ending); + let report = evm::analyze(&code).unwrap(); + assert_eq!(report.functions.len(), 4096); + assert_eq!(report.fallback, "unknown"); + } +} + +#[test] +fn payability_only_follows_jumps_to_jumpdest() { + for (target, expected) in [(&[0x5b, 0x00][..], "payable"), (&[0x00][..], "unknown")] { + let mut code = prefix(); + let entry = u8::try_from(code.len() + 10).unwrap(); + comparison(&mut code, 0xfeed0001, 4, entry); + code.push(0x00); + assert_eq!(code.len(), usize::from(entry)); + code.extend([0x5b, 0x60, entry + 4, 0x56]); + code.extend_from_slice(target); + let report = evm::analyze(&code).unwrap(); + assert_eq!(report.functions.len(), 1); + assert!(report.functions[0].jumpdest_valid); + assert_eq!(report.functions[0].mutability, expected); + } +} From b837aa22dc013fdbfe6342112763c99fd335a3a9 Mon Sep 17 00:00:00 2001 From: David Mann Date: Wed, 18 Nov 2026 02:35:46 +0100 Subject: [PATCH 127/183] craft-control: agents in the open window for apps on main (#2141) The ArtCraft Launcher's switch (AgentSwitch, mcp_flag, launcher_allows), the agent settings, the connection file (agent-connection.json) and the -cli mcp side that finds the open window (Live: window while the app accepts agents, otherwise headless or the closed-app choice; launcher starts the app beside the CLI), behind the new feature agents. No UI toolkit and no async runtime. Same formats as craft_automation::agents on next, which can re-export these once the branches meet. --- Cargo.lock | 15 + Cargo.toml | 2 + crates/control/Cargo.toml | 16 + crates/control/src/agents/connection.rs | 115 ++++++ crates/control/src/agents/live.rs | 480 ++++++++++++++++++++++++ crates/control/src/agents/mod.rs | 72 ++++ crates/control/src/agents/settings.rs | 124 ++++++ crates/control/src/agents/switch.rs | 93 +++++ crates/control/src/lib.rs | 4 +- crates/control/tests/agents.rs | 428 +++++++++++++++++++++ 10 files changed, 1348 insertions(+), 1 deletion(-) create mode 100644 crates/control/src/agents/connection.rs create mode 100644 crates/control/src/agents/live.rs create mode 100644 crates/control/src/agents/mod.rs create mode 100644 crates/control/src/agents/settings.rs create mode 100644 crates/control/src/agents/switch.rs create mode 100644 crates/control/tests/agents.rs diff --git a/Cargo.lock b/Cargo.lock index d7561e563..49cefd1ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1557,6 +1557,16 @@ dependencies = [ "ureq", ] +[[package]] +name = "craft-ai-agents" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-ai-integrations?rev=35e0352666a117407d62230a6c6c2366f3e21a3b#35e0352666a117407d62230a6c6c2366f3e21a3b" +dependencies = [ + "dirs", + "serde", + "serde_json", +] + [[package]] name = "craft-ai-core" version = "0.1.0" @@ -1675,10 +1685,15 @@ dependencies = [ name = "craft-control" version = "0.1.0" dependencies = [ + "craft-ai-agents", + "craft-atomic", + "craft-flags", "getrandom 0.3.4", + "log", "proptest", "serde", "serde_json", + "tempfile", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 159c22ad4..26cb9f606 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,6 +58,8 @@ craft-gzip = { path = "crates/gzip" } craft-gridcraft-format = { path = "crates/gridcraft-format" } craft-aaf = { path = "crates/aaf" } craft-atomic = { path = "crates/atomic" } +# The ArtCraft Launcher's app list for AI agents (storytold/craft-ai-integrations, crates/ai-agents). +craft-ai-agents = { git = "https://github.com/storytold/craft-ai-integrations", rev = "35e0352666a117407d62230a6c6c2366f3e21a3b" } craft-xtask = { path = "crates/xtask" } craft-captions = { path = "crates/captions" } craft-cfb = { path = "crates/cfb" } diff --git a/crates/control/Cargo.toml b/crates/control/Cargo.toml index 0a18ccc99..5c4a90242 100644 --- a/crates/control/Cargo.toml +++ b/crates/control/Cargo.toml @@ -10,6 +10,12 @@ repository.workspace = true [lints] workspace = true +[features] +default = [] +# AI agents in the open window (desktop): the ArtCraft Launcher's switch, the connection file and +# the `-cli mcp` side that finds the open window. The agent settings build without it. +agents = ["dep:craft-ai-agents", "dep:craft-atomic", "dep:craft-flags", "dep:log"] + [dependencies] serde = { workspace = true } serde_json = { workspace = true } @@ -18,6 +24,16 @@ serde_json = { workspace = true } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # The per-launch control token: 32 random bytes from the operating system (MIT OR Apache-2.0). getrandom = "0.3" +# The launcher's app list, read in one place for the launcher, the gateway and every app (MIT OR Apache-2.0, ours). +craft-ai-agents = { workspace = true, optional = true } +craft-atomic = { workspace = true, optional = true } +craft-flags = { workspace = true, optional = true } +log = { workspace = true, optional = true } [dev-dependencies] proptest = { workspace = true } +tempfile = "3" + +[[test]] +name = "agents" +required-features = ["agents"] diff --git a/crates/control/src/agents/connection.rs b/crates/control/src/agents/connection.rs new file mode 100644 index 000000000..0c0bcebc7 --- /dev/null +++ b/crates/control/src/agents/connection.rs @@ -0,0 +1,115 @@ +//! The connection file: where an app's control server listens for agents. + +use std::net::{SocketAddr, TcpStream}; +use std::path::{Path, PathBuf}; +use std::time::Duration; + +use serde::{Deserialize, Serialize}; + +/// The connection file in the app's settings folder, present while the app accepts agents. +pub const CONNECTION_FILE: &str = "agent-connection.json"; +/// The token file the app keeps in its settings folder for agent connections. +pub const TOKEN_FILE: &str = "agent-control.token"; +/// How long [`probe`] waits for a connection to be accepted. +pub const PROBE_TIMEOUT: Duration = Duration::from_millis(500); +/// The version of the [`Connection`] file format. +const CONNECTION_VERSION: u32 = 1; +/// The largest connection file read; anything bigger is not one. +const MAX_CONNECTION_BYTES: u64 = 1 << 20; + +/// What an app publishes in [`CONNECTION_FILE`]: `{"version", "pid", "port", "tokenFile", "app"}`. +/// Holds no secret: the token stays in its own owner-only file. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Connection { + /// The file format's version (1). + pub version: u32, + /// The app's process id: only that process removes the file. + pub pid: u32, + /// The loopback port of the control server. + pub port: u16, + /// The file holding the token. + pub token_file: PathBuf, + /// The app's version, for diagnostics. + pub app: String, +} + +impl Connection { + /// This process's connection on `port`, naming `app` (the app's version string). + pub fn new(port: u16, token_file: PathBuf, app: impl Into) -> Self { + Self { version: CONNECTION_VERSION, pid: std::process::id(), port, token_file, app: app.into() } + } + + /// `127.0.0.1:`. + pub fn addr(&self) -> String { + format!("127.0.0.1:{}", self.port) + } +} + +fn io_error(path: &Path, e: impl std::fmt::Display) -> std::io::Error { + std::io::Error::other(format!("{}: {e}", path.display())) +} + +/// Publishes `c` in `dir` (made if missing), written atomically so a reader never sees half a +/// file. +pub fn write_connection(dir: &Path, c: &Connection) -> std::io::Result<()> { + std::fs::create_dir_all(dir).map_err(|e| io_error(dir, e))?; + let path = dir.join(CONNECTION_FILE); + let text = serde_json::to_string_pretty(c).map_err(|e| io_error(&path, e))?; + craft_atomic::atomic_write(&path, text.as_bytes()).map_err(|e| io_error(&path, e)) +} + +/// The connection published in `dir`, if any. A file of another version, with port 0, or one +/// that does not parse (invalid UTF-8 included) counts as none: the app rewrites it when it next +/// starts listening. Anything but a regular file (a FIFO would block the read) or a file over +/// 1 MiB is an error, and left alone. +pub fn read_connection(dir: &Path) -> std::io::Result> { + let path = dir.join(CONNECTION_FILE); + let meta = match std::fs::metadata(&path) { + Ok(m) => m, + Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(None), + Err(e) => return Err(io_error(&path, e)), + }; + if !meta.is_file() { + return Err(io_error(&path, "not a regular file")); + } + if meta.len() > MAX_CONNECTION_BYTES { + return Err(io_error(&path, format!("larger than {MAX_CONNECTION_BYTES} bytes"))); + } + let bytes = match std::fs::read(&path) { + Ok(b) => b, + Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(None), + Err(e) => return Err(io_error(&path, e)), + }; + Ok(serde_json::from_slice::(&bytes).ok().filter(|c| c.version == CONNECTION_VERSION && c.port != 0)) +} + +/// Removes the connection file in `dir` if process `pid` wrote it (another instance may have +/// published its own since). Errors are ignored: a stale file only fails [`probe`]. +pub fn remove_connection(dir: &Path, pid: u32) { + if let Ok(Some(c)) = read_connection(dir) + && c.pid == pid + { + let _ = std::fs::remove_file(dir.join(CONNECTION_FILE)); + } +} + +/// Removes the connection file in `dir` when nothing listens on its port any more (an app that +/// crashed or quit without removing it), or when it does not read as a connection. A live +/// instance's file is kept, and so is anything but a regular file. Errors are ignored. +pub fn remove_stale_connection(dir: &Path) { + let path = dir.join(CONNECTION_FILE); + let stale = match read_connection(dir) { + Ok(Some(c)) => !probe(c.port, PROBE_TIMEOUT), + Ok(None) => path.is_file(), + Err(_) => false, + }; + if stale { + let _ = std::fs::remove_file(path); + } +} + +/// Whether something accepts connections on loopback `port` within `timeout`; port 0 never does. +pub fn probe(port: u16, timeout: Duration) -> bool { + port != 0 && TcpStream::connect_timeout(&SocketAddr::from(([127, 0, 0, 1], port)), timeout).is_ok() +} diff --git a/crates/control/src/agents/live.rs b/crates/control/src/agents/live.rs new file mode 100644 index 000000000..d328c678f --- /dev/null +++ b/crates/control/src/agents/live.rs @@ -0,0 +1,480 @@ +//! The other end of the link: where an app's `-cli mcp` sends each tool call. +//! +//! [`Live::resolve`] runs before every tool call. It reads the connection file the app publishes +//! while it accepts agents ([`super::write_connection`]), so the app may start, quit or move to another port +//! while the MCP client stays connected, and the client's configuration holds no port and no +//! token: +//! +//! - An app that accepts agents: the call goes to its open window ([`Route::Window`]). The same +//! port, token and process id keep the window client the app made; any change makes a new one. +//! - No app accepts agents, and the person doesn't let agents use it: a session without a window +//! with only the folders given to the command ([`LiveConfig::read_roots`], [`LiveConfig::write_root`]), +//! as `mcp` always worked. The app's own folders are for agents the person let in. +//! - No app accepts agents, but agents are allowed: the closed-app choice decides +//! ([`LiveConfig::when_closed`], otherwise [`AgentSettings::when_app_closed`]): start the app and +//! wait until it accepts agents, a headless session with the app's agent folders (the command's +//! folders win), or an error that says what to do. +//! +//! Once headless, the session stays headless: documents don't move under the agent. Lookups are +//! serialised, so concurrent calls start the app once. +//! +//! The crate has no async runtime: `resolve` blocks (file reads, a loopback probe, and while an +//! app starts, polling), so an async MCP server calls it from its blocking pool. What a window +//! client and a headless session are stays the app's ([`LiveConfig::new`]'s `connect` and +//! `headless`), and so do the tools and the transport. Errors are the tool call's result: words +//! for the agent, and through it the person, naming the app. + +use std::ffi::{OsStr, OsString}; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::sync::{Mutex, PoisonError}; +use std::time::{Duration, Instant}; + +use super::{AgentSettings, Connection, PROBE_TIMEOUT, WhenAppClosed, probe, read_connection}; + +/// Starts the desktop app; see [`launcher`]. +pub type LaunchFn = Box Result<(), String> + Send + Sync>; +/// What the person allows now, read from the app's settings folder before every call. +pub type ConsentFn = Box Consent + Send + Sync>; +/// Makes the app's client for its open window. +pub type ConnectFn = Box Result + Send + Sync>; +/// Makes the app's headless session with these folders. +pub type HeadlessFn = Box Result + Send + Sync>; + +/// How long a started app gets to accept agents. A first start can take a while (GPU shader +/// caches, a font scan), but MCP clients give a tool call about a minute. +pub const LAUNCH_TIMEOUT: Duration = Duration::from_secs(45); +/// How often a starting app's connection file is looked for. +pub const LAUNCH_POLL: Duration = Duration::from_millis(250); + +/// The open window a call goes to: from the connection file, with the token from its token file. +#[derive(Clone, PartialEq, Eq)] +#[non_exhaustive] +pub struct Window { + /// The loopback port of the app's control server. + pub port: u16, + /// The app's process id. + pub pid: u32, + /// The control token (hex digits, lower case). + pub token: String, +} + +impl Window { + /// `127.0.0.1:`. + pub fn addr(&self) -> String { + format!("127.0.0.1:{}", self.port) + } +} + +impl fmt::Debug for Window { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + // Never the token: Debug output ends up in logs. + f.debug_struct("Window").field("port", &self.port).field("pid", &self.pid).finish_non_exhaustive() + } +} + +/// Whether the person lets agents use the app now, and its agent settings. +#[derive(Clone, Debug, Default, PartialEq, Eq)] +#[non_exhaustive] +pub struct Consent { + /// Agents may use the app ([`super::agents_allowed`]: with the suite's `AI-MCP` flag, the + /// ArtCraft Launcher's switch). + pub allowed: bool, + /// The app's agent settings (closed-app choice, folders). + pub settings: AgentSettings, +} + +impl Consent { + /// `allowed` with these settings. + pub fn new(allowed: bool, settings: AgentSettings) -> Self { + Self { allowed, settings } + } +} + +/// The folders a headless session may open from and save to. +#[derive(Clone, Debug, Default, PartialEq, Eq)] +#[non_exhaustive] +pub struct HeadlessFolders { + /// Folders files may be opened from. + pub read: Vec, + /// The folder files may be saved to. + pub write: Option, +} + +/// Where a tool call goes: the app's window client or its headless session. +#[derive(Clone, Debug)] +pub enum Route { + /// The open window. + Window(W), + /// A session without a window. + Headless(H), +} + +/// What [`Live`] needs from the app. +#[non_exhaustive] +pub struct LiveConfig { + /// The app's name in messages (`"PhotoCraft"`). + pub app_name: String, + /// The app's settings folder: connection file, token file and settings. + pub config_dir: PathBuf, + /// Overrides the app's closed-app choice (the CLI's `--when-closed`). + pub when_closed: Option, + /// Folders a headless session may open from (the CLI's read roots); while agents are allowed + /// they replace the app's read folder. + pub read_roots: Vec, + /// The folder a headless session may save to (the CLI's write root); while agents are allowed + /// it replaces the app's write folder. + pub write_root: Option, + /// Starts the app; `None` when this install can't ([`launcher`] found nothing to start). + pub launch: Option, + /// How long a started app gets to accept agents ([`LAUNCH_TIMEOUT`]). + pub launch_timeout: Duration, + /// How often a starting app is looked for ([`LAUNCH_POLL`]). + pub poll: Duration, + consent: ConsentFn, + connect: ConnectFn, + headless: HeadlessFn, +} + +impl LiveConfig { + /// The app `app_name` with its settings in `config_dir`: `consent` reads whether agents may + /// use it, `connect` makes a client for its open window, `headless` a session without one. + pub fn new( + app_name: impl Into, + config_dir: PathBuf, + consent: impl Fn(&Path) -> Consent + Send + Sync + 'static, + connect: impl Fn(&Window) -> Result + Send + Sync + 'static, + headless: impl Fn(&HeadlessFolders) -> Result + Send + Sync + 'static, + ) -> Self { + Self { + app_name: app_name.into(), + config_dir, + when_closed: None, + read_roots: Vec::new(), + write_root: None, + launch: None, + launch_timeout: LAUNCH_TIMEOUT, + poll: LAUNCH_POLL, + consent: Box::new(consent), + connect: Box::new(connect), + headless: Box::new(headless), + } + } +} + +/// The port, token and process id a window client was made for: a restarted app may keep its +/// port and token, but its old socket is gone. +type WindowKey = (u16, String, u32); +/// The current route, and for a window the key it was made for. +type Current = Option<(Route, Option)>; + +/// Resolves each tool call of one MCP session; see the module docs. +pub struct Live { + cfg: LiveConfig, + /// Serialises lookups, so concurrent calls start the app once. + lookup: Mutex<()>, + current: Mutex>, +} + +impl Live { + /// A session that has not resolved anything yet. + pub fn new(cfg: LiveConfig) -> Self { + Self { cfg, lookup: Mutex::new(()), current: Mutex::new(None) } + } + + /// The route the last [`Self::resolve`] chose, if any. + pub fn current(&self) -> Option> { + self.current.lock().unwrap_or_else(PoisonError::into_inner).as_ref().map(|(r, _)| r.clone()) + } + + fn set(&self, route: Route, key: Option) -> Route { + *self.current.lock().unwrap_or_else(PoisonError::into_inner) = Some((route.clone(), key)); + route + } + + /// Where the next tool call goes. Blocks; see the module docs. The error is the tool call's + /// result. + pub fn resolve(&self) -> Result, String> { + let _one_at_a_time = self.lookup.lock().unwrap_or_else(PoisonError::into_inner); + if let Some(route @ Route::Headless(_)) = self.current() { + return Ok(route); + } + let consent = (self.cfg.consent)(&self.cfg.config_dir); + if let Some(window) = self.find_app()? { + return self.use_window(window); + } + if !consent.allowed { + let folders = HeadlessFolders { read: self.cfg.read_roots.clone(), write: self.cfg.write_root.clone() }; + return self.headless(&folders, "the automation roots can't be used"); + } + let app = &self.cfg.app_name; + match self.cfg.when_closed.unwrap_or(consent.settings.when_app_closed) { + WhenAppClosed::Error => Err(format!("{app} isn't running: open it, then try again.")), + WhenAppClosed::Headless => { + let read = + if self.cfg.read_roots.is_empty() { consent.settings.read_folder().into_iter().collect() } else { self.cfg.read_roots.clone() }; + let write = self.cfg.write_root.clone().or_else(|| consent.settings.write_folder()); + self.headless(&HeadlessFolders { read, write }, &format!("{app} isn't running and its agent folders can't be used")) + } + WhenAppClosed::Launch => self.launch_and_wait(), + } + } + + fn headless(&self, folders: &HeadlessFolders, why: &str) -> Result, String> { + let session = (self.cfg.headless)(folders).map_err(|e| format!("{why}: {e}"))?; + Ok(self.set(Route::Headless(session), None)) + } + + fn launch_and_wait(&self) -> Result, String> { + let app = &self.cfg.app_name; + let Some(launch) = &self.cfg.launch else { + return Err(format!("{app} isn't running, and this install can't start it from here: open {app}, then try again.")); + }; + launch().map_err(|e| format!("couldn't start {app}: {e}"))?; + let deadline = Instant::now() + self.cfg.launch_timeout; + loop { + std::thread::sleep(self.cfg.poll); + if let Some(window) = self.find_app()? { + return self.use_window(window); + } + if Instant::now() >= deadline { + return Err(format!( + "{app} didn't accept agents within {} s of starting. If it's still opening, try again in a moment; otherwise check that AI agents are on in ArtCraft Launcher › Settings › AI agents.", + self.cfg.launch_timeout.as_secs() + )); + } + } + } + + fn use_window(&self, window: Window) -> Result, String> { + let key: WindowKey = (window.port, window.token.clone(), window.pid); + { + let current = self.current.lock().unwrap_or_else(PoisonError::into_inner); + if let Some((route, Some(k))) = current.as_ref() + && *k == key + { + return Ok(route.clone()); + } + } + let client = (self.cfg.connect)(&window)?; + Ok(self.set(Route::Window(client), Some(key))) + } + + /// The app accepting agents now: `None` when there is no connection file, or one left by an + /// app that crashed (nothing listens on its port). + fn find_app(&self) -> Result, String> { + find_window(&self.cfg.config_dir, &self.cfg.app_name) + } +} + +/// The window accepting agents with its settings in `dir`, with the token from its token file; +/// `None` when no app accepts agents there. `app_name` names the app in errors. +pub fn find_window(dir: &Path, app_name: &str) -> Result, String> { + let Some(c): Option = read_connection(dir).map_err(|e| e.to_string())? else { return Ok(None) }; + if !probe(c.port, PROBE_TIMEOUT) { + return Ok(None); + } + let token = read_token(&c.token_file).map_err(|e| format!("{app_name}'s agent token: {e}"))?; + Ok(Some(Window { port: c.port, pid: c.pid, token })) +} + +/// The largest token file read; a token is far shorter. +const MAX_TOKEN_FILE: u64 = 4096; + +/// The token in the token file at `path`, trimmed. The file must be a regular file of at most +/// [`MAX_TOKEN_FILE`] bytes holding a non-empty token of hex digits, and on Unix readable by its +/// owner only: a token others could read is refused rather than used. +fn read_token(path: &Path) -> Result { + use std::io::Read; + let shown = |e: &dyn fmt::Display| format!("{}: {e}", path.display()); + let file = std::fs::File::open(path).map_err(|e| shown(&e))?; + let meta = file.metadata().map_err(|e| shown(&e))?; + if !meta.is_file() { + return Err(shown(&"not a regular file")); + } + #[cfg(unix)] + { + use std::os::unix::fs::MetadataExt; + if meta.mode() & 0o077 != 0 { + return Err(shown(&format!("readable by group or others (mode {:o}); restrict it to its owner", meta.mode() & 0o777))); + } + } + let mut text = String::new(); + file.take(MAX_TOKEN_FILE + 1).read_to_string(&mut text).map_err(|e| shown(&e))?; + if text.len() as u64 > MAX_TOKEN_FILE { + return Err(shown(&format!("larger than {MAX_TOKEN_FILE} bytes"))); + } + let token = text.trim(); + if token.is_empty() || !token.bytes().all(|b| b.is_ascii_hexdigit()) { + return Err(shown(&"not a control token")); + } + Ok(token.to_ascii_lowercase()) +} + +/// How to start the desktop app `exe` (its file name without `.exe`) that ships beside the CLI at +/// `cli`: detached and with no standard streams, since the CLI's carry the MCP protocol and the +/// app must outlive the MCP client. `None` where this install can't start it: inside a Flatpak, +/// or with no app beside the CLI. +pub fn launcher(cli: &Path, exe: &str) -> Option { + use std::process::{Command, Stdio}; + let env = |name: &str| std::env::var_os(name).filter(|v| !v.is_empty()); + let (program, args) = + launch_command(cli, exe, Platform::current(), env("FLATPAK_ID").is_some(), env("APPIMAGE"), env("SystemRoot"), &|p| p.is_file())?; + let mut command = Command::new(program); + command.args(args); + let command = Mutex::new(command); + Some(Box::new(move || { + let mut c = command.lock().unwrap_or_else(PoisonError::into_inner); + c.stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::null()); + detach(&mut c); + c.spawn().map(|_| ()).map_err(|e| e.to_string()) + })) +} + +/// The platform [`launch_command`] plans for. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +enum Platform { + Windows, + MacOs, + Other, +} + +impl Platform { + fn current() -> Self { + if cfg!(windows) { + Self::Windows + } else if cfg!(target_os = "macos") { + Self::MacOs + } else { + Self::Other + } + } +} + +/// The program and arguments that start the app; see [`launcher`]. +fn launch_command( + cli: &Path, + exe: &str, + platform: Platform, + flatpak: bool, + appimage: Option, + system_root: Option, + is_file: &dyn Fn(&Path) -> bool, +) -> Option<(PathBuf, Vec)> { + if flatpak { + return None; + } + if let Some(image) = appimage { + // The AppImage's mount point goes away with the CLI; the image itself stays. + return Some((PathBuf::from(image), Vec::new())); + } + let dir = cli.parent()?; + if platform == Platform::MacOs + && dir.ends_with("Contents/MacOS") + && let Some(bundle) = dir.parent().and_then(Path::parent) + { + // A macOS app bundle: LaunchServices starts (or brings forward) the app. + return Some((PathBuf::from("/usr/bin/open"), vec![OsString::from("-a"), bundle.as_os_str().to_os_string()])); + } + let app = dir.join(if platform == Platform::Windows { format!("{exe}.exe") } else { exe.to_owned() }); + if !is_file(&app) { + return None; + } + Some(if platform == Platform::Windows { windows_launch(&app, system_root.as_deref()) } else { (app, Vec::new()) }) +} + +/// How Windows starts the app at `app`: through Explorer, as a double-click would. The app is then +/// no child of the CLI, so it outlives the MCP client ending the CLI's process tree (Claude Code +/// does on Windows), and it runs outside the container of a Microsoft Store client (Claude +/// Desktop): there, new files under `%APPDATA%` land in the client's package, where the app +/// started from the Start menu would never see them. Explorer reads a comma as a separator, so +/// such a path is started directly. (`%WINDIR%` can be empty under a Store client, hence +/// `%SystemRoot%`.) +fn windows_launch(app: &Path, system_root: Option<&OsStr>) -> (PathBuf, Vec) { + if app.to_string_lossy().contains(',') { + return (app.to_path_buf(), Vec::new()); + } + let root = system_root.filter(|r| !r.is_empty()).map_or_else(|| PathBuf::from(r"C:\Windows"), PathBuf::from); + (root.join("explorer.exe"), vec![app.as_os_str().to_os_string()]) +} + +/// Keeps the app running when the MCP client stops the CLI (and its process group). +fn detach(c: &mut std::process::Command) { + #[cfg(unix)] + { + use std::os::unix::process::CommandExt; + c.process_group(0); + } + #[cfg(windows)] + { + use std::os::windows::process::CommandExt; + const DETACHED_PROCESS: u32 = 0x0000_0008; + const CREATE_NEW_PROCESS_GROUP: u32 = 0x0000_0200; + c.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP); + } + #[cfg(not(any(unix, windows)))] + let _ = c; +} + +#[cfg(test)] +mod tests { + #![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] + use super::*; + + fn plan( + cli: &str, + platform: Platform, + flatpak: bool, + appimage: Option<&str>, + root: Option<&str>, + exists: bool, + ) -> Option<(PathBuf, Vec)> { + launch_command(Path::new(cli), "photocraft", platform, flatpak, appimage.map(OsString::from), root.map(OsString::from), &|_| exists) + } + + #[test] + fn windows_starts_the_app_through_explorer() { + let app = Path::new(r"C:\Program Files\PhotoCraft\photocraft.exe"); + let (program, args) = windows_launch(app, Some(OsStr::new(r"D:\Win"))); + assert_eq!(program, Path::new(r"D:\Win").join("explorer.exe")); + assert_eq!(args, [app.as_os_str()]); + // No usable %SystemRoot%: the default Windows folder. + let default = Path::new(r"C:\Windows").join("explorer.exe"); + assert_eq!(windows_launch(app, Some(OsStr::new(""))).0, default); + assert_eq!(windows_launch(app, None).0, default); + // Explorer would split this path at the comma. + let comma = Path::new(r"C:\Apps, tools\photocraft.exe"); + assert_eq!(windows_launch(comma, None), (comma.to_path_buf(), Vec::new())); + } + + #[test] + fn the_launch_command_fits_the_install() { + // Flatpak: the sandbox can't start the app. + assert_eq!(plan("/app/bin/photocraft-cli", Platform::Other, true, Some("/x.AppImage"), None, true), None); + // An AppImage starts its image, not the mount point the CLI runs from. + assert_eq!( + plan("/tmp/.mount/usr/bin/photocraft-cli", Platform::Other, false, Some("/home/a/P.AppImage"), None, false), + Some((PathBuf::from("/home/a/P.AppImage"), Vec::new())) + ); + // A macOS bundle opens through LaunchServices. + let (program, args) = plan("/Applications/PhotoCraft.app/Contents/MacOS/photocraft-cli", Platform::MacOs, false, None, None, false).unwrap(); + assert_eq!(program, Path::new("/usr/bin/open")); + assert_eq!(args, [OsString::from("-a"), OsString::from("/Applications/PhotoCraft.app")]); + // Beside the CLI, by the app's file name. + assert_eq!(plan("/opt/pc/photocraft-cli", Platform::Other, false, None, None, true), Some((PathBuf::from("/opt/pc/photocraft"), Vec::new()))); + let (program, args) = plan(r"C:\PC\photocraft-cli.exe", Platform::Windows, false, None, Some(r"C:\Win"), true).unwrap(); + assert_eq!(program, Path::new(r"C:\Win").join("explorer.exe")); + // The app beside the CLI (on a non-Windows host the backslashes are no separators). + assert_eq!(args, [Path::new(r"C:\PC\photocraft-cli.exe").parent().unwrap().join("photocraft.exe").into_os_string()]); + // No app beside the CLI: nothing to start. + assert_eq!(plan("/opt/pc/photocraft-cli", Platform::Other, false, None, None, false), None); + assert_eq!(plan("photocraft-cli", Platform::Other, false, None, None, true).map(|p| p.0), Some(PathBuf::from("photocraft"))); + } + + #[test] + fn a_window_never_shows_its_token() { + let w = Window { port: 7, pid: 9, token: "ab".repeat(32) }; + assert!(!format!("{w:?}").contains("abab")); + assert_eq!(w.addr(), "127.0.0.1:7"); + } +} diff --git a/crates/control/src/agents/mod.rs b/crates/control/src/agents/mod.rs new file mode 100644 index 000000000..77d45d25d --- /dev/null +++ b/crates/control/src/agents/mod.rs @@ -0,0 +1,72 @@ +//! AI agents in the open window, with no UI toolkit: whether the person lets agents use the app, +//! how the app tells its own `-cli mcp` where it listens, and where that CLI sends each tool +//! call. +//! +//! One switch serves every Craft app: the ArtCraft Launcher's *Settings › AI agents › Let AI agents +//! use Craft apps*, which writes the launcher's app list (`craft_ai_agents`). With the suite's +//! `AI-MCP` flag on, an app lets agents in when that list names it ([`AgentSwitch`]); without the +//! flag, the app's own earlier consent decides ([`agents_allowed`]). Apps have no agents switch of +//! their own. +//! +//! While agents may connect, the app serves its control channel on loopback with a token +//! ([`crate::server`], [`crate::auth`], or its own) and publishes where in its settings folder +//! ([`CONNECTION_FILE`]): the port, its process id and the token file. The app's `-cli mcp` +//! reads that file before every tool call ([`Live`]), so an MCP client's configuration never holds +//! a port or a token. The file holds no secret. A crashed app can leave it behind; nothing then +//! listens on its port ([`probe`]), and the app's next launch removes it +//! ([`remove_stale_connection`]). +//! +//! | Part | Names | Builds | +//! |---|---|---| +//! | Settings | [`AgentSettings`], [`WhenAppClosed`], [`agents_allowed`], [`folder`] | every target | +//! | The launcher's switch | [`AgentSwitch`], [`mcp_flag`], [`launcher_allows`], [`POLL`] | desktop, feature `agents` | +//! | The connection file | [`Connection`], [`write_connection`], [`read_connection`], [`remove_connection`], [`remove_stale_connection`], [`probe`] | desktop, feature `agents` | +//! | The CLI's side | [`Live`], [`LiveConfig`], [`Route`], [`Window`], [`Consent`], [`HeadlessFolders`], [`find_window`], [`launcher`] | desktop, feature `agents` | +//! +//! The same formats as `craft_automation::agents` on the shared UI library's branch (`next`), +//! which adds the egui link host and the Agents page of Preferences. +//! +//! # Adding an app +//! +//! The app (its id is the one in the ArtCraft Launcher's catalog, `"gridcraft"`): +//! +//! 1. At start, [`remove_stale_connection`] in its settings folder, then +//! `AgentSwitch::watch("gridcraft", wake)`, where `wake` asks the UI for a frame. +//! 2. On each change of [`AgentSwitch::allows`]: when it allows, listen on loopback with a token, +//! the token in an owner-only file ([`crate::auth::App::write_token_file`]), and +//! [`write_connection`] with [`Connection::new`]; when it stops allowing, stop listening and +//! [`remove_connection`] with the app's process id. No restart, no agents switch of its own. +//! +//! Its `gridcraft-cli mcp`: +//! +//! 1. A [`LiveConfig`] with the app's settings folder; `consent` reads its saved +//! [`AgentSettings`] and asks [`launcher_allows`]; `connect` makes the app's client for a +//! [`Window`] (its address and token); `headless` makes its session without a window for +//! [`HeadlessFolders`]. [`launcher`] starts the app beside the CLI. +//! 2. Before every tool call, [`Live::resolve`] (from a blocking thread in an async server), then +//! the call goes to the [`Route`] it returns. `--headless` skips [`Live`] altogether. + +// The links above name items of the `agents` feature; without it they have nothing to point at, +// and the docs of the settings alone still build. +#![cfg_attr(not(all(feature = "agents", not(target_arch = "wasm32"))), allow(rustdoc::broken_intra_doc_links))] + +mod settings; +pub use settings::{AgentSettings, WhenAppClosed, agents_allowed, folder}; + +#[cfg(all(feature = "agents", not(target_arch = "wasm32")))] +mod connection; +#[cfg(all(feature = "agents", not(target_arch = "wasm32")))] +mod live; +#[cfg(all(feature = "agents", not(target_arch = "wasm32")))] +mod switch; +#[cfg(all(feature = "agents", not(target_arch = "wasm32")))] +pub use connection::{ + CONNECTION_FILE, Connection, PROBE_TIMEOUT, TOKEN_FILE, probe, read_connection, remove_connection, remove_stale_connection, write_connection, +}; +#[cfg(all(feature = "agents", not(target_arch = "wasm32")))] +pub use live::{ + ConnectFn, Consent, ConsentFn, HeadlessFn, HeadlessFolders, LAUNCH_POLL, LAUNCH_TIMEOUT, LaunchFn, Live, LiveConfig, Route, Window, find_window, + launcher, +}; +#[cfg(all(feature = "agents", not(target_arch = "wasm32")))] +pub use switch::{AgentSwitch, POLL, launcher_allows, mcp_flag}; diff --git a/crates/control/src/agents/settings.rs b/crates/control/src/agents/settings.rs new file mode 100644 index 000000000..04ae933aa --- /dev/null +++ b/crates/control/src/agents/settings.rs @@ -0,0 +1,124 @@ +//! The agent settings an app saves in its preferences, and who decides that agents may connect. + +use std::path::PathBuf; + +use serde::{Deserialize, Serialize}; + +/// The agent settings of an app's Preferences (its `integrations` section in PhotoCraft). Saved in +/// camelCase: `allowAgentControl`, `controlPort`, `readRoot`, `writeRoot`, `whenAppClosed`. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct AgentSettings { + /// Off refuses every control server, `--control` included. + pub allow_agent_control: bool, + /// The loopback port agents connect to; 0 is any free port, published in the connection file. + pub control_port: u32, + /// The folder agents may open from; empty is none. Applied at once while agents are connected. + pub read_root: String, + /// The folder agents may save to; empty is none. Applied at once while agents are connected. + pub write_root: String, + /// What the app's `-cli mcp` does while agents may use the app but it is closed. + pub when_app_closed: WhenAppClosed, +} + +impl Default for AgentSettings { + fn default() -> Self { + Self { + allow_agent_control: true, + control_port: 0, + read_root: String::new(), + write_root: String::new(), + when_app_closed: WhenAppClosed::Launch, + } + } +} + +impl AgentSettings { + /// [`Self::read_root`] as a path ([`folder`]). + pub fn read_folder(&self) -> Option { + folder(&self.read_root) + } + + /// [`Self::write_root`] as a path ([`folder`]). + pub fn write_folder(&self) -> Option { + folder(&self.write_root) + } +} + +/// A folder setting as a path, trimmed; empty or blank is `None`. +pub fn folder(pref: &str) -> Option { + let pref = pref.trim(); + (!pref.is_empty()).then(|| PathBuf::from(pref)) +} + +/// What an app's `-cli mcp` does when an agent calls a tool while the app is closed. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum WhenAppClosed { + /// Open the app and wait for it. + #[default] + Launch, + /// Run the tool without a window. + Headless, + /// Answer with an error that asks to open the app. + Error, +} + +impl WhenAppClosed { + /// The saved names, in [`Self::ALL`] order. + pub const NAMES: &'static [&'static str] = &["launch", "headless", "error"]; + /// Every choice, in the order a menu lists them. + pub const ALL: [Self; 3] = [Self::Launch, Self::Headless, Self::Error]; + + /// The saved name. + pub fn name(self) -> &'static str { + match self { + Self::Launch => "launch", + Self::Headless => "headless", + Self::Error => "error", + } + } + + /// The choice a saved name means; `None` for any other text. + pub fn parse(name: &str) -> Option { + Self::ALL.into_iter().find(|c| c.name() == name) + } +} + +/// Whether agents may use the open window. With the suite's `AI-MCP` flag only the launcher's +/// switch decides: one switch for every Craft app, none in the app. Without the flag the app's own +/// earlier consent decides (`legacy`; PhotoCraft's is a Control Port saved before the switch). +/// Allow Agent Control off still refuses agents either way ([`AgentSettings::allow_agent_control`]). +pub fn agents_allowed(mcp_flag: bool, launcher: bool, legacy: bool) -> bool { + if mcp_flag { launcher } else { legacy } +} + +#[cfg(test)] +mod tests { + #![allow(clippy::unwrap_used)] + use super::*; + + // The saved names read back as the same choice, and nothing else reads as one. + #[test] + fn when_app_closed_names_round_trip() { + for choice in WhenAppClosed::ALL { + assert_eq!(WhenAppClosed::parse(choice.name()), Some(choice)); + assert_eq!(serde_json::to_value(choice).unwrap(), serde_json::json!(choice.name())); + } + assert_eq!(WhenAppClosed::NAMES, WhenAppClosed::ALL.map(WhenAppClosed::name)); + assert_eq!(WhenAppClosed::parse("Launch"), None); + let settings: AgentSettings = serde_json::from_str(r#"{"whenAppClosed": "headless", "controlPort": 7878}"#).unwrap(); + assert_eq!((settings.when_app_closed, settings.control_port, settings.allow_agent_control), (WhenAppClosed::Headless, 7878, true)); + } + + // A folder setting is trimmed; empty or blank means no folder. + #[test] + fn folder_preferences_are_trimmed() { + assert_eq!(folder(""), None); + assert_eq!(folder(" "), None); + assert_eq!(folder(" /work/project "), Some(PathBuf::from("/work/project"))); + let settings = AgentSettings { read_root: " /in ".into(), ..AgentSettings::default() }; + assert_eq!((settings.read_folder(), settings.write_folder()), (Some(PathBuf::from("/in")), None)); + } +} diff --git a/crates/control/src/agents/switch.rs b/crates/control/src/agents/switch.rs new file mode 100644 index 000000000..cf45f07a7 --- /dev/null +++ b/crates/control/src/agents/switch.rs @@ -0,0 +1,93 @@ +//! The ArtCraft Launcher's switch for one app, behind the suite's `AI-MCP` flag. + +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::{Arc, Weak}; +use std::time::Duration; + +use super::agents_allowed; + +/// How often [`AgentSwitch::watch`] reads the launcher's app list. +pub const POLL: Duration = Duration::from_secs(2); + +/// The suite's `AI-MCP` flag (`ArtCraft/flags.toml` or `CRAFT_FLAGS`). Reads the flags file; +/// what could not be read is logged. +pub fn mcp_flag() -> bool { + let flags = craft_flags::load(); + for problem in &flags.problems { + log::warn!("flags: {problem}"); + } + flags.enabled(&craft_flags::AI_MCP) +} + +/// The launcher's switch (Settings › AI agents › *Let AI agents use Craft apps*) lets agents use +/// the app `app_id`: the `AI-MCP` flag is on and the launcher's app list names the app. Reads two +/// small files; ask from a timer or a command, not every frame ([`AgentSwitch`] does that). +pub fn launcher_allows(app_id: &str) -> bool { + mcp_flag() && craft_ai_agents::allowed(app_id) +} + +/// The launcher's switch for one app, watched on a thread so a frame can ask without touching the +/// disk. The `AI-MCP` flag is read once, at [`Self::watch`]; the launcher's list every [`POLL`]. +/// Clones share one watch; the thread ends after the last clone is dropped. +#[derive(Clone, Debug)] +pub struct AgentSwitch { + mcp_flag: bool, + on: Arc, +} + +impl AgentSwitch { + /// Watches the launcher's list for `app_id`; a change logs `agents on/off` and calls `wake` (the + /// app asks for a frame there). + /// Without the `AI-MCP` flag nothing is watched: the launcher's list means nothing then. + pub fn watch(app_id: &'static str, wake: impl Fn() + Send + 'static) -> Self { + let flag = mcp_flag(); + if !flag { + return Self::fixed(false, false); + } + Self::watch_with(flag, move || craft_ai_agents::allowed(app_id), POLL, wake) + } + + /// A switch that never changes: tests, the web, an app without agents. + pub fn fixed(mcp_flag: bool, launcher: bool) -> Self { + Self { mcp_flag, on: Arc::new(AtomicBool::new(launcher)) } + } + + /// [`Self::watch`] with the flag given, `probe` asked once now and then every `poll`. + #[doc(hidden)] + pub fn watch_with(mcp_flag: bool, probe: impl Fn() -> bool + Send + 'static, poll: Duration, wake: impl Fn() + Send + 'static) -> Self { + let on = Arc::new(AtomicBool::new(probe())); + let seen: Weak = Arc::downgrade(&on); + let started = std::thread::Builder::new().name("launcher-agents".into()).spawn(move || { + loop { + std::thread::sleep(poll); + let now = probe(); + let Some(seen) = seen.upgrade() else { return }; + if seen.swap(now, Ordering::Relaxed) != now { + log::info!("ArtCraft Launcher: agents {}", if now { "on" } else { "off" }); + wake(); + } + } + }); + // Without a thread the answer stays what it was at launch. + if let Err(e) = started { + log::warn!("couldn't watch the ArtCraft Launcher's agents switch: {e}"); + } + Self { mcp_flag, on } + } + + /// The `AI-MCP` flag as it was when the watch started. + pub fn mcp_flag(&self) -> bool { + self.mcp_flag + } + + /// Whether the launcher's list named the app at the last poll. + pub fn launcher(&self) -> bool { + self.on.load(Ordering::Relaxed) + } + + /// Whether agents may use the open window ([`agents_allowed`]); `legacy` is the app's own + /// earlier consent, which counts only without the flag. + pub fn allows(&self, legacy: bool) -> bool { + agents_allowed(self.mcp_flag, self.launcher(), legacy) + } +} diff --git a/crates/control/src/lib.rs b/crates/control/src/lib.rs index 26727a97c..d2e4f3d95 100644 --- a/crates/control/src/lib.rs +++ b/crates/control/src/lib.rs @@ -2,12 +2,14 @@ //! files ([`auth`]), the loopback server that admits a connection by the token and hands each //! request to the window ([`server`]), the client that talks to it ([`client`]), the request the //! window answers ([`ControlRequest`]), the document watch subscribed connections wait on -//! ([`DocumentWatch`]), and what a request still running does when it finishes ([`Effect`]). It +//! ([`DocumentWatch`]), what a request still running does when it finishes ([`Effect`]), and AI +//! agents in the open window behind the ArtCraft Launcher's switch ([`agents`], feature `agents`). It //! needs no UI toolkit; the window's own requests over egui (`ui.screenshot`, `ui.resize`) are //! `craft-control-egui`. #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] #![forbid(unsafe_code)] +pub mod agents; pub mod auth; mod cancel; #[cfg(not(target_arch = "wasm32"))] diff --git a/crates/control/tests/agents.rs b/crates/control/tests/agents.rs new file mode 100644 index 000000000..673522a0b --- /dev/null +++ b/crates/control/tests/agents.rs @@ -0,0 +1,428 @@ +//! AI agents in the open window: the launcher's switch, the connection file, and where an app's +//! `-cli mcp` sends each tool call. +// Unwrapping, expecting and panicking on failure is fine in tests, unlike in shipped code. +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] + +use std::net::TcpListener; +use std::path::{Path, PathBuf}; +use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; +use std::sync::{Arc, Mutex}; +use std::time::{Duration, Instant}; + +use craft_control::agents::{ + AgentSettings, AgentSwitch, CONNECTION_FILE, Connection, Consent, HeadlessFolders, Live, LiveConfig, Route, TOKEN_FILE, WhenAppClosed, Window, + agents_allowed, find_window, read_connection, remove_connection, remove_stale_connection, write_connection, +}; + +fn temp_dir(tag: &str) -> tempfile::TempDir { + tempfile::Builder::new().prefix(&format!("craft-agents-{tag}-")).tempdir().expect("a temp dir") +} + +/// Waits up to five seconds for `done`. +fn wait_for(mut done: impl FnMut() -> bool) -> bool { + let started = Instant::now(); + while !done() { + if started.elapsed() > Duration::from_secs(5) { + return false; + } + std::thread::sleep(Duration::from_millis(5)); + } + true +} + +const TOKEN: &str = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"; + +/// Writes `text` as an owner-only token file, as an app's own token writer does. +fn write_token(path: &Path, text: &str) { + std::fs::write(path, text).unwrap(); + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o600)).unwrap(); + } +} + +/// An app accepting agents in `dir`: a listener on a free loopback port, its token file and its +/// connection file. Dropping the listener leaves the file behind, as a crashed app would. +fn publish(dir: &Path) -> (TcpListener, Connection) { + let listener = TcpListener::bind("127.0.0.1:0").unwrap(); + write_token(&dir.join(TOKEN_FILE), &format!("{}\n", TOKEN.to_ascii_uppercase())); + let c = Connection::new(listener.local_addr().unwrap().port(), dir.join(TOKEN_FILE), "Test 1.0"); + write_connection(dir, &c).unwrap(); + (listener, c) +} + +// ---- The launcher's switch ---------------------------------------------------------------------- + +/// With the `AI-MCP` flag only the launcher's switch decides; without it the app's earlier consent. +#[test] +fn with_the_flag_only_the_launchers_switch_lets_agents_in() { + assert!(agents_allowed(false, false, true), "without the flag, the app's earlier consent"); + assert!(!agents_allowed(false, true, false), "the launcher's list means nothing without the flag"); + assert!(agents_allowed(true, true, false)); + assert!(!agents_allowed(true, false, true), "no second switch in the app"); + assert!(AgentSwitch::fixed(true, true).allows(false)); + assert!(!AgentSwitch::fixed(false, true).allows(false)); +} + +/// The switch follows the launcher's list within a poll, wakes the app once per change rather than +/// once per poll, and its thread ends once the last clone is dropped. +#[test] +fn the_switch_wakes_once_per_change() { + let launcher = Arc::new(AtomicBool::new(false)); + let probes = Arc::new(AtomicUsize::new(0)); + let wakes = Arc::new(AtomicUsize::new(0)); + let probe = { + let (launcher, probes) = (launcher.clone(), probes.clone()); + move || { + probes.fetch_add(1, Ordering::Relaxed); + launcher.load(Ordering::Relaxed) + } + }; + let wake = { + let wakes = wakes.clone(); + move || { + wakes.fetch_add(1, Ordering::Relaxed); + } + }; + let switch = AgentSwitch::watch_with(true, probe, Duration::from_millis(5), wake); + let clone = switch.clone(); + assert!(!switch.launcher()); + + launcher.store(true, Ordering::Relaxed); + assert!(wait_for(|| clone.launcher()), "the switch follows the launcher"); + assert!(switch.allows(false)); + let polled = probes.load(Ordering::Relaxed); + assert!(wait_for(|| probes.load(Ordering::Relaxed) > polled + 10)); + launcher.store(false, Ordering::Relaxed); + assert!(wait_for(|| !switch.launcher())); + assert!(wait_for(|| wakes.load(Ordering::Relaxed) == 2)); + assert_eq!(wakes.load(Ordering::Relaxed), 2, "one wake per change, not per poll"); + + drop(switch); + drop(clone); + std::thread::sleep(Duration::from_millis(50)); + let after_drop = probes.load(Ordering::Relaxed); + std::thread::sleep(Duration::from_millis(50)); + assert_eq!(probes.load(Ordering::Relaxed), after_drop, "the watch ended with the last switch"); +} + +// ---- The connection file ------------------------------------------------------------------------ + +/// A published connection reads back in its documented shape, and only the process that wrote it +/// removes it. +#[test] +fn a_published_connection_reads_back_and_only_its_writer_removes_it() { + let dir = temp_dir("conn"); + let dir = dir.path(); + assert_eq!(read_connection(dir).unwrap(), None, "no file"); + let c = Connection::new(7878, dir.join(TOKEN_FILE), "MyApp 1.2.3"); + write_connection(dir, &c).unwrap(); + assert_eq!(read_connection(dir).unwrap(), Some(c.clone())); + assert_eq!(c.addr(), "127.0.0.1:7878"); + let v: serde_json::Value = serde_json::from_str(&std::fs::read_to_string(dir.join(CONNECTION_FILE)).unwrap()).unwrap(); + let mut keys: Vec<_> = v.as_object().unwrap().keys().cloned().collect(); + keys.sort(); + assert_eq!(keys, ["app", "pid", "port", "tokenFile", "version"]); + assert_eq!((v["version"].as_u64(), v["port"].as_u64(), v["app"].as_str()), (Some(1), Some(7878), Some("MyApp 1.2.3"))); + + remove_connection(dir, c.pid.wrapping_add(1)); + assert!(dir.join(CONNECTION_FILE).is_file(), "another process's file stays"); + remove_connection(dir, c.pid); + assert!(!dir.join(CONNECTION_FILE).exists()); +} + +/// A damaged, foreign or port-0 file reads as none; a directory in its place is an error and is +/// left alone; a file nobody listens on is removed as stale and a live one kept. +#[test] +fn a_damaged_foreign_or_stale_connection_file_counts_as_none() { + let dir = temp_dir("bad-conn"); + let dir = dir.path(); + for text in [ + &b""[..], + b"{not json", + b"[]", + br#"{"version":2,"pid":1,"port":7878,"tokenFile":"t","app":"x"}"#, + br#"{"version":1,"pid":1,"port":0,"tokenFile":"t","app":"x"}"#, + b"\xff\xfe not utf-8", + ] { + std::fs::write(dir.join(CONNECTION_FILE), text).unwrap(); + assert_eq!(read_connection(dir).unwrap(), None, "{}", String::from_utf8_lossy(text)); + remove_stale_connection(dir); + assert!(!dir.join(CONNECTION_FILE).exists(), "an unreadable file is not a connection"); + } + + std::fs::create_dir(dir.join(CONNECTION_FILE)).unwrap(); + assert!(read_connection(dir).is_err()); + remove_stale_connection(dir); + assert!(dir.join(CONNECTION_FILE).is_dir(), "anything but a regular file is left alone"); + std::fs::remove_dir(dir.join(CONNECTION_FILE)).unwrap(); + + let live = TcpListener::bind("127.0.0.1:0").unwrap(); + let live_port = live.local_addr().unwrap().port(); + write_connection(dir, &Connection { pid: 1, ..Connection::new(live_port, dir.join(TOKEN_FILE), "x") }).unwrap(); + remove_stale_connection(dir); + assert!(dir.join(CONNECTION_FILE).is_file(), "something listens on {live_port}"); + drop(live); + let closed = TcpListener::bind("127.0.0.1:0").unwrap().local_addr().unwrap().port(); + write_connection(dir, &Connection { pid: 1, ..Connection::new(closed, dir.join(TOKEN_FILE), "x") }).unwrap(); + remove_stale_connection(dir); + assert!(!dir.join(CONNECTION_FILE).exists(), "nothing listens on {closed}"); +} + +// ---- The CLI's side ----------------------------------------------------------------------------- + +/// What the stand-in app made: a window client (its window) or a headless session (its folders), +/// with counts of each. +#[derive(Default)] +struct Made { + connects: AtomicUsize, + sessions: AtomicUsize, +} + +type TestLive = Live; + +fn config(dir: &Path, consent: Consent, made: &Arc) -> LiveConfig { + let (a, b) = (made.clone(), made.clone()); + let mut cfg = LiveConfig::new( + "Test", + dir.to_path_buf(), + move |_: &Path| consent.clone(), + move |w: &Window| { + a.connects.fetch_add(1, Ordering::Relaxed); + Ok(w.clone()) + }, + move |f: &HeadlessFolders| { + b.sessions.fetch_add(1, Ordering::Relaxed); + Ok(f.clone()) + }, + ); + cfg.poll = Duration::from_millis(5); + cfg +} + +fn settings(when: WhenAppClosed, read: &str, write: &str) -> AgentSettings { + let mut s = AgentSettings::default(); + s.when_app_closed = when; + s.read_root = read.into(); + s.write_root = write.into(); + s +} + +fn allowed(when: WhenAppClosed) -> Consent { + Consent::new(true, settings(when, "/app-in", "/app-out")) +} + +fn headless_folders(route: Result, String>) -> HeadlessFolders { + match route { + Ok(Route::Headless(f)) => f, + Ok(Route::Window(w)) => panic!("expected headless, got the window {w:?}"), + Err(e) => panic!("expected headless, got the error {e}"), + } +} + +fn window(route: Result, String>) -> Window { + match route { + Ok(Route::Window(w)) => w, + Ok(Route::Headless(f)) => panic!("expected the window, went headless with {f:?}"), + Err(e) => panic!("expected the window, got the error {e}"), + } +} + +fn paths(p: &[&str]) -> Vec { + p.iter().map(PathBuf::from).collect() +} + +/// An app accepting agents takes the call; the same port, token and process keep the client, a +/// restarted app (another process on the same port and token) gets a new one. +#[test] +fn an_open_app_takes_the_call_and_keeps_its_client_until_it_restarts() { + let dir = temp_dir("window"); + let (_listener, c) = publish(dir.path()); + let made = Arc::new(Made::default()); + // Even without consent: an app publishes its connection only while it accepts agents. + let live = TestLive::new(config(dir.path(), Consent::default(), &made)); + let w = window(live.resolve()); + assert_eq!((w.port, w.pid, w.token.as_str(), w.addr()), (c.port, c.pid, TOKEN, c.addr()), "the token is trimmed and lower-cased"); + window(live.resolve()); + assert_eq!(made.connects.load(Ordering::Relaxed), 1, "the same window keeps its client"); + assert!(matches!(live.current(), Some(Route::Window(_)))); + + write_connection(dir.path(), &Connection { pid: c.pid.wrapping_add(1), ..c.clone() }).unwrap(); + assert_eq!(window(live.resolve()).pid, c.pid.wrapping_add(1)); + assert_eq!(made.connects.load(Ordering::Relaxed), 2, "a restarted app gets a new client"); + assert_eq!(made.sessions.load(Ordering::Relaxed), 0); +} + +/// No app accepts agents and the person doesn't let them use it: headless with only the command's +/// folders, never the app's. +#[test] +fn without_consent_a_closed_app_runs_headless_with_the_commands_folders_only() { + let dir = temp_dir("no-consent"); + let made = Arc::new(Made::default()); + let consent = Consent::new(false, settings(WhenAppClosed::Launch, "/app-in", "/app-out")); + let live = TestLive::new(config(dir.path(), consent.clone(), &made)); + assert_eq!(headless_folders(live.resolve()), HeadlessFolders::default(), "no folders given, none used"); + + let mut cfg = config(dir.path(), consent, &made); + cfg.read_roots = paths(&["/cli-in"]); + cfg.write_root = Some(PathBuf::from("/cli-out")); + let f = headless_folders(TestLive::new(cfg).resolve()); + assert_eq!((f.read, f.write), (paths(&["/cli-in"]), Some(PathBuf::from("/cli-out")))); +} + +/// Agents allowed, app closed, "headless": the app's agent folders, each replaced by the command's. +#[test] +fn allowed_and_closed_runs_headless_with_the_apps_folders_unless_the_command_gives_its_own() { + let dir = temp_dir("headless"); + let made = Arc::new(Made::default()); + let f = headless_folders(TestLive::new(config(dir.path(), allowed(WhenAppClosed::Headless), &made)).resolve()); + assert_eq!((f.read, f.write), (paths(&["/app-in"]), Some(PathBuf::from("/app-out")))); + + let mut cfg = config(dir.path(), allowed(WhenAppClosed::Headless), &made); + cfg.read_roots = paths(&["/cli-a", "/cli-b"]); + let f = headless_folders(TestLive::new(cfg).resolve()); + assert_eq!((f.read, f.write), (paths(&["/cli-a", "/cli-b"]), Some(PathBuf::from("/app-out")))); + + let mut cfg = config(dir.path(), allowed(WhenAppClosed::Headless), &made); + cfg.write_root = Some(PathBuf::from("/cli-out")); + let f = headless_folders(TestLive::new(cfg).resolve()); + assert_eq!((f.read, f.write), (paths(&["/app-in"]), Some(PathBuf::from("/cli-out")))); +} + +/// Agents allowed, app closed, "error": the call fails with words that name the app; the command's +/// choice wins over the app's. +#[test] +fn the_closed_app_choice_decides_and_the_command_overrides_it() { + let dir = temp_dir("error"); + let made = Arc::new(Made::default()); + let err = TestLive::new(config(dir.path(), allowed(WhenAppClosed::Error), &made)).resolve().err().unwrap(); + assert_eq!(err, "Test isn't running: open it, then try again."); + + let mut cfg = config(dir.path(), allowed(WhenAppClosed::Error), &made); + cfg.when_closed = Some(WhenAppClosed::Headless); + headless_folders(TestLive::new(cfg).resolve()); + let mut cfg = config(dir.path(), allowed(WhenAppClosed::Headless), &made); + cfg.when_closed = Some(WhenAppClosed::Error); + assert!(TestLive::new(cfg).resolve().is_err()); +} + +/// Once headless, the session stays headless even when the app starts, so documents don't move +/// under the agent. +#[test] +fn a_headless_session_stays_headless() { + let dir = temp_dir("sticky"); + let made = Arc::new(Made::default()); + let live = TestLive::new(config(dir.path(), Consent::default(), &made)); + headless_folders(live.resolve()); + let _app = publish(dir.path()); + headless_folders(live.resolve()); + assert_eq!((made.sessions.load(Ordering::Relaxed), made.connects.load(Ordering::Relaxed)), (1, 0), "one session, no window"); +} + +/// A connection file left by an app that crashed counts as a closed app. +#[test] +fn a_crashed_apps_connection_file_counts_as_closed() { + let dir = temp_dir("crashed"); + drop(publish(dir.path()).0); + let made = Arc::new(Made::default()); + headless_folders(TestLive::new(config(dir.path(), Consent::default(), &made)).resolve()); + assert_eq!(find_window(dir.path(), "Test").unwrap(), None); +} + +/// A token file that isn't a token, is too big or is missing fails the call and names the app; +/// nothing is sent to the window. +#[test] +fn a_bad_token_file_fails_the_call() { + let dir = temp_dir("token"); + let (_listener, _c) = publish(dir.path()); + let made = Arc::new(Made::default()); + for bad in ["", " \n", "not a token", &"a".repeat(5000)] { + write_token(&dir.path().join(TOKEN_FILE), bad); + let err = TestLive::new(config(dir.path(), Consent::default(), &made)).resolve().err().unwrap(); + assert!(err.starts_with("Test's agent token: "), "{err}"); + } + std::fs::remove_file(dir.path().join(TOKEN_FILE)).unwrap(); + assert!(find_window(dir.path(), "Test").is_err()); + assert_eq!(made.connects.load(Ordering::Relaxed), 0); +} + +/// The app's own errors reach the agent with what was being done. +#[test] +fn the_apps_errors_reach_the_agent() { + let dir = temp_dir("app-errors"); + let consent = Consent::default(); + let cfg: LiveConfig = LiveConfig::new( + "Test", + dir.path().to_path_buf(), + move |_: &Path| consent.clone(), + |w: &Window| Ok(w.clone()), + |_: &HeadlessFolders| Err("no such folder".into()), + ); + assert_eq!(TestLive::new(cfg).resolve().err().unwrap(), "the automation roots can't be used: no such folder"); + + let (_listener, _c) = publish(dir.path()); + let cfg: LiveConfig = LiveConfig::new( + "Test", + dir.path().to_path_buf(), + |_: &Path| Consent::default(), + |_: &Window| Err("refused".into()), + |f: &HeadlessFolders| Ok(f.clone()), + ); + let live = TestLive::new(cfg); + assert_eq!(live.resolve().err().unwrap(), "refused"); + assert!(live.current().is_none(), "a failed connect leaves no route"); +} + +/// "Launch" without a way to start the app, a start that fails, and an app that never accepts +/// agents each end with words that say what to do. +#[test] +fn a_launch_that_cannot_happen_or_never_finishes_says_what_to_do() { + let dir = temp_dir("launch-fails"); + let made = Arc::new(Made::default()); + let err = TestLive::new(config(dir.path(), allowed(WhenAppClosed::Launch), &made)).resolve().err().unwrap(); + assert_eq!(err, "Test isn't running, and this install can't start it from here: open Test, then try again."); + + let mut cfg = config(dir.path(), allowed(WhenAppClosed::Launch), &made); + cfg.launch = Some(Box::new(|| Err("boom".into()))); + assert_eq!(TestLive::new(cfg).resolve().err().unwrap(), "couldn't start Test: boom"); + + let mut cfg = config(dir.path(), allowed(WhenAppClosed::Launch), &made); + cfg.launch = Some(Box::new(|| Ok(()))); + cfg.launch_timeout = Duration::from_millis(40); + let err = TestLive::new(cfg).resolve().err().unwrap(); + assert!(err.starts_with("Test didn't accept agents within 0 s of starting."), "{err}"); +} + +/// "Launch" starts the app once, also for calls that arrive together, and the calls go to its +/// window once it accepts agents. +#[test] +fn a_started_app_takes_the_call_and_concurrent_calls_start_it_once() { + let dir = temp_dir("launch"); + let made = Arc::new(Made::default()); + let launches = Arc::new(AtomicUsize::new(0)); + let app: Arc>> = Arc::new(Mutex::new(None)); + let mut cfg = config(dir.path(), allowed(WhenAppClosed::Launch), &made); + let (d, n, slot) = (dir.path().to_path_buf(), launches.clone(), app.clone()); + cfg.launch = Some(Box::new(move || { + n.fetch_add(1, Ordering::Relaxed); + let (d, slot) = (d.clone(), slot.clone()); + // The app takes a moment before it accepts agents. + std::thread::spawn(move || { + std::thread::sleep(Duration::from_millis(60)); + *slot.lock().unwrap() = Some(publish(&d).0); + }); + Ok(()) + })); + let live = Arc::new(TestLive::new(cfg)); + let calls: Vec<_> = (0..4) + .map(|_| { + let live = live.clone(); + std::thread::spawn(move || window(live.resolve())) + }) + .collect(); + let ports: Vec = calls.into_iter().map(|c| c.join().unwrap().port).collect(); + assert_eq!(launches.load(Ordering::Relaxed), 1, "one start for every call"); + assert!(ports.windows(2).all(|p| p[0] == p[1]), "{ports:?}"); + assert_eq!(made.connects.load(Ordering::Relaxed), 1); +} From aa0f72303cd64548a8a2080f4e1437fd0f8054bd Mon Sep 17 00:00:00 2001 From: David Mann Date: Wed, 18 Nov 2026 02:53:47 +0100 Subject: [PATCH 128/183] craft-control agents: review fixes (#2141) - Calls queued behind a start that failed get its error instead of starting the app again; a later call retries. - The started process is reaped on a thread of its own. - APPIMAGE counts only when the CLI runs from that image's mount. - The guide names allow_agent_control as part of the listen condition. - A watcher thread that can't start leaves agents off. - The watcher test waits for the thread to end instead of a fixed sleep. --- crates/control/src/agents/live.rs | 106 ++++++++++++++++++++++------ crates/control/src/agents/mod.rs | 11 +-- crates/control/src/agents/switch.rs | 5 +- crates/control/tests/agents.rs | 45 ++++++++++-- 4 files changed, 133 insertions(+), 34 deletions(-) diff --git a/crates/control/src/agents/live.rs b/crates/control/src/agents/live.rs index d328c678f..a151a137b 100644 --- a/crates/control/src/agents/live.rs +++ b/crates/control/src/agents/live.rs @@ -16,7 +16,9 @@ //! folders win), or an error that says what to do. //! //! Once headless, the session stays headless: documents don't move under the agent. Lookups are -//! serialised, so concurrent calls start the app once. +//! serialised, so concurrent calls start the app once: calls that queued while a start was under +//! way and found no window get that start's error rather than starting the app again; a call made +//! after it tries again. //! //! The crate has no async runtime: `resolve` blocks (file reads, a loopback probe, and while an //! app starts, polling), so an async MCP server calls it from its blocking pool. What a window @@ -27,6 +29,7 @@ use std::ffi::{OsStr, OsString}; use std::fmt; use std::path::{Path, PathBuf}; +use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::{Mutex, PoisonError}; use std::time::{Duration, Instant}; @@ -171,15 +174,17 @@ type Current = Option<(Route, Option)>; /// Resolves each tool call of one MCP session; see the module docs. pub struct Live { cfg: LiveConfig, - /// Serialises lookups, so concurrent calls start the app once. - lookup: Mutex<()>, + /// Serialises lookups, so concurrent calls start the app once; holds the last start's error. + lookup: Mutex>, + /// How many starts have finished, read before a call queues for `lookup`. + finished: AtomicU64, current: Mutex>, } impl Live { /// A session that has not resolved anything yet. pub fn new(cfg: LiveConfig) -> Self { - Self { cfg, lookup: Mutex::new(()), current: Mutex::new(None) } + Self { cfg, lookup: Mutex::new(None), finished: AtomicU64::new(0), current: Mutex::new(None) } } /// The route the last [`Self::resolve`] chose, if any. @@ -195,7 +200,8 @@ impl Live { /// Where the next tool call goes. Blocks; see the module docs. The error is the tool call's /// result. pub fn resolve(&self) -> Result, String> { - let _one_at_a_time = self.lookup.lock().unwrap_or_else(PoisonError::into_inner); + let queued_at = self.finished.load(Ordering::Acquire); + let mut last_failure = self.lookup.lock().unwrap_or_else(PoisonError::into_inner); if let Some(route @ Route::Headless(_)) = self.current() { return Ok(route); } @@ -216,7 +222,19 @@ impl Live { let write = self.cfg.write_root.clone().or_else(|| consent.settings.write_folder()); self.headless(&HeadlessFolders { read, write }, &format!("{app} isn't running and its agent folders can't be used")) } - WhenAppClosed::Launch => self.launch_and_wait(), + WhenAppClosed::Launch => { + // A start finished while this call waited and the app still isn't there: its answer + // is this call's too, rather than a second start of an app that may be opening. + if self.finished.load(Ordering::Acquire) != queued_at + && let Some(failure) = last_failure.as_ref() + { + return Err(failure.clone()); + } + let started = self.launch_and_wait(); + *last_failure = started.as_ref().err().cloned(); + self.finished.fetch_add(1, Ordering::AcqRel); + started + } } } @@ -318,8 +336,14 @@ fn read_token(path: &Path) -> Result { pub fn launcher(cli: &Path, exe: &str) -> Option { use std::process::{Command, Stdio}; let env = |name: &str| std::env::var_os(name).filter(|v| !v.is_empty()); - let (program, args) = - launch_command(cli, exe, Platform::current(), env("FLATPAK_ID").is_some(), env("APPIMAGE"), env("SystemRoot"), &|p| p.is_file())?; + let install = Install { + platform: Platform::current(), + flatpak: env("FLATPAK_ID").is_some(), + appimage: env("APPIMAGE"), + appdir: env("APPDIR"), + system_root: env("SystemRoot"), + }; + let (program, args) = launch_command(cli, exe, &install, &|p| p.is_file())?; let mut command = Command::new(program); command.args(args); let command = Mutex::new(command); @@ -327,15 +351,42 @@ pub fn launcher(cli: &Path, exe: &str) -> Option { let mut c = command.lock().unwrap_or_else(PoisonError::into_inner); c.stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::null()); detach(&mut c); - c.spawn().map(|_| ()).map_err(|e| e.to_string()) + let child = c.spawn().map_err(|e| e.to_string())?; + reap(child); + Ok(()) })) } +/// Waits for `child` on a thread of its own, so a start helper that exits (`open`, Explorer) or an +/// app that quits before the CLI does is reaped rather than left a zombie until the MCP client +/// ends; the app keeps running on its own either way. Without a thread the child is dropped, as +/// before. +fn reap(mut child: std::process::Child) { + let _ = std::thread::Builder::new().name("app-start-reaper".into()).spawn(move || { + let _ = child.wait(); + }); +} + +/// What [`launch_command`] needs to know about the install, from the environment. +#[derive(Clone, Debug, Default)] +struct Install { + platform: Platform, + /// Inside a Flatpak (`FLATPAK_ID`). + flatpak: bool, + /// The AppImage the running image set (`APPIMAGE`). + appimage: Option, + /// That image's mount point (`APPDIR`). + appdir: Option, + /// `%SystemRoot%` (Windows). + system_root: Option, +} + /// The platform [`launch_command`] plans for. -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] enum Platform { Windows, MacOs, + #[default] Other, } @@ -352,19 +403,16 @@ impl Platform { } /// The program and arguments that start the app; see [`launcher`]. -fn launch_command( - cli: &Path, - exe: &str, - platform: Platform, - flatpak: bool, - appimage: Option, - system_root: Option, - is_file: &dyn Fn(&Path) -> bool, -) -> Option<(PathBuf, Vec)> { - if flatpak { +fn launch_command(cli: &Path, exe: &str, install: &Install, is_file: &dyn Fn(&Path) -> bool) -> Option<(PathBuf, Vec)> { + let platform = install.platform; + if install.flatpak { return None; } - if let Some(image) = appimage { + // Only when this CLI runs from that image's mount: a process started from another AppImage + // (an MCP client packaged as one) inherits its `APPIMAGE` too. + if let (Some(image), Some(mount)) = (&install.appimage, &install.appdir) + && cli.starts_with(mount) + { // The AppImage's mount point goes away with the CLI; the image itself stays. return Some((PathBuf::from(image), Vec::new())); } @@ -380,7 +428,7 @@ fn launch_command( if !is_file(&app) { return None; } - Some(if platform == Platform::Windows { windows_launch(&app, system_root.as_deref()) } else { (app, Vec::new()) }) + Some(if platform == Platform::Windows { windows_launch(&app, install.system_root.as_deref()) } else { (app, Vec::new()) }) } /// How Windows starts the app at `app`: through Explorer, as a double-click would. The app is then @@ -429,7 +477,10 @@ mod tests { root: Option<&str>, exists: bool, ) -> Option<(PathBuf, Vec)> { - launch_command(Path::new(cli), "photocraft", platform, flatpak, appimage.map(OsString::from), root.map(OsString::from), &|_| exists) + // An AppImage's mount is where its CLI runs from. + let appdir = appimage.map(|_| OsString::from("/tmp/.mount")); + let install = Install { platform, flatpak, appimage: appimage.map(OsString::from), appdir, system_root: root.map(OsString::from) }; + launch_command(Path::new(cli), "photocraft", &install, &|_| exists) } #[test] @@ -456,6 +507,15 @@ mod tests { plan("/tmp/.mount/usr/bin/photocraft-cli", Platform::Other, false, Some("/home/a/P.AppImage"), None, false), Some((PathBuf::from("/home/a/P.AppImage"), Vec::new())) ); + // Another AppImage's variables (an MCP client packaged as one): the app beside the CLI. + let client = plan("/opt/pc/photocraft-cli", Platform::Other, false, Some("/home/a/Client.AppImage"), None, true); + assert_eq!(client, Some((PathBuf::from("/opt/pc/photocraft"), Vec::new()))); + let no_mount = Install { appimage: Some("/home/a/P.AppImage".into()), ..Install::default() }; + assert_eq!( + launch_command(Path::new("/tmp/.mount/usr/bin/photocraft-cli"), "photocraft", &no_mount, &|_| false), + None, + "APPIMAGE without APPDIR" + ); // A macOS bundle opens through LaunchServices. let (program, args) = plan("/Applications/PhotoCraft.app/Contents/MacOS/photocraft-cli", Platform::MacOs, false, None, None, false).unwrap(); assert_eq!(program, Path::new("/usr/bin/open")); diff --git a/crates/control/src/agents/mod.rs b/crates/control/src/agents/mod.rs index 77d45d25d..8deaa34bd 100644 --- a/crates/control/src/agents/mod.rs +++ b/crates/control/src/agents/mod.rs @@ -32,10 +32,13 @@ //! //! 1. At start, [`remove_stale_connection`] in its settings folder, then //! `AgentSwitch::watch("gridcraft", wake)`, where `wake` asks the UI for a frame. -//! 2. On each change of [`AgentSwitch::allows`]: when it allows, listen on loopback with a token, -//! the token in an owner-only file ([`crate::auth::App::write_token_file`]), and -//! [`write_connection`] with [`Connection::new`]; when it stops allowing, stop listening and -//! [`remove_connection`] with the app's process id. No restart, no agents switch of its own. +//! 2. Agents may connect while `settings.allow_agent_control && switch.allows(legacy)` +//! ([`AgentSettings::allow_agent_control`], [`AgentSwitch::allows`]); check it again when the +//! launcher's switch wakes the app and when the person changes the setting. When it turns true, +//! listen on loopback with a token, the token in an owner-only file +//! ([`crate::auth::App::write_token_file`]), and [`write_connection`] with [`Connection::new`]; +//! when it turns false, stop listening and [`remove_connection`] with the app's process id. No +//! restart, no agents switch of its own. //! //! Its `gridcraft-cli mcp`: //! diff --git a/crates/control/src/agents/switch.rs b/crates/control/src/agents/switch.rs index cf45f07a7..9165879dc 100644 --- a/crates/control/src/agents/switch.rs +++ b/crates/control/src/agents/switch.rs @@ -68,9 +68,10 @@ impl AgentSwitch { } } }); - // Without a thread the answer stays what it was at launch. + // Without a thread a later "off" in the launcher would never be seen: agents stay out. if let Err(e) = started { - log::warn!("couldn't watch the ArtCraft Launcher's agents switch: {e}"); + log::warn!("couldn't watch the ArtCraft Launcher's agents switch, so agents stay off: {e}"); + on.store(false, Ordering::Relaxed); } Self { mcp_flag, on } } diff --git a/crates/control/tests/agents.rs b/crates/control/tests/agents.rs index 673522a0b..c5e39251a 100644 --- a/crates/control/tests/agents.rs +++ b/crates/control/tests/agents.rs @@ -72,9 +72,12 @@ fn the_switch_wakes_once_per_change() { let launcher = Arc::new(AtomicBool::new(false)); let probes = Arc::new(AtomicUsize::new(0)); let wakes = Arc::new(AtomicUsize::new(0)); + // Held by the watch thread through its probe: gone once the thread has ended. + let alive = Arc::new(()); let probe = { - let (launcher, probes) = (launcher.clone(), probes.clone()); + let (launcher, probes, alive) = (launcher.clone(), probes.clone(), alive.clone()); move || { + let _ = &alive; probes.fetch_add(1, Ordering::Relaxed); launcher.load(Ordering::Relaxed) } @@ -101,10 +104,10 @@ fn the_switch_wakes_once_per_change() { drop(switch); drop(clone); - std::thread::sleep(Duration::from_millis(50)); - let after_drop = probes.load(Ordering::Relaxed); - std::thread::sleep(Duration::from_millis(50)); - assert_eq!(probes.load(Ordering::Relaxed), after_drop, "the watch ended with the last switch"); + assert!(wait_for(|| Arc::strong_count(&alive) == 1), "the watch ended with the last switch"); + let after_end = probes.load(Ordering::Relaxed); + std::thread::sleep(Duration::from_millis(20)); + assert_eq!(probes.load(Ordering::Relaxed), after_end, "nothing probes after the watch ended"); } // ---- The connection file ------------------------------------------------------------------------ @@ -426,3 +429,35 @@ fn a_started_app_takes_the_call_and_concurrent_calls_start_it_once() { assert!(ports.windows(2).all(|p| p[0] == p[1]), "{ports:?}"); assert_eq!(made.connects.load(Ordering::Relaxed), 1); } + +/// Calls that queued while a start was under way get its error when the app still isn't there, +/// rather than starting it again; a call made afterwards tries again. +#[test] +fn calls_queued_behind_a_failed_start_share_its_error() { + let dir = temp_dir("launch-shared"); + let made = Arc::new(Made::default()); + let launches = Arc::new(AtomicUsize::new(0)); + let mut cfg = config(dir.path(), allowed(WhenAppClosed::Launch), &made); + let n = launches.clone(); + // The app is started but never accepts agents within the timeout. + cfg.launch = Some(Box::new(move || { + n.fetch_add(1, Ordering::Relaxed); + Ok(()) + })); + cfg.launch_timeout = Duration::from_millis(150); + let live = Arc::new(TestLive::new(cfg)); + let calls: Vec<_> = (0..4) + .map(|_| { + let live = live.clone(); + std::thread::spawn(move || live.resolve()) + }) + .collect(); + let answers: Vec<_> = calls.into_iter().map(|c| c.join().unwrap()).collect(); + assert_eq!(launches.load(Ordering::Relaxed), 1, "one start for the calls that came together"); + for answer in &answers { + let err = answer.as_ref().err().unwrap(); + assert!(err.starts_with("Test didn't accept agents within"), "{err}"); + } + assert!(live.resolve().is_err()); + assert_eq!(launches.load(Ordering::Relaxed), 2, "a later call starts the app again"); +} From be5c6accc1f3d5d60a626cd3ab5d9e1012dcfe8d Mon Sep 17 00:00:00 2001 From: William Dunn Date: Sat, 7 Nov 2026 08:22:02 -0500 Subject: [PATCH 129/183] craft-esign: add the e-sign contract and craft-ui's esign feature This carries over crates/esign and craft-ui's esign dialog from the cut-down #160 branch, with minimal workspace wiring. The esign dialog speaks only craft_cloud::Contact and craft_esign types. This also brings crates/cloud along as a dependency until PR #160 lands on main. --- Cargo.toml | 2 + crates/esign/Cargo.toml | 19 ++ crates/esign/src/error.rs | 63 ++++ crates/esign/src/lib.rs | 195 +++++++++++ crates/esign/src/types.rs | 172 ++++++++++ crates/ui/Cargo.toml | 8 +- crates/ui/src/esign/backend.rs | 92 +++++ crates/ui/src/esign/mod.rs | 607 +++++++++++++++++++++++++++++++++ crates/ui/src/lib.rs | 2 + 9 files changed, 1158 insertions(+), 2 deletions(-) create mode 100644 crates/esign/Cargo.toml create mode 100644 crates/esign/src/error.rs create mode 100644 crates/esign/src/lib.rs create mode 100644 crates/esign/src/types.rs create mode 100644 crates/ui/src/esign/backend.rs create mode 100644 crates/ui/src/esign/mod.rs diff --git a/Cargo.toml b/Cargo.toml index 319e0c1e8..f79734650 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,6 +62,7 @@ craft-atomic = { path = "crates/atomic" } craft-xtask = { path = "crates/xtask" } craft-captions = { path = "crates/captions" } craft-cfb = { path = "crates/cfb" } +craft-cloud = { path = "crates/cloud" } craft-codepage = { path = "crates/codepage" } craft-cms = { path = "crates/cms" } craft-cloud = { path = "crates/cloud" } @@ -95,6 +96,7 @@ craft-dpx = { path = "crates/dpx" } craft-dwg = { path = "crates/dwg" } craft-fcproj-format = { path = "crates/fcproj-format" } craft-ecproj-format = { path = "crates/ecproj-format" } +craft-esign = { path = "crates/esign" } craft-figma-rest = { path = "crates/figma-rest" } craft-exr = { path = "crates/exr" } craft-flags = { path = "crates/flags" } diff --git a/crates/esign/Cargo.toml b/crates/esign/Cargo.toml new file mode 100644 index 000000000..7a2efc324 --- /dev/null +++ b/crates/esign/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "craft-esign" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true +description = "What an e-sign service offers the Craft apps: envelopes, recipients and events as contracts, with no vendor and no IO" + +[lints] +workspace = true + +[dependencies] +craft-cloud = { workspace = true } +serde = { workspace = true } +thiserror = { workspace = true } + +[dev-dependencies] +serde_json = { workspace = true } diff --git a/crates/esign/src/error.rs b/crates/esign/src/error.rs new file mode 100644 index 000000000..fca354b45 --- /dev/null +++ b/crates/esign/src/error.rs @@ -0,0 +1,63 @@ +//! One error type for every e-sign contract. +//! +//! Cloud failures are wrapped so a host can surface sign-in and reachability +//! the same way it already does for files. The e-sign-only cases are the ones +//! a UI acts on differently: declined, voided, expired, identity check. + +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum Error { + /// Something the cloud contracts already classify. + #[error(transparent)] + Cloud(#[from] craft_cloud::Error), + + /// A recipient refused to sign. + #[error("declined: {0}")] + Declined(String), + + /// The sender voided the envelope. + #[error("voided: {0}")] + Voided(String), + + /// The envelope passed its deadline without completing. + #[error("expired: {0}")] + Expired(String), + + /// The provider rejected the signer's identity check. + #[error("identity check failed: {0}")] + IdentityCheck(String), + + /// The chosen provider refuses this request under its policy. + #[error("provider policy: {0}")] + ProviderPolicy(String), + + /// The service does not offer this at all. + #[error("this signing service does not support {0}")] + Unsupported(&'static str), + + /// The answer did not match the protocol. + #[error("malformed {what}: {detail}")] + Malformed { what: &'static str, detail: String }, + + /// A field the caller supplied could not be used safely. + #[error("invalid {what}: {detail}")] + Invalid { what: &'static str, detail: String }, +} + +impl Error { + pub fn malformed(what: &'static str, detail: impl Into) -> Error { + Error::Malformed { what, detail: detail.into() } + } + + pub fn invalid(what: &'static str, detail: impl Into) -> Error { + Error::Invalid { what, detail: detail.into() } + } + + /// Whether trying again could succeed without the user doing anything. + pub fn is_transient(&self) -> bool { + matches!(self, Error::Cloud(e) if e.is_transient()) + } +} + +pub type Result = std::result::Result; diff --git a/crates/esign/src/lib.rs b/crates/esign/src/lib.rs new file mode 100644 index 000000000..4efb15116 --- /dev/null +++ b/crates/esign/src/lib.rs @@ -0,0 +1,195 @@ +//! What an e-sign service has to offer the Craft apps, and nothing about who +//! provides it. +//! +//! An envelope is a ceremony: a document snapshot, a set of recipients, field +//! placements, and a status. The legal audit trail, identity checks and +//! invitation mail belong to the signing service. This crate only names the +//! contracts an app needs to create, send, watch and finish that ceremony. +//! +//! Nothing in this crate opens a socket. Each trait is implemented by a host +//! (CollabCraft, a desktop adapter, a test double) that brings its own +//! transport. No type here names a vendor. No type here knows about PDF +//! structure: a document is opaque bytes plus a content hash. +//! +//! This crate sits beside `craft-cloud`. It reuses [`craft_cloud::Identity`] +//! and the idea of a contact for autocomplete, but it does not extend +//! [`craft_cloud::Provider`] or [`craft_cloud::Capability`]. Signing is not +//! file access, and a signer role is not a share permission. + +#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] + +mod error; +mod types; + +pub use error::{Error, Result}; +pub use types::{ + CompletedDocument, Envelope, EnvelopeDraft, EnvelopeEvent, EnvelopeStatus, EsignCapability, FieldPlacement, Recipient, RecipientStatus, +}; + +/// Creating and driving envelopes. +/// +/// Methods that a minimal service may omit are defaulted to +/// [`Error::Unsupported`], the same pattern [`craft_cloud::Conversations`] +/// uses for optional cloud features. +pub trait Envelopes { + /// Create a draft from a document snapshot. + /// + /// `document` is the exact byte sequence the ceremony seals. The + /// implementation hashes it and stores `content_sha256` on the envelope. + /// `idempotency_key` makes a retried create return the same envelope. + fn create(&self, draft: &EnvelopeDraft, document: &[u8], idempotency_key: &str) -> Result; + + /// Send invitations and move the envelope to [`EnvelopeStatus::Sent`]. + fn send(&self, envelope: &str) -> Result; + + /// Current status, including per-recipient progress. + fn status(&self, envelope: &str) -> Result; + + /// The finished document and provider evidence. + /// + /// Fails unless status is [`EnvelopeStatus::Completed`]. + fn completed(&self, envelope: &str) -> Result; + + /// Cancel an in-flight envelope. + fn void(&self, _envelope: &str, _reason: &str) -> Result<()> { + Err(Error::Unsupported("void")) + } + + /// Nudge one recipient who has not signed yet. + fn remind(&self, _envelope: &str, _recipient: &str) -> Result<()> { + Err(Error::Unsupported("reminders")) + } + + /// A URL the recipient opens to sign inside the provider's UI. + fn signing_url(&self, _envelope: &str, _recipient: &str, _return_to: &str) -> Result { + Err(Error::Unsupported("embedded signing")) + } +} + +/// Turning provider webhooks into [`EnvelopeEvent`]s. +/// +/// Server-side only. A desktop host that implements [`Envelopes`] never needs +/// a webhook secret and need not implement this beyond refusing. +pub trait EventIntake { + /// Verify authenticity and parse zero or more events from one HTTP body. + fn verify_event(&self, headers: &[(String, String)], body: &[u8]) -> Result>; +} + +/// Everything one signing service can do. +/// +/// A service implements the capabilities it has and reports the rest as +/// absent, so a caller can hide void on a stub that only supports the happy +/// path rather than offering a control that fails on use. +pub trait SigningService: Envelopes + EventIntake { + /// A stable identifier, such as `stub` or `documenso`. Used in + /// configuration and logs, never shown to a user. + fn id(&self) -> &str; + + /// What this service actually supports. + fn capabilities(&self) -> Vec; + + fn supports(&self, capability: EsignCapability) -> bool { + self.capabilities().contains(&capability) + } + + /// The party that holds legal and compliance responsibility for the + /// ceremony. Shown to senders before they send (upstream #2315). + fn responsible_party(&self) -> String; +} + +#[cfg(test)] +mod tests { + use super::*; + use craft_cloud::Identity; + + struct RefuseAll; + + impl Envelopes for RefuseAll { + fn create(&self, _: &EnvelopeDraft, _: &[u8], _: &str) -> Result { + Err(Error::Unsupported("create")) + } + + fn send(&self, _: &str) -> Result { + Err(Error::Unsupported("send")) + } + + fn status(&self, _: &str) -> Result { + Err(Error::Unsupported("status")) + } + + fn completed(&self, _: &str) -> Result { + Err(Error::Unsupported("completed")) + } + } + + impl EventIntake for RefuseAll { + fn verify_event(&self, _: &[(String, String)], _: &[u8]) -> Result> { + Err(Error::Unsupported("webhooks")) + } + } + + impl SigningService for RefuseAll { + fn id(&self) -> &str { + "refuse" + } + + fn capabilities(&self) -> Vec { + Vec::new() + } + + fn responsible_party(&self) -> String { + "nobody".into() + } + } + + #[test] + fn defaulted_methods_are_unsupported() { + let s = RefuseAll; + assert!(matches!(s.void("e", "x"), Err(Error::Unsupported("void")))); + assert!(matches!(s.remind("e", "r"), Err(Error::Unsupported("reminders")))); + assert!(matches!(s.signing_url("e", "r", "https://example"), Err(Error::Unsupported("embedded signing")))); + assert!(!s.supports(EsignCapability::Envelopes)); + assert_eq!(s.responsible_party(), "nobody"); + } + + #[test] + fn draft_round_trips_json() { + let draft = EnvelopeDraft { + title: "NDA".into(), + message: Some("please sign".into()), + sender: Identity { id: "u1".into(), display: "Ada".into(), email: Some("ada@example.com".into()), avatar: None }, + document_id: Some("doc-1".into()), + document_etag: Some("\"abc\"".into()), + recipients: vec![Recipient { + id: "r1".into(), + name: "Bob".into(), + email: "bob@example.com".into(), + role: "Signer".into(), + required: true, + status: RecipientStatus::Pending, + }], + placements: vec![FieldPlacement { + role: "Signer".into(), + page: 0, + x: 0.1, + y: 0.2, + w: 0.3, + h: 0.05, + kind: "signature".into(), + required: true, + }], + expires: Some("2026-12-31".into()), + }; + let json = serde_json::to_string(&draft).expect("serialize"); + let back: EnvelopeDraft = serde_json::from_str(&json).expect("deserialize"); + assert_eq!(back, draft); + } + + #[test] + fn cloud_errors_wrap_and_report_transient() { + let err = Error::from(craft_cloud::Error::Unreachable("down".into())); + assert!(err.is_transient()); + let err = Error::Declined("no".into()); + assert!(!err.is_transient()); + } +} diff --git a/crates/esign/src/types.rs b/crates/esign/src/types.rs new file mode 100644 index 000000000..c75f99a67 --- /dev/null +++ b/crates/esign/src/types.rs @@ -0,0 +1,172 @@ +//! The data the e-sign contracts pass around. +//! +//! Every type here is plain and vendor-neutral. A field that only means +//! something to one product belongs in that provider's crate. Nothing here +//! knows about PDF structure; a document is opaque bytes plus a content hash. + +use craft_cloud::Identity; +use serde::{Deserialize, Serialize}; + +/// What a signing service can do. +/// +/// Reported rather than assumed, so a caller hides void or remind on a service +/// that only supports create/send/status/completed. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum EsignCapability { + /// Create, send, poll status, and fetch the completed document. + Envelopes, + /// Cancel an in-flight envelope. + Void, + /// Nudge a recipient who has not signed yet. + Reminders, + /// Return a URL the recipient opens to sign in the provider's UI. + EmbeddedSigning, + /// Accept provider webhooks and turn them into [`EnvelopeEvent`]s. + Webhooks, +} + +/// Where an envelope is in its life. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum EnvelopeStatus { + /// Created but not yet sent to recipients. + Draft, + /// At least one recipient still owes a signature. + Sent, + /// Every required recipient has signed. + Completed, + /// The sender cancelled it. + Voided, + /// A recipient declined. + Declined, + /// The deadline passed without completion. + Expired, +} + +/// What one recipient still owes, or has done. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum RecipientStatus { + Pending, + Viewed, + Signed, + Declined, +} + +/// Who must sign, as the dialog and the service agree. +/// +/// Built from a [`craft_cloud::Contact`] by an explicit conversion at the host +/// boundary. Never a [`craft_cloud::ShareTarget`]: signing is not access. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct Recipient { + /// Opaque handle the service wants back. + pub id: String, + /// What to show. A display name where there is one. + pub name: String, + /// Delivery address. Required for invitation mail. + pub email: String, + /// Signer role label, such as "Client" or "Countersign". Colours and + /// field placement key off this string within one envelope. + pub role: String, + /// Whether the envelope cannot complete without this person. + pub required: bool, + pub status: RecipientStatus, +} + +/// One signature (or initials / date) placement on the document. +/// +/// Coordinates are normalised page space: origin top-left, `x`/`y`/`w`/`h` in +/// `[0.0, 1.0]` of the page. The document implementation maps these onto its +/// own field model; this crate never sees PDF objects. +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct FieldPlacement { + /// Recipient role this field belongs to. + pub role: String, + /// Zero-based page index. + pub page: u32, + pub x: f32, + pub y: f32, + pub w: f32, + pub h: f32, + /// Machine-readable kind: `signature`, `initials`, `date`, `text`. + pub kind: String, + pub required: bool, +} + +impl PartialEq for FieldPlacement { + fn eq(&self, other: &Self) -> bool { + self.role == other.role + && self.page == other.page + && self.kind == other.kind + && self.required == other.required + && self.x.to_bits() == other.x.to_bits() + && self.y.to_bits() == other.y.to_bits() + && self.w.to_bits() == other.w.to_bits() + && self.h.to_bits() == other.h.to_bits() + } +} + +impl Eq for FieldPlacement {} + +/// What the caller wants to send, before the service assigns an id. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct EnvelopeDraft { + /// Human title for the ceremony. + pub title: String, + /// Optional note shown to recipients. + pub message: Option, + /// Who is asking for signatures. Bound to the active account at send time. + pub sender: Identity, + /// Cloud document identity at the moment of the snapshot, when known. + pub document_id: Option, + pub document_etag: Option, + pub recipients: Vec, + pub placements: Vec, + /// `YYYY-MM-DD`. After this the envelope expires if still open. + pub expires: Option, +} + +/// An envelope the service knows about. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct Envelope { + pub id: String, + pub title: String, + pub message: Option, + pub sender: Identity, + pub document_id: Option, + pub document_etag: Option, + /// SHA-256 of the document bytes at create time, lowercase hex. + pub content_sha256: String, + pub recipients: Vec, + pub placements: Vec, + pub status: EnvelopeStatus, + pub expires: Option, + /// RFC 3339. + pub created: Option, + /// RFC 3339 when status became [`EnvelopeStatus::Completed`]. + pub completed_at: Option, +} + +/// The finished document plus whatever evidence the provider returns. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct CompletedDocument { + pub envelope_id: String, + /// Signed document bytes. Opaque to this crate. + pub bytes: Vec, + /// Provider evidence (certificate of completion, audit export, …). + pub evidence: Vec, +} + +/// Something that happened to an envelope. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct EnvelopeEvent { + pub envelope_id: String, + /// Machine-readable kind: `sent`, `viewed`, `signed`, `declined`, `voided`, `completed`. + pub kind: String, + /// Recipient id when the event is about one person. + pub recipient_id: Option, + /// RFC 3339. + pub at: Option, + pub detail: Option, +} diff --git a/crates/ui/Cargo.toml b/crates/ui/Cargo.toml index ac5085cd9..cbb7b8dfe 100644 --- a/crates/ui/Cargo.toml +++ b/crates/ui/Cargo.toml @@ -19,9 +19,11 @@ log = "0.4" serde = { version = "1", features = ["derive"], optional = true } # Same version as epaint's, for reading a face's character map. skrifa = { version = "0.44", default-features = false, features = ["std"] } -# The vendor-neutral vocabulary the share dialog speaks. No IO and no -# vendor, so this stays buildable for the web. +# The vendor-neutral vocabulary the share and e-sign dialogs speak. No IO and +# no vendor, so this stays buildable for the web. craft-cloud = { workspace = true, optional = true } +# The e-sign contract the request-signatures dialog states its work through. +craft-esign = { workspace = true, optional = true } # The control channel's report of the cloud state. One serialiser here # rather than one per application. No IO and no vendor. serde_json = { workspace = true, optional = true } @@ -65,6 +67,8 @@ share = ["dep:craft-cloud"] # Open and Save against cloud storage. Needs the share dialog, which a # document's overflow menu and the Share split button both open. cloud = ["share", "dep:serde_json"] +# Request-signatures dialog. +esign = ["dep:craft-cloud", "dep:craft-esign"] [dev-dependencies] # serde: the IME tests read events that only the suite's egui fork has from JSON. diff --git a/crates/ui/src/esign/backend.rs b/crates/ui/src/esign/backend.rs new file mode 100644 index 000000000..8d80a18f4 --- /dev/null +++ b/crates/ui/src/esign/backend.rs @@ -0,0 +1,92 @@ +//! Where the e-sign dialog's work happens, which is never on the frame. +//! +//! Same shape as [`crate::share::ShareBackend`]: the dialog states what it +//! wants, something behind this trait does the waiting, and answers arrive on +//! a channel keyed by sequence number. + +use craft_cloud::Contact; +use craft_esign::{CompletedDocument, Envelope, EnvelopeDraft, EsignCapability}; + +/// One thing the dialog needs done. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum Request { + /// What the signing service can actually do, and who is legally responsible. + Capabilities, + /// People matching what has been typed so far (cloud contacts). + Lookup { query: String, limit: usize }, + /// Create a draft from a document snapshot, then optionally send it. + Create { draft: Box, document: Vec, idempotency_key: String, send: bool }, + /// Current status of one envelope. + Status { envelope: String }, + /// Finished document bytes. + Completed { envelope: String }, + /// Cancel an in-flight envelope. + Void { envelope: String, reason: String }, + /// Nudge one recipient. + Remind { envelope: String, recipient: String }, +} + +/// What came back. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum Answer { + Capabilities { + capabilities: Vec, + responsible_party: String, + /// Whether a cloud account is attached so invitations can leave. + linked: bool, + }, + Lookup(Vec), + Created(Envelope), + Status(Envelope), + Completed(CompletedDocument), + Voided { + envelope: String, + }, + Reminded { + envelope: String, + recipient: String, + }, +} + +/// Where one answer goes. +pub struct Replier { + seq: u64, + tx: std::sync::mpsc::Sender<(u64, Result)>, +} + +impl Replier { + pub(crate) fn new(seq: u64, tx: std::sync::mpsc::Sender<(u64, Result)>) -> Replier { + Replier { seq, tx } + } + + pub fn seq(&self) -> u64 { + self.seq + } + + pub fn dup(&self) -> Replier { + Replier { seq: self.seq, tx: self.tx.clone() } + } + + pub fn answer(self, answer: Answer) { + self.deliver(Ok(answer)); + } + + pub fn refuse(self, reason: impl Into) { + self.deliver(Err(reason.into())); + } + + fn deliver(self, result: Result) { + let _ = self.tx.send((self.seq, result)); + } +} + +impl std::fmt::Debug for Replier { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Replier").field("seq", &self.seq).finish() + } +} + +/// Somewhere a [`Request`] can run without blocking a frame. +pub trait EsignBackend { + fn submit(&self, request: Request, reply: Replier); +} diff --git a/crates/ui/src/esign/mod.rs b/crates/ui/src/esign/mod.rs new file mode 100644 index 000000000..7bfd017fa --- /dev/null +++ b/crates/ui/src/esign/mod.rs @@ -0,0 +1,607 @@ +//! Request-signatures dialog, the same one in every Craft app that sends PDFs. +//! +//! Nothing here opens a socket. Every call goes through [`EsignBackend`]. +//! Nothing here blocks: answers arrive on a channel and are read once per +//! frame. Signing is not sharing: recipients are never [`craft_cloud::ShareTarget`]s. + +use std::sync::mpsc::{Receiver, Sender}; +use std::time::Duration; + +use craft_cloud::{Contact, Identity}; +use craft_esign::{Envelope, EnvelopeDraft, EnvelopeStatus, EsignCapability, FieldPlacement, Recipient, RecipientStatus}; +use egui::{Context, RichText, Ui}; + +mod backend; + +pub use backend::{Answer, EsignBackend, Replier, Request}; + +/// How long after the last keystroke the dialog asks for matches. +pub const DEBOUNCE: Duration = Duration::from_millis(200); + +const MATCHES: usize = 8; +const MIN_QUERY: usize = 2; +const RETRY: f64 = 20.0; + +type Inbox = (u64, Result); + +/// Every string the dialog shows. +#[derive(Clone, Debug)] +pub struct EsignLabels { + pub title: String, + pub recipients: String, + pub recipient_hint: String, + pub searching: String, + pub no_matches: String, + pub add_address: String, + pub role: String, + pub message: String, + pub send: String, + pub sending: String, + pub close: String, + pub loading: String, + pub responsible: String, + pub no_service: String, + pub sign_in_first: String, + pub need_recipient: String, + pub status: String, + pub void: String, + pub remind: String, + pub download: String, + pub request: String, +} + +impl Default for EsignLabels { + fn default() -> EsignLabels { + EsignLabels { + title: "Request signatures".into(), + recipients: "Signers".into(), + recipient_hint: "Name or email".into(), + searching: "Searching…".into(), + no_matches: "No matches".into(), + add_address: "Add email address".into(), + role: "Role".into(), + message: "Message".into(), + send: "Send".into(), + sending: "Sending…".into(), + close: "Close".into(), + loading: "Loading…".into(), + responsible: "Signing is provided by {party}. That party holds legal and compliance responsibility for the ceremony.".into(), + no_service: "Signatures cannot be requested here.".into(), + sign_in_first: "Sign in to request signatures.".into(), + need_recipient: "Add at least one signer.".into(), + status: "Status".into(), + void: "Void".into(), + remind: "Remind".into(), + download: "Download completed".into(), + request: "Request signatures".into(), + } + } +} + +/// What the application must supply when the user presses Send. +/// +/// The dialog holds recipients and copy; the application owns the document +/// bytes and encodes them, then submits [`Request::Create`] through the backend. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct SendRequest { + pub draft: EnvelopeDraft, + pub idempotency_key: String, +} + +/// One Request signatures dialog. +pub struct EsignDialog { + open: bool, + labels: EsignLabels, + backend: Option>, + capabilities: Option>, + responsible: Option, + linked: bool, + asked_caps_at: Option, + caps_seq: Option, + draft_idempotency_key: Option, + seq: u64, + tx: Sender, + rx: Receiver, + newest: u64, + document_id: String, + document_etag: Option, + document_title: String, + sender: Option, + query: String, + query_changed_at: f64, + lookup_seq: u64, + last_lookup_query: String, + matches: Vec, + looking: bool, + recipients: Vec, + message: String, + placements: Vec, + busy: bool, + error: Option, + envelope: Option, + send_out: Option, + completed_bytes: Option>, + account_fingerprint: Option, +} + +impl Default for EsignDialog { + fn default() -> EsignDialog { + let (tx, rx) = std::sync::mpsc::channel(); + EsignDialog { + open: false, + labels: EsignLabels::default(), + backend: None, + capabilities: None, + responsible: None, + linked: false, + asked_caps_at: None, + caps_seq: None, + draft_idempotency_key: None, + seq: 0, + tx, + rx, + newest: 0, + document_id: String::new(), + document_etag: None, + document_title: String::new(), + sender: None, + query: String::new(), + query_changed_at: 0.0, + lookup_seq: 0, + last_lookup_query: String::new(), + matches: Vec::new(), + looking: false, + recipients: Vec::new(), + message: String::new(), + placements: Vec::new(), + busy: false, + error: None, + envelope: None, + send_out: None, + completed_bytes: None, + account_fingerprint: None, + } + } +} + +impl EsignDialog { + pub fn new() -> EsignDialog { + EsignDialog::default() + } + + pub fn labels(mut self, labels: EsignLabels) -> EsignDialog { + self.labels = labels; + self + } + + pub fn set_backend(&mut self, backend: impl EsignBackend + 'static) { + self.backend = Some(Box::new(backend)); + self.capabilities = None; + self.asked_caps_at = None; + self.caps_seq = None; + } + + /// False until the service reports [`EsignCapability::Envelopes`]. + pub fn available(&self) -> bool { + self.capabilities.as_ref().is_some_and(|c| c.contains(&EsignCapability::Envelopes)) + } + + pub fn is_open(&self) -> bool { + self.open + } + + /// Open for a document. `sender` is the active account identity. + pub fn open(&mut self, document_id: String, document_title: String, document_etag: Option, sender: Identity) { + let fingerprint = format!("{}@{}", sender.id, sender.email.as_deref().unwrap_or("")); + let account_changed = self.account_fingerprint.as_deref() != Some(fingerprint.as_str()); + let document_changed = self.document_id != document_id; + if account_changed || document_changed { + self.recipients.clear(); + self.message.clear(); + self.envelope = None; + self.completed_bytes = None; + self.error = None; + self.draft_idempotency_key = None; + } + self.account_fingerprint = Some(fingerprint); + self.document_id = document_id; + self.document_title = document_title; + self.document_etag = document_etag; + self.sender = Some(sender); + self.open = true; + self.query.clear(); + self.matches.clear(); + } + + pub fn close(&mut self) { + self.open = false; + } + + /// Field placements the app prepared (page-normalised). Replaces any prior set. + pub fn set_placements(&mut self, placements: Vec) { + self.placements = placements; + } + + /// What Send asked the application to encode and submit, if anything. + pub fn take_send_request(&mut self) -> Option { + self.send_out.take() + } + + /// Submit a request through the host backend (for example after the app + /// encoded document bytes for a [`SendRequest`]). + pub fn submit_request(&mut self, request: Request) { + let _ = self.submit(request); + } + + /// Completed document bytes after a successful download request. + pub fn take_completed_bytes(&mut self) -> Option> { + self.completed_bytes.take() + } + + /// Tell the dialog create/send finished (or failed) after the app submitted. + pub fn note_create_result(&mut self, result: Result) { + self.busy = false; + match result { + Ok(env) => { + self.envelope = Some(env); + self.error = None; + } + Err(reason) => self.error = Some(reason), + } + } + + fn submit(&mut self, request: Request) -> u64 { + self.seq = self.seq.saturating_add(1); + let seq = self.seq; + self.newest = seq; + if let Some(backend) = self.backend.as_ref() { + backend.submit(request, Replier::new(seq, self.tx.clone())); + } else { + let _ = self.tx.send((seq, Err("no e-sign backend".into()))); + } + seq + } + + fn pump(&mut self, now: f64) { + while let Ok((seq, result)) = self.rx.try_recv() { + if self.caps_seq == Some(seq) { + self.caps_seq = None; + } + if seq < self.newest && !matches!(result, Ok(Answer::Capabilities { .. })) { + // Stale lookup or status; keep capabilities even if older. + if !matches!(&result, Ok(Answer::Lookup(_))) { + continue; + } + if seq != self.lookup_seq { + continue; + } + } + match result { + Ok(Answer::Capabilities { capabilities, responsible_party, linked }) => { + self.capabilities = Some(capabilities); + self.responsible = Some(responsible_party); + self.linked = linked; + } + Ok(Answer::Lookup(contacts)) if seq == self.lookup_seq => { + self.matches = contacts; + self.looking = false; + } + Ok(Answer::Created(env)) | Ok(Answer::Status(env)) => { + self.busy = false; + self.envelope = Some(env); + self.error = None; + } + Ok(Answer::Completed(doc)) => { + self.busy = false; + self.completed_bytes = Some(doc.bytes); + self.error = None; + } + Ok(Answer::Voided { .. }) => { + self.busy = false; + if let Some(env) = self.envelope.as_mut() { + env.status = EnvelopeStatus::Voided; + } + } + Ok(Answer::Reminded { .. }) => { + self.busy = false; + } + Err(reason) => { + self.busy = false; + self.looking = false; + self.error = Some(reason); + } + _ => {} + } + } + + if self.backend.is_some() && self.caps_seq.is_none() { + let first = self.capabilities.is_none() && self.asked_caps_at.is_none(); + let retry = self.asked_caps_at.is_some_and(|asked| !self.available() && now - asked >= RETRY); + if first || retry { + self.asked_caps_at = Some(now); + self.caps_seq = Some(self.submit(Request::Capabilities)); + } + } + } + + fn maybe_lookup(&mut self, now: f64) { + if !self.open || self.query.len() < MIN_QUERY { + return; + } + if (now - self.query_changed_at) < DEBOUNCE.as_secs_f64() { + return; + } + if self.looking || self.last_lookup_query == self.query { + return; + } + self.looking = true; + self.last_lookup_query = self.query.clone(); + self.lookup_seq = self.submit(Request::Lookup { query: self.query.clone(), limit: MATCHES }); + } + + fn add_contact(&mut self, contact: Contact) { + let email = contact.email.clone().unwrap_or_else(|| contact.id.clone()); + if self.recipients.iter().any(|r| r.email.eq_ignore_ascii_case(&email)) { + return; + } + let role = format!("Signer {}", self.recipients.len() + 1); + self.recipients.push(Recipient { id: contact.id, name: contact.name, email, role, required: true, status: RecipientStatus::Pending }); + self.draft_idempotency_key = None; + self.query.clear(); + self.matches.clear(); + } + + fn add_email(&mut self, email: String) { + let email = email.trim().to_string(); + if email.is_empty() || !email.contains('@') { + return; + } + if self.recipients.iter().any(|r| r.email.eq_ignore_ascii_case(&email)) { + return; + } + let role = format!("Signer {}", self.recipients.len() + 1); + self.recipients.push(Recipient { id: email.clone(), name: email.clone(), email, role, required: true, status: RecipientStatus::Pending }); + self.draft_idempotency_key = None; + self.query.clear(); + self.matches.clear(); + } + + fn queue_send(&mut self) { + let Some(sender) = self.sender.clone() else { + self.error = Some(self.labels.sign_in_first.clone()); + return; + }; + if self.recipients.is_empty() { + self.error = Some(self.labels.need_recipient.clone()); + return; + } + if !self.linked { + self.error = Some(self.labels.sign_in_first.clone()); + return; + } + let draft = EnvelopeDraft { + title: if self.document_title.is_empty() { "Document".into() } else { self.document_title.clone() }, + message: if self.message.trim().is_empty() { None } else { Some(self.message.clone()) }, + sender, + document_id: if self.document_id.is_empty() { None } else { Some(self.document_id.clone()) }, + document_etag: self.document_etag.clone(), + recipients: self.recipients.clone(), + placements: self.placements.clone(), + expires: None, + }; + if self.draft_idempotency_key.is_none() { + self.draft_idempotency_key = Some(format!("esign-{}-{}", self.document_id, self.seq.saturating_add(1))); + } + let idempotency_key = self.draft_idempotency_key.clone().unwrap_or_default(); + self.busy = true; + self.error = None; + self.send_out = Some(SendRequest { draft, idempotency_key }); + } + + /// Draw the dialog when open. Call every frame (even when closed) so + /// capability probes and inbox pumping continue. + pub fn show(&mut self, ctx: &Context) { + let now = ctx.input(|i| i.time); + self.pump(now); + if self.open { + self.maybe_lookup(now); + } + if !self.open { + return; + } + + let mut open = self.open; + let labels = self.labels.clone(); + egui::Window::new(&labels.title).open(&mut open).resizable(true).default_width(420.0).show(ctx, |ui| { + self.ui(ui); + }); + self.open = open; + } + + fn ui(&mut self, ui: &mut Ui) { + if let Some(err) = &self.error { + ui.colored_label(ui.visuals().error_fg_color, err); + ui.add_space(4.0); + } + + if !self.available() { + ui.label(if self.capabilities.is_none() { self.labels.loading.as_str() } else { self.labels.no_service.as_str() }); + return; + } + + if let Some(party) = &self.responsible { + ui.label(RichText::new(self.labels.responsible.replace("{party}", party)).small()); + ui.add_space(6.0); + } + + if let Some(env) = self.envelope.clone() { + self.status_panel(ui, &env); + return; + } + + ui.label(RichText::new(&self.document_title).strong()); + ui.add_space(4.0); + + ui.label(&self.labels.recipients); + let response = ui.add(egui::TextEdit::singleline(&mut self.query).hint_text(&self.labels.recipient_hint)); + if response.changed() { + self.query_changed_at = ui.input(|i| i.time); + self.matches.clear(); + self.looking = false; + self.lookup_seq = 0; + self.last_lookup_query.clear(); + } + if self.looking { + ui.spinner(); + ui.label(&self.labels.searching); + } else if self.query.len() >= MIN_QUERY && self.matches.is_empty() { + ui.horizontal(|ui| { + ui.label(&self.labels.no_matches); + if ui.button(&self.labels.add_address).clicked() { + self.add_email(self.query.clone()); + } + }); + } + for contact in self.matches.clone() { + let label = match &contact.email { + Some(email) => format!("{} <{}>", contact.name, email), + None => contact.name.clone(), + }; + if ui.selectable_label(false, label).clicked() { + self.add_contact(contact); + } + } + + ui.add_space(4.0); + let mut remove: Option = None; + for (i, recipient) in self.recipients.iter().enumerate() { + ui.horizontal(|ui| { + ui.label(format!("{} — {}", recipient.name, recipient.email)); + ui.label(RichText::new(&recipient.role).small()); + if ui.small_button("×").clicked() { + remove = Some(i); + } + }); + } + if let Some(i) = remove { + self.recipients.remove(i); + self.draft_idempotency_key = None; + } + + ui.add_space(6.0); + ui.label(&self.labels.message); + let message = ui.add(egui::TextEdit::multiline(&mut self.message).desired_rows(3)); + if message.changed() { + self.draft_idempotency_key = None; + } + + ui.add_space(8.0); + ui.horizontal(|ui| { + let can_send = !self.busy && self.linked && !self.recipients.is_empty(); + if ui.add_enabled(can_send, egui::Button::new(if self.busy { &self.labels.sending } else { &self.labels.send })).clicked() { + self.queue_send(); + } + if ui.button(&self.labels.close).clicked() { + self.open = false; + } + }); + } + + fn status_panel(&mut self, ui: &mut Ui, env: &Envelope) { + ui.label(RichText::new(&env.title).strong()); + ui.label(format!("{}: {:?}", self.labels.status, env.status)); + for r in &env.recipients { + ui.label(format!("{} — {:?} ({})", r.name, r.status, r.role)); + } + ui.add_space(8.0); + ui.horizontal(|ui| { + let caps = self.capabilities.clone().unwrap_or_default(); + if caps.contains(&EsignCapability::Reminders) + && ui.add_enabled(!self.busy, egui::Button::new(&self.labels.remind)).clicked() + && let Some(r) = env.recipients.iter().find(|r| r.status == RecipientStatus::Pending) + { + self.busy = true; + let _ = self.submit(Request::Remind { envelope: env.id.clone(), recipient: r.id.clone() }); + } + if caps.contains(&EsignCapability::Void) + && env.status == EnvelopeStatus::Sent + && ui.add_enabled(!self.busy, egui::Button::new(&self.labels.void)).clicked() + { + self.busy = true; + let _ = self.submit(Request::Void { envelope: env.id.clone(), reason: "voided by sender".into() }); + } + if env.status == EnvelopeStatus::Completed && ui.add_enabled(!self.busy, egui::Button::new(&self.labels.download)).clicked() { + self.busy = true; + let _ = self.submit(Request::Completed { envelope: env.id.clone() }); + } + if ui.button(&self.labels.close).clicked() { + self.open = false; + } + }); + if ui.button("Refresh status").clicked() { + self.busy = true; + let _ = self.submit(Request::Status { envelope: env.id.clone() }); + } + } +} + +/// Split button that opens the request-signatures dialog. +/// +/// `open` is called when the primary action is chosen. The chevron offers +/// status refresh when an envelope id is known. +pub fn request_button(ui: &mut Ui, labels: &EsignLabels, available: bool, menu: &[crate::menu::MenuItem]) -> Option { + if !available { + return None; + } + let menu_labels = crate::menu::MenuLabels::default(); + crate::menu::split(ui, &labels.request, menu, &menu_labels) +} + +#[cfg(test)] +mod tests { + use super::*; + use std::sync::{Arc, Mutex}; + + struct Capture { + last: Mutex>, + } + + impl EsignBackend for Arc { + fn submit(&self, request: Request, reply: Replier) { + *self.last.lock().expect("lock") = Some(request); + reply.answer(Answer::Capabilities { + capabilities: vec![EsignCapability::Envelopes, EsignCapability::Void], + responsible_party: "Stub Signing".into(), + linked: true, + }); + } + } + + #[test] + fn available_after_capabilities() { + let capture = Arc::new(Capture { last: Mutex::new(None) }); + let mut dialog = EsignDialog::default(); + dialog.set_backend(capture); + let ctx = Context::default(); + dialog.show(&ctx); + dialog.show(&ctx); + assert!(dialog.available()); + assert_eq!(dialog.responsible.as_deref(), Some("Stub Signing")); + } + + #[test] + fn send_request_needs_recipient_and_sender() { + let mut dialog = EsignDialog { + linked: true, + sender: Some(Identity { id: "u".into(), display: "Ada".into(), email: Some("ada@example.com".into()), avatar: None }), + ..Default::default() + }; + dialog.queue_send(); + assert!(dialog.take_send_request().is_none()); + dialog.add_email("bob@example.com".into()); + dialog.queue_send(); + let req = dialog.take_send_request().expect("send"); + assert_eq!(req.draft.recipients.len(), 1); + assert_eq!(req.draft.recipients[0].email, "bob@example.com"); + } +} diff --git a/crates/ui/src/lib.rs b/crates/ui/src/lib.rs index 0c6d42740..a1c091ff1 100644 --- a/crates/ui/src/lib.rs +++ b/crates/ui/src/lib.rs @@ -15,6 +15,8 @@ pub mod cloud; pub mod combo; pub mod direction; pub mod docking; +#[cfg(feature = "esign")] +pub mod esign; mod focus; pub mod fonts; pub mod icons; From 81bdd0dbe88a02f3e01c9e10dbf62e64911f9e82 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Tue, 10 Nov 2026 18:40:17 -0500 Subject: [PATCH 130/183] craft-esign: context-keyed replies, context-based staleness, two completion digests Fixes three gate items skylartaylor raised on PR #661. He reproduced them against 0a937ef in https://gist.github.com/skylartaylor/c1108ecf20d63c5e3183947408ddab7a. The request-signatures dialog now tags every in-flight create, status, completed, void and remind request with the context that issued it. That context is the document identity plus the account identity. A reply installs only when that context still matches the dialog's current context. This replaces the old staleness rule. That rule keyed off a global sequence counter that typing in the signer search also bumped. It dropped a late create reply and left the dialog on Sending forever. CompletedDocument now carries original_content_sha256 and signed_content_sha256 as distinct fields, per RFC-0021's evidence guarantee in storytold/craft-contrib#37. The crate's in-process test double computes both from the bytes it actually holds. It applies a fake seal that changes the signed bytes first. The two digests are never conflated. Regression tests, all in crates/ui/src/esign/review_repro.rs unless noted: 1. review_h5_reply_for_previous_document_is_installed_after_reopen 2. review_h5_reply_for_previous_account_is_installed_after_account_switch 3. review_n1_create_reply_dropped_after_a_lookup_leaves_dialog_busy 4. completed_document_keeps_original_and_signed_digests_distinct, in crates/esign/src/lib.rs --- crates/esign/src/lib.rs | 125 ++++++++++++++++++++++- crates/esign/src/types.rs | 14 +++ crates/ui/src/esign/mod.rs | 69 ++++++++++--- crates/ui/src/esign/review_repro.rs | 151 ++++++++++++++++++++++++++++ 4 files changed, 344 insertions(+), 15 deletions(-) create mode 100644 crates/ui/src/esign/review_repro.rs diff --git a/crates/esign/src/lib.rs b/crates/esign/src/lib.rs index 4efb15116..e9e6fa04b 100644 --- a/crates/esign/src/lib.rs +++ b/crates/esign/src/lib.rs @@ -47,7 +47,11 @@ pub trait Envelopes { /// The finished document and provider evidence. /// - /// Fails unless status is [`EnvelopeStatus::Completed`]. + /// Fails unless status is [`EnvelopeStatus::Completed`]. The returned + /// [`CompletedDocument`] carries both the original document's content + /// digest and the signed artifact's digest, computed honestly rather + /// than copied from one another: the implementation must not assume the + /// provider's sealing left the bytes unchanged. fn completed(&self, envelope: &str) -> Result; /// Cancel an in-flight envelope. @@ -99,6 +103,8 @@ pub trait SigningService: Envelopes + EventIntake { #[cfg(test)] mod tests { + use std::sync::Mutex; + use super::*; use craft_cloud::Identity; @@ -192,4 +198,121 @@ mod tests { let err = Error::Declined("no".into()); assert!(!err.is_transient()); } + + /// A non-cryptographic stand-in for a content digest. Good enough to + /// prove two byte strings differ; this crate takes no hashing + /// dependency, since hashing the document is an adapter's job. + fn fake_digest(bytes: &[u8]) -> String { + use std::hash::{Hash, Hasher}; + let mut hasher = std::collections::hash_map::DefaultHasher::new(); + bytes.hash(&mut hasher); + format!("{:016x}", hasher.finish()) + } + + /// An honest in-process double for [`Envelopes`]. It keeps the exact + /// bytes `create` was given, and on `completed` returns a "signed" + /// artifact built by appending a stub provider seal to those bytes, so + /// `original_content_sha256` and `signed_content_sha256` are computed + /// from genuinely different byte strings, the way a real provider's + /// sealing would produce them, rather than one copied from the other. + struct Double { + document: Mutex>>, + } + + impl Double { + fn new() -> Double { + Double { document: Mutex::new(None) } + } + } + + impl Envelopes for Double { + fn create(&self, draft: &EnvelopeDraft, document: &[u8], _idempotency_key: &str) -> Result { + *self.document.lock().expect("lock") = Some(document.to_vec()); + Ok(Envelope { + id: "env-double".into(), + title: draft.title.clone(), + message: draft.message.clone(), + sender: draft.sender.clone(), + document_id: draft.document_id.clone(), + document_etag: draft.document_etag.clone(), + content_sha256: fake_digest(document), + recipients: draft.recipients.clone(), + placements: draft.placements.clone(), + status: EnvelopeStatus::Draft, + expires: draft.expires.clone(), + created: None, + completed_at: None, + }) + } + + fn send(&self, envelope: &str) -> Result { + self.status(envelope) + } + + fn status(&self, envelope: &str) -> Result { + let document = self.document.lock().expect("lock").clone().unwrap_or_default(); + Ok(Envelope { + id: envelope.into(), + title: "Double".into(), + message: None, + sender: Identity { id: "u1".into(), display: "Ada".into(), email: None, avatar: None }, + document_id: None, + document_etag: None, + content_sha256: fake_digest(&document), + recipients: Vec::new(), + placements: Vec::new(), + status: EnvelopeStatus::Completed, + expires: None, + created: None, + completed_at: None, + }) + } + + fn completed(&self, envelope: &str) -> Result { + let original = self.document.lock().expect("lock").clone().unwrap_or_default(); + let mut signed = original.clone(); + signed.extend_from_slice(b"\0provider-seal"); + Ok(CompletedDocument { + envelope_id: envelope.into(), + bytes: signed.clone(), + original_content_sha256: fake_digest(&original), + signed_content_sha256: fake_digest(&signed), + evidence: b"certificate-of-completion".to_vec(), + }) + } + } + + /// RFC-0021's evidence guarantee: `CompletedDocument` carries the + /// original document's digest and the signed artifact's digest as two + /// distinct, honestly computed fields, and they differ when the + /// provider's sealing changes the bytes. + #[test] + fn completed_document_keeps_original_and_signed_digests_distinct() { + let double = Double::new(); + let draft = EnvelopeDraft { + title: "Contract".into(), + message: None, + sender: Identity { id: "u1".into(), display: "Ada".into(), email: None, avatar: None }, + document_id: Some("doc-1".into()), + document_etag: None, + recipients: Vec::new(), + placements: Vec::new(), + expires: None, + }; + let original_bytes = b"the original document bytes"; + let envelope = double.create(&draft, original_bytes, "idem-1").expect("create"); + let completed = double.completed(&envelope.id).expect("completed"); + + assert_eq!(completed.original_content_sha256, fake_digest(original_bytes)); + assert_ne!(completed.bytes, original_bytes, "the signed artifact's bytes differ from the original"); + assert_eq!(completed.signed_content_sha256, fake_digest(&completed.bytes)); + assert_ne!( + completed.original_content_sha256, completed.signed_content_sha256, + "sealing changed the bytes, so the two digests must not be conflated" + ); + + let json = serde_json::to_string(&completed).expect("serialize"); + let back: CompletedDocument = serde_json::from_str(&json).expect("deserialize"); + assert_eq!(back, completed); + } } diff --git a/crates/esign/src/types.rs b/crates/esign/src/types.rs index c75f99a67..08d42456e 100644 --- a/crates/esign/src/types.rs +++ b/crates/esign/src/types.rs @@ -149,11 +149,25 @@ pub struct Envelope { } /// The finished document plus whatever evidence the provider returns. +/// +/// Carries two digests as distinct fields, never conflated: the original +/// document's content digest and the returned signed artifact's digest. The +/// two are the same hash family as [`Envelope::content_sha256`] and can +/// differ in value. A provider's sealing (a certificate page, flattening, a +/// visible audit stamp) can change the signed bytes relative to the document +/// the envelope was created from, so a caller must not assume `bytes` hashes +/// back to `original_content_sha256`. #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CompletedDocument { pub envelope_id: String, /// Signed document bytes. Opaque to this crate. pub bytes: Vec, + /// SHA-256 of the original document bytes the envelope was created from, + /// lowercase hex. Matches the envelope's own `content_sha256`. + pub original_content_sha256: String, + /// SHA-256 of `bytes`, the returned signed artifact, lowercase hex. May + /// differ from `original_content_sha256`; see the struct's docs. + pub signed_content_sha256: String, /// Provider evidence (certificate of completion, audit export, …). pub evidence: Vec, } diff --git a/crates/ui/src/esign/mod.rs b/crates/ui/src/esign/mod.rs index 7bfd017fa..c9f404583 100644 --- a/crates/ui/src/esign/mod.rs +++ b/crates/ui/src/esign/mod.rs @@ -4,6 +4,7 @@ //! Nothing here blocks: answers arrive on a channel and are read once per //! frame. Signing is not sharing: recipients are never [`craft_cloud::ShareTarget`]s. +use std::collections::HashMap; use std::sync::mpsc::{Receiver, Sender}; use std::time::Duration; @@ -12,6 +13,8 @@ use craft_esign::{Envelope, EnvelopeDraft, EnvelopeStatus, EsignCapability, Fiel use egui::{Context, RichText, Ui}; mod backend; +#[cfg(test)] +mod review_repro; pub use backend::{Answer, EsignBackend, Replier, Request}; @@ -24,6 +27,17 @@ const RETRY: f64 = 20.0; type Inbox = (u64, Result); +/// What dialog state a reply belongs to: which document, under which +/// signed-in account. A reply installs only when this still matches the +/// dialog's current context; see [`EsignDialog::submit_in_context`] and +/// [`EsignDialog::pump`]. Deliberately excludes incidental UI state such as +/// search text, which changes without the dialog meaning something new. +#[derive(Clone, Debug, PartialEq, Eq)] +struct EsignContext { + document_id: String, + account: Option, +} + /// Every string the dialog shows. #[derive(Clone, Debug)] pub struct EsignLabels { @@ -103,6 +117,9 @@ pub struct EsignDialog { tx: Sender, rx: Receiver, newest: u64, + /// Context (document plus account) each in-flight context-sensitive + /// request was issued under. Consulted, then removed, in [`Self::pump`]. + contexts: HashMap, document_id: String, document_etag: Option, document_title: String, @@ -141,6 +158,7 @@ impl Default for EsignDialog { tx, rx, newest: 0, + contexts: HashMap::new(), document_id: String::new(), document_etag: None, document_title: String::new(), @@ -202,6 +220,10 @@ impl EsignDialog { self.completed_bytes = None; self.error = None; self.draft_idempotency_key = None; + // Any job still in flight was issued for the context being left. + // Its reply will be dropped in `pump` (context no longer + // matches), so nothing will ever clear `busy` on its behalf. + self.busy = false; } self.account_fingerprint = Some(fingerprint); self.document_id = document_id; @@ -230,7 +252,7 @@ impl EsignDialog { /// Submit a request through the host backend (for example after the app /// encoded document bytes for a [`SendRequest`]). pub fn submit_request(&mut self, request: Request) { - let _ = self.submit(request); + let _ = self.submit_in_context(request); } /// Completed document bytes after a successful download request. @@ -262,19 +284,38 @@ impl EsignDialog { seq } + /// The context (document plus account) a reply must still match to install. + fn current_context(&self) -> EsignContext { + EsignContext { document_id: self.document_id.clone(), account: self.account_fingerprint.clone() } + } + + /// Like [`Self::submit`], but tags the request with the dialog's current + /// context. Everything that acts on one envelope (create, status, + /// completed, void, remind) goes through here. Capabilities does not: + /// it is answered before a document is ever opened and stays valid + /// across documents and accounts. Lookup does: a contact search issued + /// before a reopen must not populate the reopened dialog either. + fn submit_in_context(&mut self, request: Request) -> u64 { + let seq = self.submit(request); + self.contexts.insert(seq, self.current_context()); + seq + } + fn pump(&mut self, now: f64) { while let Ok((seq, result)) = self.rx.try_recv() { if self.caps_seq == Some(seq) { self.caps_seq = None; } - if seq < self.newest && !matches!(result, Ok(Answer::Capabilities { .. })) { - // Stale lookup or status; keep capabilities even if older. - if !matches!(&result, Ok(Answer::Lookup(_))) { - continue; - } - if seq != self.lookup_seq { - continue; - } + // A context-tagged reply installs only for the context that + // issued it; it drops silently for any other, including a + // document switch or an account switch. Typing in the signer + // search bumps `newest` and is not a context change, so it no + // longer gates a create/status/completed/void/remind reply: the + // rule here is context equality, nothing else. + if let Some(context) = self.contexts.remove(&seq) + && context != self.current_context() + { + continue; } match result { Ok(Answer::Capabilities { capabilities, responsible_party, linked }) => { @@ -336,7 +377,7 @@ impl EsignDialog { } self.looking = true; self.last_lookup_query = self.query.clone(); - self.lookup_seq = self.submit(Request::Lookup { query: self.query.clone(), limit: MATCHES }); + self.lookup_seq = self.submit_in_context(Request::Lookup { query: self.query.clone(), limit: MATCHES }); } fn add_contact(&mut self, contact: Contact) { @@ -521,18 +562,18 @@ impl EsignDialog { && let Some(r) = env.recipients.iter().find(|r| r.status == RecipientStatus::Pending) { self.busy = true; - let _ = self.submit(Request::Remind { envelope: env.id.clone(), recipient: r.id.clone() }); + let _ = self.submit_in_context(Request::Remind { envelope: env.id.clone(), recipient: r.id.clone() }); } if caps.contains(&EsignCapability::Void) && env.status == EnvelopeStatus::Sent && ui.add_enabled(!self.busy, egui::Button::new(&self.labels.void)).clicked() { self.busy = true; - let _ = self.submit(Request::Void { envelope: env.id.clone(), reason: "voided by sender".into() }); + let _ = self.submit_in_context(Request::Void { envelope: env.id.clone(), reason: "voided by sender".into() }); } if env.status == EnvelopeStatus::Completed && ui.add_enabled(!self.busy, egui::Button::new(&self.labels.download)).clicked() { self.busy = true; - let _ = self.submit(Request::Completed { envelope: env.id.clone() }); + let _ = self.submit_in_context(Request::Completed { envelope: env.id.clone() }); } if ui.button(&self.labels.close).clicked() { self.open = false; @@ -540,7 +581,7 @@ impl EsignDialog { }); if ui.button("Refresh status").clicked() { self.busy = true; - let _ = self.submit(Request::Status { envelope: env.id.clone() }); + let _ = self.submit_in_context(Request::Status { envelope: env.id.clone() }); } } } diff --git a/crates/ui/src/esign/review_repro.rs b/crates/ui/src/esign/review_repro.rs new file mode 100644 index 000000000..452fdfefc --- /dev/null +++ b/crates/ui/src/esign/review_repro.rs @@ -0,0 +1,151 @@ +//! Regression tests for the three gate items skylartaylor raised on PR #661, +//! reproduced against 0a937ef (storytold/craft-libs#661): +//! . +//! +//! `Hold` is a backend that keeps every request and its `Replier` so a test +//! chooses when, and in what order, the service answers. + +use std::sync::{Arc, Mutex}; + +use craft_cloud::Identity; +use craft_esign::{Envelope, EnvelopeStatus, EsignCapability}; + +use super::*; + +#[derive(Clone, Default)] +struct Hold(Arc>>); + +impl EsignBackend for Hold { + fn submit(&self, request: Request, reply: Replier) { + self.0.lock().unwrap().push((request, reply)); + } +} + +impl Hold { + /// Takes the oldest held request matching `pick`. + fn take(&self, pick: impl Fn(&Request) -> bool) -> (Request, Replier) { + let mut held = self.0.lock().unwrap(); + let i = held.iter().position(|(r, _)| pick(r)).expect("request was submitted"); + held.remove(i) + } +} + +fn who(id: &str) -> Identity { + Identity { id: id.into(), display: id.into(), email: Some(format!("{id}@example.com")), avatar: None } +} + +fn envelope_for(doc: &str, sender: &str) -> Envelope { + Envelope { + id: format!("env-{doc}"), + title: format!("Contract {doc}"), + message: None, + sender: who(sender), + document_id: Some(doc.into()), + document_etag: None, + content_sha256: String::new(), + recipients: Vec::new(), + placements: Vec::new(), + status: EnvelopeStatus::Sent, + expires: None, + created: None, + completed_at: None, + } +} + +/// A dialog with a held backend whose capabilities probe has been answered. +fn ready() -> (EsignDialog, Hold) { + let hold = Hold::default(); + let mut dialog = EsignDialog::default(); + dialog.set_backend(hold.clone()); + dialog.pump(0.0); // submits Capabilities + let (_, caps) = hold.take(|r| matches!(r, Request::Capabilities)); + caps.answer(Answer::Capabilities { + capabilities: vec![EsignCapability::Envelopes, EsignCapability::Void], + responsible_party: "Stub Signing".into(), + linked: true, + }); + dialog.pump(0.1); + assert!(dialog.available()); + (dialog, hold) +} + +/// The app's Send path: queue_send -> take_send_request -> submit Create. +fn send(dialog: &mut EsignDialog, doc_bytes: &[u8]) { + dialog.add_email("bob@example.com".into()); + dialog.queue_send(); + let out = dialog.take_send_request().expect("Send produced a request"); + dialog.submit_request(Request::Create { + draft: Box::new(out.draft), + document: doc_bytes.to_vec(), + idempotency_key: out.idempotency_key, + send: true, + }); +} + +/// Gate item 1 (document variant): the dialog is reopened for document B +/// while document A's create is in flight. A's late reply carries document +/// A's context and must not be installed as document B's envelope. +#[test] +fn review_h5_reply_for_previous_document_is_installed_after_reopen() { + let (mut dialog, hold) = ready(); + dialog.open("doc-A".into(), "A.pdf".into(), None, who("alice")); + send(&mut dialog, b"A bytes"); + dialog.open("doc-B".into(), "B.pdf".into(), None, who("alice")); + + let (_, create_a) = hold.take(|r| matches!(r, Request::Create { .. })); + create_a.answer(Answer::Created(envelope_for("doc-A", "alice"))); + dialog.pump(1.0); + + let shown = dialog.envelope.as_ref().and_then(|e| e.document_id.clone()); + assert!( + shown.is_none() || shown.as_deref() == Some("doc-B"), + "dialog is open for doc-B but shows the envelope for {shown:?} (status panel: Void/Remind act on it); busy={}", + dialog.busy + ); +} + +/// Gate item 1 (account variant): reopened for the same document under +/// another signed-in account. Alice's envelope must never render for +/// mallory. +#[test] +fn review_h5_reply_for_previous_account_is_installed_after_account_switch() { + let (mut dialog, hold) = ready(); + dialog.open("doc-A".into(), "A.pdf".into(), None, who("alice")); + send(&mut dialog, b"A bytes"); + dialog.open("doc-A".into(), "A.pdf".into(), None, who("mallory")); + + let (_, create) = hold.take(|r| matches!(r, Request::Create { .. })); + create.answer(Answer::Created(envelope_for("doc-A", "alice"))); + dialog.pump(1.0); + + let shown = dialog.envelope.as_ref().map(|e| e.sender.id.clone()); + assert!(shown.is_none() || shown.as_deref() == Some("mallory"), "dialog now belongs to mallory but shows alice's envelope: sender={shown:?}"); +} + +/// Gate item 2: Send is in flight; the user types in the signer search box +/// (a lookup is submitted, which used to bump the old staleness counter). +/// The create reply then arrives for the same context and must still +/// install: typing in a search box is not a context change. +#[test] +fn review_n1_create_reply_dropped_after_a_lookup_leaves_dialog_busy() { + let (mut dialog, hold) = ready(); + dialog.open("doc-A".into(), "A.pdf".into(), None, who("alice")); + send(&mut dialog, b"A bytes"); + assert!(dialog.busy); + + dialog.query = "ca".into(); // typed after pressing Send + dialog.query_changed_at = 1.0; + dialog.maybe_lookup(2.0); + + let (_, create) = hold.take(|r| matches!(r, Request::Create { .. })); + create.answer(Answer::Created(envelope_for("doc-A", "alice"))); + for t in 0..10 { + dialog.pump(3.0 + f64::from(t)); + } + assert!( + !dialog.busy && dialog.envelope.is_some(), + "provider created env-doc-A but dialog busy={} envelope={:?} (reply dropped as stale)", + dialog.busy, + dialog.envelope.as_ref().map(|e| e.id.clone()) + ); +} From 98bfed94c20ae9612f2a0d9c5df04eb1a87d89c5 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 11 Nov 2026 09:21:38 -0500 Subject: [PATCH 131/183] craft-esign: carry the menu helper behind the esign feature on the new egui Main's craft-ui no longer has a standalone menu module. The esign dialog is the only consumer of the split-button helper this slice carries. The module is therefore feature-gated so the default craft-ui build matches main exactly. The three widget_info calls move from the deprecated egui::WidgetType alias to egui::Role. The current pin denies that deprecation as a warning. --- crates/ui/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/ui/src/lib.rs b/crates/ui/src/lib.rs index a1c091ff1..980bd4f63 100644 --- a/crates/ui/src/lib.rs +++ b/crates/ui/src/lib.rs @@ -23,6 +23,9 @@ pub mod icons; pub mod ime; pub mod layout; pub mod localized; +// Split-button menu helper carried with the esign slice; main's craft-ui no longer has a +// standalone menu module, and only the esign dialog uses this one. +#[cfg(feature = "esign")] pub mod menu; pub mod panes; pub mod presence; From b0b5c2bf172bd5fb117b6275af4bcbdbf3ae8487 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 11 Nov 2026 21:55:05 -0500 Subject: [PATCH 132/183] craft-esign close context, idempotency and busy-ownership gaps in the dialog A reply from a replaced backend could overwrite capabilities for the new one. A reply for an older document revision could install under a reopened dialog. A send request taken before a reopen could tag its reply with the wrong context. A duplicate answer from a backend holding a second Replier could reinstall state the dialog had already moved past. A superseded status refresh could overwrite a newer one. A failed lookup could clear busy for a create that was still running. Placements and the draft idempotency key could also survive a document change or a field edit that should have invalidated them. A contact with no email address could become a recipient using its share id as the address. Two dialog instances could mint the same idempotency key for the same document. An unlinked account showed a disabled Send button with no explanation. The context model now carries the document revision and an opening counter alongside the document id and account. Pending-send context is captured at queue time and consumed by the eventual submit or result call. A late reply or result keeps the context it was built under. Each fix adds a test that fails without it. --- crates/ui/src/esign/coderabbit_repro.rs | 180 ++++++++++++++ crates/ui/src/esign/mod.rs | 312 ++++++++++++++++++++++-- crates/ui/src/esign/review_repro.rs | 14 +- 3 files changed, 473 insertions(+), 33 deletions(-) create mode 100644 crates/ui/src/esign/coderabbit_repro.rs diff --git a/crates/ui/src/esign/coderabbit_repro.rs b/crates/ui/src/esign/coderabbit_repro.rs new file mode 100644 index 000000000..98414fb75 --- /dev/null +++ b/crates/ui/src/esign/coderabbit_repro.rs @@ -0,0 +1,180 @@ +//! Regression tests for the CodeRabbit findings reviewed on PR #661, +//! reproduced against ef496161 (storytold/craft-libs#661). +//! +//! Reuses `review_repro`'s `Hold` backend and helpers: a test chooses when, +//! and in what order, a held request is answered. + +use craft_esign::{Envelope, EnvelopeStatus}; + +use super::review_repro::{envelope_for, ready, send, who}; +use super::*; + +/// A document's revision changing is itself a context change: a reply for +/// the bytes under the old `document_etag` must not install under the new +/// one, even though the document id never changed. +#[test] +fn stale_create_reply_for_old_revision_is_dropped_after_reopen_with_new_etag() { + let (mut dialog, hold) = ready(); + dialog.open("doc-A".into(), "A.pdf".into(), Some("etag-1".into()), who("alice")); + send(&mut dialog, b"A bytes etag1"); + dialog.open("doc-A".into(), "A.pdf".into(), Some("etag-2".into()), who("alice")); + + let (_, create) = hold.take(|r| matches!(r, Request::Create { .. })); + create.answer(Answer::Created(envelope_for("doc-A", "alice"))); + dialog.pump(1.0); + + assert!( + dialog.envelope.is_none(), + "stale reply for etag-1 installed into the etag-2 opening: {:?}", + dialog.envelope.as_ref().map(|e| e.id.clone()) + ); +} + +/// `take_send_request` already handed the application doc-A's draft; the +/// dialog then reopens for doc-B before the application calls +/// `submit_request`. The reply this produces must still be tagged with +/// doc-A's context, not doc-B's. +#[test] +fn create_reply_for_a_request_taken_before_reopening_does_not_install_in_the_new_document() { + let (mut dialog, hold) = ready(); + dialog.open("doc-A".into(), "A.pdf".into(), None, who("alice")); + dialog.add_email("bob@example.com".into()); + dialog.queue_send(); + let out = dialog.take_send_request().expect("send produced a request"); + + // The dialog moves on before the application gets around to submitting + // what it already took. + dialog.open("doc-B".into(), "B.pdf".into(), None, who("alice")); + dialog.submit_request(Request::Create { draft: Box::new(out.draft), document: b"A bytes".to_vec(), idempotency_key: out.idempotency_key, send: true }); + + let (_, create) = hold.take(|r| matches!(r, Request::Create { .. })); + create.answer(Answer::Created(envelope_for("doc-A", "alice"))); + dialog.pump(1.0); + + assert!( + dialog.envelope.is_none(), + "doc-A's envelope, submitted after reopening doc-B, installed into doc-B's dialog: {:?}", + dialog.envelope.as_ref().map(|e| e.id.clone()) + ); +} + +/// An untaken `SendRequest` is specific to the context that queued it; it +/// must not survive into a reopened dialog for another document. +#[test] +fn an_untaken_send_request_does_not_survive_reopening_for_another_document() { + let (mut dialog, _hold) = ready(); + dialog.open("doc-A".into(), "A.pdf".into(), None, who("alice")); + dialog.add_email("bob@example.com".into()); + dialog.queue_send(); + + dialog.open("doc-B".into(), "B.pdf".into(), None, who("alice")); + + assert!(dialog.take_send_request().is_none(), "doc-B's dialog still held doc-A's untaken send request"); +} + +/// `note_create_result` is the synchronous twin of `submit_request`: an app +/// that handles create itself, rather than through the backend channel, +/// reports the outcome here. It must drop a result for a context the dialog +/// has already left, exactly as a channel reply would. +#[test] +fn note_create_result_for_a_previous_document_does_not_install_in_the_reopened_dialog() { + let (mut dialog, _hold) = ready(); + dialog.open("doc-A".into(), "A.pdf".into(), None, who("alice")); + dialog.add_email("bob@example.com".into()); + dialog.queue_send(); + let _out = dialog.take_send_request().expect("send produced a request"); + + dialog.open("doc-B".into(), "B.pdf".into(), None, who("alice")); + dialog.note_create_result(Ok(envelope_for("doc-A", "alice"))); + + assert!( + dialog.envelope.is_none(), + "doc-A's result, reported after reopening doc-B, installed into doc-B's dialog: {:?}", + dialog.envelope.as_ref().map(|e| e.id.clone()) + ); +} + +/// `Replier::dup` is the only way a backend can answer one sequence twice. +/// The dialog answers the first reply normally, but a second reply for the +/// same (already resolved) sequence must drop unconditionally, not reach +/// the match arms with no context left to check against. +#[test] +fn a_duplicated_answer_for_an_already_resolved_sequence_is_dropped() { + let (mut dialog, hold) = ready(); + dialog.open("doc-A".into(), "A.pdf".into(), None, who("alice")); + send(&mut dialog, b"A bytes"); + + let (_, create) = hold.take(|r| matches!(r, Request::Create { .. })); + let dup = create.dup(); + create.answer(Answer::Created(envelope_for("doc-A", "alice"))); + dialog.pump(1.0); + assert_eq!(dialog.envelope.as_ref().map(|e| e.id.clone()), Some("env-doc-A".to_owned()), "the first answer should have installed normally"); + + // The dialog moves on; a backend still holding `dup` from the first + // request answers it again. + dialog.open("doc-B".into(), "B.pdf".into(), None, who("alice")); + dup.answer(Answer::Created(envelope_for("doc-A", "alice"))); + dialog.pump(2.0); + + let shown = dialog.envelope.as_ref().and_then(|e| e.document_id.clone()); + assert!( + shown.is_none() || shown.as_deref() == Some("doc-B"), + "a duplicate answer for the first request reinstalled doc-A's envelope into doc-B's dialog: {shown:?}" + ); +} + +/// `busy` belongs to whichever operation is still pending. A lookup that +/// fails while a create is genuinely in flight must not report the create +/// as finished. +#[test] +fn a_failed_lookup_does_not_clear_busy_for_a_pending_create() { + let (mut dialog, hold) = ready(); + dialog.open("doc-A".into(), "A.pdf".into(), None, who("alice")); + send(&mut dialog, b"A bytes"); + assert!(dialog.busy, "queue_send should have left the dialog busy"); + + dialog.query = "ca".into(); + dialog.query_changed_at = 0.0; + dialog.maybe_lookup(1.0); + let (_, lookup) = hold.take(|r| matches!(r, Request::Lookup { .. })); + lookup.refuse("lookup failed"); + dialog.pump(2.0); + + assert!(dialog.busy, "a failed lookup cleared busy while the create for doc-A was still pending"); +} + +/// Two "Refresh status" clicks before either reply arrives race two +/// `Request::Status` calls. If the older one answers after the newer one +/// already installed, it must not overwrite the newer status. +#[test] +fn an_older_status_reply_does_not_overwrite_a_newer_one() { + let (mut dialog, hold) = ready(); + dialog.open("doc-A".into(), "A.pdf".into(), None, who("alice")); + send(&mut dialog, b"A bytes"); + let (_, create) = hold.take(|r| matches!(r, Request::Create { .. })); + create.answer(Answer::Created(envelope_for("doc-A", "alice"))); + dialog.pump(1.0); + let env_id = dialog.envelope.as_ref().expect("created").id.clone(); + + dialog.busy = true; + let seq1 = dialog.submit_in_context(Request::Status { envelope: env_id.clone() }); + dialog.pending_op_seq = Some(seq1); + dialog.status_seq = seq1; + dialog.busy = true; + let seq2 = dialog.submit_in_context(Request::Status { envelope: env_id.clone() }); + dialog.pending_op_seq = Some(seq2); + dialog.status_seq = seq2; + + let (_, status1) = hold.take(|r| matches!(r, Request::Status { .. })); + let (_, status2) = hold.take(|r| matches!(r, Request::Status { .. })); + + // The newer request (seq2) answers first. + status2.answer(Answer::Status(Envelope { status: EnvelopeStatus::Completed, ..envelope_for("doc-A", "alice") })); + dialog.pump(2.0); + assert_eq!(dialog.envelope.as_ref().map(|e| e.status), Some(EnvelopeStatus::Completed)); + + // The older request (seq1), issued first, answers last. + status1.answer(Answer::Status(Envelope { status: EnvelopeStatus::Sent, ..envelope_for("doc-A", "alice") })); + dialog.pump(3.0); + assert_eq!(dialog.envelope.as_ref().map(|e| e.status), Some(EnvelopeStatus::Completed), "an older status reply overwrote a newer one"); +} diff --git a/crates/ui/src/esign/mod.rs b/crates/ui/src/esign/mod.rs index c9f404583..1301e4ffd 100644 --- a/crates/ui/src/esign/mod.rs +++ b/crates/ui/src/esign/mod.rs @@ -14,6 +14,8 @@ use egui::{Context, RichText, Ui}; mod backend; #[cfg(test)] +mod coderabbit_repro; +#[cfg(test)] mod review_repro; pub use backend::{Answer, EsignBackend, Replier, Request}; @@ -27,15 +29,24 @@ const RETRY: f64 = 20.0; type Inbox = (u64, Result); -/// What dialog state a reply belongs to: which document, under which -/// signed-in account. A reply installs only when this still matches the -/// dialog's current context; see [`EsignDialog::submit_in_context`] and -/// [`EsignDialog::pump`]. Deliberately excludes incidental UI state such as -/// search text, which changes without the dialog meaning something new. +/// What dialog state a reply belongs to: which document revision, under +/// which signed-in account, opened which time. A reply installs only when +/// this still matches the dialog's current context; see +/// [`EsignDialog::submit_in_context`] and [`EsignDialog::pump`]. Deliberately +/// excludes incidental UI state such as search text, which changes without +/// the dialog meaning something new. +/// +/// `opening` is bumped every time [`EsignDialog::open`] actually changes +/// something (document, revision or account). `document_etag` alone would +/// already separate two revisions of the same document id, but it cannot +/// separate "document A, closed, then A opened again" from the first +/// opening: both carry the same id and the same etag. `opening` does. #[derive(Clone, Debug, PartialEq, Eq)] struct EsignContext { document_id: String, + document_etag: Option, account: Option, + opening: u64, } /// Every string the dialog shows. @@ -57,6 +68,9 @@ pub struct EsignLabels { pub no_service: String, pub sign_in_first: String, pub need_recipient: String, + /// Shown instead of adding the person, when a search match has no email + /// address the provider can invite. + pub contact_missing_email: String, pub status: String, pub void: String, pub remind: String, @@ -83,6 +97,7 @@ impl Default for EsignLabels { no_service: "Signatures cannot be requested here.".into(), sign_in_first: "Sign in to request signatures.".into(), need_recipient: "Add at least one signer.".into(), + contact_missing_email: "This contact has no email address to invite.".into(), status: "Status".into(), void: "Void".into(), remind: "Remind".into(), @@ -120,6 +135,23 @@ pub struct EsignDialog { /// Context (document plus account) each in-flight context-sensitive /// request was issued under. Consulted, then removed, in [`Self::pump`]. contexts: HashMap, + /// Sequences whose context has already been consulted once in + /// [`Self::pump`], bounded to the most recent entries. A backend that + /// answers the same sequence twice (via [`Replier::dup`]) has its second + /// answer dropped unconditionally instead of re-entering the match arms + /// with no context to check. + consumed: std::collections::HashSet, + consumed_order: std::collections::VecDeque, + /// The sequence that currently owns `busy`, if any. An answer (success or + /// failure) for any other sequence must not clear `busy` on its behalf. + pending_op_seq: Option, + /// The most recently issued `Request::Status` sequence. An older status + /// reply that arrives after a newer one has already installed is + /// superseded and dropped. + status_seq: u64, + /// How many times [`Self::open`] has actually changed something. Part of + /// [`EsignContext`]; see its docs. + opening: u64, document_id: String, document_etag: Option, document_title: String, @@ -137,6 +169,12 @@ pub struct EsignDialog { error: Option, envelope: Option, send_out: Option, + /// The context [`Self::queue_send`] captured for the still-outstanding + /// [`SendRequest`], consumed by [`Self::submit_request`] or + /// [`Self::note_create_result`] so a reply is tagged with the context the + /// send was queued under, not whatever context is current when the + /// application finally submits it. + pending_send_context: Option, completed_bytes: Option>, account_fingerprint: Option, } @@ -159,6 +197,11 @@ impl Default for EsignDialog { rx, newest: 0, contexts: HashMap::new(), + consumed: std::collections::HashSet::new(), + consumed_order: std::collections::VecDeque::new(), + pending_op_seq: None, + status_seq: 0, + opening: 0, document_id: String::new(), document_etag: None, document_title: String::new(), @@ -176,12 +219,28 @@ impl Default for EsignDialog { error: None, envelope: None, send_out: None, + pending_send_context: None, completed_bytes: None, account_fingerprint: None, } } } +/// A send operation id no other send in this process has used, from a random +/// start so one saved by an earlier process is unlikely to repeat either. +/// Mirrors `docking::model::fresh_window_id`: a counter kept on one +/// [`EsignDialog`] repeats across two dialog instances (two windows, or one +/// replaced after a document closes), and two sends sharing an idempotency +/// key have a conforming provider return the first envelope for the second. +fn fresh_send_id() -> u64 { + use std::hash::{BuildHasher, Hasher}; + use std::sync::OnceLock; + use std::sync::atomic::{AtomicU64, Ordering}; + static NEXT: OnceLock = OnceLock::new(); + let next = NEXT.get_or_init(|| AtomicU64::new(std::collections::hash_map::RandomState::new().build_hasher().finish() >> 1)); + next.fetch_add(1, Ordering::Relaxed) +} + impl EsignDialog { pub fn new() -> EsignDialog { EsignDialog::default() @@ -213,17 +272,29 @@ impl EsignDialog { let fingerprint = format!("{}@{}", sender.id, sender.email.as_deref().unwrap_or("")); let account_changed = self.account_fingerprint.as_deref() != Some(fingerprint.as_str()); let document_changed = self.document_id != document_id; - if account_changed || document_changed { + let revision_changed = self.document_etag != document_etag; + if account_changed || document_changed || revision_changed { self.recipients.clear(); self.message.clear(); self.envelope = None; self.completed_bytes = None; self.error = None; self.draft_idempotency_key = None; + // A's fields must never reappear as B's: see the Major finding + // this guards against. + self.placements.clear(); + // An untaken send request was built for the context being left; + // drop it so a later `take_send_request` cannot hand the + // application A's draft to submit under B's dialog. + // `pending_send_context`, captured once the request is taken, is + // deliberately left alone here: see its field doc. + self.send_out = None; + self.opening = self.opening.wrapping_add(1); // Any job still in flight was issued for the context being left. // Its reply will be dropped in `pump` (context no longer // matches), so nothing will ever clear `busy` on its behalf. self.busy = false; + self.pending_op_seq = None; } self.account_fingerprint = Some(fingerprint); self.document_id = document_id; @@ -242,6 +313,10 @@ impl EsignDialog { /// Field placements the app prepared (page-normalised). Replaces any prior set. pub fn set_placements(&mut self, placements: Vec) { self.placements = placements; + // Same reasoning as `add_contact`/`add_email`/removing a recipient: the + // fields a retried create would send have changed, so a key from + // before this call must not be reused for them. + self.draft_idempotency_key = None; } /// What Send asked the application to encode and submit, if anything. @@ -251,8 +326,20 @@ impl EsignDialog { /// Submit a request through the host backend (for example after the app /// encoded document bytes for a [`SendRequest`]). + /// + /// Tags the reply with the context [`Self::queue_send`] captured when it + /// built the [`SendRequest`] being submitted, not whatever context is + /// current now. The application can encode bytes, or the dialog can be + /// reopened for another document or account, before this runs; a reply + /// for a [`SendRequest`] built under a now-abandoned context must drop in + /// [`Self::pump`] exactly as one issued under that context would, not + /// install under whichever context happens to be current when this is + /// finally called. pub fn submit_request(&mut self, request: Request) { - let _ = self.submit_in_context(request); + let context = self.pending_send_context.take().unwrap_or_else(|| self.current_context()); + let seq = self.submit(request); + self.contexts.insert(seq, context); + self.pending_op_seq = Some(seq); } /// Completed document bytes after a successful download request. @@ -261,8 +348,19 @@ impl EsignDialog { } /// Tell the dialog create/send finished (or failed) after the app submitted. + /// + /// Gated the same way as [`Self::submit_request`]: when a context was + /// captured for the outstanding send, a result reported after the + /// dialog moved on to another document or account is dropped instead of + /// installing under the new context. pub fn note_create_result(&mut self, result: Result) { + if let Some(context) = self.pending_send_context.take() + && context != self.current_context() + { + return; + } self.busy = false; + self.pending_op_seq = None; match result { Ok(env) => { self.envelope = Some(env); @@ -284,9 +382,15 @@ impl EsignDialog { seq } - /// The context (document plus account) a reply must still match to install. + /// The context (document revision plus account, plus which opening) a + /// reply must still match to install. See [`EsignContext`]. fn current_context(&self) -> EsignContext { - EsignContext { document_id: self.document_id.clone(), account: self.account_fingerprint.clone() } + EsignContext { + document_id: self.document_id.clone(), + document_etag: self.document_etag.clone(), + account: self.account_fingerprint.clone(), + opening: self.opening, + } } /// Like [`Self::submit`], but tags the request with the dialog's current @@ -301,24 +405,51 @@ impl EsignDialog { seq } + /// Remembers that `seq`'s context has already been consulted once in + /// [`Self::pump`], bounded to the most recently consulted sequences. A + /// backend that answers the same sequence twice (only possible through + /// [`Replier::dup`]) has its second answer dropped unconditionally, + /// instead of reaching the match arms with no context left to check. + fn remember_consumed(&mut self, seq: u64) { + const TRACKED: usize = 64; + if self.consumed_order.len() >= TRACKED + && let Some(oldest) = self.consumed_order.pop_front() + { + self.consumed.remove(&oldest); + } + self.consumed_order.push_back(seq); + self.consumed.insert(seq); + } + fn pump(&mut self, now: f64) { while let Ok((seq, result)) = self.rx.try_recv() { - if self.caps_seq == Some(seq) { + let is_caps_reply = self.caps_seq == Some(seq); + if is_caps_reply { self.caps_seq = None; } + if self.consumed.contains(&seq) { + continue; + } // A context-tagged reply installs only for the context that // issued it; it drops silently for any other, including a - // document switch or an account switch. Typing in the signer - // search bumps `newest` and is not a context change, so it no - // longer gates a create/status/completed/void/remind reply: the - // rule here is context equality, nothing else. - if let Some(context) = self.contexts.remove(&seq) - && context != self.current_context() - { - continue; + // document switch, a revision change or an account switch. + // Typing in the signer search bumps `newest` and is not a + // context change, so it no longer gates a create/status/ + // completed/void/remind reply: the rule here is context + // equality, nothing else. + if let Some(context) = self.contexts.remove(&seq) { + self.remember_consumed(seq); + if context != self.current_context() { + continue; + } } match result { - Ok(Answer::Capabilities { capabilities, responsible_party, linked }) => { + // Guarded by `is_caps_reply`, computed before the swap + // above cleared it: a reply from a backend `set_backend` + // already replaced carries a sequence that is not (or no + // longer) `caps_seq`, so it cannot overwrite capabilities, + // responsible or linked for the new backend. + Ok(Answer::Capabilities { capabilities, responsible_party, linked }) if is_caps_reply => { self.capabilities = Some(capabilities); self.responsible = Some(responsible_party); self.linked = linked; @@ -327,27 +458,48 @@ impl EsignDialog { self.matches = contacts; self.looking = false; } - Ok(Answer::Created(env)) | Ok(Answer::Status(env)) => { + Ok(Answer::Created(env)) => { self.busy = false; + self.pending_op_seq = None; + self.envelope = Some(env); + self.error = None; + } + // Guarded by `status_seq`, the most recently issued status + // request: two "Refresh status" clicks in flight at once can + // answer out of order, and the older one must not overwrite + // state a newer one already installed. + Ok(Answer::Status(env)) if seq == self.status_seq => { + self.busy = false; + self.pending_op_seq = None; self.envelope = Some(env); self.error = None; } Ok(Answer::Completed(doc)) => { self.busy = false; + self.pending_op_seq = None; self.completed_bytes = Some(doc.bytes); self.error = None; } Ok(Answer::Voided { .. }) => { self.busy = false; + self.pending_op_seq = None; if let Some(env) = self.envelope.as_mut() { env.status = EnvelopeStatus::Voided; } } Ok(Answer::Reminded { .. }) => { self.busy = false; + self.pending_op_seq = None; } + // Clears `busy` only when this failure belongs to the + // operation that currently owns it: a lookup failing (or a + // superseded status request failing) must not wrongly + // report a still-running create as finished. Err(reason) => { - self.busy = false; + if self.pending_op_seq == Some(seq) { + self.busy = false; + self.pending_op_seq = None; + } self.looking = false; self.error = Some(reason); } @@ -381,7 +533,15 @@ impl EsignDialog { } fn add_contact(&mut self, contact: Contact) { - let email = contact.email.clone().unwrap_or_else(|| contact.id.clone()); + // `Contact::id` is the provider's share identifier, decided by + // `target`, and is not promised to be an address: `craft_cloud` + // documents the two as distinct and warns against treating one as + // the other. Falling back to it here would hand the envelope create + // request a recipient email that is not an email. + let Some(email) = contact.email.clone() else { + self.error = Some(self.labels.contact_missing_email.clone()); + return; + }; if self.recipients.iter().any(|r| r.email.eq_ignore_ascii_case(&email)) { return; } @@ -431,12 +591,13 @@ impl EsignDialog { expires: None, }; if self.draft_idempotency_key.is_none() { - self.draft_idempotency_key = Some(format!("esign-{}-{}", self.document_id, self.seq.saturating_add(1))); + self.draft_idempotency_key = Some(format!("esign-{}-{}", self.document_id, fresh_send_id())); } let idempotency_key = self.draft_idempotency_key.clone().unwrap_or_default(); self.busy = true; self.error = None; self.send_out = Some(SendRequest { draft, idempotency_key }); + self.pending_send_context = Some(self.current_context()); } /// Draw the dialog when open. Call every frame (even when closed) so @@ -480,6 +641,13 @@ impl EsignDialog { return; } + if !self.linked { + // Send is disabled below without saying why; the compose form is + // the one place an unlinked user sees before reaching it. + ui.label(&self.labels.sign_in_first); + ui.add_space(4.0); + } + ui.label(RichText::new(&self.document_title).strong()); ui.add_space(4.0); @@ -562,18 +730,21 @@ impl EsignDialog { && let Some(r) = env.recipients.iter().find(|r| r.status == RecipientStatus::Pending) { self.busy = true; - let _ = self.submit_in_context(Request::Remind { envelope: env.id.clone(), recipient: r.id.clone() }); + let seq = self.submit_in_context(Request::Remind { envelope: env.id.clone(), recipient: r.id.clone() }); + self.pending_op_seq = Some(seq); } if caps.contains(&EsignCapability::Void) && env.status == EnvelopeStatus::Sent && ui.add_enabled(!self.busy, egui::Button::new(&self.labels.void)).clicked() { self.busy = true; - let _ = self.submit_in_context(Request::Void { envelope: env.id.clone(), reason: "voided by sender".into() }); + let seq = self.submit_in_context(Request::Void { envelope: env.id.clone(), reason: "voided by sender".into() }); + self.pending_op_seq = Some(seq); } if env.status == EnvelopeStatus::Completed && ui.add_enabled(!self.busy, egui::Button::new(&self.labels.download)).clicked() { self.busy = true; - let _ = self.submit_in_context(Request::Completed { envelope: env.id.clone() }); + let seq = self.submit_in_context(Request::Completed { envelope: env.id.clone() }); + self.pending_op_seq = Some(seq); } if ui.button(&self.labels.close).clicked() { self.open = false; @@ -581,7 +752,9 @@ impl EsignDialog { }); if ui.button("Refresh status").clicked() { self.busy = true; - let _ = self.submit_in_context(Request::Status { envelope: env.id.clone() }); + let seq = self.submit_in_context(Request::Status { envelope: env.id.clone() }); + self.pending_op_seq = Some(seq); + self.status_seq = seq; } } } @@ -645,4 +818,89 @@ mod tests { assert_eq!(req.draft.recipients.len(), 1); assert_eq!(req.draft.recipients[0].email, "bob@example.com"); } + + /// The texts egui drew, walking into `Shape::Vec` groups the way widgets nest them. Same + /// pattern as `docking::native_tests::texts`. + fn texts(shapes: &[egui::epaint::ClippedShape]) -> Vec { + fn walk(shape: &egui::Shape, out: &mut Vec) { + match shape { + egui::Shape::Vec(shapes) => shapes.iter().for_each(|s| walk(s, out)), + egui::Shape::Text(text) => out.push(text.galley.text().to_owned()), + _ => {} + } + } + let mut out = Vec::new(); + shapes.iter().for_each(|clipped| walk(&clipped.shape, &mut out)); + out + } + + #[test] + fn compose_form_shows_sign_in_message_when_not_linked() { + let mut dialog = EsignDialog { + capabilities: Some(vec![EsignCapability::Envelopes]), + document_title: "A.pdf".into(), + linked: false, + ..Default::default() + }; + let ctx = Context::default(); + let full = ctx.run_ui(egui::RawInput::default(), |ui| dialog.ui(ui)); + let shown = texts(&full.shapes); + assert!(shown.iter().any(|t| t == &dialog.labels.sign_in_first), "sign-in message not shown for an unlinked account: {shown:?}"); + } + + fn ada() -> Identity { + Identity { id: "u".into(), display: "Ada".into(), email: Some("ada@example.com".into()), avatar: None } + } + + fn placement() -> FieldPlacement { + FieldPlacement { role: "Signer".into(), page: 0, x: 0.1, y: 0.2, w: 0.3, h: 0.05, kind: "signature".into(), required: true } + } + + #[test] + fn add_contact_rejects_a_contact_with_no_email() { + let mut dialog = EsignDialog::default(); + let contact = + Contact { id: "share-id-123".into(), target: craft_cloud::ShareTarget::User("share-id-123".into()), name: "Mallory".into(), email: None, avatar: None, is_group: false }; + dialog.add_contact(contact); + assert!(dialog.recipients.is_empty(), "a contact with no email became a recipient: {:?}", dialog.recipients); + assert_eq!(dialog.error.as_deref(), Some(dialog.labels.contact_missing_email.as_str())); + } + + #[test] + fn set_placements_invalidates_the_idempotency_key() { + let mut dialog = EsignDialog { linked: true, sender: Some(ada()), ..Default::default() }; + dialog.add_email("bob@example.com".into()); + dialog.queue_send(); + let first = dialog.take_send_request().expect("first send").idempotency_key; + + dialog.set_placements(vec![placement()]); + dialog.queue_send(); + let second = dialog.take_send_request().expect("second send").idempotency_key; + + assert_ne!(first, second, "changing placements kept the old idempotency key: {first}"); + } + + #[test] + fn placements_do_not_survive_a_document_change() { + let mut dialog = EsignDialog::default(); + dialog.open("doc-A".into(), "A.pdf".into(), None, ada()); + dialog.set_placements(vec![placement()]); + + dialog.open("doc-B".into(), "B.pdf".into(), None, ada()); + + assert!(dialog.placements.is_empty(), "doc-B inherited doc-A's placements: {:?}", dialog.placements); + } + + #[test] + fn queue_send_keys_are_unique_across_dialog_instances() { + fn send_key(doc: &str) -> String { + let mut dialog = EsignDialog { linked: true, sender: Some(ada()), document_id: doc.into(), ..Default::default() }; + dialog.add_email("bob@example.com".into()); + dialog.queue_send(); + dialog.take_send_request().expect("send").idempotency_key + } + let a = send_key("doc-A"); + let b = send_key("doc-A"); + assert_ne!(a, b, "two fresh dialog instances for the same document produced the same idempotency key: {a}"); + } } diff --git a/crates/ui/src/esign/review_repro.rs b/crates/ui/src/esign/review_repro.rs index 452fdfefc..c9780d7e5 100644 --- a/crates/ui/src/esign/review_repro.rs +++ b/crates/ui/src/esign/review_repro.rs @@ -12,8 +12,10 @@ use craft_esign::{Envelope, EnvelopeStatus, EsignCapability}; use super::*; +/// Reused by `coderabbit_repro`, the regression tests for the CodeRabbit +/// findings reviewed on the same pull request. #[derive(Clone, Default)] -struct Hold(Arc>>); +pub(super) struct Hold(Arc>>); impl EsignBackend for Hold { fn submit(&self, request: Request, reply: Replier) { @@ -23,18 +25,18 @@ impl EsignBackend for Hold { impl Hold { /// Takes the oldest held request matching `pick`. - fn take(&self, pick: impl Fn(&Request) -> bool) -> (Request, Replier) { + pub(super) fn take(&self, pick: impl Fn(&Request) -> bool) -> (Request, Replier) { let mut held = self.0.lock().unwrap(); let i = held.iter().position(|(r, _)| pick(r)).expect("request was submitted"); held.remove(i) } } -fn who(id: &str) -> Identity { +pub(super) fn who(id: &str) -> Identity { Identity { id: id.into(), display: id.into(), email: Some(format!("{id}@example.com")), avatar: None } } -fn envelope_for(doc: &str, sender: &str) -> Envelope { +pub(super) fn envelope_for(doc: &str, sender: &str) -> Envelope { Envelope { id: format!("env-{doc}"), title: format!("Contract {doc}"), @@ -53,7 +55,7 @@ fn envelope_for(doc: &str, sender: &str) -> Envelope { } /// A dialog with a held backend whose capabilities probe has been answered. -fn ready() -> (EsignDialog, Hold) { +pub(super) fn ready() -> (EsignDialog, Hold) { let hold = Hold::default(); let mut dialog = EsignDialog::default(); dialog.set_backend(hold.clone()); @@ -70,7 +72,7 @@ fn ready() -> (EsignDialog, Hold) { } /// The app's Send path: queue_send -> take_send_request -> submit Create. -fn send(dialog: &mut EsignDialog, doc_bytes: &[u8]) { +pub(super) fn send(dialog: &mut EsignDialog, doc_bytes: &[u8]) { dialog.add_email("bob@example.com".into()); dialog.queue_send(); let out = dialog.take_send_request().expect("Send produced a request"); From 820aa7b32ca64339e097cc7906728507ff6c69d8 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 11 Nov 2026 22:00:49 -0500 Subject: [PATCH 133/183] craft-esign clear the texture delta the sign-in message test's frame leaves run_ui's FullOutput carries textures_delta. egui panics on drop when a test never applies or clears it. --- crates/ui/src/esign/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/ui/src/esign/mod.rs b/crates/ui/src/esign/mod.rs index 1301e4ffd..9bf9d95b6 100644 --- a/crates/ui/src/esign/mod.rs +++ b/crates/ui/src/esign/mod.rs @@ -843,7 +843,8 @@ mod tests { ..Default::default() }; let ctx = Context::default(); - let full = ctx.run_ui(egui::RawInput::default(), |ui| dialog.ui(ui)); + let mut full = ctx.run_ui(egui::RawInput::default(), |ui| dialog.ui(ui)); + full.textures_delta.clear(); let shown = texts(&full.shapes); assert!(shown.iter().any(|t| t == &dialog.labels.sign_in_first), "sign-in message not shown for an unlinked account: {shown:?}"); } From 5c44349a894b0ce0a7108f070ec7be72827b5f2e Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 11 Nov 2026 22:03:19 -0500 Subject: [PATCH 134/183] craft-esign apply rustfmt to the new tests Wraps a few lines fmt would otherwise reject on the next check. --- crates/ui/src/esign/coderabbit_repro.rs | 7 ++++++- crates/ui/src/esign/mod.rs | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/crates/ui/src/esign/coderabbit_repro.rs b/crates/ui/src/esign/coderabbit_repro.rs index 98414fb75..88d875d29 100644 --- a/crates/ui/src/esign/coderabbit_repro.rs +++ b/crates/ui/src/esign/coderabbit_repro.rs @@ -45,7 +45,12 @@ fn create_reply_for_a_request_taken_before_reopening_does_not_install_in_the_new // The dialog moves on before the application gets around to submitting // what it already took. dialog.open("doc-B".into(), "B.pdf".into(), None, who("alice")); - dialog.submit_request(Request::Create { draft: Box::new(out.draft), document: b"A bytes".to_vec(), idempotency_key: out.idempotency_key, send: true }); + dialog.submit_request(Request::Create { + draft: Box::new(out.draft), + document: b"A bytes".to_vec(), + idempotency_key: out.idempotency_key, + send: true, + }); let (_, create) = hold.take(|r| matches!(r, Request::Create { .. })); create.answer(Answer::Created(envelope_for("doc-A", "alice"))); diff --git a/crates/ui/src/esign/mod.rs b/crates/ui/src/esign/mod.rs index 9bf9d95b6..18ad4f608 100644 --- a/crates/ui/src/esign/mod.rs +++ b/crates/ui/src/esign/mod.rs @@ -836,12 +836,8 @@ mod tests { #[test] fn compose_form_shows_sign_in_message_when_not_linked() { - let mut dialog = EsignDialog { - capabilities: Some(vec![EsignCapability::Envelopes]), - document_title: "A.pdf".into(), - linked: false, - ..Default::default() - }; + let mut dialog = + EsignDialog { capabilities: Some(vec![EsignCapability::Envelopes]), document_title: "A.pdf".into(), linked: false, ..Default::default() }; let ctx = Context::default(); let mut full = ctx.run_ui(egui::RawInput::default(), |ui| dialog.ui(ui)); full.textures_delta.clear(); @@ -860,8 +856,14 @@ mod tests { #[test] fn add_contact_rejects_a_contact_with_no_email() { let mut dialog = EsignDialog::default(); - let contact = - Contact { id: "share-id-123".into(), target: craft_cloud::ShareTarget::User("share-id-123".into()), name: "Mallory".into(), email: None, avatar: None, is_group: false }; + let contact = Contact { + id: "share-id-123".into(), + target: craft_cloud::ShareTarget::User("share-id-123".into()), + name: "Mallory".into(), + email: None, + avatar: None, + is_group: false, + }; dialog.add_contact(contact); assert!(dialog.recipients.is_empty(), "a contact with no email became a recipient: {:?}", dialog.recipients); assert_eq!(dialog.error.as_deref(), Some(dialog.labels.contact_missing_email.as_str())); From 4e007a5fb0e1bfd90c3dc6857eb460c00b2058ed Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 11 Nov 2026 22:06:11 -0500 Subject: [PATCH 135/183] craft-esign add the missing regression test for the capabilities race The is_caps_reply guard from the earlier commit had no test of its own. A reply from a replaced backend now provably cannot overwrite the new backend's capabilities, responsible party or linked state. --- crates/ui/src/esign/coderabbit_repro.rs | 33 ++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/crates/ui/src/esign/coderabbit_repro.rs b/crates/ui/src/esign/coderabbit_repro.rs index 88d875d29..c7c954002 100644 --- a/crates/ui/src/esign/coderabbit_repro.rs +++ b/crates/ui/src/esign/coderabbit_repro.rs @@ -6,9 +6,40 @@ use craft_esign::{Envelope, EnvelopeStatus}; -use super::review_repro::{envelope_for, ready, send, who}; +use super::review_repro::{Hold, envelope_for, ready, send, who}; use super::*; +/// Only one capabilities probe is ever outstanding for the current backend. +/// `set_backend` clears `caps_seq`, but a reply already in flight from the +/// backend being replaced keeps its old sequence number: it must not +/// overwrite capabilities, responsible or linked for the new backend when +/// it finally arrives. +#[test] +fn a_capabilities_reply_from_a_replaced_backend_does_not_overwrite_the_new_ones() { + let hold_a = Hold::default(); + let mut dialog = EsignDialog::default(); + dialog.set_backend(hold_a.clone()); + dialog.pump(0.0); + let (_, caps_a) = hold_a.take(|r| matches!(r, Request::Capabilities)); + + // The backend is replaced before A's capabilities probe answers. + let hold_b = Hold::default(); + dialog.set_backend(hold_b.clone()); + dialog.pump(0.1); + let (_, caps_b) = hold_b.take(|r| matches!(r, Request::Capabilities)); + + caps_b.answer(Answer::Capabilities { capabilities: vec![EsignCapability::Envelopes], responsible_party: "B".into(), linked: true }); + dialog.pump(0.2); + assert_eq!(dialog.responsible.as_deref(), Some("B")); + + // A's reply, from the replaced backend, arrives after B's already installed. + caps_a.answer(Answer::Capabilities { capabilities: vec![EsignCapability::Void], responsible_party: "A".into(), linked: false }); + dialog.pump(0.3); + + assert_eq!(dialog.responsible.as_deref(), Some("B"), "a stale Capabilities reply from a replaced backend overwrote the new backend's"); + assert!(dialog.linked, "a stale Capabilities reply from a replaced backend turned linked back off"); +} + /// A document's revision changing is itself a context change: a reply for /// the bytes under the old `document_etag` must not install under the new /// one, even though the document id never changed. From 9e70a85182a6eb016d0fc6a2461da81f5a1df3c9 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 11 Nov 2026 22:49:13 -0500 Subject: [PATCH 136/183] craft-esign fix status routing, relink, role reuse, close and i18n gaps A public submit_request call carrying Request::Status never registered status_seq. Its own reply then failed the supersession guard. The dialog kept showing an envelope's old state. submit_request now records status_seq for a Status submission the same way status_panel's own button already does. Once available() turns true it never asks again. A backend whose linked value changes after an out-of-band sign-in stayed stuck showing the sign-in message. A new reset_capabilities method reprobes the current backend. It reuses the same reset set_backend already performs. Recipient roles were derived from the current recipient count. Add two recipients, remove the first, then add a third: the third gets the second's exact role. A placement keyed to a removed recipient's role could then bind to whichever recipient later receives that reused label. Roles now come from a counter that only climbs. A recipient removal also drops any placement keyed to a role no recipient holds anymore. Both Close buttons set self.open to false inside the window's content closure. show() then overwrote it with the window's own unchanged open binding, undoing the click. show() now requires both to agree the dialog stays open. The manual status refresh button showed the English "Refresh status" caption regardless of the labels a host supplied. EsignLabels gained a refresh field for it. Each fix adds a test that fails without it. --- .../ui/src/esign/coderabbit_round2_repro.rs | 72 ++++++++++ crates/ui/src/esign/mod.rs | 128 +++++++++++++++++- 2 files changed, 195 insertions(+), 5 deletions(-) create mode 100644 crates/ui/src/esign/coderabbit_round2_repro.rs diff --git a/crates/ui/src/esign/coderabbit_round2_repro.rs b/crates/ui/src/esign/coderabbit_round2_repro.rs new file mode 100644 index 000000000..96fe9d1f5 --- /dev/null +++ b/crates/ui/src/esign/coderabbit_round2_repro.rs @@ -0,0 +1,72 @@ +//! Regression tests for CodeRabbit's second review pass on PR #661, +//! reproduced against 1e84947c (storytold/craft-libs#661). +//! +//! Reuses `review_repro`'s `Hold` backend and helpers, the same as +//! `coderabbit_repro`. + +use craft_esign::{Envelope, EnvelopeStatus}; + +use super::review_repro::{Hold, envelope_for, ready, send, who}; +use super::*; + +/// A host can drive `Request::Status` through the public `submit_request` +/// path directly, not only through `status_panel`'s own "Refresh status" +/// button. That path must register `status_seq` too, or the reply it +/// produces fails the supersession guard added for the button's path and is +/// dropped. +#[test] +fn submit_request_for_a_public_status_submission_registers_status_seq() { + let (mut dialog, hold) = ready(); + dialog.open("doc-A".into(), "A.pdf".into(), None, who("alice")); + send(&mut dialog, b"A bytes"); + let (_, create) = hold.take(|r| matches!(r, Request::Create { .. })); + create.answer(Answer::Created(envelope_for("doc-A", "alice"))); + dialog.pump(1.0); + let env_id = dialog.envelope.as_ref().expect("created").id.clone(); + + dialog.submit_request(Request::Status { envelope: env_id }); + let (_, status) = hold.take(|r| matches!(r, Request::Status { .. })); + status.answer(Answer::Status(Envelope { status: EnvelopeStatus::Completed, ..envelope_for("doc-A", "alice") })); + dialog.pump(2.0); + + assert_eq!( + dialog.envelope.as_ref().map(|e| e.status), + Some(EnvelopeStatus::Completed), + "a Status reply submitted through the public submit_request path was dropped by the status_seq guard" + ); +} + +/// `available()` stops asking again once the service has reported +/// `Envelopes`, so a backend whose `linked` value changes out of band (the +/// user signs in after the dialog already probed) is never re-asked unless +/// something clears the cached capabilities. `reset_capabilities` is that +/// something, on the same backend instance. +#[test] +fn reset_capabilities_reprobes_the_same_backend_after_an_out_of_band_sign_in() { + let hold = Hold::default(); + let mut dialog = EsignDialog::default(); + dialog.set_backend(hold.clone()); + dialog.pump(0.0); + let (_, caps1) = hold.take(|r| matches!(r, Request::Capabilities)); + caps1.answer(Answer::Capabilities { capabilities: vec![EsignCapability::Envelopes], responsible_party: "Stub Signing".into(), linked: false }); + dialog.pump(0.1); + assert!(dialog.available()); + assert!(!dialog.linked); + + // Available is already true, so pump's own retry condition + // (`!available() && ...`) never fires again on its own, no matter how + // much time passes. + for t in 0..5 { + dialog.pump(0.2 + f64::from(t)); + } + + // The user signs in; nothing about the backend instance changes, so + // only an explicit reset asks again. + dialog.reset_capabilities(); + dialog.pump(1.0); + let (_, caps2) = hold.take(|r| matches!(r, Request::Capabilities)); + caps2.answer(Answer::Capabilities { capabilities: vec![EsignCapability::Envelopes], responsible_party: "Stub Signing".into(), linked: true }); + dialog.pump(1.1); + + assert!(dialog.linked, "reset_capabilities did not pick up the backend's new linked state"); +} diff --git a/crates/ui/src/esign/mod.rs b/crates/ui/src/esign/mod.rs index 18ad4f608..b2f7dbb0e 100644 --- a/crates/ui/src/esign/mod.rs +++ b/crates/ui/src/esign/mod.rs @@ -16,6 +16,8 @@ mod backend; #[cfg(test)] mod coderabbit_repro; #[cfg(test)] +mod coderabbit_round2_repro; +#[cfg(test)] mod review_repro; pub use backend::{Answer, EsignBackend, Replier, Request}; @@ -76,6 +78,8 @@ pub struct EsignLabels { pub remind: String, pub download: String, pub request: String, + /// Caption of the status panel's manual refresh action. + pub refresh: String, } impl Default for EsignLabels { @@ -103,6 +107,7 @@ impl Default for EsignLabels { remind: "Remind".into(), download: "Download completed".into(), request: "Request signatures".into(), + refresh: "Refresh status".into(), } } } @@ -163,6 +168,13 @@ pub struct EsignDialog { matches: Vec, looking: bool, recipients: Vec, + /// How many recipients have ever been added for the document currently + /// open, used to label the next one. Monotonic, not derived from the + /// current recipient count or roles in use: a count- or scan-based label + /// is free to repeat once the recipient holding it is removed, and a + /// freed role can then bind a new recipient to an old recipient's + /// placements. Reset in [`Self::open`] alongside `recipients`. + next_role_number: u32, message: String, placements: Vec, busy: bool, @@ -213,6 +225,7 @@ impl Default for EsignDialog { matches: Vec::new(), looking: false, recipients: Vec::new(), + next_role_number: 0, message: String::new(), placements: Vec::new(), busy: false, @@ -241,6 +254,17 @@ fn fresh_send_id() -> u64 { next.fetch_add(1, Ordering::Relaxed) } +/// Whether the dialog stays open after one [`EsignDialog::show`] frame. +/// +/// `window_open` is egui's own title-bar close control; `dialog_open` is +/// whatever [`EsignDialog::ui`] already decided, such as a Close button. +/// Either one closing the dialog must stick: a plain `window_open` would +/// let the window's unchanged binding undo a Close button clicked inside +/// the same frame. +fn still_open(window_open: bool, dialog_open: bool) -> bool { + window_open && dialog_open +} + impl EsignDialog { pub fn new() -> EsignDialog { EsignDialog::default() @@ -253,6 +277,21 @@ impl EsignDialog { pub fn set_backend(&mut self, backend: impl EsignBackend + 'static) { self.backend = Some(Box::new(backend)); + self.reset_capabilities(); + } + + /// Probe the current backend again for capabilities and link state. + /// + /// `available()` never asks again once the service has reported + /// [`EsignCapability::Envelopes`]; the retry in [`Self::pump`] is for a + /// backend that is still unavailable, not for a `linked` value that is + /// stale after an out-of-band sign-in. Call this once that sign-in + /// completes on the backend already set, when replacing it with + /// [`Self::set_backend`] would be artificial. A reply still in flight + /// from the probe this replaces is dropped in [`Self::pump`] exactly as + /// one from a backend [`Self::set_backend`] already replaced is: + /// `caps_seq` is cleared here the same way. + pub fn reset_capabilities(&mut self) { self.capabilities = None; self.asked_caps_at = None; self.caps_seq = None; @@ -275,6 +314,7 @@ impl EsignDialog { let revision_changed = self.document_etag != document_etag; if account_changed || document_changed || revision_changed { self.recipients.clear(); + self.next_role_number = 0; self.message.clear(); self.envelope = None; self.completed_bytes = None; @@ -325,7 +365,9 @@ impl EsignDialog { } /// Submit a request through the host backend (for example after the app - /// encoded document bytes for a [`SendRequest`]). + /// encoded document bytes for a [`SendRequest`], or a status refresh the + /// host drives itself rather than through [`Self::status_panel`]'s own + /// button). /// /// Tags the reply with the context [`Self::queue_send`] captured when it /// built the [`SendRequest`] being submitted, not whatever context is @@ -337,9 +379,16 @@ impl EsignDialog { /// finally called. pub fn submit_request(&mut self, request: Request) { let context = self.pending_send_context.take().unwrap_or_else(|| self.current_context()); + // A public `Request::Status` submission is request-specific routing + // state too: without this, `pump`'s `status_seq` guard never sees + // this sequence and drops the reply that comes back for it. + let is_status = matches!(request, Request::Status { .. }); let seq = self.submit(request); self.contexts.insert(seq, context); self.pending_op_seq = Some(seq); + if is_status { + self.status_seq = seq; + } } /// Completed document bytes after a successful download request. @@ -545,7 +594,7 @@ impl EsignDialog { if self.recipients.iter().any(|r| r.email.eq_ignore_ascii_case(&email)) { return; } - let role = format!("Signer {}", self.recipients.len() + 1); + let role = self.next_role(); self.recipients.push(Recipient { id: contact.id, name: contact.name, email, role, required: true, status: RecipientStatus::Pending }); self.draft_idempotency_key = None; self.query.clear(); @@ -560,13 +609,20 @@ impl EsignDialog { if self.recipients.iter().any(|r| r.email.eq_ignore_ascii_case(&email)) { return; } - let role = format!("Signer {}", self.recipients.len() + 1); + let role = self.next_role(); self.recipients.push(Recipient { id: email.clone(), name: email.clone(), email, role, required: true, status: RecipientStatus::Pending }); self.draft_idempotency_key = None; self.query.clear(); self.matches.clear(); } + /// A role label no recipient added for the document currently open has + /// held, including one since removed: see `next_role_number`'s doc. + fn next_role(&mut self) -> String { + self.next_role_number += 1; + format!("Signer {}", self.next_role_number) + } + fn queue_send(&mut self) { let Some(sender) = self.sender.clone() else { self.error = Some(self.labels.sign_in_first.clone()); @@ -617,7 +673,11 @@ impl EsignDialog { egui::Window::new(&labels.title).open(&mut open).resizable(true).default_width(420.0).show(ctx, |ui| { self.ui(ui); }); - self.open = open; + // `open` reflects only the window's own title-bar close control; + // `self.ui` may already have set `self.open` to false from one of + // its own Close buttons. Either closing the dialog must stick, so + // reopening it takes a fresh `Self::open` call either way. + self.open = still_open(open, self.open); } fn ui(&mut self, ui: &mut Ui) { @@ -695,6 +755,10 @@ impl EsignDialog { if let Some(i) = remove { self.recipients.remove(i); self.draft_idempotency_key = None; + // A placement keyed to the removed recipient's role would + // otherwise ride along in the next draft matching no recipient. + let live_roles: std::collections::HashSet<&str> = self.recipients.iter().map(|r| r.role.as_str()).collect(); + self.placements.retain(|p| live_roles.contains(p.role.as_str())); } ui.add_space(6.0); @@ -750,7 +814,7 @@ impl EsignDialog { self.open = false; } }); - if ui.button("Refresh status").clicked() { + if ui.button(&self.labels.refresh).clicked() { self.busy = true; let seq = self.submit_in_context(Request::Status { envelope: env.id.clone() }); self.pending_op_seq = Some(seq); @@ -906,4 +970,58 @@ mod tests { let b = send_key("doc-A"); assert_ne!(a, b, "two fresh dialog instances for the same document produced the same idempotency key: {a}"); } + + #[test] + fn recipient_roles_never_repeat_after_a_removal() { + let mut dialog = EsignDialog::default(); + dialog.add_email("a@example.com".into()); + dialog.add_email("b@example.com".into()); + dialog.recipients.remove(0); + dialog.add_email("c@example.com".into()); + + let roles: Vec<&str> = dialog.recipients.iter().map(|r| r.role.as_str()).collect(); + assert_eq!(roles.len(), 2, "{roles:?}"); + assert_ne!(roles[0], roles[1], "B and C were both assigned the same role after A was removed: {roles:?}"); + } + + #[test] + fn still_open_requires_both_the_window_and_the_dialog_to_agree() { + // A Close button inside `ui` already set `self.open` to false; the + // window's own close control was not used. + assert!(!still_open(true, false), "an internal Close click was undone by the window's unchanged open binding"); + // The title-bar close control was used; nothing inside set it false. + assert!(!still_open(false, true)); + // Neither closed it. + assert!(still_open(true, true)); + } + + fn envelope_stub() -> Envelope { + Envelope { + id: "env-1".into(), + title: "Contract".into(), + message: None, + sender: ada(), + document_id: None, + document_etag: None, + content_sha256: String::new(), + recipients: Vec::new(), + placements: Vec::new(), + status: EnvelopeStatus::Sent, + expires: None, + created: None, + completed_at: None, + } + } + + #[test] + fn refresh_status_caption_is_localized() { + let labels = EsignLabels { refresh: "Actualizar estado".into(), ..EsignLabels::default() }; + let mut dialog = EsignDialog { capabilities: Some(vec![EsignCapability::Envelopes]), labels, envelope: Some(envelope_stub()), ..Default::default() }; + let ctx = Context::default(); + let mut full = ctx.run_ui(egui::RawInput::default(), |ui| dialog.ui(ui)); + full.textures_delta.clear(); + let shown = texts(&full.shapes); + assert!(shown.iter().any(|t| t == "Actualizar estado"), "refresh caption is not localized: {shown:?}"); + assert!(!shown.iter().any(|t| t == "Refresh status"), "hardcoded English caption still shown: {shown:?}"); + } } From df8f35d2976187cc0545c13e823b897a40baefd3 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 11 Nov 2026 22:50:19 -0500 Subject: [PATCH 137/183] craft-esign apply rustfmt to the refresh caption test Wraps a line fmt would otherwise reject on the next check. --- crates/ui/src/esign/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/ui/src/esign/mod.rs b/crates/ui/src/esign/mod.rs index b2f7dbb0e..244db54ba 100644 --- a/crates/ui/src/esign/mod.rs +++ b/crates/ui/src/esign/mod.rs @@ -1016,7 +1016,8 @@ mod tests { #[test] fn refresh_status_caption_is_localized() { let labels = EsignLabels { refresh: "Actualizar estado".into(), ..EsignLabels::default() }; - let mut dialog = EsignDialog { capabilities: Some(vec![EsignCapability::Envelopes]), labels, envelope: Some(envelope_stub()), ..Default::default() }; + let mut dialog = + EsignDialog { capabilities: Some(vec![EsignCapability::Envelopes]), labels, envelope: Some(envelope_stub()), ..Default::default() }; let ctx = Context::default(); let mut full = ctx.run_ui(egui::RawInput::default(), |ui| dialog.ui(ui)); full.textures_delta.clear(); From 52d874ae96ed45bbc44eeb4202a421ceac40ad33 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 11 Nov 2026 23:10:05 -0500 Subject: [PATCH 138/183] craft-esign keep the send context off status requests submit_request consumed the captured send context for every request kind. A status refresh for the current document submitted while another document's send was still outstanding then carried the old context. pump dropped its reply as stale. The context now goes only to the create submission that answers the taken send request. Every other request uses the current context. --- .../ui/src/esign/coderabbit_round2_repro.rs | 32 +++++++++++++++++++ crates/ui/src/esign/mod.rs | 11 ++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/crates/ui/src/esign/coderabbit_round2_repro.rs b/crates/ui/src/esign/coderabbit_round2_repro.rs index 96fe9d1f5..8eae9a84b 100644 --- a/crates/ui/src/esign/coderabbit_round2_repro.rs +++ b/crates/ui/src/esign/coderabbit_round2_repro.rs @@ -70,3 +70,35 @@ fn reset_capabilities_reprobes_the_same_backend_after_an_out_of_band_sign_in() { assert!(dialog.linked, "reset_capabilities did not pick up the backend's new linked state"); } + +/// The captured send context belongs only to the create submission that +/// answers a taken [`SendRequest`]. A status refresh submitted for the +/// current document while another document's send is still outstanding must +/// carry the current context, or `pump` drops its reply as belonging to the +/// abandoned send. +#[test] +fn status_for_the_current_document_is_not_consumed_by_an_outstanding_send_from_another() { + let (mut dialog, hold) = ready(); + + // Document A's send is taken by the app but never submitted: its captured + // context stays pending. + dialog.open("doc-A".into(), "A.pdf".into(), None, who("alice")); + send(&mut dialog, b"A bytes"); + + // The dialog moves on to document B, which already has an envelope the + // host wants a status for. + dialog.open("doc-B".into(), "B.pdf".into(), None, who("alice")); + dialog.envelope = Some(envelope_for("doc-B", "alice")); + let env_id = dialog.envelope.as_ref().map(|e| e.id.clone()).unwrap_or_default(); + + dialog.submit_request(Request::Status { envelope: env_id }); + let (_, status) = hold.take(|r| matches!(r, Request::Status { .. })); + status.answer(Answer::Status(Envelope { status: EnvelopeStatus::Completed, ..envelope_for("doc-B", "alice") })); + dialog.pump(1.0); + + assert_eq!( + dialog.envelope.as_ref().map(|e| e.status), + Some(EnvelopeStatus::Completed), + "B's status reply was dropped because the status request consumed A's outstanding send context" + ); +} diff --git a/crates/ui/src/esign/mod.rs b/crates/ui/src/esign/mod.rs index 244db54ba..64087bbd5 100644 --- a/crates/ui/src/esign/mod.rs +++ b/crates/ui/src/esign/mod.rs @@ -378,7 +378,16 @@ impl EsignDialog { /// install under whichever context happens to be current when this is /// finally called. pub fn submit_request(&mut self, request: Request) { - let context = self.pending_send_context.take().unwrap_or_else(|| self.current_context()); + // The captured send context belongs to the create submission answering + // a taken [`SendRequest`], and to nothing else. A status refresh (or + // any other request) submitted while that send is still outstanding is + // the current document's business: tagging it with the old send's + // context would make `pump` drop its reply as stale. + let context = if matches!(request, Request::Create { .. }) { + self.pending_send_context.take().unwrap_or_else(|| self.current_context()) + } else { + self.current_context() + }; // A public `Request::Status` submission is request-specific routing // state too: without this, `pump`'s `status_seq` guard never sees // this sequence and drops the reply that comes back for it. From a64ad5959339ed480bdab023b35c0ff88a9e06ba Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 11 Nov 2026 23:44:44 -0500 Subject: [PATCH 139/183] craft-esign make the outstanding-send regression test actually outstanding The send helper submitted the create immediately, consuming the captured context before the status request ran. The test now queues and takes document A's send without submitting it, leaving the context pending. That pending context is the scenario the guard exists for. --- crates/ui/src/esign/coderabbit_round2_repro.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/ui/src/esign/coderabbit_round2_repro.rs b/crates/ui/src/esign/coderabbit_round2_repro.rs index 8eae9a84b..190ca1fa9 100644 --- a/crates/ui/src/esign/coderabbit_round2_repro.rs +++ b/crates/ui/src/esign/coderabbit_round2_repro.rs @@ -81,9 +81,13 @@ fn status_for_the_current_document_is_not_consumed_by_an_outstanding_send_from_a let (mut dialog, hold) = ready(); // Document A's send is taken by the app but never submitted: its captured - // context stays pending. + // context stays pending. The `send` helper would submit the create and + // consume that context, which is exactly what this test must avoid. dialog.open("doc-A".into(), "A.pdf".into(), None, who("alice")); - send(&mut dialog, b"A bytes"); + dialog.add_email("bob@example.com".into()); + dialog.queue_send(); + let taken = dialog.take_send_request(); + assert!(taken.is_some(), "A's send request was taken, leaving its context pending"); // The dialog moves on to document B, which already has an envelope the // host wants a status for. From 22978401ce6819d5f6a930385469b20df31d1878 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Tue, 17 Nov 2026 15:57:28 -0500 Subject: [PATCH 140/183] Cargo.toml: drop the craft-cloud workspace entry that #160 landed This branch added craft-cloud to [workspace.dependencies] for the e-sign dialog's vocabulary. #160 added the same entry beside craft-cloud-local while this branch waited, in a different place in the list, so the rebase kept both and cargo refused the manifest. Main's entry stays. Cargo.lock is regenerated on the new base. --- Cargo.lock | 11 +++++++++++ Cargo.toml | 1 - 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index d9bd3a98c..daede0085 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1912,6 +1912,16 @@ dependencies = [ "zip 9.1.3", ] +[[package]] +name = "craft-esign" +version = "0.1.0" +dependencies = [ + "craft-cloud", + "serde", + "serde_json", + "thiserror 2.0.21", +] + [[package]] name = "craft-evm" version = "0.1.0" @@ -3285,6 +3295,7 @@ name = "craft-ui" version = "0.1.0" dependencies = [ "craft-cloud", + "craft-esign", "craft-fonts-build", "craft-i18n", "eframe", diff --git a/Cargo.toml b/Cargo.toml index f79734650..3ad015a19 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,6 @@ craft-atomic = { path = "crates/atomic" } craft-xtask = { path = "crates/xtask" } craft-captions = { path = "crates/captions" } craft-cfb = { path = "crates/cfb" } -craft-cloud = { path = "crates/cloud" } craft-codepage = { path = "crates/codepage" } craft-cms = { path = "crates/cms" } craft-cloud = { path = "crates/cloud" } From bfe246b5b4b795f0c763aed751b4f9a628f41de1 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Tue, 17 Nov 2026 16:33:50 -0500 Subject: [PATCH 141/183] craft-ui: leave the menu module ungated, as main has it This branch gated `pub mod menu;` behind the esign feature, which was right when main had no menu module of its own. #160 landed one, and its cloud pages use it (crates/ui/src/cloud/pages.rs, cloud/title.rs). The gate therefore broke every build with cloud on and esign off, which is what the workspace clippy leg does. The gate was the whole remaining content of the commit that carried the helper across. --- crates/ui/src/lib.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/crates/ui/src/lib.rs b/crates/ui/src/lib.rs index 980bd4f63..a1c091ff1 100644 --- a/crates/ui/src/lib.rs +++ b/crates/ui/src/lib.rs @@ -23,9 +23,6 @@ pub mod icons; pub mod ime; pub mod layout; pub mod localized; -// Split-button menu helper carried with the esign slice; main's craft-ui no longer has a -// standalone menu module, and only the esign dialog uses this one. -#[cfg(feature = "esign")] pub mod menu; pub mod panes; pub mod presence; From a3784a72edfedbca0d968e23febff43f3e265059 Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 18 Nov 2026 03:16:31 +0100 Subject: [PATCH 142/183] test(ci): keep full gate source out of shell harness --- scripts/test-full-validation.py | 46 ++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/scripts/test-full-validation.py b/scripts/test-full-validation.py index f0e4153af..658f49f54 100644 --- a/scripts/test-full-validation.py +++ b/scripts/test-full-validation.py @@ -5,6 +5,7 @@ from pathlib import Path import subprocess import sys import unittest +from unittest.mock import patch ROOT = Path(__file__).resolve().parents[1] SCRIPT = ROOT / "scripts/ci-full-validation.sh" @@ -20,7 +21,30 @@ COMMANDS = [ ] +# Validate the real script, but execute only this fixed, reviewed command sequence. +# Repository-file bytes must never become bash -c source in a mock-only harness. +SOURCE = r""" +set -euo pipefail +unset CRAFT_HOSTILE_DIVISOR PROPTEST_CASES +if [ "${RUNNER_OS:-}" = Windows ]; then + powershell.exe -NoProfile -Command '$ErrorActionPreference = "Stop"; Start-Service Spooler; Add-PrinterDriver -Name "Generic / Text Only"' +fi +cargo fmt --check +cargo clippy --workspace --all-targets --locked -- -D warnings +cargo clippy --workspace --all-targets --all-features --locked -- -D warnings +cargo test --workspace --locked +cargo test --workspace --all-features --locked +""" + + +def source_lines(text): + return [line.strip() for line in text.splitlines() + if line.strip() and not line.lstrip().startswith("#")] + + def run(os_name, fail=""): + if source_lines(SCRIPT.read_text()) != source_lines(SOURCE): + raise AssertionError("full validation command sequence changed") env = dict(os.environ, RUNNER_OS=os_name, FAIL=fail, CRAFT_HOSTILE_DIVISOR="8", PROPTEST_CASES="64") mock = r""" @@ -31,11 +55,31 @@ cargo() { } powershell.exe() { printf 'print-queue\n'; } """ - return subprocess.run([BASH, "-c", mock + SCRIPT.read_text()], env=env, + return subprocess.run([BASH, "-c", mock + SOURCE], env=env, capture_output=True, text=True, check=False) class FullValidation(unittest.TestCase): + def test_changed_source_is_rejected_without_execution(self): + for source in [ + SOURCE + "\necho injected", + SOURCE.replace("cargo fmt --check", "cargo fmt --check; echo injected"), + SOURCE.replace("cargo fmt --check", "cargo fmt $(echo injected) --check"), + SOURCE.replace("cargo test --workspace --locked", ""), + SOURCE + "\ncargo test --workspace --locked", + ]: + with self.subTest(source=source): + with patch.object(Path, "read_text", return_value=source), patch.object(subprocess, "run") as execute: + with self.assertRaises(AssertionError): + run("Linux") + execute.assert_not_called() + + def test_comments_and_blank_lines_do_not_change_commands(self): + with patch.object(Path, "read_text", return_value="# harmless comment\n\n" + SOURCE): + result = run("Linux") + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertEqual(result.stdout.splitlines(), COMMANDS) + def test_every_os_runs_both_full_configurations(self): for name in ["Linux", "macOS", "Windows"]: with self.subTest(os=name): From 5b1ad7511ce68a56f79d53a66b0dbddb5d2ed943 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Wed, 18 Nov 2026 09:17:21 +0700 Subject: [PATCH 143/183] dex: bound retained reference caller and target strings (#2115) Co-authored-by: FredApps --- crates/dex/src/dex.rs | 65 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/crates/dex/src/dex.rs b/crates/dex/src/dex.rs index e25acb859..3ecc8224c 100644 --- a/crates/dex/src/dex.rs +++ b/crates/dex/src/dex.rs @@ -686,8 +686,18 @@ pub struct Reference { pub target: String, } +/// Maximum caller and target string bytes retained across a reference query. +/// A count limit alone cannot bound repeated, amplified method signatures. +const MAX_REFERENCE_BYTES: usize = 64 << 20; + /// Every instruction that refers to class `desc` (optionally only its methods named `method`). +/// Returns a truncated prefix when the count or aggregate caller/target byte budget is exhausted. pub fn references(dex: &Dex<'_>, desc: &str, method: Option<&str>, max: usize) -> (Vec, bool) { + references_with_byte_limit(dex, desc, method, max, MAX_REFERENCE_BYTES) +} + +fn references_with_byte_limit(dex: &Dex<'_>, desc: &str, method: Option<&str>, max: usize, max_bytes: usize) -> (Vec, bool) { + let mut bytes_left = max_bytes; let mut out = Vec::new(); for c in &dex.classes { let cd = dex.class_data(c); @@ -715,7 +725,12 @@ pub fn references(dex: &Dex<'_>, desc: &str, method: Option<&str>, max: usize) - if out.len() >= max { return (out, true); } - out.push(Reference { caller: dex.method_ref(m.method_idx), offset: i.offset, instruction: i.name, kind, target }); + let caller = dex.method_ref(m.method_idx); + let Some(left) = bytes_left.checked_sub(caller.len()).and_then(|left| left.checked_sub(target.len())) else { + return (out, true); + }; + bytes_left = left; + out.push(Reference { caller, offset: i.offset, instruction: i.name, kind, target }); } } } @@ -927,4 +942,52 @@ mod tests { }; assert!(!d.class_data(&c).complete); } + + #[test] + fn references_bound_repeated_long_signatures_before_retaining_results() { + let mut data = vec![0u8; 578]; + data[4..8].copy_from_slice(&256u32.to_le_bytes()); + // 256 parameter entries all refer to the same long descriptor. + // One direct method at offset 520, with code at 544 (ULEB128 A0 04). + data[520..528].copy_from_slice(&[0, 0, 1, 0, 0, 0, 0xa0, 4]); + data[556..560].copy_from_slice(&9u32.to_le_bytes()); + for offset in [560, 566, 572] { + data[offset..offset + 2].copy_from_slice(&0x0071u16.to_le_bytes()); + } + let desc = format!("L{};", "x".repeat(256)); + let mut dex = bare_dex(&data, vec![desc.clone(), "run".into()], vec![0]); + dex.protos.push(ProtoId { shorty: 0, ret: 0, params_off: 4 }); + dex.methods.push(MemberId { class_idx: 0, type_or_proto: 0, name_idx: 1 }); + dex.classes.push(ClassDef { + class_idx: 0, + access: 0, + superclass_idx: NO_INDEX, + interfaces_off: 0, + source_file_idx: NO_INDEX, + annotations_off: 0, + class_data_off: 520, + static_values_off: 0, + }); + let signature = dex.method_ref(0); + assert!(signature.len() > 256 * 256); + let pair_bytes = signature.len() * 2; + let (all, truncated) = references_with_byte_limit(&dex, &desc, Some("run"), 100, pair_bytes * 3); + assert!(!truncated); + assert_eq!(all.len(), 3); + assert!(all.iter().all(|r| r.caller == signature && r.target == signature)); + let (bounded, truncated) = references_with_byte_limit(&dex, &desc, Some("run"), 100, pair_bytes * 2); + assert!(truncated); + assert_eq!(bounded, all[..2]); + assert_eq!(bounded.iter().map(|r| r.caller.len() + r.target.len()).sum::(), pair_bytes * 2); + let (below_one, truncated) = references_with_byte_limit(&dex, &desc, Some("run"), 100, pair_bytes - 1); + assert!(truncated); + assert!(below_one.is_empty()); + let (count_limited, truncated) = references_with_byte_limit(&dex, &desc, Some("run"), 1, usize::MAX); + assert!(truncated); + assert_eq!(count_limited, all[..1]); + let (zero, truncated) = references_with_byte_limit(&dex, &desc, Some("run"), 0, usize::MAX); + assert!(truncated); + assert!(zero.is_empty()); + assert_eq!(references(&dex, &desc, Some("run"), 100), (all, false)); + } } From 72d8ac7c6cfe846cb848a3938d08a1474d4260c9 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Wed, 18 Nov 2026 09:17:29 +0700 Subject: [PATCH 144/183] fix(xfa): bound retained namespace copies before allocation (#2122) Co-authored-by: FredApps --- crates/xfa/README.md | 4 ++-- crates/xfa/src/xml.rs | 50 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/crates/xfa/README.md b/crates/xfa/README.md index a3548c2d1..21620cbb9 100644 --- a/crates/xfa/README.md +++ b/crates/xfa/README.md @@ -1,8 +1,8 @@ # craft-xfa -Scoped namespace-aware XML DOM extracted unchanged from PDFCraft xfa/xml.rs at 271e479c. This is not a complete XFA implementation: template interpretation, packets, data binding, scripts, layout, fonts and PDF generation remain app-owned. +Scoped namespace-aware XML DOM extracted from PDFCraft xfa/xml.rs at 271e479c. This is not a complete XFA implementation: template interpretation, packets, data binding, scripts, layout, fonts and PDF generation remain app-owned. -Preserves source byte ranges, coalesced text, namespace shadowing and document-local node identities. Uses craft-xml strict events with DTD rejection by default, depth 1024 and caller node count. Other event-reader defaults remain in force. Namespace snapshots are copied per element as before; this is not a new total-memory bound or a full XML namespaces conformance claim. +Preserves source byte ranges, coalesced text, namespace shadowing and document-local node identities. Uses craft-xml strict events with DTD rejection by default, depth 1024 and caller node count. Other event-reader defaults remain in force. Namespace snapshots are copied per element as before, with a 64 MiB cumulative pre-allocation budget for snapshot entry headers, prefix/URI bytes and resolved element/attribute namespace URI copies. Excess returns an error. This intentionally tightens resource admission; it is not a total DOM memory bound or a full XML namespaces conformance claim. Original source by Dylan M. Taylor (eead4541, 7d44e654), MIT OR Apache-2.0. diff --git a/crates/xfa/src/xml.rs b/crates/xfa/src/xml.rs index b76f4d755..70fe5d580 100644 --- a/crates/xfa/src/xml.rs +++ b/crates/xfa/src/xml.rs @@ -2,6 +2,7 @@ use std::ops::Range; +const MAX_NAMESPACE_BYTES: usize = 64 << 20; const XML_NS: &str = "http://www.w3.org/XML/1998/namespace"; const XMLNS_NS: &str = "http://www.w3.org/2000/xmlns/"; @@ -139,31 +140,49 @@ fn split_qname(qname: &str) -> (&str, &str) { } } -fn resolve_ns(scope: &[(String, String)], prefix: &str, is_attr: bool) -> Result, String> { +// One long inherited URI otherwise gets copied into every descendant. Charge retained +// namespace strings and snapshot entry headers before copying, across the whole document. +fn charge_namespace(bytes: &mut usize, amount: usize) -> Result<(), String> { + *bytes = bytes.checked_sub(amount).ok_or_else(|| "namespace retention budget exceeded".to_string())?; + Ok(()) +} + +fn copy_namespace(uri: &str, bytes: &mut usize) -> Result, String> { + charge_namespace(bytes, uri.len())?; + Ok(Some(uri.to_string())) +} + +fn resolve_ns(scope: &[(String, String)], prefix: &str, is_attr: bool, bytes: &mut usize) -> Result, String> { if prefix == "xml" { - return Ok(Some(XML_NS.to_string())); + return copy_namespace(XML_NS, bytes); } if prefix == "xmlns" { - return Ok(Some(XMLNS_NS.to_string())); + return copy_namespace(XMLNS_NS, bytes); } if prefix.is_empty() { if is_attr { return Ok(None); } - return Ok(scope.iter().rev().find(|(p, _)| p.is_empty()).and_then(|(_, u)| (!u.is_empty()).then(|| u.clone()))); + return match scope.iter().rev().find(|(p, _)| p.is_empty()) { + Some((_, u)) if !u.is_empty() => copy_namespace(u, bytes), + _ => Ok(None), + }; } match scope.iter().rev().find(|(p, _)| p == prefix) { - Some((_, u)) if !u.is_empty() => Ok(Some(u.clone())), + Some((_, u)) if !u.is_empty() => copy_namespace(u, bytes), _ => Err(format!("undeclared namespace prefix: {prefix}")), } } - impl Document { pub fn parse(text: &str) -> Result { Self::parse_with_options(text, ParsingOptions::default()) } pub fn parse_with_options(text: &str, options: ParsingOptions) -> Result { + Self::parse_with_namespace_budget(text, options, MAX_NAMESPACE_BYTES) + } + + fn parse_with_namespace_budget(text: &str, options: ParsingOptions, mut namespace_bytes: usize) -> Result { let mut opts = craft_xml::Options { strict: true, doctype: if options.allow_dtd { craft_xml::Doctype::Ignore } else { craft_xml::Doctype::Reject }, @@ -194,20 +213,23 @@ impl Document { } } let (el_prefix, el_local) = split_qname(&name); - let el_ns = resolve_ns(&scope, el_prefix, false)?; + let el_ns = resolve_ns(&scope, el_prefix, false, &mut namespace_bytes)?; let mut el_attrs = Vec::new(); for (k, v) in attrs { if k == "xmlns" || k.starts_with("xmlns:") { continue; } let (ap, al) = split_qname(&k); - let ans = resolve_ns(&scope, ap, true)?; + let ans = resolve_ns(&scope, ap, true, &mut namespace_bytes)?; el_attrs.push(AttrData { ns: ans, name: al.to_string(), value: v }); } // Deduplicate in-scope namespace bindings, keeping the innermost binding per prefix. let mut namespaces: Vec<(String, String)> = Vec::new(); for (p, u) in scope.iter().rev() { if !namespaces.iter().any(|(ep, _)| ep == p) { + charge_namespace(&mut namespace_bytes, std::mem::size_of::<(String, String)>())?; + charge_namespace(&mut namespace_bytes, p.len())?; + charge_namespace(&mut namespace_bytes, u.len())?; namespaces.push((p.clone(), u.clone())); } } @@ -391,6 +413,18 @@ impl<'a> Node<'a> { mod tests { use super::*; + #[test] + fn inherited_namespace_copies_obey_aggregate_byte_admission() { + let uri = format!("urn:{}", "x".repeat(124)); + let snapshot = std::mem::size_of::<(String, String)>() + 1 + uri.len(); + for (child, expanded_copies) in [("", 0), ("", 1), ("", 1), ("", 2)] { + let input = format!("{}", child.repeat(8)); + let needed = 9 * snapshot + 8 * expanded_copies * uri.len(); + assert!(Document::parse_with_namespace_budget(&input, ParsingOptions::default(), needed).is_ok()); + assert!(Document::parse_with_namespace_budget(&input, ParsingOptions::default(), needed - 1).is_err()); + assert!(Document::parse_with_namespace_budget(&input, ParsingOptions::default(), 0).is_err()); + } + } #[test] fn namespace_shadowing_attributes_text_and_source_ranges() { let text = "onethree"; From 6b16ec2b416a91abaf2ccc49a8a29921c3a75546 Mon Sep 17 00:00:00 2001 From: David Mann Date: Wed, 18 Nov 2026 03:19:07 +0100 Subject: [PATCH 145/183] craft-control agents: second review round (#2141) - The token is passed on as the app wrote it (trimmed): craft-control's server compares exactly and accepts any CONTROL_TOKEN of 32+ chars. The token file is checked as a regular file before it is opened (a FIFO would block the open). - Allow Agent Control off counts as not allowed on the CLI's side too. - A window route is dropped once no app accepts agents. - A headless session with the app's agent folders ends when the person stops letting agents in. - The launch timeout is capped and the deadline computed without overflow; the poll interval is kept between 1 ms and 1 s. - The connect error names the app's window; the guide says to remove the connection file on quit and that one process per settings folder accepts agents; the AppImage mount is compared after resolving links. - Tests for each, and a wider margin in the queued-start test. --- crates/control/src/agents/live.rs | 139 +++++++++++++++++++++--------- crates/control/src/agents/mod.rs | 11 ++- crates/control/src/lib.rs | 3 +- crates/control/tests/agents.rs | 127 +++++++++++++++++++++++++-- 4 files changed, 227 insertions(+), 53 deletions(-) diff --git a/crates/control/src/agents/live.rs b/crates/control/src/agents/live.rs index a151a137b..49b242ff5 100644 --- a/crates/control/src/agents/live.rs +++ b/crates/control/src/agents/live.rs @@ -7,15 +7,20 @@ //! //! - An app that accepts agents: the call goes to its open window ([`Route::Window`]). The same //! port, token and process id keep the window client the app made; any change makes a new one. -//! - No app accepts agents, and the person doesn't let agents use it: a session without a window -//! with only the folders given to the command ([`LiveConfig::read_roots`], [`LiveConfig::write_root`]), -//! as `mcp` always worked. The app's own folders are for agents the person let in. +//! - No app accepts agents, and the person doesn't let agents use it ([`Consent::allowed`] off, or +//! [`AgentSettings::allow_agent_control`] off, under which the app doesn't listen either): a +//! session without a window with only the folders given to the command +//! ([`LiveConfig::read_roots`], [`LiveConfig::write_root`]), as `mcp` always worked. The app's own +//! folders are for agents the person let in. //! - No app accepts agents, but agents are allowed: the closed-app choice decides //! ([`LiveConfig::when_closed`], otherwise [`AgentSettings::when_app_closed`]): start the app and //! wait until it accepts agents, a headless session with the app's agent folders (the command's //! folders win), or an error that says what to do. //! -//! Once headless, the session stays headless: documents don't move under the agent. Lookups are +//! Once headless, the session stays headless: documents don't move under the agent. Only a session +//! made with the app's agent folders ends when the person stops letting agents in; the next call +//! gets one with the command's folders. A window route is dropped as soon as no app accepts agents. +//! Lookups are //! serialised, so concurrent calls start the app once: calls that queued while a start was under //! way and found no window get that start's error rather than starting the app again; a call made //! after it tries again. @@ -49,6 +54,10 @@ pub type HeadlessFn = Box Result + Sen pub const LAUNCH_TIMEOUT: Duration = Duration::from_secs(45); /// How often a starting app's connection file is looked for. pub const LAUNCH_POLL: Duration = Duration::from_millis(250); +/// The longest [`LiveConfig::launch_timeout`] used; a longer one is cut to this. +const MAX_LAUNCH_TIMEOUT: Duration = Duration::from_secs(600); +/// The range [`LiveConfig::poll`] is kept in. +const POLL_RANGE: (Duration, Duration) = (Duration::from_millis(1), Duration::from_secs(1)); /// The open window a call goes to: from the connection file, with the token from its token file. #[derive(Clone, PartialEq, Eq)] @@ -58,7 +67,7 @@ pub struct Window { pub port: u16, /// The app's process id. pub pid: u32, - /// The control token (hex digits, lower case). + /// The control token, as its token file holds it (trimmed). pub token: String, } @@ -80,8 +89,9 @@ impl fmt::Debug for Window { #[derive(Clone, Debug, Default, PartialEq, Eq)] #[non_exhaustive] pub struct Consent { - /// Agents may use the app ([`super::agents_allowed`]: with the suite's `AI-MCP` flag, the - /// ArtCraft Launcher's switch). + /// Agents may use the app: `agents_allowed(mcp_flag(), launcher_allows(""), legacy)` + /// ([`super::agents_allowed`]), with the suite's `AI-MCP` flag the ArtCraft Launcher's switch. + /// [`Live`] also requires [`AgentSettings::allow_agent_control`]. pub allowed: bool, /// The app's agent settings (closed-app choice, folders). pub settings: AgentSettings, @@ -130,9 +140,9 @@ pub struct LiveConfig { pub write_root: Option, /// Starts the app; `None` when this install can't ([`launcher`] found nothing to start). pub launch: Option, - /// How long a started app gets to accept agents ([`LAUNCH_TIMEOUT`]). + /// How long a started app gets to accept agents ([`LAUNCH_TIMEOUT`]; at most 10 minutes). pub launch_timeout: Duration, - /// How often a starting app is looked for ([`LAUNCH_POLL`]). + /// How often a starting app is looked for ([`LAUNCH_POLL`]; kept between 1 ms and 1 s). pub poll: Duration, consent: ConsentFn, connect: ConnectFn, @@ -168,8 +178,15 @@ impl LiveConfig { /// The port, token and process id a window client was made for: a restarted app may keep its /// port and token, but its old socket is gone. type WindowKey = (u16, String, u32); -/// The current route, and for a window the key it was made for. -type Current = Option<(Route, Option)>; +/// The route the last call took. +struct Current { + route: Route, + /// For a window, the key its client was made for. + key: Option, + /// A headless session that holds folders of the app's agent settings: it lasts only while + /// the person lets agents in. + app_folders: bool, +} /// Resolves each tool call of one MCP session; see the module docs. pub struct Live { @@ -178,7 +195,7 @@ pub struct Live { lookup: Mutex>, /// How many starts have finished, read before a call queues for `lookup`. finished: AtomicU64, - current: Mutex>, + current: Mutex>>, } impl Live { @@ -189,38 +206,67 @@ impl Live { /// The route the last [`Self::resolve`] chose, if any. pub fn current(&self) -> Option> { - self.current.lock().unwrap_or_else(PoisonError::into_inner).as_ref().map(|(r, _)| r.clone()) + self.current.lock().unwrap_or_else(PoisonError::into_inner).as_ref().map(|c| c.route.clone()) } - fn set(&self, route: Route, key: Option) -> Route { - *self.current.lock().unwrap_or_else(PoisonError::into_inner) = Some((route.clone(), key)); + fn set(&self, route: Route, key: Option, app_folders: bool) -> Route { + *self.current.lock().unwrap_or_else(PoisonError::into_inner) = Some(Current { route: route.clone(), key, app_folders }); route } + /// The headless session to keep using, if any: one made with the app's folders only while + /// agents are still `allowed`. A route that may not be kept is dropped. + fn sticky_headless(&self, allowed: bool) -> Option> { + let mut current = self.current.lock().unwrap_or_else(PoisonError::into_inner); + match current.as_ref() { + Some(c) if matches!(c.route, Route::Headless(_)) && (allowed || !c.app_folders) => Some(c.route.clone()), + Some(c) if matches!(c.route, Route::Headless(_)) => { + *current = None; + None + } + _ => None, + } + } + + /// Forgets a window route: no app accepts agents any more, so its client is for a socket + /// that is gone. + fn drop_window(&self) { + let mut current = self.current.lock().unwrap_or_else(PoisonError::into_inner); + if current.as_ref().is_some_and(|c| matches!(c.route, Route::Window(_))) { + *current = None; + } + } + /// Where the next tool call goes. Blocks; see the module docs. The error is the tool call's /// result. pub fn resolve(&self) -> Result, String> { let queued_at = self.finished.load(Ordering::Acquire); let mut last_failure = self.lookup.lock().unwrap_or_else(PoisonError::into_inner); - if let Some(route @ Route::Headless(_)) = self.current() { + let consent = (self.cfg.consent)(&self.cfg.config_dir); + // Allow Agent Control off refuses agents, as the app does: it doesn't listen then. + let allowed = consent.allowed && consent.settings.allow_agent_control; + if let Some(route) = self.sticky_headless(allowed) { return Ok(route); } - let consent = (self.cfg.consent)(&self.cfg.config_dir); if let Some(window) = self.find_app()? { return self.use_window(window); } - if !consent.allowed { - let folders = HeadlessFolders { read: self.cfg.read_roots.clone(), write: self.cfg.write_root.clone() }; - return self.headless(&folders, "the automation roots can't be used"); - } + self.drop_window(); let app = &self.cfg.app_name; + if !allowed { + let folders = HeadlessFolders { read: self.cfg.read_roots.clone(), write: self.cfg.write_root.clone() }; + return self.headless(&folders, false, &format!("{app} can't use the automation roots")); + } match self.cfg.when_closed.unwrap_or(consent.settings.when_app_closed) { WhenAppClosed::Error => Err(format!("{app} isn't running: open it, then try again.")), WhenAppClosed::Headless => { + let app_read = self.cfg.read_roots.is_empty() && consent.settings.read_folder().is_some(); + let app_write = self.cfg.write_root.is_none() && consent.settings.write_folder().is_some(); let read = if self.cfg.read_roots.is_empty() { consent.settings.read_folder().into_iter().collect() } else { self.cfg.read_roots.clone() }; let write = self.cfg.write_root.clone().or_else(|| consent.settings.write_folder()); - self.headless(&HeadlessFolders { read, write }, &format!("{app} isn't running and its agent folders can't be used")) + let why = format!("{app} isn't running and its agent folders can't be used"); + self.headless(&HeadlessFolders { read, write }, app_read || app_write, &why) } WhenAppClosed::Launch => { // A start finished while this call waited and the app still isn't there: its answer @@ -238,44 +284,51 @@ impl Live { } } - fn headless(&self, folders: &HeadlessFolders, why: &str) -> Result, String> { + /// A headless session with `folders` from now on; `app_folders` when some of them are the + /// app's agent folders. `why` leads its error. + fn headless(&self, folders: &HeadlessFolders, app_folders: bool, why: &str) -> Result, String> { let session = (self.cfg.headless)(folders).map_err(|e| format!("{why}: {e}"))?; - Ok(self.set(Route::Headless(session), None)) + Ok(self.set(Route::Headless(session), None, app_folders)) } + /// Starts the app and waits until it accepts agents, at most the launch timeout. fn launch_and_wait(&self) -> Result, String> { let app = &self.cfg.app_name; let Some(launch) = &self.cfg.launch else { return Err(format!("{app} isn't running, and this install can't start it from here: open {app}, then try again.")); }; launch().map_err(|e| format!("couldn't start {app}: {e}"))?; - let deadline = Instant::now() + self.cfg.launch_timeout; + let timeout = self.cfg.launch_timeout.min(MAX_LAUNCH_TIMEOUT); + let started = Instant::now(); + let deadline = started.checked_add(timeout).unwrap_or(started); + let poll = self.cfg.poll.clamp(POLL_RANGE.0, POLL_RANGE.1); loop { - std::thread::sleep(self.cfg.poll); + std::thread::sleep(poll); if let Some(window) = self.find_app()? { return self.use_window(window); } if Instant::now() >= deadline { return Err(format!( "{app} didn't accept agents within {} s of starting. If it's still opening, try again in a moment; otherwise check that AI agents are on in ArtCraft Launcher › Settings › AI agents.", - self.cfg.launch_timeout.as_secs() + timeout.as_secs() )); } } } + /// The client for `window`: the one made for the same port, token and process, or a new one. fn use_window(&self, window: Window) -> Result, String> { let key: WindowKey = (window.port, window.token.clone(), window.pid); { let current = self.current.lock().unwrap_or_else(PoisonError::into_inner); - if let Some((route, Some(k))) = current.as_ref() - && *k == key + if let Some(c) = current.as_ref() + && c.key.as_ref() == Some(&key) { - return Ok(route.clone()); + return Ok(c.route.clone()); } } - let client = (self.cfg.connect)(&window)?; - Ok(self.set(Route::Window(client), Some(key))) + let client = (self.cfg.connect)(&window).map_err(|e| format!("couldn't reach {}'s window: {e}", self.cfg.app_name))?; + Ok(self.set(Route::Window(client), Some(key), false)) } /// The app accepting agents now: `None` when there is no connection file, or one left by an @@ -299,12 +352,17 @@ pub fn find_window(dir: &Path, app_name: &str) -> Result, String> /// The largest token file read; a token is far shorter. const MAX_TOKEN_FILE: u64 = 4096; -/// The token in the token file at `path`, trimmed. The file must be a regular file of at most -/// [`MAX_TOKEN_FILE`] bytes holding a non-empty token of hex digits, and on Unix readable by its -/// owner only: a token others could read is refused rather than used. +/// The token in the token file at `path`, trimmed and otherwise as written: the app's server +/// compares it exactly ([`crate::auth::tokens_match`]). The file must be a regular file of at most +/// [`MAX_TOKEN_FILE`] bytes holding one token (no spaces or control characters in it), and on Unix +/// readable by its owner only: a token others could read is refused rather than used. fn read_token(path: &Path) -> Result { use std::io::Read; let shown = |e: &dyn fmt::Display| format!("{}: {e}", path.display()); + // Before opening: opening a FIFO for reading blocks until something writes to it. + if !std::fs::metadata(path).map_err(|e| shown(&e))?.is_file() { + return Err(shown(&"not a regular file")); + } let file = std::fs::File::open(path).map_err(|e| shown(&e))?; let meta = file.metadata().map_err(|e| shown(&e))?; if !meta.is_file() { @@ -323,10 +381,10 @@ fn read_token(path: &Path) -> Result { return Err(shown(&format!("larger than {MAX_TOKEN_FILE} bytes"))); } let token = text.trim(); - if token.is_empty() || !token.bytes().all(|b| b.is_ascii_hexdigit()) { + if token.is_empty() || token.chars().any(|c| c.is_whitespace() || c.is_control()) { return Err(shown(&"not a control token")); } - Ok(token.to_ascii_lowercase()) + Ok(token.to_owned()) } /// How to start the desktop app `exe` (its file name without `.exe`) that ships beside the CLI at @@ -336,14 +394,16 @@ fn read_token(path: &Path) -> Result { pub fn launcher(cli: &Path, exe: &str) -> Option { use std::process::{Command, Stdio}; let env = |name: &str| std::env::var_os(name).filter(|v| !v.is_empty()); + // Both sides resolved, so a mount reached through a symlink (`$TMPDIR`) still matches. + let resolved = |p: &Path| std::fs::canonicalize(p).unwrap_or_else(|_| p.to_path_buf()); let install = Install { platform: Platform::current(), flatpak: env("FLATPAK_ID").is_some(), appimage: env("APPIMAGE"), - appdir: env("APPDIR"), + appdir: env("APPDIR").map(|d| resolved(Path::new(&d)).into_os_string()), system_root: env("SystemRoot"), }; - let (program, args) = launch_command(cli, exe, &install, &|p| p.is_file())?; + let (program, args) = launch_command(&resolved(cli), exe, &install, &|p| p.is_file())?; let mut command = Command::new(program); command.args(args); let command = Mutex::new(command); @@ -391,6 +451,7 @@ enum Platform { } impl Platform { + /// The platform this build runs on. fn current() -> Self { if cfg!(windows) { Self::Windows diff --git a/crates/control/src/agents/mod.rs b/crates/control/src/agents/mod.rs index 8deaa34bd..e1b0b9923 100644 --- a/crates/control/src/agents/mod.rs +++ b/crates/control/src/agents/mod.rs @@ -14,7 +14,7 @@ //! reads that file before every tool call ([`Live`]), so an MCP client's configuration never holds //! a port or a token. The file holds no secret. A crashed app can leave it behind; nothing then //! listens on its port ([`probe`]), and the app's next launch removes it -//! ([`remove_stale_connection`]). +//! ([`remove_stale_connection`]). An app that quits removes its own ([`remove_connection`]). //! //! | Part | Names | Builds | //! |---|---|---| @@ -37,13 +37,16 @@ //! launcher's switch wakes the app and when the person changes the setting. When it turns true, //! listen on loopback with a token, the token in an owner-only file //! ([`crate::auth::App::write_token_file`]), and [`write_connection`] with [`Connection::new`]; -//! when it turns false, stop listening and [`remove_connection`] with the app's process id. No -//! restart, no agents switch of its own. +//! when it turns false, and when the app quits, stop listening and [`remove_connection`] with +//! the app's process id. No restart, no agents switch of its own. There is one connection file +//! per settings folder: an app that runs more than one process on one folder lets only one of +//! them accept agents. //! //! Its `gridcraft-cli mcp`: //! //! 1. A [`LiveConfig`] with the app's settings folder; `consent` reads its saved -//! [`AgentSettings`] and asks [`launcher_allows`]; `connect` makes the app's client for a +//! [`AgentSettings`] and answers `agents_allowed(mcp_flag(), launcher_allows("gridcraft"), legacy)` +//! ([`agents_allowed`], [`mcp_flag`], [`launcher_allows`]); `connect` makes the app's client for a //! [`Window`] (its address and token); `headless` makes its session without a window for //! [`HeadlessFolders`]. [`launcher`] starts the app beside the CLI. //! 2. Before every tool call, [`Live::resolve`] (from a blocking thread in an async server), then diff --git a/crates/control/src/lib.rs b/crates/control/src/lib.rs index d2e4f3d95..56ce2e685 100644 --- a/crates/control/src/lib.rs +++ b/crates/control/src/lib.rs @@ -3,7 +3,8 @@ //! request to the window ([`server`]), the client that talks to it ([`client`]), the request the //! window answers ([`ControlRequest`]), the document watch subscribed connections wait on //! ([`DocumentWatch`]), what a request still running does when it finishes ([`Effect`]), and AI -//! agents in the open window behind the ArtCraft Launcher's switch ([`agents`], feature `agents`). It +//! agents in the open window behind the ArtCraft Launcher's switch ([`agents`]: its settings on +//! every target, the switch, the connection file and the CLI's side with feature `agents`). It //! needs no UI toolkit; the window's own requests over egui (`ui.screenshot`, `ui.resize`) are //! `craft-control-egui`. #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] diff --git a/crates/control/tests/agents.rs b/crates/control/tests/agents.rs index c5e39251a..95a4651eb 100644 --- a/crates/control/tests/agents.rs +++ b/crates/control/tests/agents.rs @@ -246,7 +246,11 @@ fn an_open_app_takes_the_call_and_keeps_its_client_until_it_restarts() { // Even without consent: an app publishes its connection only while it accepts agents. let live = TestLive::new(config(dir.path(), Consent::default(), &made)); let w = window(live.resolve()); - assert_eq!((w.port, w.pid, w.token.as_str(), w.addr()), (c.port, c.pid, TOKEN, c.addr()), "the token is trimmed and lower-cased"); + assert_eq!( + (w.port, w.pid, w.token.as_str(), w.addr()), + (c.port, c.pid, TOKEN.to_ascii_uppercase().as_str(), c.addr()), + "the token is trimmed, otherwise as written" + ); window(live.resolve()); assert_eq!(made.connects.load(Ordering::Relaxed), 1, "the same window keeps its client"); assert!(matches!(live.current(), Some(Route::Window(_)))); @@ -333,8 +337,8 @@ fn a_crashed_apps_connection_file_counts_as_closed() { assert_eq!(find_window(dir.path(), "Test").unwrap(), None); } -/// A token file that isn't a token, is too big or is missing fails the call and names the app; -/// nothing is sent to the window. +/// A token file that isn't a token, is too big, is missing, isn't a regular file or (on Unix) +/// others can read fails the call and names the app; nothing is sent to the window. #[test] fn a_bad_token_file_fails_the_call() { let dir = temp_dir("token"); @@ -345,6 +349,23 @@ fn a_bad_token_file_fails_the_call() { let err = TestLive::new(config(dir.path(), Consent::default(), &made)).resolve().err().unwrap(); assert!(err.starts_with("Test's agent token: "), "{err}"); } + // Any token the app's server accepts is passed on: upper case, dashes. + write_token(&dir.path().join(TOKEN_FILE), "AB12-cd34-EF56-0000-1111-2222-3333-4444"); + assert_eq!(find_window(dir.path(), "Test").unwrap().unwrap().token, "AB12-cd34-EF56-0000-1111-2222-3333-4444"); + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + let token = dir.path().join(TOKEN_FILE); + write_token(&token, TOKEN); + std::fs::set_permissions(&token, std::fs::Permissions::from_mode(0o644)).unwrap(); + let err = find_window(dir.path(), "Test").err().unwrap(); + assert!(err.contains("readable by group or others"), "{err}"); + // A FIFO would block a plain open until something writes to it. + std::fs::remove_file(&token).unwrap(); + assert!(std::process::Command::new("mkfifo").arg(&token).status().unwrap().success()); + let err = find_window(dir.path(), "Test").err().unwrap(); + assert!(err.contains("not a regular file"), "{err}"); + } std::fs::remove_file(dir.path().join(TOKEN_FILE)).unwrap(); assert!(find_window(dir.path(), "Test").is_err()); assert_eq!(made.connects.load(Ordering::Relaxed), 0); @@ -362,7 +383,7 @@ fn the_apps_errors_reach_the_agent() { |w: &Window| Ok(w.clone()), |_: &HeadlessFolders| Err("no such folder".into()), ); - assert_eq!(TestLive::new(cfg).resolve().err().unwrap(), "the automation roots can't be used: no such folder"); + assert_eq!(TestLive::new(cfg).resolve().err().unwrap(), "Test can't use the automation roots: no such folder"); let (_listener, _c) = publish(dir.path()); let cfg: LiveConfig = LiveConfig::new( @@ -373,7 +394,7 @@ fn the_apps_errors_reach_the_agent() { |f: &HeadlessFolders| Ok(f.clone()), ); let live = TestLive::new(cfg); - assert_eq!(live.resolve().err().unwrap(), "refused"); + assert_eq!(live.resolve().err().unwrap(), "couldn't reach Test's window: refused"); assert!(live.current().is_none(), "a failed connect leaves no route"); } @@ -438,18 +459,26 @@ fn calls_queued_behind_a_failed_start_share_its_error() { let made = Arc::new(Made::default()); let launches = Arc::new(AtomicUsize::new(0)); let mut cfg = config(dir.path(), allowed(WhenAppClosed::Launch), &made); - let n = launches.clone(); - // The app is started but never accepts agents within the timeout. + let entered = Arc::new(AtomicUsize::new(0)); + let (n, e) = (launches.clone(), entered.clone()); + // The app is started but never accepts agents within the timeout. The start waits until every + // call is under way and then a while longer, so a call that hasn't reached its lookup by the + // time the start ends is very unlikely (there is no hook between the two). cfg.launch = Some(Box::new(move || { n.fetch_add(1, Ordering::Relaxed); + assert!(wait_for(|| e.load(Ordering::Relaxed) == 4), "every call starts"); + std::thread::sleep(Duration::from_millis(250)); Ok(()) })); cfg.launch_timeout = Duration::from_millis(150); let live = Arc::new(TestLive::new(cfg)); let calls: Vec<_> = (0..4) .map(|_| { - let live = live.clone(); - std::thread::spawn(move || live.resolve()) + let (live, entered) = (live.clone(), entered.clone()); + std::thread::spawn(move || { + entered.fetch_add(1, Ordering::Relaxed); + live.resolve() + }) }) .collect(); let answers: Vec<_> = calls.into_iter().map(|c| c.join().unwrap()).collect(); @@ -461,3 +490,83 @@ fn calls_queued_behind_a_failed_start_share_its_error() { assert!(live.resolve().is_err()); assert_eq!(launches.load(Ordering::Relaxed), 2, "a later call starts the app again"); } + +/// Allow Agent Control off refuses agents on the CLI's side too, as the app does by not +/// listening: no start, and only the command's folders. +#[test] +fn allow_agent_control_off_counts_as_not_allowed() { + let dir = temp_dir("aac-off"); + let made = Arc::new(Made::default()); + let mut s = settings(WhenAppClosed::Launch, "/app-in", "/app-out"); + s.allow_agent_control = false; + let mut cfg = config(dir.path(), Consent::new(true, s), &made); + cfg.launch = Some(Box::new(|| panic!("nothing may start the app"))); + cfg.read_roots = paths(&["/cli-in"]); + let f = headless_folders(TestLive::new(cfg).resolve()); + assert_eq!((f.read, f.write), (paths(&["/cli-in"]), None)); +} + +/// A window route is dropped once no app accepts agents, so a dead client isn't kept or handed +/// back. +#[test] +fn a_window_that_went_away_is_forgotten() { + let dir = temp_dir("gone"); + let made = Arc::new(Made::default()); + let live = TestLive::new(config(dir.path(), allowed(WhenAppClosed::Error), &made)); + let (listener, c) = publish(dir.path()); + window(live.resolve()); + drop(listener); + remove_connection(dir.path(), c.pid); + assert!(live.resolve().is_err(), "the app is closed and the choice is an error"); + assert!(live.current().is_none(), "the dead window is gone"); +} + +/// A headless session with the app's agent folders ends when the person stops letting agents in; +/// one with only the command's folders stays. +#[test] +fn a_headless_session_with_the_apps_folders_ends_with_consent() { + let dir = temp_dir("revoke"); + let made = Arc::new(Made::default()); + let on = Arc::new(AtomicBool::new(true)); + let gate = on.clone(); + let (b, c) = (made.clone(), made.clone()); + let cfg: LiveConfig = LiveConfig::new( + "Test", + dir.path().to_path_buf(), + move |_: &Path| Consent::new(gate.load(Ordering::Relaxed), settings(WhenAppClosed::Headless, "/app-in", "/app-out")), + move |w: &Window| { + b.connects.fetch_add(1, Ordering::Relaxed); + Ok(w.clone()) + }, + move |f: &HeadlessFolders| { + c.sessions.fetch_add(1, Ordering::Relaxed); + Ok(f.clone()) + }, + ); + let live = TestLive::new(cfg); + assert_eq!(headless_folders(live.resolve()).read, paths(&["/app-in"])); + on.store(false, Ordering::Relaxed); + assert_eq!(headless_folders(live.resolve()), HeadlessFolders::default(), "the app's folders went with the consent"); + on.store(true, Ordering::Relaxed); + assert_eq!(headless_folders(live.resolve()), HeadlessFolders::default(), "a session without the app's folders stays"); + assert_eq!(made.sessions.load(Ordering::Relaxed), 2); +} + +/// A huge launch timeout or poll is cut down rather than overflowing the deadline or blocking. +#[test] +fn a_huge_launch_timeout_or_poll_neither_panics_nor_hangs() { + let dir = temp_dir("huge"); + let made = Arc::new(Made::default()); + let mut cfg = config(dir.path(), allowed(WhenAppClosed::Launch), &made); + let (d, app) = (dir.path().to_path_buf(), Arc::new(Mutex::new(None))); + let slot = app.clone(); + cfg.launch = Some(Box::new(move || { + *slot.lock().unwrap() = Some(publish(&d).0); + Ok(()) + })); + cfg.launch_timeout = Duration::MAX; + cfg.poll = Duration::MAX; + let started = Instant::now(); + window(TestLive::new(cfg).resolve()); + assert!(started.elapsed() < Duration::from_secs(5), "{:?}", started.elapsed()); +} From aa423ded8095ce5a92e1590aee31a6625f54febe Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Wed, 18 Nov 2026 03:36:07 +0100 Subject: [PATCH 146/183] docs(xfa): distinguish extracted baseline from later hardening --- ATTRIBUTION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 63061b638..eb9a55eeb 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -145,7 +145,7 @@ Sanitization, animation fitting and numeric output policy remain caller-owned. ## XFA XML DOM -`crates/xfa/src/xml.rs` is extracted from PDFCraft at `271e479c53723b1b294c866d5cb2f27604601b29`, originally by Dylan M. Taylor (`eead4541`, `7d44e654`), MIT OR Apache-2.0. Only visibility and module boundaries change; PDF/layout/form policy remains in the app. +`crates/xfa/src/xml.rs` is extracted from PDFCraft at `271e479c53723b1b294c866d5cb2f27604601b29`, originally by Dylan M. Taylor (`eead4541`, `7d44e654`), MIT OR Apache-2.0. The initial extraction changes visibility and module boundaries; subsequent namespace-retention budget hardening intentionally tightens resource admission. PDF/layout/form policy remains in the app. ## Java class inspection From c0edd96888939f70e02066085281f1d3cd9cd7ca Mon Sep 17 00:00:00 2001 From: batistalucasv Date: Wed, 18 Nov 2026 00:31:10 -0300 Subject: [PATCH 147/183] craft-html, craft-flow: preserve table structure, colgroup widths and vertical merges (#1785) (#1802) * craft-html, craft-flow: preserve table structure, colgroup widths and vertical merges (#1785) * craft-html: address CodeRabbit review feedback on vmerge and colgroups (#1785) * craft-html: precompute grid column offsets in table export * craft-html: preserve fully covered rows during table import (#1785) * craft-html: resolve merge conflict artifacts and unclosed delimiter in tests (#1785) * craft-flow, craft-html: validate matching spans on vmerge and preserve leading grid columns (#1785) --- crates/flow/src/from_doc.rs | 5 + crates/flow/src/to_doc.rs | 35 +++ crates/flow/src/types.rs | 18 +- crates/html/src/doc/builder.rs | 142 +++++++++-- crates/html/src/doc/export.rs | 81 ++++++- crates/html/src/doc/tests.rs | 423 +++++++++++++++++++++++++++++++++ 6 files changed, 681 insertions(+), 23 deletions(-) diff --git a/crates/flow/src/from_doc.rs b/crates/flow/src/from_doc.rs index e3e915201..b167779e7 100644 --- a/crates/flow/src/from_doc.rs +++ b/crates/flow/src/from_doc.rs @@ -1114,6 +1114,9 @@ fn flow_table(doc: &Document, t: &Table, depth: usize, tracked: FlowOpts) -> FTa // Word. Only Repeat as header row makes it one then. let header = r.props.header || (ri == 0 && style.is_some() && t.props.look.header_row && t.rows.len() > 1); let mut cells = Vec::new(); + for _ in 0..r.first_grid() { + cells.push(Cell::default()); + } for (ci, c) in r.cells.iter().enumerate() { let styled = if bake { styled_cell(t, style.as_ref(), (ri, ci), ncols) } else { None }; let mut rowspan = 1; @@ -1159,6 +1162,8 @@ fn flow_table(doc: &Document, t: &Table, depth: usize, tracked: FlowOpts) -> FTa Some(Box::new(crate::CellPic { img, repeat: p.repeat, align: p.align })) }), width: None, + vmerge_restart: c.props.vmerge == VMerge::Restart, + synthetic_covered: false, }); } rows.push(cells); diff --git a/crates/flow/src/to_doc.rs b/crates/flow/src/to_doc.rs index 0375c448c..faf08bb99 100644 --- a/crates/flow/src/to_doc.rs +++ b/crates/flow/src/to_doc.rs @@ -907,6 +907,41 @@ impl<'a> Builder<'a> { } tb.rows.push(row); } + let starts: Vec<(usize, usize)> = (0..tb.rows.first().map_or(0, |row| row.cells.len())) + .filter(|&ci| tb.rows.first().and_then(|row| row.cells.get(ci)).is_some_and(|c| c.props.vmerge == VMerge::Continue)) + .map(|ci| (ci, tb.grid_col(0, ci))) + .collect(); + for (ci, g) in starts { + let span = tb.rows.first().map_or(1, |r| r.cells[ci].props.span); + let more = tb + .cell_at_grid(1, g) + .filter(|&i| tb.grid_col(1, i) == g) + .and_then(|i| tb.rows.get(1)?.cells.get(i)) + .is_some_and(|c| c.props.vmerge == VMerge::Continue && c.props.span == span); + if let Some(cell) = tb.rows.first_mut().and_then(|r| r.cells.get_mut(ci)) { + cell.props.vmerge = if more { VMerge::Restart } else { VMerge::None }; + } + } + for r in 1..tb.rows.len() { + for ci in 0..tb.rows[r].cells.len() { + if tb.rows[r].cells[ci].props.vmerge == VMerge::Continue { + let g = tb.grid_col(r, ci); + let span = tb.rows[r].cells[ci].props.span; + let prev_r = r - 1; + if let Some(up_ci) = tb.cell_at_grid(prev_r, g) + && tb.grid_col(prev_r, up_ci) == g + && tb.rows[prev_r].cells[up_ci].props.span == span + { + let up_cell = &mut tb.rows[prev_r].cells[up_ci]; + if up_cell.props.vmerge == VMerge::None { + up_cell.props.vmerge = VMerge::Restart; + } + } else { + tb.rows[r].cells[ci].props.vmerge = VMerge::None; + } + } + } + } // Its markup kept for the writer, by its place among the top's tables. if depth == 0 { if t.kept.is_some() || t.wrap.is_some() { diff --git a/crates/flow/src/types.rs b/crates/flow/src/types.rs index d5abb7537..fcd955a30 100644 --- a/crates/flow/src/types.rs +++ b/crates/flow/src/types.rs @@ -881,6 +881,10 @@ pub struct Cell { /// The width, points, the source gives a cell spanning one column (HTML): see /// [`FTable::widths_from_cells`]. pub width: Option, + /// Whether the source explicitly started a vertical merge (`mso-yfti-vmerge:restart`). + pub vmerge_restart: bool, + /// Whether this covered placeholder was synthesized by [`FTable::insert_covered`]. + pub synthetic_covered: bool, } /// A cell's background picture: the picture at its own size, how it fills the cell, and where an @@ -907,6 +911,8 @@ impl Default for Cell { direction: Default::default(), picture: None, width: None, + vmerge_restart: false, + synthetic_covered: false, } } } @@ -999,8 +1005,8 @@ impl FTable { let mut g = 0usize; let mut ci = 0usize; while let Some(c) = self.rows.get(r).and_then(|row| row.get(ci)) { - let (span, rs, covered) = (c.colspan.clamp(1, 63) as usize, c.rowspan.clamp(1, 1000) as usize, c.covered); - if rs > 1 && !covered { + let (span, rs, vmerge_restart) = (c.colspan.clamp(1, 63) as usize, c.rowspan.clamp(1, 1000) as usize, c.vmerge_restart); + if rs > 1 { for k in 1..rs { work += 1; if work > MAX_COVERED_WORK { @@ -1017,8 +1023,14 @@ impl FTable { } x += cc.colspan.clamp(1, 63) as usize; } + if at < row.len() && x == g && row[at].covered && (vmerge_restart || row[at].synthetic_covered) { + // Row already has a matching explicit continuation (when this cell had + // `mso-yfti-vmerge:restart`) or a synthetic placeholder from an earlier + // row. Avoid adding a duplicate covered cell which would make the row ragged. + continue; + } if row.len() < 64 { - row.insert(at, Cell { colspan: span as u32, covered: true, ..Default::default() }); + row.insert(at, Cell { colspan: span as u32, covered: true, synthetic_covered: true, ..Default::default() }); } } } diff --git a/crates/html/src/doc/builder.rs b/crates/html/src/doc/builder.rs index 68bb7d8db..b6859523f 100644 --- a/crates/html/src/doc/builder.rs +++ b/crates/html/src/doc/builder.rs @@ -55,6 +55,27 @@ struct TableB { row: Option>, /// The table or one of its cells asks for borders. bordered: bool, + /// Explicit column widths from `` and childless ``. + col_widths: Vec>, + /// Pending ``: `(span, width, has_child_cols)`. + pending_colgroup: Option<(usize, Option, bool)>, +} + +impl TableB { + /// Commit pending colgroup widths: if childless, push span columns with group width. + /// When child `` elements are present, they have already received the group width + /// during `` handling; columns from earlier groups are never backfilled. + fn commit_pending_colgroup(&mut self) { + if let Some((span, group_w, has_child_cols)) = self.pending_colgroup.take() + && !has_child_cols + { + for _ in 0..span { + if self.col_widths.len() < MAX_TABLE_COLS { + self.col_widths.push(group_w); + } + } + } + } } struct ElementStyle { @@ -863,6 +884,15 @@ impl<'r> Builder<'r> { } } + /// Finalize an open HTML element popped from the stack. + /// + /// Side effects: + /// - Flushes any buffered inline text into the current block container. + /// - Sets `pending_page_break` if the element requests page break before or after. + /// - For `Cell`: pops the cell container, attaches generated blocks to the cell, and pushes into the active row. + /// - For `Tr`: commits any pending `` definitions and pushes the completed row into the active table. + /// - For `Table`: commits pending colgroup widths, finalizes table rows with `insert_covered` (bounded to `MAX_ROWS`), + /// resolves explicit column widths from colgroups/cells, and appends the resulting table to the enclosing container. fn close(&mut self, e: &El) { if e.page_break_after || e.page_break { self.pending_page_break = true; @@ -881,26 +911,53 @@ impl<'r> Builder<'r> { } } ElKind::Tr => { - if let Some(t) = self.tables.last_mut() - && let Some(r) = t.row.take() - { - t.rows.push(r); + if let Some(t) = self.tables.last_mut() { + t.commit_pending_colgroup(); + if let Some(r) = t.row.take() { + t.rows.push(r); + } } } ElKind::Table => { if let Some(mut t) = self.tables.pop() { + t.commit_pending_colgroup(); if let Some(r) = t.row.take() { t.rows.push(r); } let borderless = !t.bordered; // Keep at most MAX_ROWS rows (the model drops the rest anyway): bounds the // O(rows × rowspan) work of `insert_covered` on a table of millions of ``. - let rows: Vec<_> = t.rows.into_iter().filter(|r| !r.is_empty()).take(craft_wordmodel::table::MAX_ROWS).collect(); + let rows: Vec<_> = t.rows.into_iter().take(craft_wordmodel::table::MAX_ROWS).collect(); let mut ft = FTable { rows, widths: Vec::new(), borderless, extra: None, kept: None, wrap: None }; + let col_widths = &t.col_widths; if !ft.rows.is_empty() { ft.insert_covered(); - // Columns keep the widths their cells give when every column has one. - if ft.cols() <= MAX_TABLE_COLS { + ft.rows.retain(|r| !r.is_empty()); + } + if !ft.rows.is_empty() { + if !col_widths.is_empty() && ft.cols() <= MAX_TABLE_COLS { + let mut widths = vec![None; ft.cols()]; + for (i, &cw) in col_widths.iter().take(ft.cols()).enumerate() { + if let Some(w) = cw { + widths[i] = Some(w); + } + } + for row in &ft.rows { + let mut g = 0; + for c in row { + if let (Some(w), Some(slot)) = (c.width, widths.get_mut(g)) { + slot.get_or_insert(w); + } + g += c.colspan.clamp(1, 63) as usize; + } + } + if widths.iter().any(Option::is_some) { + let known_sum: f32 = widths.iter().filter_map(|w| *w).sum(); + let known_count = widths.iter().filter(|w| w.is_some()).count(); + let avg = if known_count > 0 { known_sum / known_count as f32 } else { 72.0 }; + ft.widths = widths.into_iter().map(|w| w.unwrap_or(avg)).collect(); + } + } else if ft.cols() <= MAX_TABLE_COLS { ft.widths_from_cells(); } self.container().push(FBlock::Table(ft)); @@ -1001,6 +1058,14 @@ impl<'r> Builder<'r> { } } + /// Process void or special HTML elements (`br`, `hr`, `wbr`, `col`, `colgroup`, `img`). + /// + /// Side effects: + /// - `br` / `wbr`: inserts line break or zero-width break into the active paragraph. + /// - `hr`: inserts a thematic horizontal rule block with borders and spacing into the container. + /// - `col`: extracts span and explicit CSS width, resolves against active ``, and appends up to `MAX_TABLE_COLS` column widths to the table. + /// - `colgroup`: commits any previous pending colgroup and buffers new span and width styles until child cols or closing tag arrive. + /// - `img`: parses dimensions, styles, and data/remote sources, creating an image block or inline image run. fn start_special(&mut self, name: &str, attrs: &[(String, String)]) -> bool { match name { "br" => { @@ -1020,6 +1085,34 @@ impl<'r> Builder<'r> { let fmt = self.fmt(); self.start_para().push_text("\u{200B}", &fmt); } + "col" => { + let css = self.css_of(name, attrs); + let span = attr(attrs, "span").and_then(|v| v.trim().parse::().ok()).unwrap_or(1).clamp(1, MAX_TABLE_COLS); + let w = cell_width(&css, attrs); + if let Some(t) = self.tables.last_mut() { + let group_w = if let Some((_, group_w, has_child_cols)) = &mut t.pending_colgroup { + *has_child_cols = true; + *group_w + } else { + None + }; + let effective_w = w.or(group_w); + for _ in 0..span { + if t.col_widths.len() < MAX_TABLE_COLS { + t.col_widths.push(effective_w); + } + } + } + } + "colgroup" => { + let css = self.css_of(name, attrs); + let span = attr(attrs, "span").and_then(|v| v.trim().parse::().ok()).unwrap_or(1).clamp(1, MAX_TABLE_COLS); + let w = cell_width(&css, attrs); + if let Some(t) = self.tables.last_mut() { + t.commit_pending_colgroup(); + t.pending_colgroup = Some((span, w, false)); + } + } "img" => { let alt = attr(attrs, "alt").unwrap_or("").to_string(); let dim = |key: &str| attr(attrs, key).and_then(|v| v.trim().trim_end_matches("px").trim().parse::().ok()).map(|p| p * 0.75); @@ -1164,12 +1257,20 @@ impl<'r> Builder<'r> { let css = self.css_of(name, attrs); let ElementStyle { mut fmt, block_background, align, preserve, page_break, page_break_after } = self.element_style(name, attrs, kind, &css); match kind { - ElKind::Table => self.tables.push(TableB { rows: Vec::new(), row: None, bordered: declares_border(attrs, &css, true) }), + ElKind::Table => self.tables.push(TableB { + rows: Vec::new(), + row: None, + bordered: declares_border(attrs, &css, true), + col_widths: Vec::new(), + pending_colgroup: None, + }), ElKind::Tr => { - if let Some(t) = self.tables.last_mut() - && let Some(r) = t.row.take() - { - t.rows.push(r); + if let Some(t) = self.tables.last_mut() { + t.commit_pending_colgroup(); + if let Some(r) = t.row.take() { + t.rows.push(r); + } + t.row = Some(Vec::new()); } } ElKind::Cell => { @@ -1216,11 +1317,16 @@ impl<'r> Builder<'r> { _ => {} } } + // The last declaration wins, as in the cascade. + let mso_vmerge = decls(&css).filter(|(k, _)| k == "mso-yfti-vmerge").last().map(|(_, v)| v.trim().to_ascii_lowercase()); + let is_mso_vmerge_continue = mso_vmerge.as_deref() == Some("continue"); + let is_mso_vmerge_restart = mso_vmerge.as_deref() == Some("restart"); + let rowspan = attr(attrs, "rowspan").and_then(|v| v.trim().parse::().ok()).map(|v| v.clamp(1, 1000)).unwrap_or(1); self.cells.push(Cell { blocks: Vec::new(), colspan, - rowspan: attr(attrs, "rowspan").and_then(|v| v.trim().parse::().ok()).map(|v| v.clamp(1, 1000)).unwrap_or(1), - covered: false, + rowspan, + covered: is_mso_vmerge_continue, header: name == "th", shading, borders: cell_borders(&css), @@ -1229,6 +1335,8 @@ impl<'r> Builder<'r> { direction: Default::default(), picture: None, width: if colspan == 1 { cell_width(&css, attrs) } else { None }, + vmerge_restart: is_mso_vmerge_restart, + synthetic_covered: false, }); fmt.background = None; self.containers.push(Vec::new()); @@ -1261,6 +1369,12 @@ impl<'r> Builder<'r> { } return; } + if name == "colgroup" { + if let Some(t) = self.tables.last_mut() { + t.commit_pending_colgroup(); + } + return; + } let crosses = matches!(name, "table"); let target = if matches!(name, "td" | "th") { self.find_open(|e| e.kind == ElKind::Cell, |e| e.kind == ElKind::Table) diff --git a/crates/html/src/doc/export.rs b/crates/html/src/doc/export.rs index 9fb861d85..52f7f50f0 100644 --- a/crates/html/src/doc/export.rs +++ b/crates/html/src/doc/export.rs @@ -263,21 +263,87 @@ fn para_html(p: &Para) -> String { } } +/// Render an HTML table element, emitting `` column widths and cell attributes. fn table_html(t: &FTable, out: &mut String, depth: usize) { out.push_str("\n"); - for row in &t.rows { - out.push_str(""); - for c in row { - if c.covered { + if !t.widths.is_empty() { + out.push_str("\n"); + for w in &t.widths { + out.push_str(&format!("\n")); + } + out.push_str("\n"); + } + let nrows = t.rows.len(); + let grid_cols: Vec> = t + .rows + .iter() + .map(|row| { + let mut x = 0usize; + row.iter() + .map(|c| { + let start = x; + x = x.saturating_add(c.colspan.clamp(1, 63) as usize); + start + }) + .collect() + }) + .collect(); + let cell_at_grid = |r: usize, target_g: usize| -> Option { grid_cols.get(r)?.binary_search(&target_g).ok() }; + let grid_col = |r: usize, ci: usize| -> usize { grid_cols.get(r).and_then(|row| row.get(ci)).copied().unwrap_or(0) }; + + let mut is_covered: Vec> = t.rows.iter().map(|r| vec![false; r.len()]).collect(); + let mut rowspans: Vec> = t.rows.iter().map(|r| r.iter().map(|c| c.rowspan.clamp(1, 1000)).collect()).collect(); + + for r in 0..nrows { + let row_len = t.rows.get(r).map_or(0, |row| row.len()); + for ci in 0..row_len { + if is_covered.get(r).and_then(|row| row.get(ci)).copied().unwrap_or(false) { continue; } + let Some(c) = t.rows.get(r).and_then(|row| row.get(ci)) else { continue }; + let g = grid_col(r, ci); + let span = c.colspan.clamp(1, 63) as usize; + let mut extent = 1u32; + for down_r in (r + 1)..nrows { + let Some(down_ci) = cell_at_grid(down_r, g) else { break }; + let Some(down_c) = t.rows.get(down_r).and_then(|row| row.get(down_ci)) else { break }; + let down_covered = is_covered.get(down_r).and_then(|row| row.get(down_ci)).copied().unwrap_or(false); + if grid_col(down_r, down_ci) == g + && down_c.colspan.clamp(1, 63) as usize == span + && down_c.covered + && !down_c.vmerge_restart + && !down_covered + { + if let Some(down_row) = is_covered.get_mut(down_r) + && let Some(slot) = down_row.get_mut(down_ci) + { + *slot = true; + } + extent = extent.saturating_add(1); + } else { + break; + } + } + if let Some(slot) = rowspans.get_mut(r).and_then(|row| row.get_mut(ci)) { + *slot = (*slot).max(extent); + } + } + } + + for (ri, row) in t.rows.iter().enumerate() { + out.push_str(""); + for (ci, c) in row.iter().enumerate() { + if is_covered.get(ri).and_then(|r| r.get(ci)).copied().unwrap_or(false) { + continue; + } + let rowspan = rowspans.get(ri).and_then(|r| r.get(ci)).copied().unwrap_or(c.rowspan.clamp(1, 1000)); let tag = if c.header { "th" } else { "td" }; let mut attrs = String::new(); if c.colspan > 1 { attrs.push_str(&format!(" colspan=\"{}\"", c.colspan)); } - if c.rowspan > 1 { - attrs.push_str(&format!(" rowspan=\"{}\"", c.rowspan)); + if rowspan > 1 { + attrs.push_str(&format!(" rowspan=\"{}\"", rowspan)); } let v_css = match c.valign { Some(VAlign::Center) => "vertical-align:middle", @@ -288,6 +354,9 @@ fn table_html(t: &FTable, out: &mut String, depth: usize) { if !t.borderless { css.insert(0, "border:1px solid #999".to_string()); } + if let Some(w) = c.width { + css.push(format!("width:{w:.2}pt")); + } if let Some(s) = c.shading { css.push(format!("background-color:#{}", s.hex())); } diff --git a/crates/html/src/doc/tests.rs b/crates/html/src/doc/tests.rs index c0b00084b..6c4e5fe8e 100644 --- a/crates/html/src/doc/tests.rs +++ b/crates/html/src/doc/tests.rs @@ -717,6 +717,195 @@ fn cells_give_their_columns_widths() { assert_eq!(t.widths, [75.0, 150.0]); } +#[test] +fn col_elements_give_table_column_widths() { + let f = parse("
    AB
    "); + let FBlock::Table(t) = &f.blocks[0] else { panic!() }; + assert_eq!(t.widths, [75.0, 150.0]); + + // col with span + let f2 = parse( + "
    123
    ", + ); + let FBlock::Table(t2) = &f2.blocks[0] else { panic!() }; + assert_eq!(t2.widths, [72.0, 72.0, 144.0]); + + // Childless colgroup defines widths across declared span + let f3 = parse("
    12
    "); + let FBlock::Table(t3) = &f3.blocks[0] else { panic!() }; + assert_eq!(t3.widths, [75.0, 75.0]); + + // Child col elements override colgroup widths + let f4 = parse("
    1
    "); + let FBlock::Table(t4) = &f4.blocks[0] else { panic!() }; + assert_eq!(t4.widths, [150.0]); + + // Mixed childless colgroup and colgroup with child col elements + let f5 = parse( + "
    123
    ", + ); + let FBlock::Table(t5) = &f5.blocks[0] else { panic!() }; + assert_eq!(t5.widths, [75.0, 200.0, 300.0]); + + // Child col elements inherit parent colgroup width when unset + let f6 = parse("
    12
    "); + let FBlock::Table(t6) = &f6.blocks[0] else { panic!() }; + assert_eq!(t6.widths, [90.0, 90.0]); + + // Child col elements without width inherit group width while explicit child width takes precedence + let f7 = parse("
    12
    "); + let FBlock::Table(t7) = &f7.blocks[0] else { panic!() }; + assert_eq!(t7.widths, [150.0, 90.0]); + + // Partial explicit col widths fall back to average for unset columns + let f8 = parse("
    12
    "); + let FBlock::Table(t8) = &f8.blocks[0] else { panic!() }; + assert_eq!(t8.widths, [100.0, 100.0]); + + // Export includes colgroup + let doc = model::to_doc(&f); + let html = export(&doc); + assert!(html.contains(""), "html export includes colgroup: {html}"); + assert!(html.contains(""), "{html}"); + assert!(html.contains(""), "{html}"); +} + +#[test] +fn word_html_vertical_merge_is_preserved() { + use craft_wordmodel::props::VMerge; + let html = "\ + \ + \ +
    TopB1
    ContB2
    "; + let f = parse(html); + let FBlock::Table(t) = &f.blocks[0] else { panic!() }; + assert_eq!(t.rows.len(), 2); + assert_eq!(t.rows[0].len(), 2); + assert_eq!(t.rows[1].len(), 2, "second row must have exactly 2 cells, no duplicate synthetic cell"); + assert!(!t.rows[0][0].covered); + assert!(t.rows[1][0].covered); + + let doc = model::to_doc(&f); + let craft_wordmodel::Block::Table(tb) = &*doc.body[0] else { panic!() }; + assert_eq!(tb.rows[0].cells[0].props.vmerge, VMerge::Restart); + assert_eq!(tb.rows[1].cells[0].props.vmerge, VMerge::Continue); + assert_eq!(tb.rows[1].cells.len(), 2, "table model second row has exactly 2 cells"); + assert_eq!(tb.vertical_extent(0, 0), Some((0, 2))); +} + +#[test] +fn html_multiple_colgroups_do_not_backfill_earlier_groups() { + // Earlier colgroup with unset column must not be backfilled by later colgroup width. + let html = "\ + \ + \ + \ +
    12
    "; + let f = parse(html); + let FBlock::Table(t) = &f.blocks[0] else { panic!() }; + assert_eq!(t.widths, [50.0, 50.0], "column 0 was not backfilled by group 2 width of 200pt"); +} + +#[test] +fn word_html_rowspan_with_explicit_vmerge_continue_no_duplicate_cell() { + use craft_wordmodel::props::VMerge; + let html = "\ + \ + \ +
    AB1
    A_contB2
    "; + let f = parse(html); + let FBlock::Table(t) = &f.blocks[0] else { panic!() }; + assert_eq!(t.rows.len(), 2); + assert_eq!(t.rows[0].len(), 2); + assert_eq!(t.rows[1].len(), 2, "second row must have exactly 2 cells, not ragged"); + assert!(!t.rows[0][0].covered); + assert!(t.rows[1][0].covered); + + let doc = model::to_doc(&f); + let craft_wordmodel::Block::Table(tb) = &*doc.body[0] else { panic!() }; + assert_eq!(tb.rows[0].cells[0].props.vmerge, VMerge::Restart); + assert_eq!(tb.rows[1].cells[0].props.vmerge, VMerge::Continue); + assert_eq!(tb.rows[1].cells.len(), 2); + assert_eq!(tb.vertical_extent(0, 0), Some((0, 2))); +} + +#[test] +fn to_doc_normalises_row_0_continue_cell() { + use craft_wordmodel::props::VMerge; + // Case 1: Row 0 has continue and Row 1 has continue -> Row 0 normalised to Restart. + let html_multi = "\ + \ + \ +
    TopContB1
    BottomContB2
    "; + let f_multi = parse(html_multi); + let doc_multi = model::to_doc(&f_multi); + let craft_wordmodel::Block::Table(tb_multi) = &*doc_multi.body[0] else { panic!() }; + assert_eq!(tb_multi.rows[0].cells[0].props.vmerge, VMerge::Restart, "row 0 continue normalised to restart"); + assert_eq!(tb_multi.rows[1].cells[0].props.vmerge, VMerge::Continue); + + // Case 2: Row 0 has continue but table has only 1 row (or no continuation) -> normalised to None. + let html_single = "\ + \ +
    SoloContB1
    "; + let f_single = parse(html_single); + let doc_single = model::to_doc(&f_single); + let craft_wordmodel::Block::Table(tb_single) = &*doc_single.body[0] else { panic!() }; + assert_eq!(tb_single.rows[0].cells[0].props.vmerge, VMerge::None, "orphaned row 0 continue normalised to none"); + + // Case 3: Row 0 col 1 has continue, Row 1 has a spanning continue starting at col 0 -> col 1 normalised to None. + let html_span = "\ + \ + \ +
    A0B0
    SpanCont
    "; + let f_span = parse(html_span); + let doc_span = model::to_doc(&f_span); + let craft_wordmodel::Block::Table(tb_span) = &*doc_span.body[0] else { panic!() }; + assert_eq!(tb_span.rows[0].cells[1].props.vmerge, VMerge::None, "unaligned spanning continuation in row 1 must not mark row 0 cell as restart"); +} + +/// #1785: A covered continuation cell with `rowspan > 1` expands into the following row when +/// no restart cell above spans it. +#[test] +fn covered_continuation_with_rowspan_expands_into_next_row() { + use craft_wordmodel::props::VMerge; + let html = "\ + \ + \ + \ +
    TopB0
    MidB1
    B2
    "; + let f = parse(html); + let doc = model::to_doc(&f); + let craft_wordmodel::Block::Table(tb) = &*doc.body[0] else { panic!() }; + assert_eq!(tb.rows.len(), 3); + assert_eq!(tb.rows[2].cells.len(), 2, "row 2 should have placeholder + B2"); + assert_eq!(tb.rows[2].cells[0].props.vmerge, VMerge::Continue); +} + +/// #1785: A plain `rowspan=2` cell `A` in col 0 followed by `B` (`vmerge:restart`) and `D` +/// must still insert a placeholder for `A` in row 1 even when `B`'s explicit `vmerge:continue` +/// is the first `` in row 1. +#[test] +fn rowspan_before_explicit_vmerge_continue_keeps_grid_columns() { + use craft_wordmodel::props::VMerge; + let html = "\ + \ + \ +
    ABD
    B_contD1
    "; + let f = parse(html); + let doc = model::to_doc(&f); + let craft_wordmodel::Block::Table(tb) = &*doc.body[0] else { panic!() }; + assert_eq!(tb.rows.len(), 2); + assert_eq!(tb.rows[0].cells.len(), 3); + assert_eq!(tb.rows[1].cells.len(), 3, "row 1 should have placeholder for A, B_cont, and D1"); + assert_eq!(tb.rows[1].cells[0].props.vmerge, VMerge::Continue); + assert_eq!(tb.rows[1].cells[1].props.vmerge, VMerge::Continue); + let craft_wordmodel::Block::Para(p1) = &*tb.rows[1].cells[1].blocks[0] else { panic!() }; + assert_eq!(p1.text, "B_cont"); + assert_eq!(tb.rows[1].cells[2].props.vmerge, VMerge::None); + let craft_wordmodel::Block::Para(p2) = &*tb.rows[1].cells[2].blocks[0] else { panic!() }; + assert_eq!(p2.text, "D1"); +} + #[test] fn cells_take_their_css_borders() { use craft_wordmodel::props::{Border, BorderStyle}; @@ -768,6 +957,240 @@ fn hostile_style_sheets_never_panic() { } } +#[test] +fn conflicting_mso_vmerge_declarations_last_wins() { + let html_restart_wins = "
    A
    "; + let f1 = parse(html_restart_wins); + let FBlock::Table(t1) = &f1.blocks[0] else { panic!() }; + assert!(t1.rows[0][0].vmerge_restart); + assert!(!t1.rows[0][0].covered); + + let html_continue_wins = "
    B
    "; + let f2 = parse(html_continue_wins); + let FBlock::Table(t2) = &f2.blocks[0] else { panic!() }; + assert!(!t2.rows[0][0].vmerge_restart); + assert!(t2.rows[0][0].covered); +} + +#[test] +fn export_flow_derives_rowspan_for_vmerge_continuations() { + let html = "\ + \ + \ +
    TopB1
    ContB2
    "; + let f = parse(html); + let exported = export_flow(&f, "en"); + assert!(exported.contains(""), "covered continuation cell should not be emitted: {exported}"); + assert!(exported.contains(">B1"), "{exported}"); + assert!(exported.contains(">B2"), "{exported}"); +} + +#[test] +fn export_flow_preserves_orphan_covered_continuation_content() { + let html = "\ + \ + \ +
    Orphan0B0
    A1B1
    "; + let f = parse(html); + let exported = export_flow(&f, "en"); + assert!(exported.contains("Orphan0"), "orphan continuation content in row 0 must be preserved: {exported}"); +} + +#[test] +fn html_roundtrip_preserves_colgroups_widths_and_vmerge() { + use craft_wordmodel::props::VMerge; + + let html = "\ + \ + \ + \ + \ +
    MergeAB1
    MergeA_contB2
    "; + + let f1 = parse(html); + let FBlock::Table(t1) = &f1.blocks[0] else { panic!() }; + assert_eq!(t1.widths, [80.0, 120.0]); + assert_eq!(t1.rows.len(), 2); + assert_eq!(t1.rows[0].len(), 2); + assert_eq!(t1.rows[1].len(), 2); + assert!(!t1.rows[0][0].covered); + assert!(t1.rows[0][0].vmerge_restart); + assert!(t1.rows[1][0].covered); + + let doc1 = model::to_doc(&f1); + let craft_wordmodel::Block::Table(tb1) = &*doc1.body[0] else { panic!() }; + assert_eq!(tb1.rows[0].cells[0].props.vmerge, VMerge::Restart); + assert_eq!(tb1.rows[1].cells[0].props.vmerge, VMerge::Continue); + assert_eq!(tb1.vertical_extent(0, 0), Some((0, 2))); + + // Export to HTML via export() + let exported = export(&doc1); + assert!(exported.contains(""), "exported HTML must contain colgroup: {exported}"); + assert!(exported.contains("width:80.00pt"), "{exported}"); + assert!(exported.contains("width:120.00pt"), "{exported}"); + assert!(exported.contains("rowspan=\"2\""), "exported HTML must emit rowspan=\"2\": {exported}"); + + // Parse the exported HTML again + let f2 = parse(&exported); + let FBlock::Table(t2) = &f2.blocks[0] else { panic!() }; + assert_eq!(t2.widths, t1.widths, "column widths must match"); + assert_eq!(t2.rows.len(), t1.rows.len(), "row counts must match"); + assert_eq!(t2.rows[0].len(), t1.rows[0].len(), "row 0 cell count must match"); + assert_eq!(t2.rows[1].len(), t1.rows[1].len(), "row 1 cell count must match"); + assert_eq!(t2.rows[0][0].covered, t1.rows[0][0].covered, "row 0 cell 0 covered flag must match"); + assert_eq!(t2.rows[1][0].covered, t1.rows[1][0].covered, "row 1 cell 0 covered flag must match"); + + let doc2 = model::to_doc(&f2); + let craft_wordmodel::Block::Table(tb2) = &*doc2.body[0] else { panic!() }; + assert_eq!(tb2.rows[0].cells[0].props.vmerge, tb1.rows[0].cells[0].props.vmerge, "vmerge restart matches"); + assert_eq!(tb2.rows[1].cells[0].props.vmerge, tb1.rows[1].cells[0].props.vmerge, "vmerge continue matches"); + assert_eq!(tb2.vertical_extent(0, 0), tb1.vertical_extent(0, 0), "vertical merge extent matches"); +} + +fn assert_single_col_vmerge_table(tb: &craft_wordmodel::Table) { + use craft_wordmodel::props::VMerge; + assert_eq!(tb.rows.len(), 3, "table must have 3 rows"); + assert_eq!(tb.grid.len(), 1, "table must have 1 column"); + assert_eq!(tb.rows[0].cells.len(), 1); + assert_eq!(tb.rows[1].cells.len(), 1); + assert_eq!(tb.rows[2].cells.len(), 1); + assert_eq!(tb.rows[0].cells[0].props.vmerge, VMerge::Restart); + assert_eq!(tb.rows[1].cells[0].props.vmerge, VMerge::Continue); + assert_eq!(tb.rows[2].cells[0].props.vmerge, VMerge::None); + assert_eq!(tb.vertical_extent(0, 0), Some((0, 2))); + assert_eq!(tb.grid_col(2, 0), 0, "Bottom cell must be at grid column 0"); + let bottom_text = match &*tb.rows[2].cells[0].blocks[0] { + craft_wordmodel::Block::Para(p) => &p.text, + _ => panic!("expected paragraph in Bottom cell"), + }; + assert_eq!(bottom_text, "Bottom", "Bottom must be at row 2, cell 0"); +} + +#[test] +fn html_roundtrip_preserves_fully_covered_row_and_single_column_table() { + // A one-column table with a Word vertical merge across the first two rows, + // followed by an ordinary "Bottom" cell in row three. + let html = "\ + \ + \ + \ +
    Top
    Cont
    Bottom
    "; + + let f1 = parse(html); + let FBlock::Table(t1) = &f1.blocks[0] else { panic!() }; + assert_eq!(t1.rows.len(), 3, "initial import must have 3 rows"); + assert_eq!(t1.cols(), 1, "initial import must have 1 column"); + assert_eq!(t1.rows[0].len(), 1); + assert_eq!(t1.rows[1].len(), 1); + assert_eq!(t1.rows[2].len(), 1); + assert!(!t1.rows[0][0].covered); + assert!(t1.rows[0][0].vmerge_restart); + assert!(t1.rows[1][0].covered); + assert!(!t1.rows[2][0].covered); + + let doc1 = model::to_doc(&f1); + let craft_wordmodel::Block::Table(tb1) = &*doc1.body[0] else { panic!() }; + assert_single_col_vmerge_table(tb1); + + // Export to HTML via export() + let exported = export(&doc1); + assert!(exported.contains("rowspan=\"2\""), "exported HTML must emit rowspan=\"2\": {exported}"); + assert!(exported.contains(""), "covered row with no visible cells must emit empty tr: {exported}"); + assert!(exported.contains("Bottom"), "exported HTML must contain Bottom: {exported}"); + + // Parse the exported HTML again + let f2 = parse(&exported); + let FBlock::Table(t2) = &f2.blocks[0] else { panic!() }; + assert_eq!(t2.rows.len(), 3, "round-trip Flow must keep 3 rows"); + assert_eq!(t2.cols(), 1, "round-trip Flow must keep 1 column"); + assert_eq!(t2.rows[0].len(), 1, "row 0 has 1 cell"); + assert_eq!(t2.rows[1].len(), 1, "row 1 (fully covered row) has 1 cell"); + assert_eq!(t2.rows[2].len(), 1, "row 2 has 1 cell"); + assert!(!t2.rows[0][0].covered); + assert!(t2.rows[1][0].covered, "row 1 cell must be covered placeholder"); + assert!(!t2.rows[2][0].covered, "row 2 cell (Bottom) must not be covered"); + + // Convert round-tripped flow to document model + let doc2 = model::to_doc(&f2); + let craft_wordmodel::Block::Table(tb2) = &*doc2.body[0] else { panic!() }; + assert_single_col_vmerge_table(tb2); +} + +#[test] +fn vmerge_validation_requires_matching_spans() { + use craft_wordmodel::props::VMerge; + + // 1. Later-row check: row 0 has colspan=2, row 1 has continuation with colspan=1. + // Mismatched spans must clear continuation to None and NOT promote row 0 cell to Restart. + let ft_mismatched = FTable { + rows: vec![ + vec![Cell { colspan: 2, ..Cell::default() }], + vec![Cell { colspan: 1, covered: true, ..Cell::default() }, Cell { colspan: 1, ..Cell::default() }], + ], + widths: vec![50.0, 50.0], + ..Default::default() + }; + let doc = model::to_doc(&Flow { blocks: vec![FBlock::Table(ft_mismatched)], ..Default::default() }); + let craft_wordmodel::Block::Table(tb) = &*doc.body[0] else { panic!() }; + assert_eq!(tb.rows[0].cells[0].props.vmerge, VMerge::None, "mismatched span must not promote to Restart"); + assert_eq!(tb.rows[1].cells[0].props.vmerge, VMerge::None, "mismatched span must clear Continue to None"); + + // 2. First-row check: row 0 has continuation with colspan=2, row 1 has continuation with colspan=1. + // Mismatched spans must clear row 0 continuation to None, not promote to Restart. + let ft_row0_mismatched = FTable { + rows: vec![ + vec![Cell { colspan: 2, covered: true, ..Cell::default() }], + vec![Cell { colspan: 1, covered: true, ..Cell::default() }, Cell { colspan: 1, ..Cell::default() }], + ], + widths: vec![50.0, 50.0], + ..Default::default() + }; + let doc0 = model::to_doc(&Flow { blocks: vec![FBlock::Table(ft_row0_mismatched)], ..Default::default() }); + let craft_wordmodel::Block::Table(tb0) = &*doc0.body[0] else { panic!() }; + assert_eq!(tb0.rows[0].cells[0].props.vmerge, VMerge::None, "mismatched span in row 0 must clear to None"); + assert_eq!(tb0.rows[1].cells[0].props.vmerge, VMerge::None, "mismatched span in row 1 must clear to None"); + + // 3. Matching spans: row 0 has colspan=2, row 1 has continuation with colspan=2. + // Matching spans must promote row 0 to Restart and keep row 1 as Continue. + let ft_matching = FTable { + rows: vec![vec![Cell { colspan: 2, ..Cell::default() }], vec![Cell { colspan: 2, covered: true, ..Cell::default() }]], + widths: vec![50.0, 50.0], + ..Default::default() + }; + let doc_m = model::to_doc(&Flow { blocks: vec![FBlock::Table(ft_matching)], ..Default::default() }); + let craft_wordmodel::Block::Table(tb_m) = &*doc_m.body[0] else { panic!() }; + assert_eq!(tb_m.rows[0].cells[0].props.vmerge, VMerge::Restart); + assert_eq!(tb_m.rows[1].cells[0].props.vmerge, VMerge::Continue); +} + +#[test] +fn export_table_preserves_first_grid_column_alignment() { + let mut doc = craft_wordmodel::Document::default(); + let mut table = craft_wordmodel::Table::new(2, 3, 240.0); + table.grid = vec![40.0, 80.0, 120.0]; + table.rows[0].cells = vec![craft_wordmodel::Cell::with_text("A"), craft_wordmodel::Cell::with_text("B"), craft_wordmodel::Cell::with_text("C")]; + table.rows[1].props.grid_before = 1; + table.rows[1].cells = vec![craft_wordmodel::Cell::with_text("D"), craft_wordmodel::Cell::with_text("E")]; + doc.body = vec![std::sync::Arc::new(craft_wordmodel::Block::Table(table))]; + + // Flow representation should preserve the leading grid position + let flow = model::from_doc(&doc); + let FBlock::Table(ft) = &flow.blocks[0] else { panic!() }; + assert_eq!(ft.rows.len(), 2); + assert_eq!(ft.rows[0].len(), 3); + assert_eq!(ft.rows[1].len(), 3, "row 1 must have 3 cells (1 leading placeholder + 2 data cells)"); + assert_eq!(ft.widths, vec![40.0, 80.0, 120.0]); + + // HTML export should emit 3 colgroup cols and preserve cell alignment + let html = export(&doc); + assert!(html.contains(""), "must contain col 0 width: {html}"); + assert!(html.contains(""), "must contain col 1 width: {html}"); + assert!(html.contains(""), "must contain col 2 width: {html}"); + assert!(html.contains(">D"), "must contain cell D: {html}"); + assert!(html.contains(">E"), "must contain cell E: {html}"); +} + /// Ensure container elements (such as `div` and `p`) with background colors do not leak /// character shading onto their child text runs (#1786). #[test] From 7d06803a3204ab64a00c722ff2a0da9e32d66d44 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:41:59 +0700 Subject: [PATCH 148/183] fix(doc-binary): use canonical MD4 BLIP identifiers (#2153) --- Cargo.lock | 10 +++ crates/doc-binary/Cargo.toml | 1 + crates/doc-binary/src/write/picture.rs | 91 ++++++++++++++++++++++---- 3 files changed, 90 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3557ae355..292078c6e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1792,6 +1792,7 @@ dependencies = [ "craft-wordmodel", "image", "log", + "md4", "miniz_oxide 0.9.1", "proptest", "serde_json", @@ -6991,6 +6992,15 @@ dependencies = [ "digest 0.11.3", ] +[[package]] +name = "md4" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd76fb0fd6b2e4be62a73f8e0858ca97f81babcb1af322dcaca196f735f17f80" +dependencies = [ + "digest 0.11.3", +] + [[package]] name = "memchr" version = "2.8.3" diff --git a/crates/doc-binary/Cargo.toml b/crates/doc-binary/Cargo.toml index 6c5a5625e..98b7e2c69 100644 --- a/crates/doc-binary/Cargo.toml +++ b/crates/doc-binary/Cargo.toml @@ -17,6 +17,7 @@ craft-wordmodel = { workspace = true } chrono = { version = "0.4.45", default-features = false, features = ["std"] } image = { version = "0.25", default-features = false, features = ["png", "bmp"] } log = "0.4" +md4 = "0.11" miniz_oxide = "0.9" sha1 = "0.11" thiserror = { workspace = true } diff --git a/crates/doc-binary/src/write/picture.rs b/crates/doc-binary/src/write/picture.rs index 07eb19fa4..6454c320f 100644 --- a/crates/doc-binary/src/write/picture.rs +++ b/crates/doc-binary/src/write/picture.rs @@ -3,7 +3,7 @@ //! picture's place in the BLIP store, crop, alt text) and the `OfficeArtFBSE` with the BLIP //! embedded in it. The character 0x01 in the text points here through `sprmCPicLocation`. -use sha1::Digest; +use md4::Digest; /// `PICF.cbHeader`. const CB_HEADER: u16 = 0x44; @@ -77,14 +77,15 @@ impl Blip { } } - /// The `OfficeArtBlip*` record. - fn record(&self, w_emu: i32, h_emu: i32) -> Vec { + /// The `OfficeArtBlip*` record and its format-defined identifier. + fn record(&self, w_emu: i32, h_emu: i32) -> (Vec, [u8; 16]) { let (raw, (typ, inst)) = match self { Blip::Png(b) => (b, BLIP_PNG), Blip::Jpeg(b) => (b, BLIP_JPEG), Blip::Metafile(b, emf) => (b, if *emf { BLIP_EMF } else { BLIP_WMF }), }; - let mut body = uid(raw).to_vec(); + let id = uid(raw); + let mut body = id.to_vec(); match self { Blip::Png(b) | Blip::Jpeg(b) => { body.push(0xFF); // tag @@ -106,16 +107,14 @@ impl Blip { body.extend_from_slice(&packed); } } - rec(0, inst, typ, &body) + (rec(0, inst, typ, &body), id) } } -/// A 16-byte id for a BLIP (the format wants an MD4; any digest identifies it). +/// MS-ODRAW requires MD4 of the uncompressed BLIP payload, not the original import file. +/// This legacy-format identifier is not authentication or a security integrity check. fn uid(bytes: &[u8]) -> [u8; 16] { - let d = sha1::Sha1::digest(bytes); - let mut u = [0u8; 16]; - u.copy_from_slice(d.get(..16).unwrap_or(&[0; 16])); - u + md4::Md4::digest(bytes).into() } /// An OfficeArt record: header (version, instance, type, length) then the body. @@ -147,9 +146,10 @@ impl Pictures { let gh = (h.max(1.0) / (1.0 - ct - cb).max(0.01)).min(1584.0); let emu = |pt: f32| (pt * 12_700.0).round() as i32; - let blip_rec = blip.record(emu(gw), emu(gh)); + let (blip_rec, id) = blip.record(emu(gw), emu(gh)); let mut fbse = vec![blip.bt(), blip.bt()]; - fbse.extend_from_slice(&uid(bytes)); + // Reuse the embedded BLIP's identifier after PNG conversion/placeable-header removal. + fbse.extend_from_slice(&id); fbse.extend_from_slice(&0x00FFu16.to_le_bytes()); // tag fbse.extend_from_slice(&(blip_rec.len() as u32).to_le_bytes()); fbse.extend_from_slice(&1u32.to_le_bytes()); // cRef @@ -209,3 +209,70 @@ impl Pictures { u32::try_from(at).ok() } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn blip_uid_matches_rfc1320_vectors() { + assert_eq!(uid(b""), [0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31, 0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0]); + assert_eq!(uid(b"abc"), [0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52, 0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d]); + } + + fn check_record_ids(input: &[u8], payload: &[u8]) { + let mut pictures = Pictures::default(); + assert_eq!(pictures.add(input, 1.0, 1.0, [0.0; 4], ""), Some(0)); + let bytes = &pictures.data; + let shape = usize::from(CB_HEADER); + let shape_len = u32::from_le_bytes(bytes[shape + 4..shape + 8].try_into().unwrap()) as usize; + let fbse = shape + 8 + shape_len; + assert_eq!(&bytes[fbse + 2..fbse + 4], &FBSE.to_le_bytes()); + let embedded = fbse + 8 + 36; + let typ = u16::from_le_bytes(bytes[embedded + 2..embedded + 4].try_into().unwrap()); + let emitted = if typ == BLIP_WMF.0 || typ == BLIP_EMF.0 { + // Controlled tiny fixtures: skip the UID and 34-byte metafile header. + miniz_oxide::inflate::decompress_to_vec_zlib(&bytes[embedded + 58..]).unwrap() + } else { + assert!(typ == BLIP_PNG.0 || typ == BLIP_JPEG.0); + bytes[embedded + 25..].to_vec() + }; + assert_eq!(emitted, payload, "stored image bytes must retain the expected conversion"); + let expected = uid(&emitted); + assert_eq!(&bytes[fbse + 10..fbse + 26], &expected, "FBSE must identify stored data"); + assert_eq!(&bytes[embedded + 8..embedded + 24], &expected, "BLIP must share the same identifier"); + } + + #[test] + fn blip_ids_identify_unmodified_payloads() { + // Tiny format-dispatch fixtures exercise identifier bytes, not image validation. + let png = b"\x89PNGsmall"; + check_record_ids(png, png); + let jpeg = b"\xff\xd8\xffsmall"; + check_record_ids(jpeg, jpeg); + let wmf = [1, 0, 9, 0, 0, 3, 9, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0]; + check_record_ids(&wmf, &wmf); + let mut emf = vec![0; 44]; + emf[..4].copy_from_slice(&1u32.to_le_bytes()); + emf[40..44].copy_from_slice(b" EMF"); + check_record_ids(&emf, &emf); + } + + #[test] + fn blip_ids_exclude_placeable_wmf_header() { + let wmf = [1, 0, 9, 0, 0, 3, 9, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0]; + let mut placeable = vec![0; 22]; + placeable[..4].copy_from_slice(&[0xd7, 0xcd, 0xc6, 0x9a]); + placeable.extend_from_slice(&wmf); + check_record_ids(&placeable, &wmf); + } + + #[test] + fn blip_ids_identify_converted_bmp_payload() { + let mut bmp = std::io::Cursor::new(Vec::new()); + image::DynamicImage::new_rgb8(1, 1).write_to(&mut bmp, image::ImageFormat::Bmp).unwrap(); + let Blip::Png(encoded) = Blip::of(bmp.get_ref()).unwrap() else { panic!("BMP must become PNG") }; + assert_ne!(bmp.get_ref(), &encoded); + check_record_ids(bmp.get_ref(), &encoded); + } +} From c255ab0e517b489fdefb69500456c755d6ecd763 Mon Sep 17 00:00:00 2001 From: skylar taylor-barrick Date: Wed, 18 Nov 2026 04:43:01 +0100 Subject: [PATCH 149/183] fix(html): keep widthless colgroups on cell-width fallback --- crates/html/src/doc/builder.rs | 2 +- crates/html/src/doc/tests.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/crates/html/src/doc/builder.rs b/crates/html/src/doc/builder.rs index b6859523f..022a51015 100644 --- a/crates/html/src/doc/builder.rs +++ b/crates/html/src/doc/builder.rs @@ -935,7 +935,7 @@ impl<'r> Builder<'r> { ft.rows.retain(|r| !r.is_empty()); } if !ft.rows.is_empty() { - if !col_widths.is_empty() && ft.cols() <= MAX_TABLE_COLS { + if col_widths.iter().any(Option::is_some) && ft.cols() <= MAX_TABLE_COLS { let mut widths = vec![None; ft.cols()]; for (i, &cw) in col_widths.iter().take(ft.cols()).enumerate() { if let Some(w) = cw { diff --git a/crates/html/src/doc/tests.rs b/crates/html/src/doc/tests.rs index 6c4e5fe8e..c81687d48 100644 --- a/crates/html/src/doc/tests.rs +++ b/crates/html/src/doc/tests.rs @@ -1,5 +1,22 @@ use super::*; +#[test] +fn widthless_columns_do_not_change_cell_width_resolution() { + let widths = |columns: &str, cells: &str| { + let flow = parse(&format!("{columns}{cells}
    ")); + let FBlock::Table(table) = &flow.blocks[0] else { panic!("expected table") }; + table.widths.clone() + }; + let partial = "xy"; + let widthless = ""; + assert!(widths("", partial).is_empty()); + assert_eq!(widths(widthless, partial), widths("", partial)); + let complete = "xy"; + assert_eq!(widths(widthless, complete), vec![30.0, 60.0]); + // An explicitly declared column still enables the existing average-fill rule. + assert_eq!(widths("", "xy"), vec![100.0, 100.0]); +} + #[test] fn numeric_entity_rejects_sign() { assert_eq!(unescape("a&#+65;b"), "a&#+65;b"); From 71579152ffd426c18364d8c2444dc7b057742078 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 17 Nov 2026 22:46:28 -0500 Subject: [PATCH 150/183] Separate strict native preview sniffing from generic ZIP compatibility --- crates/designcraft-format/src/lib.rs | 5 ++- crates/designcraft-format/src/tests.rs | 34 ++++++++++++++ crates/document-bundle/src/lib.rs | 62 +++++++++++++++++++------- 3 files changed, 84 insertions(+), 17 deletions(-) diff --git a/crates/designcraft-format/src/lib.rs b/crates/designcraft-format/src/lib.rs index eab431eab..9ce481a3b 100644 --- a/crates/designcraft-format/src/lib.rs +++ b/crates/designcraft-format/src/lib.rs @@ -127,9 +127,10 @@ pub fn starts_designcraft(prefix: &[u8]) -> bool { craft_document_bundle::starts_with_mimetype(prefix, BUNDLE) } -/// Read the first-page PNG preview from a ZIP package, with a fixed 4 MiB cap. +/// Read the first-page PNG preview from an unprefixed native ZIP package, with a fixed 4 MiB cap. +/// Nonmatching signatures are rejected after at most four bytes read. pub fn read_preview(reader: R) -> Option> { - craft_document_bundle::read_preview_from(reader, PREVIEW) + craft_document_bundle::read_unprefixed_preview_from(reader, PREVIEW) } fn is_linked(document: &Value, id: &str) -> bool { diff --git a/crates/designcraft-format/src/tests.rs b/crates/designcraft-format/src/tests.rs index 38cf1c34f..736d2e17c 100644 --- a/crates/designcraft-format/src/tests.rs +++ b/crates/designcraft-format/src/tests.rs @@ -167,3 +167,37 @@ fn bytes_supplied_for_a_linked_asset_are_not_written() -> Result<(), Box(&bytes)?.assets, [("8".to_owned(), b"kept".to_vec())]); Ok(()) } + +#[test] +fn preview_uses_the_strict_signature_path_without_losing_cursor_independence() -> Result<(), Box> { + struct Counted { + cursor: std::io::Cursor>, + bytes_read: usize, + } + impl std::io::Read for Counted { + fn read(&mut self, out: &mut [u8]) -> std::io::Result { + let n = self.cursor.read(out)?; + self.bytes_read += n; + Ok(n) + } + } + impl std::io::Seek for Counted { + fn seek(&mut self, position: std::io::SeekFrom) -> std::io::Result { + self.cursor.seek(position) + } + } + let mut non_zip = Counted { cursor: std::io::Cursor::new(vec![0x42; 1 << 20]), bytes_read: 0 }; + non_zip.cursor.set_position(100); + assert_eq!(read_preview(&mut non_zip), None); + assert!(non_zip.bytes_read <= 4); + + let bytes = save(&json!({}), "DesignCraft test", Some(b"png"), &[], &[])?; + let mut cursor = std::io::Cursor::new(&bytes); + cursor.set_position(bytes.len() as u64); + assert_eq!(read_preview(cursor), Some(b"png".to_vec())); + let mut prefixed = b"MZsynthetic-prefix".to_vec(); + prefixed.extend(bytes); + assert_eq!(craft_document_bundle::read_preview_from(std::io::Cursor::new(&prefixed), PREVIEW), Some(b"png".to_vec())); + assert_eq!(read_preview(std::io::Cursor::new(prefixed)), None); + Ok(()) +} diff --git a/crates/document-bundle/src/lib.rs b/crates/document-bundle/src/lib.rs index 845381f30..b425856ad 100644 --- a/crates/document-bundle/src/lib.rs +++ b/crates/document-bundle/src/lib.rs @@ -315,20 +315,10 @@ pub fn read_preview(bytes: &[u8], preview_entry: &str) -> Option> { archive.read(preview_entry, PREVIEW_LIMIT).ok().flatten() } -/// Read a bounded preview from a seekable file without loading the full bundle into memory. -/// -/// A file that does not start with a zip local-file header is turned away after four bytes. The zip -/// reader would otherwise search the whole file for an end-of-directory record it does not have, -/// which takes seconds for a large non-bundle file (an InDesign document in a recent-files list) -/// and minutes on a network share. -pub fn read_preview_from(mut reader: R, preview_entry: &str) -> Option> { +/// Read a preview from a seekable ZIP, including archives with a leading prefix. +/// The decompressed preview is limited to 4 MiB; archive discovery may perform substantial I/O. +pub fn read_preview_from(reader: R, preview_entry: &str) -> Option> { const PREVIEW_LIMIT: u64 = 4 << 20; - let mut magic = [0u8; 4]; - reader.read_exact(&mut magic).ok()?; - if &magic != b"PK\x03\x04" { - return None; - } - reader.seek(std::io::SeekFrom::Start(0)).ok()?; let mut zip = zip::ZipArchive::new(reader).ok()?; let entry = zip.by_name(preview_entry).ok()?; if entry.size() > PREVIEW_LIMIT { @@ -339,6 +329,22 @@ pub fn read_preview_from(mut reader: R, preview_entry: &str) -> (u64::try_from(preview.len()).ok()? <= PREVIEW_LIMIT).then_some(preview) } +/// Read a preview only from a ZIP with a local-file header at byte zero. +/// +/// Use for native formats whose contract excludes prefixed/self-extracting archives. +/// Nonmatching inputs require at most four bytes read, regardless of the initial cursor position. +/// Matching ZIPs still require directory I/O; this is not an overall read/time budget. +pub fn read_unprefixed_preview_from(mut reader: R, preview_entry: &str) -> Option> { + reader.seek(std::io::SeekFrom::Start(0)).ok()?; + let mut magic = [0u8; 4]; + reader.read_exact(&mut magic).ok()?; + if &magic != b"PK\x03\x04" { + return None; + } + reader.seek(std::io::SeekFrom::Start(0)).ok()?; + read_preview_from(reader, preview_entry) +} + fn read_legacy(bytes: &[u8], spec: Spec<'_>) -> Result { let mut document: Value = serde_json::from_slice(bytes).map_err(|e| Error::NotBundle(e.to_string()))?; let mut assets = Vec::new(); @@ -446,13 +452,39 @@ mod tests { assert_eq!(read_preview_from(Cursor::new(&bytes), SPEC.preview_entry).as_deref(), Some(&b"png"[..])); } + #[test] + fn prefixed_bundle_admission_is_explicit() { + let bundle = write(br#"{}"#, 4, "Test 0.1", Some(b"png"), &[], &[], SPEC).unwrap(); + let mut bytes = b"MZsynthetic-prefix".to_vec(); + bytes.extend(bundle); + let mut original = zip::ZipArchive::new(Cursor::new(&bytes)).unwrap(); + let mut preview = Vec::new(); + original.by_name(SPEC.preview_entry).unwrap().read_to_end(&mut preview).unwrap(); + assert_eq!(preview, b"png"); + assert!(has_document(&bytes, SPEC)); + assert!(!starts_with_mimetype(&bytes, SPEC)); + assert_eq!(read_preview_from(Cursor::new(&bytes), SPEC.preview_entry), Some(preview)); + assert_eq!(read_unprefixed_preview_from(Cursor::new(&bytes), SPEC.preview_entry), None); + } + + #[test] + fn preview_from_an_advanced_reader_still_reads_the_bundle() { + let bytes = write(br#"{}"#, 4, "Test 0.1", Some(b"png"), &[], &[], SPEC).unwrap(); + for offset in [1, 4, bytes.len() / 2, bytes.len()] { + let mut reader = Cursor::new(&bytes); + reader.set_position(offset as u64); + assert_eq!(read_preview_from(reader.clone(), SPEC.preview_entry).as_deref(), Some(&b"png"[..]), "offset {offset}"); + assert_eq!(read_unprefixed_preview_from(reader, SPEC.preview_entry).as_deref(), Some(&b"png"[..]), "offset {offset}"); + } + } + #[test] fn preview_from_a_non_zip_reads_only_its_signature() { let mut file = Counting { inner: Cursor::new(vec![0x42u8; 1 << 20]), read: 0 }; - assert_eq!(read_preview_from(&mut file, SPEC.preview_entry), None); + assert_eq!(read_unprefixed_preview_from(&mut file, SPEC.preview_entry), None); assert!(file.read <= 4, "read {} bytes of a file that is not a zip", file.read); let mut empty = Counting { inner: Cursor::new(Vec::new()), read: 0 }; - assert_eq!(read_preview_from(&mut empty, SPEC.preview_entry), None); + assert_eq!(read_unprefixed_preview_from(&mut empty, SPEC.preview_entry), None); } #[test] From ec6583848740ad94c56c92aa6cc92a994d118658 Mon Sep 17 00:00:00 2001 From: William Dunn Date: Tue, 17 Nov 2026 22:56:16 -0500 Subject: [PATCH 151/183] craft-suite-account: provider-neutral suite account list and keychain token store (#665) * craft-suite-account: the suite account list and keychain token store Carries crates/suite-account over from the cut-down craft-libs#160 branch. This follows RFC-0025 (storytold/craft-contrib#35). service.rs is removed. It was the CollabCraft device-flow client. Its Service, Flow, Identity, Polled and SignedOut types went with it. Store::sign_out is also gone. The provider adapter now owns ending a session at the deployment. Store::discard and Store::forget cover the local half that stays here. Every remaining CollabCraft-specific word is reworded to a provider-neutral description. The one serde alias and the one test fixture name that spelled the old provider out are gone too. Adds a generation field to Account, per RFC-0025's cross-app lifecycle guarantees. A sign-in bumps it. Store::update_token refuses a write made against a stale generation. A fuller tombstone for the removal case is left as a TODO referencing the RFC, documented on Accounts::remove. Also drops one unused restrict() function found while verifying clippy -D warnings on Linux. It was pre-existing dead code. The unix write path already sets the file mode at creation. * craft-suite-account: lock list mutations, make generations monotonic across removal Fixes the three review gates on PR #665 (rev 2e9c84f). Every mutation of accounts.json now goes through an OS-level file lock. The lock is a sibling .lock file taken with std::fs::File::try_lock and a bounded retry, matching the mechanism craft-ai-integrations' store already uses for the same problem. Two processes each completing 100 sign-ins into one folder used to leave 101 rows on file. Both the real two-process and two-thread conformance tests now land all 200 rows. A removed account now leaves a tombstone holding its last generation. A re-add continues past that tombstone. It never restarts at 0. update_token checks the generation twice. The first check runs before the keychain is touched at all. An already-stale caller never overwrites a newer token. The second check runs under the lock, after the keychain write. It catches a removal that landed in the window that write opened. A tombstoned account answers StaleGeneration. It never answers Unknown. The second check also removes the token it just wrote, under the same lock, when the account turns out to be gone. A refresh racing a discard can then resurrect neither the row nor the keychain entry. discard itself now removes the keychain entry inside the same lock hold as the list write. The module docs now name the chosen keychain-versus-list write order for each operation. They also name the state a crash in that window leaves behind for the next reader to repair, per RFC-0025 guarantee 1. A new test simulates the window update_token opens between its keychain write and its generation commit. The conformance tests are adapted from the maintainer's review-reproduction gist for this crate. Forget racing a refresh is the one gist case left out. forget is deliberately generation-agnostic and local, per RFC-0025 guarantee 4. That fix would be a separate, broader change than these three gates. * craft-suite-account: close the review gaps CodeRabbit found in the rebase Six fixes. Generation bumps in sign_in, update_token and remove_with_tombstone now use checked_add. A bump at the maximum refuses with GenerationExhausted. It never wraps back to a small number a stale caller could pass again. accounts::write now refuses a list that would serialize past MAX_BYTES before touching disk. An oversized display name can then never brick the list for every later reader. NewAccount.linked now persists onto Account. It used to be silently dropped at sign_in. update_token's stale-write cleanup now only removes a keychain token that still matches the token it wrote itself. A concurrent sign-in's token for the same handle survives that cleanup now. Store::forget and Store::has_token now return Error::Isolated before touching the keychain, matching every other mutator. migrate::adopt re-reads the legacy file right before deleting it and skips the delete when something rewrote it since. The read buffers are wrapped in Zeroizing too. A parsed-but-unused token copy no longer outlives the one Secret already covers. Three findings were not valid against this code and are not changed. The torn-state window CodeRabbit flagged in update_token's generation commit is the same crash recovery the module docs already describe. The existing torn-state test already exercises it. Forcing the keychain write under the same lock as two concurrent sign-ins for one handle would reintroduce the cross-process deadlock the lock module exists to avoid. A failed discard already reports its own error. A refresh that re-establishes a full session afterward is recovery. It is never a silent mismatch. * craft-suite-account: apply cargo fmt to the review-gap fixes cargo fmt wraps the long struct literals and assert calls the previous commit added. The content is unchanged. * craft-suite-account: factor the race test's join-handle type out clippy::type_complexity flagged the four-deep generic on handle_slot in the stale-refresh-vs-re-sign-in test. A type alias clears it without changing the test. * craft-suite-account: flush before the rename, re-check the token under the lock Two review findings. The temporary file is now flushed with sync_all before the rename, keeping the crash story the doc tells. A discard racing a sign-in could delete the token the sign-in had just written and the sign-in still reported Ok. The lock closure re-checks the keychain right before committing the row and writes the token again when something else changed it. * craft-suite-account: sync the parent directory after the rename The temp-file flush persists the bytes. The rename changes a directory entry with its own durability on Linux. Power loss after write returned could otherwise resurrect the older list and lose a tombstone a discard already reported written. A sync failure now reports an error, never success. Unix only, since directories do not open for sync elsewhere. * craft-suite-account: keep activation out of refresh, require an explicit format marker, stop logging paths Three fixes. update_token no longer calls Accounts::put for its row commit. That call always makes the written row active. Refreshing an account in the background used to silently steal the selection from whatever account the person had actually picked. A new Accounts::refresh_in_place replaces the row without touching active. put stays exactly as it was for sign_in and set_active, the two calls meant to change it. Accounts::format no longer carries #[serde(default)]. Every other field still does. A missing format key used to default through Accounts's own Default impl. That impl answers FORMAT. A file that never declared a format therefore read as exactly the one format this build understands. read now also rejects any parsed format that is not exactly FORMAT. The old check only rejected a newer one; format 0 passed it the same way a missing key did. accounts::read's error messages now name only the file, never the full path. Store::shared logs a read failure at warn. The path sits under the user's profile folder. restrict on Windows stays a no-op. Its comment now states the guarantee's real scope. The default per-user config folder gives it. A portable install or an ARTCRAFT_SUITE_DIR override does not. A real fix needs the Win32 authorization API. Every binding for it is an unsafe fn. This workspace forbids unsafe_code outright. That part of the finding is refused in part. Closing it for real needs a maintainer-approved exception for this one call site, or a vetted dependency wrapping that API safely. Either is a decision for its own PR. * craft-suite-account: move update_token's keychain write inside the lock skylartaylor's finding. update_token used to write the keychain, then take the list lock. A newer sign-in, or a discard followed by a re-add, could land for the same handle in between. The second check under the lock already answered StaleGeneration in that case, but the earlier write had already landed over the newer session's token. shared() then served the new session's row with the stale refresh's bytes. Deleting the stale token on its own was never going to fix this; that still loses the newer session, it only changes which bytes go missing. The keychain write now happens only inside the lock, in the second generation check's own success arm, immediately before the row commits. The first, unlocked check still exists, purely to reject an already-stale caller before it ever takes the lock; it writes nothing. Every losing path, a newer sign-in, a discard, a discard followed by a re-add, now answers with an error having never touched the keychain at all. There is nothing stale left in it to clean up or weigh against a winner's own token. Store::remove_token_if_still is gone. Its two call sites in the losing branches never write a token to begin with now. Nothing is left for it to conditionally remove. This keeps the lock discipline the module docs describe: the write is conditional on the row commit going ahead, the same shape as discard's own keychain call inside its lock hold and sign_in's existing re-check, never an unconditional call made regardless. Two deterministic tests reproduce both orderings skylartaylor named, each proving the fix against the pre-fix code before passing against the fix: a_refresh_racing_a_newer_sign_in_for_the_same_handle_never_overwrites_its_token and a_refresh_racing_a_discard_and_re_add_for_the_same_handle_never_overwrites_its_token. Both hold the real accounts lock on a background thread standing in for the winning operation. They release it only after the refresh's own unlocked first check has had the chance to read the pre-race state. Both then assert shared() serves the winning session's own token afterward. The crate's own pre-existing hook-based race tests could no longer reach the window they were built for, since that window no longer has a keychain call in it to hook. tests/review_repro.rs's two Hooked-based tests are rewritten onto real threads racing on a Barrier instead, the same device the file's own two-thread sign-in test already uses. The lock makes their outcomes hold for either ordering now. A hook could only ever force one. The now-unused Hooked harness is removed along with them. src/tests.rs's own matching hook-based test is replaced outright by the two new ones above. That covers its ground and the newly found gap together. * craft-suite-account: pin the race tests' second-check window skylartaylor's review note on PR 665: the two update_token race tests in src/tests.rs send their release signal and then immediately call update_token, so the competing sign-in or discard-and-re-add can finish before the refresh's first, unlocked check ever runs. A pre-fix build could then pass the same assertions by rejecting early at that first check, never reaching the second, locked one the tests are named for. Adds race_hook, a test-only pause point inside update_token between its two checks. A test arms it, starts the refresh, waits for the refresh to signal that its first check has read the pre-race generation, runs the competing operation to completion, then releases the refresh into its second check. Both race tests are rewritten onto this instead of holding the real accounts lock on a background thread, which left the same gap skylartaylor found: the lock never blocked the refresh's unlocked first read, only its second, locked one. * craft-suite-account: make the race test hook per store instead of process wide CI runs this crate's suite with the default, parallel test runner. The hook update_token pauses on between its two generation checks lived behind one process wide slot, so when the Workspace gate's parallel run landed both race tests at the same time, one test's release on that slot answered the other test's pause: the pinned ordering collapsed, the refresh ran ahead of the competing write, its second check legitimately matched, and update_token returned Ok where the test expected StaleGeneration. Reproduced on the lab build host with the crate's default threaded test run; failed on the first attempt, matching the CI failure exactly. The hook now lives on the Store instance, one per store, armed only on the exact store a given test built. A concurrent test's own store keeps its own hook, so there is nothing left for two tests to cross no matter how the runner schedules them. Checked the rest of the suite for the same kind of shared state: every other test builds its own tempdir and its own in-memory keychain, and the two-process test spawns its own child with --test-threads=1 for that child's own run, so none of them depend on the parent suite running single threaded. --- Cargo.lock | 115 ++- Cargo.toml | 1 + crates/suite-account/Cargo.toml | 35 + crates/suite-account/src/accounts.rs | 342 ++++++++ crates/suite-account/src/error.rs | 51 ++ crates/suite-account/src/lib.rs | 455 ++++++++++ crates/suite-account/src/lock.rs | 96 +++ crates/suite-account/src/migrate.rs | 187 ++++ crates/suite-account/src/paths.rs | 138 +++ crates/suite-account/src/race_hook.rs | 74 ++ crates/suite-account/src/secret.rs | 48 ++ crates/suite-account/src/store.rs | 176 ++++ crates/suite-account/src/tests.rs | 939 +++++++++++++++++++++ crates/suite-account/tests/review_repro.rs | 305 +++++++ 14 files changed, 2960 insertions(+), 2 deletions(-) create mode 100644 crates/suite-account/Cargo.toml create mode 100644 crates/suite-account/src/accounts.rs create mode 100644 crates/suite-account/src/error.rs create mode 100644 crates/suite-account/src/lib.rs create mode 100644 crates/suite-account/src/lock.rs create mode 100644 crates/suite-account/src/migrate.rs create mode 100644 crates/suite-account/src/paths.rs create mode 100644 crates/suite-account/src/race_hook.rs create mode 100644 crates/suite-account/src/secret.rs create mode 100644 crates/suite-account/src/store.rs create mode 100644 crates/suite-account/src/tests.rs create mode 100644 crates/suite-account/tests/review_repro.rs diff --git a/Cargo.lock b/Cargo.lock index 292078c6e..4031c80f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -232,6 +232,17 @@ version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" +[[package]] +name = "apple-native-keyring-store" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b350bfd03649e07aa05c0a81b3e15934374e585c98204a57e20b9d49f49bb9a" +dependencies = [ + "keyring-core", + "log", + "security-framework", +] + [[package]] name = "arbitrary" version = "1.5.0" @@ -3170,6 +3181,21 @@ dependencies = [ "weezl 0.2.1", ] +[[package]] +name = "craft-suite-account" +version = "0.1.0" +dependencies = [ + "dirs", + "keyring", + "keyring-core", + "log", + "serde", + "serde_json", + "sha2 0.10.9", + "tempfile", + "zeroize", +] + [[package]] name = "craft-svg" version = "0.1.0" @@ -4438,7 +4464,7 @@ dependencies = [ "ff 0.13.1", "generic-array", "group 0.13.0", - "hkdf", + "hkdf 0.12.4", "pem-rfc7468 0.7.0", "pkcs8 0.10.2", "rand_core 0.6.4", @@ -5087,6 +5113,17 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + [[package]] name = "futures-sink" version = "0.3.34" @@ -5107,6 +5144,7 @@ checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" dependencies = [ "futures-core", "futures-io", + "futures-macro", "futures-sink", "futures-task", "memchr", @@ -5716,6 +5754,15 @@ dependencies = [ "hmac 0.12.1", ] +[[package]] +name = "hkdf" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4aaa26c720c68b866f2c96ef5c1264b3e6f473fe5d4ce61cd44bbe913e553018" +dependencies = [ + "hmac 0.13.0", +] + [[package]] name = "hmac" version = "0.12.1" @@ -6697,6 +6744,27 @@ dependencies = [ "serde", ] +[[package]] +name = "keyring" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2270074a3d26bcac93c1dc5d2845eb4c089e8d761ccf6e0ea266a16004640627" +dependencies = [ + "apple-native-keyring-store", + "keyring-core", + "windows-native-keyring-store", + "zbus-secret-service-keyring-store", +] + +[[package]] +name = "keyring-core" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29fbf4b551298c67925f38cf341a1ada797a75f1837bdf8ae1fc8e2ebc6efb59" +dependencies = [ + "log", +] + [[package]] name = "khronos-egl" version = "6.0.0" @@ -8180,7 +8248,7 @@ dependencies = [ "generic-array", "getrandom 0.2.17", "hex", - "hkdf", + "hkdf 0.12.4", "idea", "k256", "log", @@ -9745,6 +9813,25 @@ dependencies = [ "zeroize", ] +[[package]] +name = "secret-service" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5107b24b91445dd2aa449a258a1807b63240942157292354dc5bfdbeb8bc6db8" +dependencies = [ + "aes 0.9.4", + "cbc", + "futures-util", + "getrandom 0.4.3", + "hkdf 0.13.0", + "hybrid-array", + "num", + "once_cell", + "serde", + "sha2 0.11.1", + "zbus", +] + [[package]] name = "security-framework" version = "3.7.0" @@ -12554,6 +12641,19 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-native-keyring-store" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063426e76fdec7438d56bb777f67e318a84a25c707b07e575cb8b78e10c028f8" +dependencies = [ + "byteorder", + "keyring-core", + "regex", + "windows-sys 0.61.2", + "zeroize", +] + [[package]] name = "windows-numerics" version = "0.3.1" @@ -13097,6 +13197,17 @@ dependencies = [ "zvariant", ] +[[package]] +name = "zbus-secret-service-keyring-store" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74801d001b9e7729adb4f1825b67b398185fed424749aa3d8bacf70417137d9a" +dependencies = [ + "keyring-core", + "secret-service", + "zbus", +] + [[package]] name = "zbus_macros" version = "5.19.0" diff --git a/Cargo.toml b/Cargo.toml index 319e0c1e8..63ab712f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -173,6 +173,7 @@ craft-settings = { path = "crates/settings" } craft-scraft-format = { path = "crates/scraft-format" } craft-time = { path = "crates/time" } craft-silhouette-studio = { path = "crates/silhouette-studio" } +craft-suite-account = { path = "crates/suite-account" } craft-svg = { path = "crates/svg" } craft-stencilcraft-format = { path = "crates/stencilcraft-format" } craft-stencilcraft-document = { path = "crates/stencilcraft-document" } diff --git a/crates/suite-account/Cargo.toml b/crates/suite-account/Cargo.toml new file mode 100644 index 000000000..e1527bfd8 --- /dev/null +++ b/crates/suite-account/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "craft-suite-account" +description = "Shared suite-level account store: who is signed in, kept once for the whole Craft suite, with the token in the operating system's keychain" +version.workspace = true +edition.workspace = true +license.workspace = true +rust-version.workspace = true +repository.workspace = true + +[lints] +workspace = true + +[dependencies] +serde = { version = "1", features = ["derive"] } +serde_json = "1" +log = "0.4" +# Non-wasm only: no per-user config dir in the browser. +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +dirs = "7" +# The account handle is a digest of the service and the user, so the same account always lands on +# the same keychain entry and a second sign-in replaces it instead of leaving one behind. +sha2 = "0.10" +# Overwrites a token's bytes when the value is dropped. Pure Rust, safe API, so the +# workspace's `unsafe_code = "forbid"` still holds. +zeroize = { version = "1", features = ["alloc"] } +# Windows Credential Manager, the macOS Keychain and the Secret Service, behind one API. The `v1` +# default feature picks the right one per platform and pins `crypto-rust` for the Secret Service, +# so no OpenSSL and no C toolchain comes in. +keyring = "4.2" +# The entry constructor that takes store modifiers, which is how a Windows credential asks for +# machine-local persistence. `keyring` installs the platform store; this reads it. +keyring-core = "1" + +[dev-dependencies] +tempfile = "3" diff --git a/crates/suite-account/src/accounts.rs b/crates/suite-account/src/accounts.rs new file mode 100644 index 000000000..877848a21 --- /dev/null +++ b/crates/suite-account/src/accounts.rs @@ -0,0 +1,342 @@ +//! The accounts file: who has signed in and at which deployment. +//! +//! No token is in here. Every field is something a user interface shows, or something needed to +//! find the token in the keychain. See [`crate::store`] for the token itself. + +use std::path::Path; + +use serde::{Deserialize, Serialize}; +use sha2::{Digest, Sha256}; + +use crate::error::Error; + +/// The format this code writes. A reader that does not recognise the number leaves the file alone. +pub const FORMAT: u32 = 1; + +/// The largest accounts file that will be read. A suite account list is a few hundred bytes. A +/// megabyte is already far past anything legitimate. +const MAX_BYTES: u64 = 1 << 20; + +/// One account, as the suite remembers it. +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] +#[serde(default)] +pub struct Account { + /// The handle for this account inside the suite. It is also the keychain entry's user name. + /// + /// A digest of `service` and `user` (see [`handle`]). Signing in again as the same person at + /// the same deployment therefore lands on the same keychain entry. No stale entry is left + /// behind. + pub id: String, + /// The deployment this account signs in to, as a base URL with no trailing slash. + pub service: String, + /// The deployment's own identifier for this account: the OIDC subject, never an address. + pub user: String, + /// What to show a person. Never an identity: two people can share a display name. + pub display: String, + pub email: Option, + /// Unix seconds when this account was first stored here. + pub added: i64, + /// Unix seconds when an application last used it. + pub last_used: i64, + /// Whether cloud storage is linked, as recorded by [`crate::NewAccount::linked`] at sign-in. + /// For a user interface only; the deployment is the authority and is asked again on each + /// start. + pub linked: bool, + /// Bumped every time this row's content changes: a sign-in that replaces the entry, or (per + /// RFC-0025's cross-app lifecycle guarantees) a removal. A caller that read the account before + /// one of those passes its generation back on a later write; [`crate::Store::update_token`] + /// refuses a write made against a generation that is no longer current, so a refresh started + /// before a change completes can never land after it and overwrite something newer. + pub generation: u32, +} + +/// What is left behind when an account is removed: the generation it reached, so a re-add or a +/// stale write can never land before it. +/// +/// RFC-0025's "Cross-app lifecycle guarantees" (point 2): generations are monotonic across removal +/// and re-add. Without this, a removed-and-re-added account restarted at generation 0, so a stale +/// refresh from before the removal passed the generation check against the new session and +/// replaced its token; a refresh racing a removal could even put a keychain entry back after the +/// removal deleted it. See [`Located::Tombstoned`] and [`crate::Store::update_token`]. +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] +#[serde(default)] +pub struct Tombstone { + pub id: String, + /// The generation the account reached, bumped once more by the removal itself. A write + /// against any generation at or before this one is stale. + pub generation: u32, +} + +/// Where [`Accounts::locate`] found (or didn't find) an id. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Located<'a> { + /// A row is on the list. + Active(&'a Account), + /// No row, but a tombstone: the account was removed and holds this generation. A write against + /// it is stale, never [`crate::Error::Unknown`]; see [`crate::Store::update_token`]. + Tombstoned(u32), + /// Neither. This handle has never been on this list. + Unknown, +} + +/// The whole file. +/// +/// `format` has no `#[serde(default)]` of its own, unlike every other field here. A container- +/// level default would fill a missing `format` key in from this struct's own `Default` impl, +/// which answers [`FORMAT`]: a file that never said what format it was would then read as +/// exactly the format this build understands. Requiring the key keeps a file that never +/// declared a format from passing as one that did. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct Accounts { + pub format: u32, + #[serde(default)] + pub accounts: Vec, + /// The account an application should use when it has no reason to prefer another. + #[serde(default)] + pub active: Option, + /// Removed accounts, holding the generation they reached. See [`Tombstone`]. + #[serde(default)] + pub tombstones: Vec, +} + +impl Default for Accounts { + fn default() -> Accounts { + Accounts { format: FORMAT, accounts: Vec::new(), active: None, tombstones: Vec::new() } + } +} + +impl Accounts { + pub fn get(&self, id: &str) -> Option<&Account> { + self.accounts.iter().find(|a| a.id == id) + } + + /// The generation a tombstone for `id` holds, when there is one. + pub fn tombstone_generation(&self, id: &str) -> Option { + self.tombstones.iter().find(|t| t.id == id).map(|t| t.generation) + } + + /// Finds `id` as an active row, a tombstone, or neither. The one lookup + /// [`crate::Store::update_token`] needs to answer a write with the right error: a stale + /// generation against a row that is still there, a stale generation against one that was + /// removed, or a handle that was never on this list at all. + pub fn locate(&self, id: &str) -> Located<'_> { + match self.get(id) { + Some(account) => Located::Active(account), + None => match self.tombstone_generation(id) { + Some(generation) => Located::Tombstoned(generation), + None => Located::Unknown, + }, + } + } + + /// The active account, when one is named and still on the list. + /// + /// An `active` naming an account that is gone gives the ordinary answer of `None`. A + /// half-finished sign-out on another machine must not stop an application starting. + pub fn current(&self) -> Option<&Account> { + self.active.as_deref().and_then(|id| self.get(id)) + } + + /// Adds or replaces an account. The account then becomes the active one. + /// + /// Clears any tombstone for this id: the account is current again, so nothing should still + /// answer a write against it with "removed". + /// + /// For a sign-in. [`Store::set_active`] is the other caller allowed to change `active`; a + /// background refresh never should. See [`Accounts::refresh_in_place`]. + /// + /// [`Store::set_active`]: crate::Store::set_active + pub fn put(&mut self, account: Account) { + self.tombstones.retain(|t| t.id != account.id); + self.active = Some(account.id.clone()); + match self.accounts.iter_mut().find(|a| a.id == account.id) { + Some(existing) => *existing = account, + None => self.accounts.push(account), + } + } + + /// Replaces an active row's content without touching which account is current. + /// + /// For [`Store::update_token`]: a refresh is maintenance a person never asked for by name. It + /// must not steal the selection away from whichever account they actually picked, the way + /// [`Accounts::put`] would. Does nothing when `id` no longer names an active row; the caller + /// has already confirmed it does, under the same lock, right before calling this. + /// + /// [`Store::update_token`]: crate::Store::update_token + pub fn refresh_in_place(&mut self, id: &str, account: Account) { + if let Some(existing) = self.accounts.iter_mut().find(|a| a.id == id) { + *existing = account; + } + } + + /// Drops an account and leaves a tombstone holding its generation, bumped once more by the + /// removal itself (RFC-0025 lifecycle guarantee 2). Whoever is left over, if anybody, becomes + /// active. + /// + /// Refuses with [`Error::GenerationExhausted`] when `generation` is already `u32::MAX`. + /// Wrapping past it would hand out a small number again. A stale caller's check against that + /// small number would then pass. Monotonic generations exist to rule that out. + pub fn remove_with_tombstone(&mut self, id: &str, generation: u32) -> Result<(), Error> { + let bumped = generation.checked_add(1).ok_or_else(|| Error::GenerationExhausted(id.to_owned()))?; + self.accounts.retain(|a| a.id != id); + if self.active.as_deref() == Some(id) { + self.active = self.accounts.first().map(|a| a.id.clone()); + } + match self.tombstones.iter_mut().find(|t| t.id == id) { + Some(existing) => existing.generation = bumped, + None => self.tombstones.push(Tombstone { id: id.to_owned(), generation: bumped }), + } + Ok(()) + } +} + +/// The handle for an account at a deployment. +/// +/// A digest, with the address and the subject kept out of it. The digest is stable. One account +/// therefore stays on one keychain entry however many times somebody signs in. The handle is also +/// opaque. A credential manager window puts the handle on screen. Nobody's address belongs in that +/// list. +pub fn handle(service: &str, user: &str) -> String { + let mut hash = Sha256::new(); + hash.update(normalise(service).as_bytes()); + hash.update(b"\n"); + hash.update(user.as_bytes()); + let digest = hash.finalize(); + digest.iter().take(12).map(|b| format!("{b:02x}")).collect() +} + +/// A deployment's base URL with any trailing slashes taken off. One deployment is then one account +/// however the URL was typed. +pub fn normalise(service: &str) -> String { + service.trim().trim_end_matches('/').to_owned() +} + +/// Just the file's name, for an error a log might show. +/// +/// The full path sits under a user's profile folder and names them. [`Store::shared`] logs a +/// read failure at `warn`. Every message built here therefore says only the file, never the +/// path it lived under. The name alone is enough to say which file failed and why. +/// +/// [`Store::shared`]: crate::Store::shared +fn named(path: &Path) -> &str { + path.file_name().and_then(|n| n.to_str()).unwrap_or("the accounts file") +} + +/// Reads the file. A missing file is an empty list. That is what "nobody has signed in" looks like. +/// +/// Accepts only a file that explicitly declares this exact [`FORMAT`]. `format` carries no +/// `#[serde(default)]` (see [`Accounts`]). A file with no `format` key therefore fails to parse +/// here. It never quietly reads as [`FORMAT`] through [`Accounts`]'s own `Default` impl. A file +/// that spells out `"format": 0` parses fine. The check just below rejects it there, the same as +/// any other value [`FORMAT`] does not name. Without both checks, an unrelated JSON file that +/// happens to parse into this permissive shape (every other field here defaults) could be read +/// as an empty account list and then overwritten outright by the next sign-in, a format this +/// reader never actually established. +pub fn read(path: &Path) -> Result { + let bytes = match std::fs::metadata(path) { + Ok(meta) if meta.len() > MAX_BYTES => { + return Err(Error::Malformed(format!("{} is {} bytes, too large to be an account list", named(path), meta.len()))); + } + Ok(_) => std::fs::read(path), + Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(Accounts::default()), + Err(e) => return Err(Error::Io(format!("couldn't read {} ({e})", named(path)))), + }; + let bytes = bytes.map_err(|e| Error::Io(format!("couldn't read {} ({e})", named(path))))?; + let parsed: Accounts = serde_json::from_slice(&bytes).map_err(|e| Error::Malformed(format!("{} didn't parse ({e})", named(path))))?; + if parsed.format != FORMAT { + return Err(Error::Malformed(format!( + "{} declares format {}. This build writes and reads only format {FORMAT}. A missing or unrecognised marker is never read as an account list.", + named(path), + parsed.format + ))); + } + Ok(parsed) +} + +/// Writes the file through a temporary file and a rename. The rename is atomic: a reader never +/// sees a half-written file, only the previous write or this one, never a mix of both. +/// +/// That atomicity is not durability. The temporary file is flushed to disk with `sync_all` before +/// the rename. The rename itself then never promotes data the disk has not actually taken yet. +/// Without that flush, power loss right after the rename could still leave an empty or truncated +/// file on a filesystem that reorders writes behind a rename. [`read`] would then answer +/// [`Error::Malformed`] forever. Every mutation here reads the file first. There would be +/// nothing left to repair it with. +/// +/// Readable by this user alone where the platform has file modes. The file holds no token. It does +/// say who is signed in. That is nobody else's business. +/// +/// Refuses a list that would serialize past [`MAX_BYTES`], before any file is touched. [`read`] +/// rejects a file that large; writing one anyway would succeed here and then make every later +/// read of this list fail, including the reads every other mutation needs before it can repair +/// anything. An oversized `display` or `email` on one account is the realistic way to reach this, +/// not the ordinary handful of accounts a suite ever holds. +pub fn write(path: &Path, accounts: &Accounts) -> Result<(), Error> { + let dir = path.parent().ok_or_else(|| Error::Io(format!("{} has no parent folder", path.display())))?; + let json = serde_json::to_vec_pretty(accounts).map_err(|e| Error::Malformed(e.to_string()))?; + if json.len() as u64 > MAX_BYTES { + return Err(Error::Malformed(format!( + "the account list would be {} bytes, too large to write; {} would reject it unread", + json.len(), + path.display() + ))); + } + std::fs::create_dir_all(dir).map_err(|e| Error::Io(format!("couldn't create {} ({e})", dir.display())))?; + use std::io::Write; + + let stamp = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_nanos()).unwrap_or(0); + let pid = std::process::id(); + let tmp = dir.join(format!(".{}.{}.{}.tmp", path.file_name().and_then(|n| n.to_str()).unwrap_or("accounts"), stamp, pid)); + #[cfg(unix)] + { + use std::fs::OpenOptions; + use std::os::unix::fs::OpenOptionsExt; + let mut file = OpenOptions::new() + .write(true) + .create_new(true) + .mode(0o600) + .open(&tmp) + .map_err(|e| Error::Io(format!("couldn't create {} ({e})", tmp.display())))?; + file.write_all(&json).map_err(|e| Error::Io(format!("couldn't write {} ({e})", tmp.display())))?; + file.sync_all().map_err(|e| Error::Io(format!("couldn't flush {} ({e})", tmp.display())))?; + } + #[cfg(not(unix))] + { + use std::fs::OpenOptions; + let mut file = + OpenOptions::new().write(true).create_new(true).open(&tmp).map_err(|e| Error::Io(format!("couldn't create {} ({e})", tmp.display())))?; + file.write_all(&json).map_err(|e| Error::Io(format!("couldn't write {} ({e})", tmp.display())))?; + file.sync_all().map_err(|e| Error::Io(format!("couldn't flush {} ({e})", tmp.display())))?; + restrict(&tmp)?; + } + std::fs::rename(&tmp, path).map_err(|e| Error::Io(format!("couldn't replace {} ({e})", path.display())))?; + // The flush above persisted the file's bytes. The rename changed a directory entry, and that + // entry has its own durability: on Linux, power loss after this function returned could + // otherwise resurrect the older list, losing a tombstone a discard already reported written. + // Directories open and sync on unix only; elsewhere the rename's own guarantees stand alone. + #[cfg(unix)] + { + if let Some(parent) = path.parent() { + let dir = std::fs::File::open(parent).map_err(|e| Error::Io(format!("couldn't open {} ({e})", parent.display())))?; + dir.sync_all().map_err(|e| Error::Io(format!("couldn't flush {} ({e})", parent.display())))?; + } + } + Ok(()) +} + +#[cfg(not(unix))] +fn restrict(_path: &Path) -> Result<(), Error> { + // A no-op today. That is a real gap this comment used to paper over. A new file in the + // platform configuration folder (the default `paths::Rule::Platform` home) inherits that + // folder's own, profile-scoped access rules. The account list is this user's alone there. + // `paths::Rule::Portable` and `paths::Rule::EnvVar` point `write` at whatever folder the + // caller named. A new file there inherits that folder's own Windows access control list, + // whatever it is. A shared or loosely permissioned folder in either of those two cases + // leaves the account list (subjects, display names, emails, never a token) readable by + // anyone else with access to it. Narrowing that needs a per-user Windows DACL on the file, + // set through the Win32 authorization API. Every binding for that API is an `unsafe fn`. + // This workspace forbids `unsafe_code` outright. Closing this for real needs either a + // maintainer-approved exception for one call site or a vetted dependency that wraps that API + // safely. Both are decisions for a dedicated PR. See `paths::Rule`. + Ok(()) +} diff --git a/crates/suite-account/src/error.rs b/crates/suite-account/src/error.rs new file mode 100644 index 000000000..a0e3b15e5 --- /dev/null +++ b/crates/suite-account/src/error.rs @@ -0,0 +1,51 @@ +//! What can go wrong. + +/// A failure in the shared account store. +/// +/// None of these is "nobody is signed in". That is an ordinary answer. It comes back as +/// [`crate::Shared::None`]. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum Error { + /// This process reads and writes nothing: `ARTCRAFT_SUITE_DIR` is set and empty, or the system + /// has no per-user configuration folder. + Isolated, + Io(String), + /// The accounts file is in a format this build does not know, or is not an accounts file. + Malformed(String), + /// The operating system's keychain refused. + Keychain(String), + /// No account on file has that handle. + Unknown(String), + /// A write named a generation the account has already moved past: another sign-in or removal + /// landed first. See RFC-0025's "Cross-app lifecycle guarantees". + StaleGeneration { + id: String, + expected: u32, + current: u32, + }, + /// This handle has reached the highest generation `u32` can hold. Nothing can bump it + /// further. The write that would have is refused. Wrapping back to a small generation would + /// let a stale caller pass the check again. Reaching this needs about four billion sign-ins + /// or removals of the same handle. + GenerationExhausted(String), +} + +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Error::Isolated => f.write_str("this process keeps no shared account"), + Error::Io(why) | Error::Malformed(why) => f.write_str(why), + Error::Keychain(why) => write!(f, "the keychain refused: {why}"), + Error::Unknown(id) => write!(f, "no account {id} is signed in"), + Error::StaleGeneration { id, expected, current } => { + write!( + f, + "account {id} moved from generation {expected} to {current}; this write was made against a generation that is no longer current" + ) + } + Error::GenerationExhausted(id) => write!(f, "account {id} has reached the highest generation this build can record"), + } + } +} + +impl std::error::Error for Error {} diff --git a/crates/suite-account/src/lib.rs b/crates/suite-account/src/lib.rs new file mode 100644 index 000000000..88e80c6c6 --- /dev/null +++ b/crates/suite-account/src/lib.rs @@ -0,0 +1,455 @@ +//! The Craft App Suite's shared account store: the suite's keychain. +//! +//! Somebody signs in once and every Craft App acts as them. Before this, each application kept its +//! own session file. Taken across the suite that meant a sign-in per application, a copy of a +//! bearer token on disk per application, and a separate place to revoke per application. +//! +//! The store has two halves, kept deliberately apart: +//! +//! * The list of accounts is a small JSON file in one suite-level folder ([`paths`]). It names who +//! has signed in, at which deployment, and which account is current. It holds no credential. +//! * The token is in the operating system's keychain ([`store`]). Windows Credential Manager, the +//! macOS Keychain, or the Secret Service. +//! +//! Nothing here is mandatory. An application asks [`Store::shared`] what the suite has to offer and +//! gets one of three answers: somebody is signed in, nobody is signed in, or there is an account on +//! file whose token could not be read. The second and third leave the application exactly as it was +//! before this crate existed, offering its own sign-in. A machine with no keychain, a locked +//! keychain, a missing folder and an empty suite all land on "nobody is signed in". None of them is +//! an error that stops an application starting. +//! +//! [`Store::discard`] clears the keychain entry and then the row, for a session this machine +//! should stop holding. [`Store::forget`] clears only the keychain entry, leaving the row for a +//! user interface to still show (and, say, offer "sign in again" on). Neither talks to the +//! deployment: ending the session there, so every machine the person left one on drops it too, is +//! a distinct operation that belongs to the provider adapter that knows how to ask the deployment +//! for that, per RFC-0025's "Cross-app lifecycle guarantees" (point 4: forgetting is local, +//! revoking is at the provider). A consumer that wants both calls its own revoke, then +//! [`Store::discard`]. +//! +//! An application upgrading from its own session file calls [`migrate::adopt`] once at startup. +//! +//! ## Concurrent mutations and partial-failure recovery +//! +//! Several apps run at once against one account list and one keychain (RFC-0025's "Cross-app +//! lifecycle guarantees"). Every mutation of the accounts file ([`Store::sign_in`], +//! [`Store::update_token`], [`Store::discard`], [`Store::set_active`], [`Store::touch`]) therefore +//! reads, changes and writes it under one OS-level file lock ([`lock::with_lock`]), never an +//! unlocked read-modify-write. A pure read ([`Store::accounts`], [`Store::shared`]) does not take +//! the lock; [`accounts::write`] already replaces the file through a temporary file and a rename, +//! so a reader never sees a half-written file, only one write older than the latest. +//! +//! The lock does not wrap an unconditional keychain call. A keychain write or removal happens +//! either entirely before the lock is taken or, for [`Store::discard`], [`Store::sign_in`]'s +//! re-check and [`Store::update_token`]'s write, inside the same lock hold as the list change it +//! belongs with. Each of those three is conditional on the list mutation it sits beside actually +//! going ahead, never a call made regardless. A locked section is never held across a call into +//! the keychain that another `Store` in this process could itself be waiting on; that would +//! deadlock two `Store`s over one folder in a single process the same way two applications would +//! be. +//! +//! Each operation's ordering is chosen so a crash, or another process winning a race, leaves a +//! state the next reader detects and repairs rather than a silent mismatch (guarantee 1): +//! +//! * [`Store::sign_in`] writes the keychain token first, the list second. A crash in between +//! leaves one keychain entry nothing on the list points at yet. Harmless: the account's handle +//! is a digest of the deployment and the subject, so the next sign-in for the same account +//! overwrites that same entry rather than minting a new one. A concurrent [`Store::discard`] +//! for the same handle landing in that same window is not harmless the same way: it would +//! delete the entry this call just wrote and then, moments later, this call would still commit +//! a row claiming a session that no longer has a token behind it. The lock closure therefore +//! re-checks the keychain just before committing the row. It writes the token again when +//! something else has already changed it. The row this call reports `Ok` for then always has +//! its token in place the moment it lands. +//! * [`Store::discard`] removes the keychain entry and writes the list's tombstone under the same +//! lock hold. A crash between them leaves a row on the list with no entry behind it; `shared()` +//! already reads that as nobody signed in, and the next sign-in for that account tidies the row +//! up. +//! * [`Store::update_token`] checks the account's generation once, unlocked, purely to reject an +//! already-stale caller cheaply before it ever takes the lock. The keychain write itself +//! happens only under the lock, in the generation re-check's own success arm, immediately +//! before the row commits. A sign-in, a discard, or a discard followed by a re-add can land in +//! the window the unlocked check left open. The re-check exists to catch exactly that, whoever +//! won it. Either way, this call answers [`Error::StaleGeneration`] (or [`Error::Unknown`], for +//! a handle never on this list at all; see "Cross-app lifecycle guarantees" point 2 and +//! [`accounts::Accounts::locate`]) having never touched the keychain. There is never a stale +//! token left in it to clean up or weigh against the winner's own. A crash between the write +//! and the commit, both now inside one lock hold, leaves the list one generation behind a +//! keychain token that is already the +//! newer one; the next successful `update_token` against that same, still-current generation +//! simply writes through it again. +//! +//! ```no_run +//! # fn main() -> Result<(), craft_suite_account::Error> { +//! use craft_suite_account::{Shared, Store}; +//! +//! let store = Store::open(); +//! match store.shared() { +//! Shared::Session { account, token } => { +//! // Use `token` as a bearer against `account.service`. +//! let _ = (account, token); +//! } +//! // Offer this application's own sign-in, exactly as before. +//! Shared::None => {} +//! Shared::Unreadable { why, .. } => eprintln!("the shared sign-in could not be read: {why}"), +//! } +//! # Ok(()) } +//! ``` + +#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] + +pub mod accounts; +mod error; +mod lock; +pub mod migrate; +pub mod paths; +#[cfg(test)] +mod race_hook; +mod secret; +pub mod store; + +#[cfg(test)] +mod tests; + +use std::path::{Path, PathBuf}; + +pub use accounts::{Account, Accounts}; +pub use error::Error; +pub use migrate::Adopted; +pub use secret::Secret; +pub use store::{KEYCHAIN_SERVICE, Keychain, Memory, TokenStore}; + +/// What the suite store has to offer. +#[derive(Debug)] +pub enum Shared { + /// Somebody is signed in and the token came back. + Session { account: Account, token: Secret }, + /// Nobody is signed in here. Offer a sign-in. + None, + /// An account is on file and its token could not be read: a locked keychain, a keychain this + /// process may not reach, or an entry somebody deleted by hand. + /// + /// Offer a sign-in. Say why the shared one did not come through. Quietly showing a signed-out + /// window would leave somebody wondering where their account went. + Unreadable { account: Account, why: String }, +} + +/// A sign-in about to be recorded. +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub struct NewAccount { + /// The deployment's base URL. + pub service: String, + /// The deployment's identifier for the account: the OIDC subject. + pub user: String, + pub display: String, + pub email: Option, + /// Whether cloud storage is linked. Recorded for a user interface; the deployment is the + /// authority and is asked again on each start. + pub linked: bool, +} + +/// The suite's account store. +pub struct Store { + /// The suite folder. `None` when this process keeps nothing. + dir: Option, + tokens: S, + /// This store's own test-only pause point (see [`race_hook`]). One per instance, never + /// shared across stores, so two tests racing their own stores in parallel can never answer + /// each other's pause. + #[cfg(test)] + race_hook: race_hook::Hook, +} + +impl Store { + /// The real store: the suite folder for this platform and the platform's keychain. + pub fn open() -> Store { + Store::at(paths::resolve(&paths::Probe::default()).dir, Keychain) + } +} + +impl Store { + /// A store over a given folder and token store. `None` keeps nothing. + pub fn at(dir: Option, tokens: S) -> Store { + Store { + dir, + tokens, + #[cfg(test)] + race_hook: race_hook::Hook::new(), + } + } + + /// Arms this store's own test-only pause point in [`Store::update_token`], between its + /// first, unlocked check and the lock it takes for its second one. See [`race_hook`] for + /// why the hook lives on the store rather than behind one shared slot. + #[cfg(test)] + pub(crate) fn arm_race_hook(&self) -> race_hook::Handle { + self.race_hook.arm() + } + + /// The suite folder, when there is one. + pub fn dir(&self) -> Option<&Path> { + self.dir.as_deref() + } + + /// The accounts file, when there is one. + pub fn path(&self) -> Option { + self.dir.as_deref().map(paths::file) + } + + /// Whether this store can hold a session. It needs a folder. The machine needs a keychain. + /// + /// Checked before a sign-in and before a migration. Neither then half-completes. + pub fn usable(&self) -> Result<(), Error> { + let _ = self.dir.as_deref().ok_or(Error::Isolated)?; + self.tokens.available().map_err(Error::Keychain) + } + + /// Whether a readable token is stored for this account handle. + /// + /// Checked against isolation first, the same as every call that reaches the keychain. An + /// isolated store answers [`Error::Isolated`] here too, before any keychain read. + pub fn has_token(&self, id: &str) -> Result { + let _ = self.dir.as_deref().ok_or(Error::Isolated)?; + Ok(self.tokens.get(id).map_err(Error::Keychain)?.is_some()) + } + + /// Every account on file. An isolated store has none. + pub fn accounts(&self) -> Result { + match self.path() { + Some(path) => accounts::read(&path), + None => Ok(Accounts::default()), + } + } + + /// What the suite has to offer. Never fails: absence of every kind is [`Shared::None`]. + /// + /// This is the call an application makes at startup. The answer decides whether it offers its + /// own sign-in. + pub fn shared(&self) -> Shared { + let list = match self.accounts() { + Ok(list) => list, + Err(Error::Isolated) => return Shared::None, + Err(e) => { + log::warn!("the suite account list could not be read: {e}"); + return Shared::None; + } + }; + let Some(account) = list.current().cloned() else { return Shared::None }; + match self.tokens.get(&account.id) { + Ok(Some(token)) => Shared::Session { account, token }, + // On file with no entry behind it. Somebody deleted the entry, or a sign-out got half + // way. Either way nobody is signed in. The next sign-in tidies the row up. + Ok(None) => Shared::None, + Err(why) => Shared::Unreadable { account, why }, + } + } + + /// Records a sign-in: the token into the keychain, then the account onto the list, the latter + /// as one locked read-change-write (see the module docs, "Concurrent mutations and + /// partial-failure recovery"). + /// + /// The token goes first. A failed list write then leaves the previous state intact and one + /// unreferenced keychain entry. The next sign-in for the same account overwrites that entry, + /// because the handle is a digest of the deployment and the subject. Nothing fresh is minted + /// each time. The other order would leave an account on the list with no token behind it. + /// + /// A [`Store::discard`] for this same handle can still land between that first write and the + /// lock below, taking the entry this call just placed with it. The lock closure re-checks the + /// keychain right before it commits the row. It writes the token again when something else + /// has already changed it. An `Ok` from this call then never reports a session with no token + /// behind it. + pub fn sign_in(&self, new: &NewAccount, token: &Secret, now: i64) -> Result { + self.usable()?; + let path = self.path().ok_or(Error::Isolated)?; + let service = accounts::normalise(&new.service); + let id = accounts::handle(&service, &new.user); + self.tokens.put(&id, token).map_err(Error::Keychain)?; + lock::with_lock(&path, || { + let mut list = accounts::read(&path)?; + let existing = list.get(&id).cloned(); + let added = existing.as_ref().map_or(now, |a| a.added); + // A fresh generation, continuing past whatever this handle last reached, whether that + // was an active row (a sign-in replacing it) or a tombstone (a removal, per RFC-0025 + // lifecycle guarantee 2: generations are monotonic across removal and re-add, never + // restarting at 0). Either way a write made against the generation this handle held a + // moment ago is now stale. See [`Account::generation`]. + let generation = match &existing { + Some(account) => account.generation.checked_add(1).ok_or_else(|| Error::GenerationExhausted(id.clone()))?, + None => match list.tombstone_generation(&id) { + Some(generation) => generation.checked_add(1).ok_or_else(|| Error::GenerationExhausted(id.clone()))?, + None => 0, + }, + }; + let account = Account { + id: id.clone(), + service: service.clone(), + user: new.user.clone(), + display: new.display.clone(), + email: new.email.clone(), + added, + last_used: now, + linked: new.linked, + generation, + }; + // A discard for this handle could have run entirely in the window between the + // unlocked write above and this lock: it would have removed that entry on its way to + // the tombstone this call just read past. Putting the token again here, still inside + // the lock, closes that window: the row committed just below is never left pointing + // at a keychain entry something else already took. Skipped when nothing changed it, + // so the common, non-racing sign-in never pays for a second keychain write. + if self.tokens.get(&id).map_err(Error::Keychain)?.as_ref() != Some(token) { + self.tokens.put(&id, token).map_err(Error::Keychain)?; + } + list.put(account.clone()); + accounts::write(&path, &list)?; + Ok(account) + }) + } + + /// Writes a refreshed token back, honouring the account's generation. + /// + /// Updates this account's row in place. It never changes which account is active. A refresh + /// runs in the background for whichever account needs one, including one the person did not + /// select. It must never steal the selection away from the account they actually picked. + /// [`Store::sign_in`] and [`Store::set_active`] are the only calls that change `active`. + /// + /// `expected_generation` is the generation the caller last read the account at. A sign-in or a + /// removal bumps the generation (see [`Account::generation`]); a refresh that was already in + /// flight when one of those landed is then refused rather than silently overwriting something + /// newer, per RFC-0025's "Cross-app lifecycle guarantees" (point 2: removal wins over refresh). + /// An account that was removed answers [`Error::StaleGeneration`] holding the tombstone's + /// generation, never [`Error::Unknown`] and never a silent recreation; only a handle that has + /// never been on this list at all is `Unknown`. See [`accounts::Accounts::locate`]. + /// + /// Checked twice. The keychain is written only once, inside the lock, after the second check + /// passes. + /// + /// The first check, unlocked, is a fast rejection only. A caller already stale when it calls + /// at all never even takes the lock. It writes nothing. The second check, under the accounts + /// lock, is what the keychain write is actually conditioned on: `self.tokens.put` runs only + /// in that check's own success arm, right before the row commits, both inside the one lock + /// hold. A sign-in or a discard for the same handle can land in the window between the two + /// checks. The second check exists to catch exactly that. By the time it runs, this call + /// still has not touched the keychain at all. Every losing path, a newer sign-in, a discard, + /// a discard followed by a re-add, answers [`Error::StaleGeneration`] (or [`Error::Unknown`]) + /// having written nothing. No stale token is ever left in the keychain for a cleanup step to + /// weigh against a winner's. See the module docs ("Concurrent mutations and partial-failure + /// recovery"). + pub fn update_token(&self, id: &str, expected_generation: u32, token: &Secret, now: i64) -> Result { + self.usable()?; + let path = self.path().ok_or(Error::Isolated)?; + + match accounts::read(&path)?.locate(id) { + accounts::Located::Active(account) if account.generation == expected_generation => {} + accounts::Located::Active(account) => { + return Err(Error::StaleGeneration { id: id.to_owned(), expected: expected_generation, current: account.generation }); + } + accounts::Located::Tombstoned(current) => { + return Err(Error::StaleGeneration { id: id.to_owned(), expected: expected_generation, current }); + } + accounts::Located::Unknown => return Err(Error::Unknown(id.to_owned())), + } + + // Test only, and a no-op unless a test armed this store's own hook (see `race_hook`): + // holds here, right after the first check above has read the pre-race generation and + // right before the lock for the second one, so a test can run a competing sign-in or a + // discard and re-add to completion in between. Without this, a test that only lines + // threads up at their start cannot tell a build that correctly rejects at the second, + // locked check apart from a pre-fix build that got lucky and rejected at the first, + // unlocked one instead. + #[cfg(test)] + self.race_hook.pause(); + + lock::with_lock(&path, || { + let mut list = accounts::read(&path)?; + match list.locate(id) { + accounts::Located::Active(account) if account.generation == expected_generation => { + let mut updated = account.clone(); + updated.generation = updated.generation.checked_add(1).ok_or_else(|| Error::GenerationExhausted(id.to_owned()))?; + updated.last_used = now; + // The write and the commit are one atomic step from here on, with respect to + // every other mutator. sign_in and discard both take this same lock for + // their own keychain and list changes. Nothing can land between this put and + // this write. + self.tokens.put(id, token).map_err(Error::Keychain)?; + // Not `list.put`: a refresh is maintenance, never a reason to make this the + // account a person selected. See [`accounts::Accounts::refresh_in_place`]. + list.refresh_in_place(id, updated.clone()); + accounts::write(&path, &list)?; + Ok(updated) + } + accounts::Located::Active(account) => { + Err(Error::StaleGeneration { id: id.to_owned(), expected: expected_generation, current: account.generation }) + } + accounts::Located::Tombstoned(current) => Err(Error::StaleGeneration { id: id.to_owned(), expected: expected_generation, current }), + accounts::Located::Unknown => Err(Error::Unknown(id.to_owned())), + } + }) + } + + /// Makes an account the current one. + pub fn set_active(&self, id: &str) -> Result<(), Error> { + let path = self.path().ok_or(Error::Isolated)?; + lock::with_lock(&path, || { + let mut list = accounts::read(&path)?; + if list.get(id).is_none() { + return Err(Error::Unknown(id.to_owned())); + } + list.active = Some(id.to_owned()); + accounts::write(&path, &list) + }) + } + + /// Records that an application used the account, for a list that can show the most recent one. + pub fn touch(&self, id: &str, now: i64) -> Result<(), Error> { + let path = self.path().ok_or(Error::Isolated)?; + lock::with_lock(&path, || { + let mut list = accounts::read(&path)?; + let Some(account) = list.accounts.iter_mut().find(|a| a.id == id) else { + return Err(Error::Unknown(id.to_owned())); + }; + account.last_used = now; + accounts::write(&path, &list) + }) + } + + /// Clears an account here: the keychain entry and the row's tombstone, under one lock hold. + /// + /// This is the local half of a sign-out only. Ending the session at the deployment, so every + /// machine the person left one on drops it too, is a distinct call on the provider adapter; a + /// consumer that wants both makes that call first, while the token can still be read, and then + /// calls this. See the module documentation and RFC-0025's "Cross-app lifecycle guarantees". + /// + /// The keychain removal happens inside the same lock hold as the list write, not before it: a + /// refresh racing this discard (see [`Store::update_token`]'s second check) must never be able + /// to land its own keychain write back in between this call's keychain removal and its list + /// write and so put the entry right back. + pub fn discard(&self, id: &str) -> Result<(), Error> { + let path = self.path().ok_or(Error::Isolated)?; + lock::with_lock(&path, || { + let mut list = accounts::read(&path)?; + if let Some(account) = list.get(id).cloned() { + self.tokens.remove(id).map_err(Error::Keychain)?; + list.remove_with_tombstone(id, account.generation)?; + accounts::write(&path, &list)?; + } + Ok(()) + }) + } + + /// Clears the keychain entry for an account, leaving the list alone. + /// + /// Checked against isolation first. `Store::at(None, _)` keeps nothing; without this check an + /// isolated store could still reach into the keychain and delete another application's + /// shared credential on this same machine. + pub fn forget(&self, id: &str) -> Result<(), Error> { + let _ = self.dir.as_deref().ok_or(Error::Isolated)?; + self.tokens.remove(id).map_err(Error::Keychain) + } +} + +impl std::fmt::Debug for Store { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Store").field("dir", &self.dir).field("tokens", &self.tokens).finish() + } +} diff --git a/crates/suite-account/src/lock.rs b/crates/suite-account/src/lock.rs new file mode 100644 index 000000000..160ff3e3c --- /dev/null +++ b/crates/suite-account/src/lock.rs @@ -0,0 +1,96 @@ +//! A cross-process lock beside the accounts file. +//! +//! Every mutation of `accounts.json`, a sign-in, a token refresh, a removal, an active-account +//! change, a touch, goes through [`with_lock`]. Without it every mutation is an unlocked +//! read-modify-write: two processes each completing 100 sign-ins into one folder left 101 rows on +//! file instead of 200, because the second writer's read missed the first writer's row. A pure +//! read (`Store::accounts`, `Store::shared`) does not need the lock. [`crate::accounts::write`] +//! already writes through a temporary file and a rename, so a reader never sees a torn file; it +//! can only see a list that is one write older than the latest. +//! +//! This matches the mechanism `craft-ai-integrations`'s own secret store already uses for the same +//! problem: a sibling `.lock` file, taken with `std::fs::File::try_lock` and a bounded retry, +//! never a new dependency. RFC-0025's convergence note names that store's "locked read-change- +//! write" as a requirement the shared crate adopts; this is that adoption, ahead of the +//! convergence PR itself. + +use std::fs::{self, File, OpenOptions}; +use std::io; +use std::path::{Path, PathBuf}; +use std::time::{Duration, Instant}; + +use crate::error::Error; + +/// How long to wait for another process holding the lock before giving up. Long enough that a +/// normal read-change-write of a few-hundred-byte file never times out under load; short enough +/// that a process holding the lock across a crash does not wedge every other app indefinitely. +const LOCK_TIMEOUT: Duration = Duration::from_secs(5); +const POLL_INTERVAL: Duration = Duration::from_millis(20); + +fn lock_path(path: &Path) -> PathBuf { + let name = path.file_name().and_then(|n| n.to_str()).unwrap_or("accounts.json"); + path.with_file_name(format!("{name}.lock")) +} + +fn open_lock_file(path: &Path) -> io::Result { + if let Some(dir) = path.parent() { + fs::create_dir_all(dir)?; + } + OpenOptions::new().read(true).write(true).create(true).truncate(false).open(lock_path(path)) +} + +/// Runs `f` while holding an exclusive, OS-level lock on `path`'s sibling `.lock` file. +/// +/// `f` reads, changes and writes the accounts file; `with_lock` only ever wraps that, never a +/// keychain call. A keychain is its own atomic resource per entry; serialising it behind this file +/// lock would mean the two apps this guards could never run a keychain operation while either held +/// the lock, which is exactly the deadlock a same-process caller (two `Store`s sharing one folder, +/// as two applications in one process would be) could hit. Acquiring the lock itself fails only as +/// [`Error::Io`]; `f` may return any [`Error`]. +pub(crate) fn with_lock(path: &Path, f: impl FnOnce() -> Result) -> Result { + let lock = open_lock_file(path).map_err(|e| Error::Io(format!("couldn't open the lock beside {} ({e})", path.display())))?; + let start = Instant::now(); + loop { + match lock.try_lock() { + Ok(()) => break, + Err(fs::TryLockError::WouldBlock) => { + if start.elapsed() > LOCK_TIMEOUT { + return Err(Error::Io(format!("timed out waiting for the accounts lock on {}", path.display()))); + } + std::thread::sleep(POLL_INTERVAL); + } + Err(fs::TryLockError::Error(e)) => { + return Err(Error::Io(format!("couldn't lock {} ({e})", path.display()))); + } + } + } + let result = f(); + let _ = lock.unlock(); + result +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn the_lock_is_exclusive_while_held_and_released_after() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join("accounts.json"); + let blocked = with_lock(&path, || { + let other = open_lock_file(&path).unwrap(); + Ok(matches!(other.try_lock(), Err(fs::TryLockError::WouldBlock))) + }) + .unwrap(); + assert!(blocked, "a second lock attempt should see the first one held"); + assert!(with_lock(&path, || Ok(true)).unwrap(), "the lock is free again once `with_lock` returns"); + } + + #[test] + fn an_error_from_the_closure_still_releases_the_lock() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join("accounts.json"); + let _: Result<(), Error> = with_lock(&path, || Err(Error::Unknown("x".to_owned()))); + assert!(with_lock(&path, || Ok(true)).unwrap(), "a failed closure must not leave the lock held"); + } +} diff --git a/crates/suite-account/src/migrate.rs b/crates/suite-account/src/migrate.rs new file mode 100644 index 000000000..94ad3d128 --- /dev/null +++ b/crates/suite-account/src/migrate.rs @@ -0,0 +1,187 @@ +//! Taking over a per-application session file. +//! +//! An application that signed in before the suite store existed wrote its own session beside its +//! own settings, naming the file however it liked. GridCraft's was +//! `%APPDATA%\GridCraft\legacy-session.json`. Upgrading must not sign anybody out. The application +//! therefore hands that session to the suite store once and deletes the file. The token then lives +//! in the keychain and the whole suite can use it. +//! +//! The application does this, never the launcher. The file belongs to the application. Nothing +//! should reach into another application's folder to delete a file. +//! +//! The file is only deleted once the suite store holds the session. Where the suite store can keep +//! nothing (no keychain on this machine, or this process is isolated) the file stays exactly where +//! it is. Removing it would sign the user out. That is the one thing migration must not do. +//! +//! The earliest of these files held one key: `{"token": "..."}`. It names no deployment and no +//! subject. There is nothing to key an account on. Such a file is left exactly where it is too. A +//! made-up handle would file the token under something nothing ever looks up again. That reads as +//! a silent sign-out. An application that rewrites the file with the deployment and the subject is +//! adopted on the next startup. Adopting one launch late costs nothing. + +use std::path::Path; + +use serde::Deserialize; +use zeroize::Zeroizing; + +use crate::accounts::{self, Account}; +use crate::error::Error; +use crate::secret::Secret; +use crate::store::TokenStore; +use crate::{NewAccount, Store}; + +/// What a legacy session file said. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Legacy { + /// The deployment's base URL, with any trailing slash trimmed. Empty where the file predates + /// the application recording it. + pub service: String, + /// The deployment's own identifier for the account: the OIDC subject. Empty where the file + /// predates the application recording it. + pub user: String, + pub display: String, + pub email: Option, + pub token: Secret, +} + +impl Legacy { + /// What the file does not say yet, when it cannot be keyed to an account. + /// + /// The account handle is a digest of the deployment and the subject. Both are therefore + /// needed. A session written before the application recorded them carries a token alone. + pub fn incomplete(&self) -> Option<&'static str> { + if self.service.is_empty() { + return Some("which deployment it belongs to"); + } + if self.user.is_empty() { + return Some("whose account it is"); + } + None + } +} + +/// What happened. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum Adopted { + /// There was no file. There is nothing to take over. + Nothing, + /// The session is in the suite store now. The file is gone. + Taken(Account), + /// The file was left exactly where it is. The application goes on reading it. `why` says + /// which case it was: the suite store can keep nothing here, or the file does not yet say + /// enough to key an account on. + Kept { why: String }, +} + +/// The shape on disk. +/// +/// What an application writes today is `token`, `service`, `subject` and `display`. The file +/// predates this crate. The aliases therefore cover the other plausible spellings. +/// +/// The token is the only key that has to be there: a file without one carries no session at all. +/// Everything else defaults. That is what lets the earliest `{"token": "..."}` file still parse. +/// [`adopt`] then leaves such a file alone. Keying an account on nothing is the alternative. +#[derive(Deserialize)] +struct Stored { + #[serde(alias = "session", alias = "session_token", alias = "bearer", alias = "access_token")] + token: String, + #[serde(default, alias = "base", alias = "base_url", alias = "url", alias = "service_url")] + service: String, + #[serde(default, alias = "id", alias = "sub", alias = "subject", alias = "user_id")] + user: String, + #[serde(default, alias = "name", alias = "display_name")] + display: String, + #[serde(default)] + email: Option, +} + +/// The largest session file that will be read. +const MAX_BYTES: u64 = 64 << 10; + +/// Reads a legacy session file. A missing file is `Ok(None)`. +pub fn read(path: &Path) -> Result, Error> { + match std::fs::metadata(path) { + Ok(meta) if meta.len() > MAX_BYTES => { + return Err(Error::Malformed(format!("{} is {} bytes, too large to be a session", path.display(), meta.len()))); + } + Ok(_) => {} + Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(None), + Err(e) => return Err(Error::Io(format!("couldn't read {} ({e})", path.display()))), + } + // The raw file bytes and the token `serde` deserializes both hold the token in plain text, + // the same as the final `Secret` does. Dropping them ordinarily leaves that plain text for + // the allocator, unzeroed; only `Secret`'s own copy would be covered. Wrapping both in + // `Zeroizing` closes that gap. Destructuring `Stored` below moves `token` out whole, with no + // clone and no second plain copy to forget about. + let bytes = Zeroizing::new(std::fs::read(path).map_err(|e| Error::Io(format!("couldn't read {} ({e})", path.display())))?); + let Stored { token, service, user, display, email } = + serde_json::from_slice(&bytes).map_err(|e| Error::Malformed(format!("{} didn't parse ({e})", path.display())))?; + let token = Zeroizing::new(token); + if token.trim().is_empty() { + return Err(Error::Malformed(format!("{} carries no session", path.display()))); + } + let service = accounts::normalise(&service); + // The subject is never stood in for. A handle built on anything else would file the token + // where nothing looks for it. See [`Legacy::incomplete`]. + let user = user.trim().to_owned(); + let display = if display.trim().is_empty() { user.clone() } else { display }; + Ok(Some(Legacy { service, user, display, email, token: Secret::new(token.trim()) })) +} + +/// Hands a legacy session to the suite store and removes the file. +/// +/// Call this once at startup, before asking the suite store who is signed in. Safe to call when +/// there is no file. Safe to call again after it has run. +pub fn adopt(store: &Store, path: &Path, now: i64) -> Result { + let Some(legacy) = read(path)? else { return Ok(Adopted::Nothing) }; + if let Some(unsaid) = legacy.incomplete() { + return Ok(Adopted::Kept { why: format!("{} does not say {unsaid} yet", path.display()) }); + } + if let Err(why) = store.usable() { + return Ok(Adopted::Kept { why: why.to_string() }); + } + let service = accounts::normalise(&legacy.service); + let id = accounts::handle(&service, &legacy.user); + let existing = if store.has_token(&id)? { store.accounts()?.get(&id).cloned() } else { None }; + if let Some(account) = existing { + if file_still_holds(path, &legacy) { + match std::fs::remove_file(path) { + Ok(()) => {} + Err(e) if e.kind() == std::io::ErrorKind::NotFound => {} + Err(e) => return Err(Error::Io(format!("the suite already holds this session. {} is still there ({e})", path.display()))), + } + } + return Ok(Adopted::Taken(account)); + } + let new = NewAccount { + service: legacy.service.clone(), + user: legacy.user.clone(), + display: legacy.display.clone(), + email: legacy.email.clone(), + linked: false, + }; + let account = store.sign_in(&new, &legacy.token, now)?; + // Only now, with the session held somewhere better, does the file go. Something else may + // have rewritten it in the meantime (another process still running the application's own, + // now-superseded writer, mid-refresh); deleting that newer content would discard a session + // nothing else holds a copy of. `file_still_holds` only lets the removal through when the + // file is still exactly what was just adopted. Leaving it is always safe: the next startup's + // `adopt` call sees it again and tries once more. + if file_still_holds(path, &legacy) { + match std::fs::remove_file(path) { + Ok(()) => {} + Err(e) if e.kind() == std::io::ErrorKind::NotFound => {} + Err(e) => return Err(Error::Io(format!("the session moved to the keychain. {} is still there ({e})", path.display()))), + } + } + Ok(Adopted::Taken(account)) +} + +/// Whether `path` still parses to exactly `adopted`, right before it would be removed. +/// +/// Any other outcome, a changed file, a vanished file, or one that no longer parses, is treated +/// the same: do not delete. A changed file holds something nothing else has adopted yet; a +/// vanished one needs no removal; an unparseable one is not safe to reason about here at all. +fn file_still_holds(path: &Path, adopted: &Legacy) -> bool { + matches!(read(path), Ok(Some(current)) if current == *adopted) +} diff --git a/crates/suite-account/src/paths.rs b/crates/suite-account/src/paths.rs new file mode 100644 index 000000000..695760244 --- /dev/null +++ b/crates/suite-account/src/paths.rs @@ -0,0 +1,138 @@ +//! Where the suite keeps its list of accounts. +//! +//! One folder for the whole Craft App Suite. It sits beside the per-application folders. It is not +//! a child of any of them. +//! +//! `craft-settings` gives each application `/`. That is the right home +//! for that application's own preferences. An account is not one of those. The same person signs in +//! once and every Craft App acts as them. The record therefore belongs to the suite. An account +//! placed under one application's folder would make every other application read a folder it does +//! not own. +//! Removing that application would then sign everybody out. The launcher's own folder fails for the +//! same reason. An application must not have to know the launcher exists. +//! +//! So: `/ArtCraft` on Windows and macOS. `/artcraft` on +//! Linux and the BSDs. The launcher already spells its own folder that way per platform. Written +//! out, those are `%APPDATA%\ArtCraft`, `~/Library/Application Support/ArtCraft` and +//! `~/.config/artcraft`. +//! +//! It is the configuration folder. The record then follows a Windows profile the way a user would +//! expect. The per-application session file this replaces lived in `%APPDATA%` too. The folder +//! holds no secret. The token is in the keychain. + +use std::ffi::OsString; +use std::path::{Path, PathBuf}; + +/// The suite folder's name, spelled the way the launcher spells its own per platform. +pub const DIR: &str = if cfg!(any(target_os = "macos", target_os = "windows")) { "ArtCraft" } else { "artcraft" }; + +/// The file inside it. +pub const FILE: &str = "accounts.json"; + +/// Points the suite folder somewhere else. Set and empty means read and write nothing. +pub const ENV_VAR: &str = "ARTCRAFT_SUITE_DIR"; + +/// File names beside the executable that switch portable mode on. The launcher's Windows portable +/// zip ships `portable.txt`. `portable` is `craft-settings`' own spelling. +pub const PORTABLE_MARKERS: &[&str] = &["portable.txt", "portable"]; + +/// The folder a portable install keeps the suite's accounts in, beside the executable. +pub const PORTABLE_DIR: &str = "ArtCraftSuite"; + +/// Which rule chose the folder. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum Rule { + /// [`ENV_VAR`] named it. + EnvVar, + /// [`ENV_VAR`] was set and empty. Nothing is read or written. + Isolated, + /// A portable marker beside the executable. + Portable, + /// The platform's configuration folder. + Platform, + /// This system has no per-user configuration folder. Nothing is read or written. A file in the + /// current directory would be the wrong home for a record of who is signed in. + Nowhere, +} + +/// A chosen folder and the rule behind it. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Resolved { + /// The suite folder. `None` for [`Rule::Isolated`] and [`Rule::Nowhere`]. + pub dir: Option, + pub rule: Rule, +} + +/// Reads an environment variable by name. +pub type EnvReader = Box Option>; + +/// What the rules look at. The default reads the real process. Tests supply their own. +pub struct Probe { + pub env: EnvReader, + /// The folder holding the executable, if known. + pub exe_dir: Option, + /// The platform configuration folder (`%APPDATA%`, `Application Support`, `~/.config`). + pub platform_config_dir: Option, +} + +impl Default for Probe { + fn default() -> Probe { + Probe { + env: Box::new(|name| std::env::var_os(name)), + exe_dir: std::env::current_exe().ok().and_then(|p| p.parent().map(Path::to_path_buf)), + platform_config_dir: dirs::config_dir(), + } + } +} + +impl std::fmt::Debug for Probe { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Probe").field("exe_dir", &self.exe_dir).field("platform_config_dir", &self.platform_config_dir).finish_non_exhaustive() + } +} + +/// Applies the rules, first match winning. +pub fn resolve(probe: &Probe) -> Resolved { + if let Some(value) = (probe.env)(ENV_VAR) { + if value.is_empty() { + return Resolved { dir: None, rule: Rule::Isolated }; + } + return Resolved { dir: Some(PathBuf::from(value)), rule: Rule::EnvVar }; + } + if let Some(dir) = probe.exe_dir.as_deref().and_then(portable_dir) { + return Resolved { dir: Some(dir), rule: Rule::Portable }; + } + match &probe.platform_config_dir { + Some(base) => Resolved { dir: Some(base.join(DIR)), rule: Rule::Platform }, + None => Resolved { dir: None, rule: Rule::Nowhere }, + } +} + +/// The accounts file inside a suite folder. +pub fn file(dir: &Path) -> PathBuf { + dir.join(FILE) +} + +/// The folder a portable marker points at, when `exe_dir` has one. +/// +/// On macOS the executable sits in `X.app/Contents/MacOS`. The marker is therefore looked for +/// beside the `.app` bundle. Writing inside a signed bundle breaks its signature. +fn portable_dir(exe_dir: &Path) -> Option { + let base = bundle_parent(exe_dir).unwrap_or(exe_dir); + PORTABLE_MARKERS.iter().any(|m| base.join(m).is_file()).then(|| base.join(PORTABLE_DIR)) +} + +fn bundle_parent(exe_dir: &Path) -> Option<&Path> { + if !cfg!(target_os = "macos") || exe_dir.file_name()? != "MacOS" { + return None; + } + let contents = exe_dir.parent()?; + if contents.file_name()? != "Contents" { + return None; + } + let bundle = contents.parent()?; + if bundle.extension()? != "app" { + return None; + } + bundle.parent() +} diff --git a/crates/suite-account/src/race_hook.rs b/crates/suite-account/src/race_hook.rs new file mode 100644 index 000000000..13bff53ce --- /dev/null +++ b/crates/suite-account/src/race_hook.rs @@ -0,0 +1,74 @@ +//! A synchronization point inside [`crate::Store::update_token`], between its first, unlocked +//! generation check and the lock it takes for its second one. Test only, compiled for nothing +//! but `cargo test`. +//! +//! Added for a review note on this crate's own race tests: a thread barrier only lines the +//! refresh and a competing sign-in or discard-and-re-add up at their *start*. From there either +//! one can finish first. A build that still has the bug this crate's tests guard against can +//! then pass for the wrong reason, by rejecting at the first, unlocked check because the +//! competing write happened to land first, never reaching the second, locked check the test is +//! actually named for. [`Hook::arm`] and [`Hook::pause`] below pin that window instead: a test +//! arms its own `Store`'s hook before starting the refresh on that same store, waits on the +//! returned handle's `arrived` until the refresh has done its first check, runs the competing +//! operation to completion, then sends on `go` to let the refresh continue into its second +//! check. +//! +//! The hook lives on the `Store` instance, one [`Hook`] per store, rather than behind one shared +//! slot for the whole process. The workspace's own CI runs this crate's suite with the default, +//! parallel test runner, not the single-threaded invocation this crate's local gate had been +//! using; a process-wide hook armed by two of this crate's race tests running at the same time +//! answered each other's `pause`, so one test's release freed the other test's refresh early and +//! the pinned ordering both tests rely on collapsed. Scoping the hook to the store a given test +//! actually built means a concurrent test's hook can never be the one `update_token` reaches, +//! because every store keeps its own, so there is nothing left to cross. +//! +//! Outside a test that calls `arm`, [`Hook::pause`] does nothing: every other `update_token` +//! call, including every one outside this crate's own test suite, runs straight through. + +use std::sync::Mutex; +use std::sync::mpsc::{Receiver, SyncSender, sync_channel}; + +struct Gate { + arrived: SyncSender<()>, + go: Receiver<()>, +} + +/// One store's own pause point. `Store::at` creates one for every instance; most never arm it, +/// so [`Hook::pause`] stays a no-op for them. +pub(crate) struct Hook(Mutex>); + +/// The test's half of the gate. `arrived.recv()` blocks until the refresh reaches the pause +/// point on this same store; sending on `go` releases it to continue past it. +pub(crate) struct Handle { + pub(crate) arrived: Receiver<()>, + pub(crate) go: SyncSender<()>, +} + +impl Hook { + /// A fresh, disarmed hook, for `Store::at` to give every store it builds. + pub(crate) fn new() -> Hook { + Hook(Mutex::new(None)) + } + + /// Arms this store's own pause point for the next call into its [`crate::Store::update_token`]. + /// A store this test never built, and so never raced on, keeps its own hook disarmed the + /// whole time, whatever else is running in parallel. + pub(crate) fn arm(&self) -> Handle { + let (arrived_tx, arrived_rx) = sync_channel::<()>(0); + let (go_tx, go_rx) = sync_channel::<()>(0); + let mut guard = self.0.lock().unwrap_or_else(|e| e.into_inner()); + *guard = Some(Gate { arrived: arrived_tx, go: go_rx }); + Handle { arrived: arrived_rx, go: go_tx } + } + + /// `update_token`'s half. A no-op when this store's hook was never armed, which is every + /// call outside a test that called `arm` on this exact store. When armed, tells the test it + /// has just finished its first, unlocked check, then blocks until the test releases it. + pub(crate) fn pause(&self) { + let gate = self.0.lock().unwrap_or_else(|e| e.into_inner()).take(); + if let Some(gate) = gate { + let _ = gate.arrived.send(()); + let _ = gate.go.recv(); + } + } +} diff --git a/crates/suite-account/src/secret.rs b/crates/suite-account/src/secret.rs new file mode 100644 index 000000000..19de1a3c7 --- /dev/null +++ b/crates/suite-account/src/secret.rs @@ -0,0 +1,48 @@ +//! A credential held in memory. + +use zeroize::Zeroizing; + +/// A bearer token, wrapped so it cannot be printed by accident. +/// +/// There is no `Display` and no `Serialize`. [`Debug`] reports the length and nothing else. A token +/// therefore never reaches a log line through a `{:?}` on some struct that happens to carry one. +/// The bytes are overwritten when the value is dropped. +/// +/// [`Secret::expose`] is the one way out. The only caller that needs it is the code building an +/// `Authorization` header. +#[derive(Clone)] +pub struct Secret(Zeroizing); + +impl Secret { + pub fn new(value: impl Into) -> Secret { + Secret(Zeroizing::new(value.into())) + } + + /// The bytes themselves. Send them. Never log them. + pub fn expose(&self) -> &str { + &self.0 + } + + /// How many bytes the token is. A report names this and never the value. + pub fn len(&self) -> usize { + self.0.len() + } + + pub fn is_empty(&self) -> bool { + self.0.is_empty() + } +} + +impl std::fmt::Debug for Secret { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "Secret({} bytes)", self.0.len()) + } +} + +impl PartialEq for Secret { + fn eq(&self, other: &Secret) -> bool { + *self.0 == *other.0 + } +} + +impl Eq for Secret {} diff --git a/crates/suite-account/src/store.rs b/crates/suite-account/src/store.rs new file mode 100644 index 000000000..15de2d6e2 --- /dev/null +++ b/crates/suite-account/src/store.rs @@ -0,0 +1,176 @@ +//! The token, in the operating system's own keychain. +//! +//! Windows Credential Manager, the macOS Keychain, or the Secret Service on Linux and the BSDs. +//! +//! A bearer token in a JSON file beside an application's settings is what this replaces. Such a +//! file is readable by anything running as the user. It survives in backups. It leaves nothing for +//! an administrator to revoke. A keychain entry is scoped to the one user. The platform encrypts it +//! at rest. It can be deleted one entry at a time from the platform's own window. +//! +//! One service name covers the whole suite. Every entry the suite ever writes is therefore findable +//! and removable in one place. +//! +//! ```text +//! service ai.storyteller.artcraft.suite-account +//! user the account handle (crate::accounts::handle: a digest of the deployment and the subject) +//! secret a bearer token for that account, minted by whatever deployment the handle names +//! ``` +//! +//! On Windows that is a generic credential whose target name is +//! `.ai.storyteller.artcraft.suite-account`, with machine-local persistence. A bearer token +//! minted for this machine therefore stays on it. On macOS it is a generic password in the user's +//! login keychain. On Linux and the BSDs it is a Secret Service item in the user's default +//! collection. That collection is locked with the login session. +//! +//! [`TokenStore`] is a trait so everything above it can be tested without a keychain. [`Memory`] is +//! the stand-in, the way `craft-nextcloud` drives a canned transport. + +use std::collections::BTreeMap; +use std::sync::{Arc, Mutex, PoisonError}; + +use crate::error::Error; +use crate::secret::Secret; + +/// The keychain service name every Craft App uses. One namespace, one place to revoke. +pub const KEYCHAIN_SERVICE: &str = "ai.storyteller.artcraft.suite-account"; + +/// Reading and writing one token per account handle. +pub trait TokenStore { + /// Whether this machine has a keychain this process can use. + /// + /// A headless Linux box with no Secret Service answers `Err`. The suite then behaves as though + /// nobody is signed in. No token goes to a file. + fn available(&self) -> Result<(), String>; + /// The token for `handle`, or `Ok(None)` when there is no entry. + fn get(&self, handle: &str) -> Result, String>; + fn put(&self, handle: &str, token: &Secret) -> Result<(), String>; + /// Removes the entry. Already gone is success. + fn remove(&self, handle: &str) -> Result<(), String>; +} + +/// The platform's keychain. +#[derive(Clone, Copy, Debug, Default)] +pub struct Keychain; + +impl Keychain { + fn entry(handle: &str) -> Result { + // Installs the platform store on the first call, once per process. + if let Err(e) = keyring::Entry::store_status() { + return Err(Error::Keychain(e.to_string())); + } + #[cfg(target_os = "windows")] + { + // Local, where the store's own default is Enterprise. An Enterprise credential is part + // of the roaming profile. A bearer token minted for this machine has no business + // travelling to another one. + let modifiers = std::collections::HashMap::from([("persistence", "Local")]); + keyring_core::Entry::new_with_modifiers(KEYCHAIN_SERVICE, handle, &modifiers).map_err(|e| Error::Keychain(e.to_string())) + } + #[cfg(not(target_os = "windows"))] + keyring_core::Entry::new(KEYCHAIN_SERVICE, handle).map_err(|e| Error::Keychain(e.to_string())) + } +} + +impl TokenStore for Keychain { + fn available(&self) -> Result<(), String> { + match keyring::Entry::store_status() { + Ok(()) => Ok(()), + Err(e) => Err(e.to_string()), + } + } + + fn get(&self, handle: &str) -> Result, String> { + let entry = Keychain::entry(handle).map_err(|e| e.to_string())?; + match entry.get_password() { + Ok(token) => Ok(Some(Secret::new(token))), + Err(keyring::Error::NoEntry) => Ok(None), + Err(e) => Err(e.to_string()), + } + } + + fn put(&self, handle: &str, token: &Secret) -> Result<(), String> { + let entry = Keychain::entry(handle).map_err(|e| e.to_string())?; + entry.set_password(token.expose()).map_err(|e| e.to_string()) + } + + fn remove(&self, handle: &str) -> Result<(), String> { + let entry = Keychain::entry(handle).map_err(|e| e.to_string())?; + match entry.delete_credential() { + Ok(()) | Err(keyring::Error::NoEntry) => Ok(()), + Err(e) => Err(e.to_string()), + } + } +} + +/// A keychain stand-in that keeps entries in memory. +/// +/// For tests. It also covers the answers a real keychain gives that are awkward to arrange: an +/// entry is there, there is no keychain on this machine, the keychain is there and locked. +#[derive(Clone, Debug, Default)] +pub struct Memory { + entries: Arc>>, + /// Why there is no usable keychain here, when there is not one. + missing: Option, + /// Why every read and write fails, for a keychain that exists and refuses. + refusing: Option, +} + +impl Memory { + pub fn new() -> Memory { + Memory::default() + } + + /// A machine with no keychain at all. + pub fn missing(why: impl Into) -> Memory { + Memory { missing: Some(why.into()), ..Memory::default() } + } + + /// A keychain that is there and refuses, the way a locked Secret Service does. + pub fn refusing(why: impl Into) -> Memory { + Memory { refusing: Some(why.into()), ..Memory::default() } + } + + /// How many entries are held. Tests use it to show a sign-out removed one. + pub fn count(&self) -> usize { + self.entries.lock().unwrap_or_else(PoisonError::into_inner).len() + } + + pub fn has(&self, handle: &str) -> bool { + self.entries.lock().unwrap_or_else(PoisonError::into_inner).contains_key(handle) + } +} + +impl TokenStore for Memory { + fn available(&self) -> Result<(), String> { + match &self.missing { + Some(why) => Err(why.clone()), + None => Ok(()), + } + } + + fn get(&self, handle: &str) -> Result, String> { + self.available()?; + if let Some(why) = &self.refusing { + return Err(why.clone()); + } + Ok(self.entries.lock().unwrap_or_else(PoisonError::into_inner).get(handle).cloned()) + } + + fn put(&self, handle: &str, token: &Secret) -> Result<(), String> { + self.available()?; + if let Some(why) = &self.refusing { + return Err(why.clone()); + } + self.entries.lock().unwrap_or_else(PoisonError::into_inner).insert(handle.to_owned(), token.clone()); + Ok(()) + } + + fn remove(&self, handle: &str) -> Result<(), String> { + self.available()?; + if let Some(why) = &self.refusing { + return Err(why.clone()); + } + self.entries.lock().unwrap_or_else(PoisonError::into_inner).remove(handle); + Ok(()) + } +} diff --git a/crates/suite-account/src/tests.rs b/crates/suite-account/src/tests.rs new file mode 100644 index 000000000..c1a614aab --- /dev/null +++ b/crates/suite-account/src/tests.rs @@ -0,0 +1,939 @@ +//! Tests for the store, the migration and the fallback when nobody is signed in. +//! +//! A keychain is awkward to drive from a test. Everything above it therefore runs against +//! [`Memory`](crate::store::Memory). + +use std::ffi::OsString; +use std::path::{Path, PathBuf}; + +use crate::accounts::{self, Account}; +use crate::paths::{self, Probe, Rule}; +use crate::store::{Memory, TokenStore}; +use crate::{Adopted, Error, NewAccount, Secret, Shared, Store}; + +const SERVICE: &str = "https://craft.example.com"; +const USER: &str = "e9b1c0e4-0000-4000-8000-000000000001"; +const TOKEN: &str = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"; +const NOW: i64 = 1_760_000_000; + +fn probe(env: &[(&str, &str)], exe_dir: Option<&str>, config: Option<&str>) -> Probe { + let env: Vec<(String, String)> = env.iter().map(|(k, v)| ((*k).to_owned(), (*v).to_owned())).collect(); + Probe { + env: Box::new(move |name| env.iter().find(|(k, _)| k == name).map(|(_, v)| OsString::from(v))), + exe_dir: exe_dir.map(PathBuf::from), + platform_config_dir: config.map(PathBuf::from), + } +} + +fn new_account() -> NewAccount { + NewAccount { service: SERVICE.to_owned(), user: USER.to_owned(), display: "Ada Lovelace".to_owned(), email: None, linked: true } +} + +// ---- where the store lives ------------------------------------------------- + +#[test] +fn the_variable_names_the_folder() { + let r = paths::resolve(&probe(&[(paths::ENV_VAR, "/somewhere/else")], None, Some("/home/a/.config"))); + assert_eq!(r.rule, Rule::EnvVar); + assert_eq!(r.dir.as_deref(), Some(Path::new("/somewhere/else"))); +} + +#[test] +fn an_empty_variable_keeps_nothing() { + let r = paths::resolve(&probe(&[(paths::ENV_VAR, "")], None, Some("/home/a/.config"))); + assert_eq!(r.rule, Rule::Isolated); + assert_eq!(r.dir, None); +} + +#[test] +fn the_platform_folder_is_the_default() { + let r = paths::resolve(&probe(&[], None, Some("/home/a/.config"))); + assert_eq!(r.rule, Rule::Platform); + assert_eq!(r.dir.as_deref(), Some(Path::new("/home/a/.config").join(paths::DIR).as_path())); +} + +#[test] +fn a_portable_marker_wins_over_the_platform_folder() { + let dir = tempfile::tempdir().unwrap(); + std::fs::write(dir.path().join("portable.txt"), b"").unwrap(); + let exe_dir = dir.path().display().to_string(); + let r = paths::resolve(&probe(&[], Some(&exe_dir), Some("/home/a/.config"))); + assert_eq!(r.rule, Rule::Portable); + assert_eq!(r.dir.as_deref(), Some(dir.path().join(paths::PORTABLE_DIR).as_path())); +} + +#[test] +fn no_platform_folder_keeps_nothing() { + let r = paths::resolve(&probe(&[], None, None)); + assert_eq!(r.rule, Rule::Nowhere); + assert_eq!(r.dir, None); +} + +#[test] +fn the_handle_is_stable_and_separates_accounts() { + let a = accounts::handle(SERVICE, USER); + assert_eq!(a, accounts::handle(SERVICE, USER), "the same account twice is the same entry"); + // A trailing slash is the same deployment typed differently. + assert_eq!(a, accounts::handle("https://craft.example.com/", USER)); + assert_ne!(a, accounts::handle("https://other.example.com", USER), "another deployment is another account"); + assert_ne!(a, accounts::handle(SERVICE, "somebody-else"), "another person is another account"); + assert_eq!(a.len(), 24); + assert!(a.chars().all(|c| c.is_ascii_hexdigit())); +} + +// ---- signing in and out ---------------------------------------------------- + +#[test] +fn a_sign_in_can_be_read_back_by_the_next_application() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(dir.path().to_path_buf()), keychain.clone()); + let account = store.sign_in(&new_account(), &Secret::new(TOKEN), NOW).unwrap(); + + // A second application, its own Store over the same folder and keychain. + let other = Store::at(Some(dir.path().to_path_buf()), keychain); + match other.shared() { + Shared::Session { account: found, token } => { + assert_eq!(found.id, account.id); + assert_eq!(found.service, SERVICE); + assert_eq!(found.display, "Ada Lovelace"); + assert_eq!(token, Secret::new(TOKEN)); + } + other => panic!("expected a session, got {other:?}"), + } +} + +#[test] +fn the_accounts_file_never_holds_the_token() { + let dir = tempfile::tempdir().unwrap(); + let store = Store::at(Some(dir.path().to_path_buf()), Memory::new()); + store.sign_in(&new_account(), &Secret::new(TOKEN), NOW).unwrap(); + let on_disk = std::fs::read_to_string(store.path().unwrap()).unwrap(); + assert!(!on_disk.contains(TOKEN), "the token reached the accounts file"); + assert!(on_disk.contains(SERVICE), "the file should still name the deployment"); +} + +#[test] +fn signing_in_again_replaces_the_entry_rather_than_adding_one() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(dir.path().to_path_buf()), keychain.clone()); + let first = store.sign_in(&new_account(), &Secret::new(TOKEN), NOW).unwrap(); + let second = store.sign_in(&new_account(), &Secret::new("a-newer-token"), NOW + 60).unwrap(); + assert_eq!(first.id, second.id); + assert_eq!(first.added, second.added, "the first sign-in's date is kept"); + assert_eq!(keychain.count(), 1); + assert_eq!(store.accounts().unwrap().accounts.len(), 1); + match store.shared() { + Shared::Session { token, .. } => assert_eq!(token, Secret::new("a-newer-token")), + other => panic!("expected a session, got {other:?}"), + } +} + +#[test] +fn two_deployments_are_two_accounts() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(dir.path().to_path_buf()), keychain.clone()); + store.sign_in(&new_account(), &Secret::new(TOKEN), NOW).unwrap(); + let elsewhere = NewAccount { service: "https://other.example.com".to_owned(), ..new_account() }; + let second = store.sign_in(&elsewhere, &Secret::new("another-token"), NOW).unwrap(); + assert_eq!(keychain.count(), 2); + let list = store.accounts().unwrap(); + assert_eq!(list.accounts.len(), 2); + assert_eq!(list.active.as_deref(), Some(second.id.as_str()), "the newest sign-in becomes current"); +} + +#[test] +fn the_linked_flag_is_persisted_and_read_back() { + let dir = tempfile::tempdir().unwrap(); + let store = Store::at(Some(dir.path().to_path_buf()), Memory::new()); + let linked = NewAccount { linked: true, ..new_account() }; + let account = store.sign_in(&linked, &Secret::new(TOKEN), NOW).unwrap(); + assert!(account.linked, "sign_in's own return value should carry it"); + assert!(store.accounts().unwrap().get(&account.id).unwrap().linked, "the row on file should carry it too"); + + let unlinked = NewAccount { linked: false, ..new_account() }; + let account = store.sign_in(&unlinked, &Secret::new(TOKEN), NOW + 1).unwrap(); + assert!(!account.linked, "a later sign-in's value replaces the earlier one"); +} + +#[test] +fn discarding_an_account_clears_both_the_entry_and_the_row() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(dir.path().to_path_buf()), keychain.clone()); + let account = store.sign_in(&new_account(), &Secret::new(TOKEN), NOW).unwrap(); + + store.discard(&account.id).unwrap(); + assert!(!keychain.has(&account.id), "the keychain entry should be gone"); + assert!(store.accounts().unwrap().accounts.is_empty()); + assert!(matches!(store.shared(), Shared::None)); +} + +#[test] +fn forgetting_an_account_clears_only_the_entry_and_leaves_the_row() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(dir.path().to_path_buf()), keychain.clone()); + let account = store.sign_in(&new_account(), &Secret::new(TOKEN), NOW).unwrap(); + + store.forget(&account.id).unwrap(); + assert!(!keychain.has(&account.id), "the keychain entry should be gone"); + assert_eq!(store.accounts().unwrap().accounts.len(), 1, "forgetting leaves the row; discard removes it too"); + assert!(matches!(store.shared(), Shared::None), "no readable token behind the row still reads as nobody signed in"); +} + +#[test] +fn an_isolated_store_refuses_to_forget_a_credential_it_does_not_own() { + let keychain = Memory::new(); + keychain.put("somebody-elses-handle", &Secret::new(TOKEN)).unwrap(); + let store: Store = Store::at(None, keychain.clone()); + + assert_eq!(store.forget("somebody-elses-handle").unwrap_err(), Error::Isolated); + assert!(keychain.has("somebody-elses-handle"), "an isolated store must never reach another application's entry"); +} + +#[test] +fn an_isolated_store_refuses_to_read_has_token_too() { + let keychain = Memory::new(); + keychain.put("somebody-elses-handle", &Secret::new(TOKEN)).unwrap(); + let store: Store = Store::at(None, keychain); + + assert_eq!(store.has_token("somebody-elses-handle").unwrap_err(), Error::Isolated); +} + +#[test] +fn discarding_an_unknown_account_is_a_quiet_no_op() { + let dir = tempfile::tempdir().unwrap(); + let store = Store::at(Some(dir.path().to_path_buf()), Memory::new()); + store.discard("nobody").unwrap(); +} + +// ---- the generation guards a stale write ----------------------------------- + +#[test] +fn a_write_against_a_stale_generation_is_refused() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(dir.path().to_path_buf()), keychain.clone()); + let first = store.sign_in(&new_account(), &Secret::new(TOKEN), NOW).unwrap(); + assert_eq!(first.generation, 0); + + // Somebody else signs the same account in again, elsewhere, before the refresh below lands. + let second = store.sign_in(&new_account(), &Secret::new("rotated-elsewhere"), NOW + 30).unwrap(); + assert_eq!(second.id, first.id); + assert_eq!(second.generation, 1); + + // A refresh that read the account before that second sign-in still carries generation 0. + let stale = store.update_token(&first.id, first.generation, &Secret::new("late-refresh"), NOW + 60); + assert_eq!(stale.unwrap_err(), Error::StaleGeneration { id: first.id.clone(), expected: 0, current: 1 }); + + // The write never landed: the token on file is still the one from the second sign-in. + match store.shared() { + Shared::Session { token, .. } => assert_eq!(token, Secret::new("rotated-elsewhere")), + other => panic!("expected a session, got {other:?}"), + } +} + +#[test] +fn a_write_against_the_current_generation_succeeds_and_advances_it() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(dir.path().to_path_buf()), keychain.clone()); + let account = store.sign_in(&new_account(), &Secret::new(TOKEN), NOW).unwrap(); + + let updated = store.update_token(&account.id, account.generation, &Secret::new("refreshed-token"), NOW + 30).unwrap(); + assert_eq!(updated.generation, account.generation + 1); + match store.shared() { + Shared::Session { token, .. } => assert_eq!(token, Secret::new("refreshed-token")), + other => panic!("expected a session, got {other:?}"), + } +} + +#[test] +fn refreshing_an_account_does_not_steal_activation_from_another() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(dir.path().to_path_buf()), keychain.clone()); + let a = store.sign_in(&new_account(), &Secret::new("a-token"), NOW).unwrap(); + let elsewhere = NewAccount { service: "https://other.example.com".to_owned(), ..new_account() }; + let b = store.sign_in(&elsewhere, &Secret::new("b-token"), NOW + 1).unwrap(); + assert_eq!(store.accounts().unwrap().active.as_deref(), Some(b.id.as_str()), "B is the one picked by signing in last"); + + store.update_token(&a.id, a.generation, &Secret::new("a-token-refreshed"), NOW + 2).unwrap(); + + assert_eq!(store.accounts().unwrap().active.as_deref(), Some(b.id.as_str()), "refreshing A in the background must not steal B's selection"); + match store.shared() { + Shared::Session { account, token } => { + assert_eq!(account.id, b.id); + assert_eq!(token, Secret::new("b-token")); + } + other => panic!("expected B's session, got {other:?}"), + } +} + +#[test] +fn a_write_against_an_unknown_account_says_so_rather_than_claiming_a_stale_generation() { + let dir = tempfile::tempdir().unwrap(); + let store = Store::at(Some(dir.path().to_path_buf()), Memory::new()); + assert_eq!(store.update_token("nobody", 0, &Secret::new(TOKEN), NOW).unwrap_err(), Error::Unknown("nobody".to_owned())); +} + +// ---- a lost race never touches the keychain -------------------------------- + +/// A newer sign-in for the same handle must never let a stale refresh overwrite its token. The +/// refresh is held at `race_hook`'s pause point right after its own first, unlocked look at the +/// old generation. Only then does the newer sign-in run, and it always finishes before the pause +/// lifts and the refresh takes its second, locked look. A plain start barrier cannot pin that +/// ordering: it only lines both operations up at the beginning, so a build that still has the +/// bug this test guards against could pass anyway, by rejecting at the first check because the +/// sign-in happened to land first, never reaching the second check this test is named for. +#[test] +fn a_refresh_racing_a_newer_sign_in_for_the_same_handle_never_overwrites_its_token() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(dir.path().to_path_buf()), keychain.clone()); + let first = store.sign_in(&new_account(), &Secret::new("session-1"), NOW).unwrap(); + let seen_generation = first.generation; + + let gate = store.arm_race_hook(); + let winner_dir = dir.path().to_path_buf(); + let winner_keychain = keychain.clone(); + let winner = std::thread::spawn(move || -> Result<(), Error> { + gate.arrived.recv().map_err(|_| Error::Unknown("the refresh never reached the pause point".to_owned()))?; + Store::at(Some(winner_dir), winner_keychain).sign_in(&new_account(), &Secret::new("session-2"), NOW + 10)?; + gate.go.send(()).map_err(|_| Error::Unknown("the refresh gave up waiting for the pause to lift".to_owned()))?; + Ok(()) + }); + + let refresh = store.update_token(&first.id, seen_generation, &Secret::new("session-1-refreshed"), NOW + 20); + winner.join().unwrap().unwrap(); + + assert!(matches!(refresh, Err(Error::StaleGeneration { .. })), "the refresh must lose to the newer sign-in: {refresh:?}"); + assert!(keychain.has(&first.id), "the new session's token must still be in the keychain"); + assert_eq!( + keychain.get(&first.id).unwrap(), + Some(Secret::new("session-2")), + "the stale refresh must never have overwritten the new session's token" + ); + match store.shared() { + Shared::Session { token, .. } => assert_eq!(token, Secret::new("session-2")), + other => panic!("expected session 2's session, got {other:?}"), + } +} + +/// The same race, with the newer sign-in preceded by a discard: the handle is removed and +/// tombstoned, then signed in again, both only after the refresh's first, unlocked check has +/// already read the old generation, and both finished before the pause lifts for its second, +/// locked one. Session two's token must be the one left standing either way, the same pin as +/// the sign-in race above and for the same reason: a start barrier alone cannot tell a correct +/// second check apart from a lucky early rejection at the first one. +#[test] +fn a_refresh_racing_a_discard_and_re_add_for_the_same_handle_never_overwrites_its_token() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(dir.path().to_path_buf()), keychain.clone()); + let first = store.sign_in(&new_account(), &Secret::new("session-1"), NOW).unwrap(); + let seen_generation = first.generation; + + let gate = store.arm_race_hook(); + let winner_dir = dir.path().to_path_buf(); + let winner_keychain = keychain.clone(); + let winner_id = first.id.clone(); + let winner = std::thread::spawn(move || -> Result<(), Error> { + gate.arrived.recv().map_err(|_| Error::Unknown("the refresh never reached the pause point".to_owned()))?; + let other = Store::at(Some(winner_dir), winner_keychain); + other.discard(&winner_id)?; + other.sign_in(&new_account(), &Secret::new("session-2"), NOW + 10)?; + gate.go.send(()).map_err(|_| Error::Unknown("the refresh gave up waiting for the pause to lift".to_owned()))?; + Ok(()) + }); + + let refresh = store.update_token(&first.id, seen_generation, &Secret::new("session-1-refreshed"), NOW + 20); + winner.join().unwrap().unwrap(); + + assert!(refresh.is_err(), "the refresh must lose to the discard and re-add: {refresh:?}"); + assert!(keychain.has(&first.id), "the re-added session's token must still be in the keychain"); + assert_eq!( + keychain.get(&first.id).unwrap(), + Some(Secret::new("session-2")), + "the stale refresh must never have overwritten the re-added session's token" + ); + match store.shared() { + Shared::Session { token, .. } => assert_eq!(token, Secret::new("session-2")), + other => panic!("expected session 2's session, got {other:?}"), + } +} + +#[test] +fn sign_in_restores_its_token_when_a_concurrent_discard_takes_it_first() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let plain = Store::at(Some(dir.path().to_path_buf()), keychain.clone()); + let first = plain.sign_in(&new_account(), &Secret::new("session-1"), NOW).unwrap(); + + /// Fires once, on this sign-in's own first token write, before it asks for the accounts + /// lock: runs a full discard for the same handle, taking the entry this call just wrote with + /// it and leaving a tombstone behind it. By the time the sign-in reaches its own lock, the + /// row it is about to commit has no keychain entry behind it unless something restores one. + /// + /// Armed for a single call only. The fix's own re-assertion put runs inside the lock and must + /// land plainly. Firing discard again from inside it would try to take the same accounts + /// lock this call already holds. That is the lock module's own deadlock case. This test + /// means to cover a different race, the one between two separate lock holders. + struct DiscardAfterPut { + inner: Memory, + dir: PathBuf, + id: String, + fired: std::sync::atomic::AtomicBool, + } + impl TokenStore for DiscardAfterPut { + fn available(&self) -> Result<(), String> { + self.inner.available() + } + fn get(&self, h: &str) -> Result, String> { + self.inner.get(h) + } + fn put(&self, h: &str, t: &Secret) -> Result<(), String> { + let r = self.inner.put(h, t); + if !self.fired.swap(true, std::sync::atomic::Ordering::SeqCst) { + Store::at(Some(self.dir.clone()), self.inner.clone()).discard(&self.id).unwrap(); + } + r + } + fn remove(&self, h: &str) -> Result<(), String> { + self.inner.remove(h) + } + } + + let racing = Store::at( + Some(dir.path().to_path_buf()), + DiscardAfterPut { + inner: keychain.clone(), + dir: dir.path().to_path_buf(), + id: first.id.clone(), + fired: std::sync::atomic::AtomicBool::new(false), + }, + ); + let account = racing.sign_in(&new_account(), &Secret::new("session-2"), NOW + 10).unwrap(); + + assert_eq!(account.id, first.id, "the same deployment and subject is the same handle"); + assert!( + keychain.has(&account.id), + "a discard landed between this sign-in's own token write and its row commit; the row this call reported Ok for must not be left without a token" + ); + match Store::at(Some(dir.path().to_path_buf()), keychain.clone()).shared() { + Shared::Session { token, .. } => assert_eq!(token, Secret::new("session-2")), + other => panic!("expected a session, got {other:?}"), + } +} + +// ---- generations never wrap ------------------------------------------------ + +/// What a crafted accounts file at the limit looks like: one account, holding `generation`. +fn account_at(id: &str, generation: u32) -> Account { + Account { + id: id.to_owned(), + service: SERVICE.to_owned(), + user: USER.to_owned(), + display: "Ada Lovelace".to_owned(), + generation, + ..Account::default() + } +} + +#[test] +fn remove_with_tombstone_refuses_to_wrap_past_the_maximum_generation() { + let mut list = accounts::Accounts::default(); + let err = list.remove_with_tombstone("x", u32::MAX).unwrap_err(); + assert_eq!(err, Error::GenerationExhausted("x".to_owned())); + assert!(list.tombstones.is_empty(), "a refused bump must leave no tombstone behind"); +} + +#[test] +fn a_refresh_against_an_account_already_at_the_maximum_generation_is_refused() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join(paths::FILE); + let id = accounts::handle(SERVICE, USER); + let list = + accounts::Accounts { format: accounts::FORMAT, accounts: vec![account_at(&id, u32::MAX)], active: Some(id.clone()), tombstones: Vec::new() }; + accounts::write(&path, &list).unwrap(); + let keychain = Memory::new(); + keychain.put(&id, &Secret::new(TOKEN)).unwrap(); + let store = Store::at(Some(dir.path().to_path_buf()), keychain); + + let err = store.update_token(&id, u32::MAX, &Secret::new("refreshed"), NOW + 1).unwrap_err(); + assert_eq!(err, Error::GenerationExhausted(id)); +} + +#[test] +fn signing_in_over_a_tombstone_at_the_maximum_generation_is_refused() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join(paths::FILE); + let id = accounts::handle(SERVICE, USER); + let list = accounts::Accounts { + format: accounts::FORMAT, + accounts: Vec::new(), + active: None, + tombstones: vec![accounts::Tombstone { id: id.clone(), generation: u32::MAX }], + }; + accounts::write(&path, &list).unwrap(); + let store = Store::at(Some(dir.path().to_path_buf()), Memory::new()); + + let err = store.sign_in(&new_account(), &Secret::new(TOKEN), NOW).unwrap_err(); + assert_eq!(err, Error::GenerationExhausted(id)); +} + +// ---- the list never grows past what the next reader can open --------------- + +#[test] +fn write_refuses_a_list_too_large_for_read_to_ever_open_again() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join(paths::FILE); + let oversized = accounts::Accounts { + format: accounts::FORMAT, + accounts: vec![Account { display: "x".repeat(2 << 20), ..account_at("huge", 0) }], + active: None, + tombstones: Vec::new(), + }; + + assert!(matches!(accounts::write(&path, &oversized), Err(Error::Malformed(_)))); + assert!(!path.exists(), "a write that cannot be read back must never land on disk"); +} + +#[test] +fn write_leaves_a_previously_good_file_untouched_when_the_new_one_is_too_large() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join(paths::FILE); + let good = + accounts::Accounts { format: accounts::FORMAT, accounts: vec![account_at("a", 0)], active: Some("a".to_owned()), tombstones: Vec::new() }; + accounts::write(&path, &good).unwrap(); + + let oversized = accounts::Accounts { + format: accounts::FORMAT, + accounts: vec![Account { display: "x".repeat(2 << 20), ..account_at("huge", 0) }], + active: None, + tombstones: Vec::new(), + }; + assert!(accounts::write(&path, &oversized).is_err()); + + assert_eq!(accounts::read(&path).unwrap(), good, "the earlier, readable file must still be exactly what was there before"); +} + +#[test] +fn a_sign_in_with_an_oversized_display_name_fails_without_bricking_the_list() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(dir.path().to_path_buf()), keychain.clone()); + store.sign_in(&new_account(), &Secret::new(TOKEN), NOW).unwrap(); + + let huge = NewAccount { display: "x".repeat(2 << 20), ..NewAccount { service: "https://other.example.com".to_owned(), ..new_account() } }; + assert!(store.sign_in(&huge, &Secret::new("another-token"), NOW + 1).is_err()); + + // The list a moment ago is still exactly readable. The first account is still there. + // `shared()` still answers normally. Without the guard, every later call would fail on a + // file nothing can parse back. + let list = store.accounts().unwrap(); + assert_eq!(list.accounts.len(), 1); + assert!(matches!(store.shared(), Shared::Session { .. })); +} + +// ---- nobody is signed in --------------------------------------------------- + +#[test] +fn an_empty_suite_offers_nothing() { + let dir = tempfile::tempdir().unwrap(); + let store = Store::at(Some(dir.path().to_path_buf()), Memory::new()); + assert!(matches!(store.shared(), Shared::None)); + assert!(store.accounts().unwrap().accounts.is_empty()); +} + +#[test] +fn an_isolated_store_offers_nothing_and_signs_nobody_in() { + let store: Store = Store::at(None, Memory::new()); + assert!(matches!(store.shared(), Shared::None)); + assert_eq!(store.usable().unwrap_err(), Error::Isolated); + assert_eq!(store.sign_in(&new_account(), &Secret::new(TOKEN), NOW).unwrap_err(), Error::Isolated); +} + +#[test] +fn a_machine_with_no_keychain_signs_nobody_in() { + let dir = tempfile::tempdir().unwrap(); + let store = Store::at(Some(dir.path().to_path_buf()), Memory::missing("no Secret Service on this machine")); + assert!(matches!(store.shared(), Shared::None)); + match store.sign_in(&new_account(), &Secret::new(TOKEN), NOW).unwrap_err() { + Error::Keychain(why) => assert!(why.contains("no Secret Service")), + other => panic!("expected a keychain failure, got {other:?}"), + } + assert!(!store.path().unwrap().exists(), "a refused sign-in should write no file"); +} + +#[test] +fn an_unreadable_keychain_says_so_rather_than_pretending_nobody_signed_in() { + let dir = tempfile::tempdir().unwrap(); + // Sign in against a working keychain, then read the same folder through a locked one. + let store = Store::at(Some(dir.path().to_path_buf()), Memory::new()); + let account = store.sign_in(&new_account(), &Secret::new(TOKEN), NOW).unwrap(); + + let locked = Store::at(Some(dir.path().to_path_buf()), Memory::refusing("the keychain is locked")); + match locked.shared() { + Shared::Unreadable { account: found, why } => { + assert_eq!(found.id, account.id); + assert!(why.contains("locked")); + } + other => panic!("expected an unreadable session, got {other:?}"), + } +} + +#[test] +fn an_account_whose_entry_is_gone_reads_as_nobody_signed_in() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(dir.path().to_path_buf()), keychain.clone()); + let account = store.sign_in(&new_account(), &Secret::new(TOKEN), NOW).unwrap(); + // Somebody deleted the credential from the platform's own window. + keychain.remove(&account.id).unwrap(); + assert!(matches!(store.shared(), Shared::None)); +} + +#[test] +fn an_active_account_that_is_no_longer_listed_reads_as_nobody_signed_in() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join(paths::FILE); + let list = accounts::Accounts { format: accounts::FORMAT, accounts: Vec::new(), active: Some("vanished".to_owned()), tombstones: Vec::new() }; + accounts::write(&path, &list).unwrap(); + let store = Store::at(Some(dir.path().to_path_buf()), Memory::new()); + assert!(matches!(store.shared(), Shared::None)); +} + +#[test] +fn a_file_from_a_later_format_is_refused_rather_than_misread() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join(paths::FILE); + std::fs::write(&path, br#"{"format":99,"accounts":[],"active":null}"#).unwrap(); + let store = Store::at(Some(dir.path().to_path_buf()), Memory::new()); + assert!(matches!(store.accounts(), Err(Error::Malformed(_)))); + // An application still starts: the shared answer is that nobody is signed in. + assert!(matches!(store.shared(), Shared::None)); +} + +#[test] +fn unreadable_json_does_not_stop_an_application_starting() { + let dir = tempfile::tempdir().unwrap(); + std::fs::write(dir.path().join(paths::FILE), b"this is not JSON").unwrap(); + let store = Store::at(Some(dir.path().to_path_buf()), Memory::new()); + assert!(matches!(store.shared(), Shared::None)); +} + +#[test] +fn a_format_of_zero_is_refused_rather_than_silently_accepted() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join(paths::FILE); + std::fs::write(&path, br#"{"format":0,"accounts":[],"active":null,"tombstones":[]}"#).unwrap(); + assert!(matches!(accounts::read(&path), Err(Error::Malformed(_)))); +} + +#[test] +fn a_missing_format_marker_is_refused_rather_than_silently_accepted() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join(paths::FILE); + // No `format` key at all: `#[serde(default)]` would otherwise read this exactly as it reads + // an explicit `"format":0` above. Both would have passed the old `> FORMAT` check. + std::fs::write(&path, br#"{"accounts":[],"active":null,"tombstones":[]}"#).unwrap(); + assert!(matches!(accounts::read(&path), Err(Error::Malformed(_)))); +} + +#[test] +fn the_one_supported_format_still_reads() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join(paths::FILE); + let body = format!(r#"{{"format":{},"accounts":[],"active":null,"tombstones":[]}}"#, accounts::FORMAT); + std::fs::write(&path, body.as_bytes()).unwrap(); + assert!(accounts::read(&path).is_ok()); +} + +#[test] +fn a_read_error_does_not_name_the_profile_folder_it_lives_under() { + let dir = tempfile::tempdir().unwrap(); + let home = dir.path().join("Users").join("a-real-persons-name").join(paths::DIR); + std::fs::create_dir_all(&home).unwrap(); + let path = home.join(paths::FILE); + std::fs::write(&path, b"this is not JSON").unwrap(); + + let message = accounts::read(&path).unwrap_err().to_string(); + assert!(!message.contains("a-real-persons-name"), "the profile folder leaked into the error: {message}"); + assert!(message.contains(paths::FILE), "the error should still say which file: {message}"); +} + +#[test] +fn an_oversized_file_error_does_not_name_the_profile_folder_either() { + let dir = tempfile::tempdir().unwrap(); + let home = dir.path().join("Users").join("another-real-name").join(paths::DIR); + std::fs::create_dir_all(&home).unwrap(); + let path = home.join(paths::FILE); + std::fs::write(&path, vec![b'x'; 2 << 20]).unwrap(); + + let message = accounts::read(&path).unwrap_err().to_string(); + assert!(!message.contains("another-real-name"), "the profile folder leaked into the error: {message}"); +} + +// ---- taking over a per-application session file ---------------------------- + +/// What GridCraft's `legacy-session.json` is read as. +fn legacy_file(dir: &Path) -> PathBuf { + let path = dir.join("legacy-session.json"); + let body = format!(r#"{{"service":"{SERVICE}","token":"{TOKEN}","user":"{USER}","display":"Ada Lovelace"}}"#); + std::fs::write(&path, body.as_bytes()).unwrap(); + path +} + +#[test] +fn a_per_application_session_moves_into_the_suite_store_and_the_file_goes() { + let suite = tempfile::tempdir().unwrap(); + let app = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(suite.path().to_path_buf()), keychain.clone()); + let path = legacy_file(app.path()); + + match crate::migrate::adopt(&store, &path, NOW).unwrap() { + Adopted::Taken(account) => { + assert_eq!(account.service, SERVICE); + assert_eq!(account.user, USER); + assert!(keychain.has(&account.id), "the token should be in the keychain"); + } + other => panic!("expected the session to be taken over, got {other:?}"), + } + assert!(!path.exists(), "the session file should be gone"); + match store.shared() { + Shared::Session { token, .. } => assert_eq!(token, Secret::new(TOKEN)), + other => panic!("expected a session, got {other:?}"), + } +} + +#[test] +fn migration_repairs_an_orphan_keychain_token_with_the_legacy_file() { + const LEGACY: &str = "legacy-session-token"; + let suite = tempfile::tempdir().unwrap(); + let app = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(suite.path().to_path_buf()), keychain.clone()); + let id = accounts::handle(SERVICE, USER); + keychain.put(&id, &Secret::new("orphan-token")).unwrap(); + let path = legacy_file(app.path()); + std::fs::write(&path, format!(r#"{{"service":"{SERVICE}","token":"{LEGACY}","user":"{USER}","display":"Ada Lovelace"}}"#).as_bytes()).unwrap(); + + match crate::migrate::adopt(&store, &path, NOW).unwrap() { + Adopted::Taken(account) => assert_eq!(account.id, id), + other => panic!("expected the legacy session to be taken over, got {other:?}"), + } + assert!(!path.exists()); + match store.shared() { + Shared::Session { token, .. } => assert_eq!(token, Secret::new(LEGACY)), + other => panic!("expected a session, got {other:?}"), + } +} + +#[test] +fn migration_leaves_a_legacy_file_alone_once_it_changed_after_being_read() { + let suite = tempfile::tempdir().unwrap(); + let app = tempfile::tempdir().unwrap(); + let path = legacy_file(app.path()); + + /// Stands in for another process still running the application's own, now-superseded + /// writer: it rewrites the legacy file with a different token the moment the suite store + /// writes this account's token, the exact window between `adopt`'s read of the file and its + /// removal of it. + struct RewriteFileOnPut { + inner: Memory, + path: PathBuf, + } + impl TokenStore for RewriteFileOnPut { + fn available(&self) -> Result<(), String> { + self.inner.available() + } + fn get(&self, h: &str) -> Result, String> { + self.inner.get(h) + } + fn put(&self, h: &str, t: &Secret) -> Result<(), String> { + let body = format!(r#"{{"service":"{SERVICE}","token":"refreshed-elsewhere","user":"{USER}","display":"Ada Lovelace"}}"#); + std::fs::write(&self.path, body.as_bytes()).unwrap(); + self.inner.put(h, t) + } + fn remove(&self, h: &str) -> Result<(), String> { + self.inner.remove(h) + } + } + + let store = Store::at(Some(suite.path().to_path_buf()), RewriteFileOnPut { inner: Memory::new(), path: path.clone() }); + let account = match crate::migrate::adopt(&store, &path, NOW).unwrap() { + Adopted::Taken(account) => account, + other => panic!("expected the session to be taken over, got {other:?}"), + }; + assert_eq!(account.service, SERVICE, "the session that was actually read is still the one adopted"); + + assert!( + path.exists(), + "the file changed after it was read; deleting it would discard the rewritten session with nothing left to recover it from" + ); + let left_behind = std::fs::read_to_string(&path).unwrap(); + assert!(left_behind.contains("refreshed-elsewhere"), "the file on disk must still be the rewritten one: {left_behind}"); +} + +#[test] +fn a_second_migration_finds_nothing_to_do() { + let suite = tempfile::tempdir().unwrap(); + let app = tempfile::tempdir().unwrap(); + let store = Store::at(Some(suite.path().to_path_buf()), Memory::new()); + let path = legacy_file(app.path()); + crate::migrate::adopt(&store, &path, NOW).unwrap(); + assert_eq!(crate::migrate::adopt(&store, &path, NOW).unwrap(), Adopted::Nothing); +} + +#[test] +fn migration_with_no_keychain_leaves_the_file_alone() { + let suite = tempfile::tempdir().unwrap(); + let app = tempfile::tempdir().unwrap(); + let store = Store::at(Some(suite.path().to_path_buf()), Memory::missing("no keychain here")); + let path = legacy_file(app.path()); + + match crate::migrate::adopt(&store, &path, NOW).unwrap() { + Adopted::Kept { why } => assert!(why.contains("no keychain here")), + other => panic!("expected the file to be kept, got {other:?}"), + } + assert!(path.exists(), "removing it would have signed the user out"); +} + +#[test] +fn migration_in_an_isolated_process_leaves_the_file_alone() { + let app = tempfile::tempdir().unwrap(); + let store: Store = Store::at(None, Memory::new()); + let path = legacy_file(app.path()); + assert!(matches!(crate::migrate::adopt(&store, &path, NOW).unwrap(), Adopted::Kept { .. })); + assert!(path.exists()); +} + +#[test] +fn a_session_file_carrying_no_session_is_refused() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join("legacy-session.json"); + std::fs::write(&path, br#"{"service":"https://craft.example.com","token":" "}"#).unwrap(); + assert!(matches!(crate::migrate::read(&path), Err(Error::Malformed(_)))); +} + +/// The four keys an application writes today, spelled exactly as it writes them. +#[test] +fn the_four_keys_an_application_writes_today_adopt_cleanly() { + let suite = tempfile::tempdir().unwrap(); + let app = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(suite.path().to_path_buf()), keychain.clone()); + let path = app.path().join("legacy-session.json"); + let body = format!(r#"{{"token":"{TOKEN}","service":"{SERVICE}","subject":"{USER}","display":"Ada Lovelace"}}"#); + std::fs::write(&path, body.as_bytes()).unwrap(); + + match crate::migrate::adopt(&store, &path, NOW).unwrap() { + Adopted::Taken(account) => { + assert_eq!(account.service, SERVICE); + assert_eq!(account.user, USER, "`subject` is the subject the handle is keyed on"); + assert_eq!(account.display, "Ada Lovelace"); + assert_eq!(account.id, accounts::handle(SERVICE, USER)); + assert!(keychain.has(&account.id)); + } + other => panic!("expected the session to be taken over, got {other:?}"), + } + assert!(!path.exists()); +} + +/// What is on every machine that signed in before the application recorded anything else. +#[test] +fn a_token_only_session_file_is_left_alone_until_the_application_records_more() { + let suite = tempfile::tempdir().unwrap(); + let app = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(suite.path().to_path_buf()), keychain.clone()); + let path = app.path().join("legacy-session.json"); + std::fs::write(&path, format!(r#"{{"token":"{TOKEN}"}}"#).as_bytes()).unwrap(); + + // It parses, and it says nothing to key an account on. + let legacy = crate::migrate::read(&path).unwrap().unwrap(); + assert_eq!(legacy.token, Secret::new(TOKEN)); + assert_eq!(legacy.service, ""); + assert_eq!(legacy.user, "", "the subject is never stood in for"); + assert_eq!(legacy.incomplete(), Some("which deployment it belongs to")); + + match crate::migrate::adopt(&store, &path, NOW).unwrap() { + Adopted::Kept { why } => assert!(why.contains("does not say"), "{why}"), + other => panic!("expected the file to be kept, got {other:?}"), + } + assert!(path.exists(), "removing it would have signed the user out"); + assert_eq!(keychain.count(), 0, "nothing should be filed under a made-up handle"); + assert!(store.accounts().unwrap().accounts.is_empty()); + assert!(matches!(store.shared(), Shared::None)); + + // The application rewrites the file once it knows the rest. The next startup adopts it. + let body = format!(r#"{{"token":"{TOKEN}","service":"{SERVICE}","subject":"{USER}","display":"Ada Lovelace"}}"#); + std::fs::write(&path, body.as_bytes()).unwrap(); + assert!(matches!(crate::migrate::adopt(&store, &path, NOW).unwrap(), Adopted::Taken(_))); + assert!(!path.exists()); + match store.shared() { + Shared::Session { account, token } => { + assert_eq!(account.id, accounts::handle(SERVICE, USER)); + assert_eq!(token, Secret::new(TOKEN)); + } + other => panic!("expected a session, got {other:?}"), + } +} + +/// The deployment is recorded the moment the device flow completes. The subject only arrives when +/// `/api/v1/me` first answers, so a file can hold one without the other. +#[test] +fn a_session_file_with_no_subject_is_left_alone() { + let suite = tempfile::tempdir().unwrap(); + let app = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(suite.path().to_path_buf()), keychain.clone()); + let path = app.path().join("legacy-session.json"); + std::fs::write(&path, format!(r#"{{"token":"{TOKEN}","service":"{SERVICE}"}}"#).as_bytes()).unwrap(); + + let legacy = crate::migrate::read(&path).unwrap().unwrap(); + assert_eq!(legacy.service, SERVICE); + assert_eq!(legacy.incomplete(), Some("whose account it is")); + + match crate::migrate::adopt(&store, &path, NOW).unwrap() { + Adopted::Kept { why } => assert!(why.contains("whose account it is"), "{why}"), + other => panic!("expected the file to be kept, got {other:?}"), + } + assert!(path.exists()); + assert_eq!(keychain.count(), 0); +} + +#[test] +fn a_session_file_spelled_the_other_way_still_reads() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join("legacy-session.json"); + let body = format!(r#"{{"base_url":"{SERVICE}/","access_token":"{TOKEN}","sub":"{USER}","name":"Ada"}}"#); + std::fs::write(&path, body.as_bytes()).unwrap(); + let legacy = crate::migrate::read(&path).unwrap().unwrap(); + assert_eq!(legacy.service, SERVICE, "the trailing slash comes off"); + assert_eq!(legacy.user, USER); + assert_eq!(legacy.display, "Ada"); + assert_eq!(legacy.token, Secret::new(TOKEN)); +} + +// ---- the secret itself ----------------------------------------------------- + +#[test] +fn a_secret_never_prints_itself() { + let secret = Secret::new(TOKEN); + let shown = format!("{secret:?}"); + assert!(!shown.contains(TOKEN), "Debug printed the token: {shown}"); + assert_eq!(shown, format!("Secret({} bytes)", TOKEN.len())); + assert_eq!(secret.len(), TOKEN.len()); +} + +#[test] +fn an_account_record_prints_no_secret() { + let account = Account { id: "abc".to_owned(), service: SERVICE.to_owned(), ..Account::default() }; + assert!(!format!("{account:?}").contains(TOKEN)); +} diff --git a/crates/suite-account/tests/review_repro.rs b/crates/suite-account/tests/review_repro.rs new file mode 100644 index 000000000..8992e2660 --- /dev/null +++ b/crates/suite-account/tests/review_repro.rs @@ -0,0 +1,305 @@ +//! Conformance tests for `craft-suite-account` (PR #665), adapted from the maintainer's review +//! reproduction gist for this crate (skylartaylor, rev `2e9c84f`). Each test asserts the behaviour +//! the crate's docs and RFC-0025 promise. +//! +//! The first two tests below once drove their race through a hook on the [`Memory`] keychain's +//! `put`, timed to land between [`Store::update_token`]'s keychain write and its second, locked +//! check. That write now happens only inside the lock, in the second check's own success arm (see +//! the module docs). Nothing sits between the two checks to hook into any more. A hook that tried +//! would be asking `update_token` to take a lock it already holds. Real threads racing on a +//! [`std::sync::Barrier`] replace it, the same device [`concurrent_sign_ins_from_two_threads_lose_no_rows`] +//! already uses below. The lock makes both outcomes this PR promises hold for every interleaving, +//! never only the one picked in advance. A race no longer needs to land in one exact window to +//! prove it. +//! +//! Not adapted here: the gist's `review_h2_forget_during_refresh_is_undone`. `forget` is, by +//! RFC-0025's "Cross-app lifecycle guarantees" (point 4), a deliberately generation-agnostic, +//! keychain-only, local operation. It does not read or write the accounts list at all, so nothing +//! in a locked read-change-write over that list can observe it racing a refresh. Fixing that +//! interleaving would mean giving `forget` list/generation semantics it does not have today, a +//! broader behaviour change than the three gates this PR closes (see the PR comment). + +use std::sync::{Arc, Barrier}; + +use craft_suite_account::{Error, Memory, NewAccount, Secret, Store, TokenStore}; + +const SERVICE: &str = "https://craft.example.com"; +const NOW: i64 = 1_760_000_000; + +fn acct(user: &str) -> NewAccount { + NewAccount { service: SERVICE.to_owned(), user: user.to_owned(), display: user.to_owned(), email: None, linked: true } +} + +fn tok(s: &str) -> Secret { + Secret::new(s.to_owned()) +} + +// ---- gate: locked read-change-write on every list mutation ----------------- + +/// H1b: app A refreshes X while app B signs in Y, on real threads racing to start at the same +/// moment. A's write must not land a stale copy of the list that was read before B's sign-in, or +/// Y's row is lost even though Y's token sits in the keychain. `update_token`'s own lock always +/// re-reads the list fresh right before it commits. That holds for either thread landing first. +#[test] +fn refresh_racing_another_sign_in_does_not_lose_that_row() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let app_a = Store::at(Some(dir.path().to_owned()), keychain.clone()); + let app_b = Store::at(Some(dir.path().to_owned()), keychain.clone()); + + let x = app_a.sign_in(&acct("x"), &tok("x1"), NOW).unwrap(); + + let start = Arc::new(Barrier::new(2)); + let (a_start, b_start) = (start.clone(), start.clone()); + let a_id = x.id.clone(); + let a = std::thread::spawn(move || { + a_start.wait(); + app_a.update_token(&a_id, x.generation, &tok("x2"), NOW + 1) + }); + let b = std::thread::spawn(move || { + b_start.wait(); + app_b.sign_in(&acct("y"), &tok("y1"), NOW) + }); + a.join().unwrap().unwrap(); + let y = b.join().unwrap().unwrap(); + + let list = Store::at(Some(dir.path().to_owned()), Memory::new()).accounts().unwrap(); + let ids: Vec<_> = list.accounts.iter().map(|a| a.user.clone()).collect(); + assert!( + list.get(&y.id).is_some(), + "Y signed in successfully but its row is gone after X's refresh: accounts on file = {ids:?}, \ + Y token in keychain = {}", + keychain.has(&y.id) + ); +} + +/// H1c: the same lost update with no hook at all: real threads, separate `Store`s over one folder +/// (as two applications in one process would be), each signing in its own account. Every sign-in +/// that returned Ok must be on the list afterwards, and none should fail. +#[test] +fn concurrent_sign_ins_from_two_threads_lose_no_rows() { + let rounds = 200; + let (mut lost, mut failed) = (0, 0); + let mut examples = Vec::new(); + for round in 0..rounds { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let start = Arc::new(Barrier::new(2)); + let handles: Vec<_> = ["a", "b"] + .into_iter() + .map(|who| { + let (path, kc, start) = (dir.path().to_owned(), keychain.clone(), start.clone()); + std::thread::spawn(move || { + let store = Store::at(Some(path), kc); + start.wait(); + store.sign_in(&acct(&format!("{who}-{round}")), &tok(who), NOW) + }) + }) + .collect(); + let results: Vec<_> = handles.into_iter().map(|h| h.join().unwrap()).collect(); + let list = Store::at(Some(dir.path().to_owned()), Memory::new()).accounts().unwrap(); + for r in &results { + match r { + Ok(a) if list.get(&a.id).is_none() => { + lost += 1; + if examples.len() < 3 { + examples.push(format!("round {round}: sign_in Ok but row missing ({} of 2 rows on file)", list.accounts.len())); + } + } + Ok(_) => {} + Err(e) => { + failed += 1; + if examples.len() < 3 { + examples.push(format!("round {round}: sign_in Err({e})")); + } + } + } + } + } + assert!( + lost == 0 && failed == 0, + "{rounds} rounds x 2 concurrent sign-ins: {lost} Ok sign-ins lost their row, {failed} sign-ins failed; e.g. {examples:#?}" + ); +} + +/// Helper for the two-process case below: when REVIEW_DIR is set, sign in REVIEW_N accounts named +/// REVIEW_WHO-i into that folder. Does nothing in a normal run. +#[test] +fn concurrent_sign_in_helper() { + let (Ok(dir), Ok(who)) = (std::env::var("REVIEW_DIR"), std::env::var("REVIEW_WHO")) else { return }; + let n: usize = std::env::var("REVIEW_N").ok().and_then(|n| n.parse().ok()).unwrap_or(100); + let store = Store::at(Some(dir.into()), Memory::new()); + for i in 0..n { + store.sign_in(&acct(&format!("{who}-{i}")), &tok(&who), NOW).unwrap(); + } +} + +/// The gate's named case: two OS processes (this test binary re-run as the helper above), each +/// signing in 100 distinct accounts into one suite folder. All 200 succeed (Ok), so 200 rows must +/// be on file: real processes rather than simulated interleaving, since this crate's own test +/// binary can spawn itself and CI here can run child processes. +#[test] +fn concurrent_sign_ins_from_two_processes_lose_no_rows() { + if std::env::var("REVIEW_DIR").is_ok() { + return; + } + let dir = tempfile::tempdir().unwrap(); + let exe = std::env::current_exe().unwrap(); + let children: Vec<_> = ["p", "q"] + .into_iter() + .map(|who| { + std::process::Command::new(&exe) + .args(["--exact", "concurrent_sign_in_helper", "--test-threads=1"]) + .env("REVIEW_DIR", dir.path()) + .env("REVIEW_WHO", who) + .env("REVIEW_N", "100") + .spawn() + .unwrap() + }) + .collect(); + for mut c in children { + assert!(c.wait().unwrap().success(), "a helper process failed a sign_in"); + } + let list = Store::at(Some(dir.path().to_owned()), Memory::new()).accounts().unwrap(); + assert_eq!( + list.accounts.len(), + 200, + "two processes each completed 100 successful sign_in calls, but only {} rows are on file", + list.accounts.len() + ); +} + +// ---- gate: generations monotonic across removal and re-add ----------------- + +/// The gate's named case "refresh-racing-discard": app A refreshes X's token while app B signs X +/// out (`discard`), on real threads racing to start at the same moment. Removal must win (RFC-0025 +/// lifecycle guarantee 2) whichever one actually lands first: neither the row nor the keychain +/// entry may come back, whether the refresh commits before the discard removes it, or the discard +/// lands first and the refresh's own second check then refuses a tombstoned account. +#[test] +fn refresh_racing_discard_resurrects_nothing() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let app_a = Store::at(Some(dir.path().to_owned()), keychain.clone()); + let app_b = Store::at(Some(dir.path().to_owned()), keychain.clone()); + + let x = app_a.sign_in(&acct("x"), &tok("x-session-1"), NOW).unwrap(); + + let start = Arc::new(Barrier::new(2)); + let (a_start, b_start) = (start.clone(), start.clone()); + let a_id = x.id.clone(); + let a = std::thread::spawn(move || { + a_start.wait(); + app_a.update_token(&a_id, x.generation, &tok("x-session-1-refreshed"), NOW + 1) + }); + let b_id = x.id.clone(); + let b = std::thread::spawn(move || { + b_start.wait(); + app_b.discard(&b_id) + }); + let refreshed = a.join().unwrap(); + b.join().unwrap().unwrap(); + + let after = Store::at(Some(dir.path().to_owned()), Memory::new()).accounts().unwrap(); + let row_back = after.get(&x.id).is_some(); + let token_back = keychain.has(&x.id); + assert!( + !row_back && !token_back, + "sign-out (discard) must win over an in-flight refresh; instead update_token returned {:?}, \ + row present after discard = {row_back}, keychain entry present after discard = {token_back}", + refreshed.as_ref().map(|a| a.generation) + ); +} + +/// The gate's named case "stale-refresh-after-discard-and-re-add": a refresh that started under +/// session 1 lands after the account was discarded and signed in again (session 2). Generations +/// monotonic across removal and re-add means the re-added row never restarts at 0, so the stale +/// refresh is refused and session 2's token survives. +#[test] +fn stale_refresh_after_discard_and_re_add_is_refused() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(dir.path().to_owned()), keychain.clone()); + + let s1 = store.sign_in(&acct("x"), &tok("session-1"), NOW).unwrap(); + let seen_generation = s1.generation; // a refresher reads this, then goes to the network + store.discard(&s1.id).unwrap(); // the person signs out ... + let s2 = store.sign_in(&acct("x"), &tok("session-2"), NOW + 10).unwrap(); // ... and back in + + let stale = store.update_token(&s1.id, seen_generation, &tok("session-1-refreshed"), NOW + 20); + let now_token = keychain.get(&s1.id).unwrap().map(|t| t.expose().to_owned()); + assert_eq!( + stale, + Err(Error::StaleGeneration { id: s1.id.clone(), expected: seen_generation, current: s2.generation }), + "refresh from the discarded session (generation {seen_generation}) must be refused as stale, \ + never Unknown: re-added session has generation {}; keychain now holds {:?}", + s2.generation, + now_token + ); + assert_eq!(now_token, Some("session-2".to_owned()), "session 2's token must survive the stale refresh"); +} + +/// The gate's named case "re-add-continues-generation": removing an account and signing it back in +/// must never restart its generation at 0. One bump for the tombstone the removal leaves, one for +/// the sign-in that follows it. +#[test] +fn re_add_continues_generation_past_the_tombstone() { + let dir = tempfile::tempdir().unwrap(); + let store = Store::at(Some(dir.path().to_owned()), Memory::new()); + + let s1 = store.sign_in(&acct("x"), &tok("session-1"), NOW).unwrap(); + assert_eq!(s1.generation, 0); + store.discard(&s1.id).unwrap(); + let s2 = store.sign_in(&acct("x"), &tok("session-2"), NOW + 10).unwrap(); + + assert_eq!(s2.id, s1.id, "the same deployment and subject is the same handle"); + assert!( + s2.generation > s1.generation, + "the re-added session's generation must be ahead of the discarded one, never restarting at 0: {} vs {}", + s2.generation, + s1.generation + ); + assert_eq!(s2.generation, s1.generation + 2, "one bump for the tombstone, one for the sign-in"); + + // A third sign-in should continue on from there rather than from the tombstone again. + let s3 = store.sign_in(&acct("x"), &tok("session-3"), NOW + 20).unwrap(); + assert_eq!(s3.generation, s2.generation + 1); +} + +// ---- gate: defined partial-failure recovery --------------------------------- + +/// RFC-0025 guarantee 1: a partial failure leaves a state the next reader detects and repairs, +/// never a silent mismatch. Simulates the window `update_token` opens between writing the +/// refreshed token to the keychain and committing the matching generation bump to the list (see +/// the crate's module docs, "Concurrent mutations and partial-failure recovery"): the token store +/// receives the refreshed token directly, standing in for a crash right after that write and +/// before the list commit. The list is then one generation behind a keychain token that is already +/// the newer one. The next `update_token` against that same, still-current generation must still +/// succeed and bring both back into step, rather than getting stuck re-reporting the mismatch. +#[test] +fn torn_state_between_the_keychain_write_and_the_generation_commit_recovers() { + let dir = tempfile::tempdir().unwrap(); + let keychain = Memory::new(); + let store = Store::at(Some(dir.path().to_owned()), keychain.clone()); + + let account = store.sign_in(&acct("x"), &tok("session-1"), NOW).unwrap(); + + // Stand in for the crash: the keychain already holds the refreshed token, but the list was + // never told, so it still shows the old generation. + keychain.put(&account.id, &tok("session-1-refreshed")).unwrap(); + match store.shared() { + craft_suite_account::Shared::Session { token, .. } => { + assert_eq!(token, tok("session-1-refreshed"), "the torn state is detectable: the keychain is already ahead of the list"); + } + other => panic!("expected a session, got {other:?}"), + } + + // The next legitimate refresh, made against the generation the list still shows, must still + // go through and bring both back into step. + let recovered = store.update_token(&account.id, account.generation, &tok("session-2"), NOW + 30).unwrap(); + assert_eq!(recovered.generation, account.generation + 1); + match store.shared() { + craft_suite_account::Shared::Session { token, .. } => assert_eq!(token, tok("session-2")), + other => panic!("expected a session, got {other:?}"), + } +} From 50fbf2bd0c05a88f95c95019f6752a1fccd94479 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:07:00 +0700 Subject: [PATCH 152/183] testkit: share exact format mutation corpus across DEX WASM and TAR (#2106) Co-authored-by: FredApps --- Cargo.lock | 1 + crates/dex/Cargo.toml | 3 +++ crates/dex/src/test_support.rs | 42 +---------------------------- crates/testkit/src/sample_damage.rs | 39 +++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 62f2866e4..5147fa867 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1757,6 +1757,7 @@ dependencies = [ name = "craft-dex" version = "0.1.0" dependencies = [ + "craft-testkit", "serde", "thiserror 2.0.21", ] diff --git a/crates/dex/Cargo.toml b/crates/dex/Cargo.toml index e4eb285f5..fc7e35d1d 100644 --- a/crates/dex/Cargo.toml +++ b/crates/dex/Cargo.toml @@ -11,3 +11,6 @@ workspace=true [dependencies] serde={workspace=true} thiserror={workspace=true} + +[dev-dependencies] +craft-testkit = { workspace = true } diff --git a/crates/dex/src/test_support.rs b/crates/dex/src/test_support.rs index a3a179145..5d50cd671 100644 --- a/crates/dex/src/test_support.rs +++ b/crates/dex/src/test_support.rs @@ -1,45 +1,5 @@ // Synthetic DEX fixture and deterministic mutations retained from Craft Anything. -/// Deterministic pseudo-random bytes (xorshift) for fuzz-like loops. -pub fn noise(seed: u64, len: usize) -> Vec { - let mut x = seed.wrapping_mul(0x9e37_79b9_7f4a_7c15) | 1; - (0..len) - .map(|_| { - x ^= x << 13; - x ^= x >> 7; - x ^= x << 17; - x as u8 - }) - .collect() -} - -/// Every way to damage a sample used by robustness tests: truncations at many lengths and -/// single-byte corruptions spread across the file. -pub fn mutations(sample: &[u8]) -> Vec> { - let mut out = Vec::new(); - let n = sample.len(); - let step = (n / 64).max(1); - let mut len = 0; - while len < n { - out.push(sample[..len].to_vec()); - len += step; - } - for (i, seed) in (0..n).step_by(step).zip(1u64..) { - let mut m = sample.to_vec(); - let noise = noise(seed, 8); - for (j, v) in noise.iter().enumerate() { - if let Some(b) = m.get_mut(i + j) { - *b = *v; - } - } - out.push(m); - let mut m = sample.to_vec(); - if let Some(b) = m.get_mut(i) { - *b = 0xff; - } - out.push(m); - } - out -} +pub use craft_testkit::sample_damage::{mutations, noise}; pub mod android { pub const HELLO: &str = "Hello, Craft!"; diff --git a/crates/testkit/src/sample_damage.rs b/crates/testkit/src/sample_damage.rs index f0bdec729..b2fbeb757 100644 --- a/crates/testkit/src/sample_damage.rs +++ b/crates/testkit/src/sample_damage.rs @@ -72,3 +72,42 @@ mod tests { } } } + +#[cfg(test)] +mod dex_corpus_compatibility_tests { + use super::*; + + #[test] + fn noise_keeps_zero_wrapping_seed_and_draw_order() { + assert_eq!(noise(0, 8), [65, 65, 41, 37, 101, 1, 113, 13]); + assert_eq!(noise(1, 8), [173, 118, 54, 116, 236, 121, 207, 234]); + assert_eq!(noise(u64::MAX, 8), [44, 200, 255, 170, 173, 156, 79, 209]); + assert!(noise(1, 0).is_empty()); + } + + #[test] + fn mutation_order_and_empty_sample_are_stable() { + assert!(mutations(&[]).is_empty()); + assert_eq!(mutations(&[1, 2]), vec![vec![], vec![1], vec![173, 118], vec![255, 2], vec![1, 27], vec![1, 255]]); + } + + #[test] + fn stride_transition_preserves_every_original_case() { + for len in [1, 63, 64, 65, 127, 128, 129, 1024] { + let seed = vec![7; len]; + let step = (len / 64).max(1); + let cases = mutations(&seed); + let positions: Vec = (0..len).step_by(step).collect(); + assert_eq!(cases.len(), positions.len() * 3); + for (case, &end) in cases.iter().zip(&positions) { + assert_eq!(case.as_slice(), &seed[..end]); + } + for (pair, &offset) in cases[positions.len()..].as_chunks::<2>().0.iter().zip(&positions) { + assert_eq!(pair[0].len(), len); + let mut expected = seed.clone(); + expected[offset] = 255; + assert_eq!(pair[1], expected); + } + } + } +} From f8d869c1e70d1df8109a951c3a30eb2e0aecd54c Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 18 Nov 2026 05:41:30 +0100 Subject: [PATCH 153/183] psd: preserve bounded placement and descriptor compatibility --- crates/psd/src/descriptor.rs | 28 +++++- crates/psd/src/smart.rs | 177 ++++++++++++++++++++++++++++++++--- 2 files changed, 191 insertions(+), 14 deletions(-) diff --git a/crates/psd/src/descriptor.rs b/crates/psd/src/descriptor.rs index 1a6f2000e..a9b0148ec 100644 --- a/crates/psd/src/descriptor.rs +++ b/crates/psd/src/descriptor.rs @@ -438,7 +438,9 @@ fn read_descriptor(r: &mut Reader<'_>, depth: usize, limits: ParseLimits) -> Res let mut items = vec_for_count(n); for _ in 0..n { let key = Id::read(r)?; - let v = read_value(r, depth + 1, limits)?; + // A descriptor item is not another container; Objc/GlbO/ObAr and lists + // charge their nested containers exactly once below. + let v = read_value(r, depth, limits)?; items.push((key, v)); } Ok(Descriptor { name, class_id, items }) @@ -837,6 +839,30 @@ mod tests { assert!(matches!(Descriptor::from_bytes(&b), Err(PsdError::Unsupported(_)))); } + #[test] + fn container_depth_is_charged_once_and_still_bounded() { + for kind in ["Objc", "GlbO", "ObAr", "VlLs"] { + for count in [33, MAX_DEPTH, MAX_DEPTH + 1] { + let mut value = Value::Integer(1); + for _ in 0..count { + value = match kind { + "GlbO" => Value::GlobalObject(Descriptor::new("null").with("next", value)), + "ObAr" => Value::ObjectArray(ObjectArray { prefix: 16, body: Descriptor::new("null").with("next", value) }), + "VlLs" => Value::List(vec![value]), + _ => Value::Descriptor(Descriptor::new("null").with("next", value)), + }; + } + let bytes = Descriptor::new("null").with("root", value).to_bytes(); + let result = Descriptor::from_bytes(&bytes); + if count <= MAX_DEPTH { + assert!(result.is_ok(), "{kind} depth {count}: {result:?}"); + } else { + assert!(matches!(result, Err(PsdError::LimitExceeded(_))), "{kind} depth {count}"); + } + } + } + } + #[test] fn deep_nesting_is_limited() { let mut d = Descriptor::new("null"); diff --git a/crates/psd/src/smart.rs b/crates/psd/src/smart.rs index d4d98c695..efa3cee2e 100644 --- a/crates/psd/src/smart.rs +++ b/crates/psd/src/smart.rs @@ -8,7 +8,8 @@ //! bicubic Bézier patches. //! //! The custom mesh is evaluated exactly (bicubic Bézier patches over `meshPoints`, split by -//! `quiltSliceX` / `quiltSliceY`). Photoshop does not publish the curves of its named styles; +//! equally spaced `quiltSliceX` / `quiltSliceY`). Unequal divisions are rejected by the +//! fallible placement reader. Photoshop does not publish the curves of its named styles; //! the styles here are clean-room geometric definitions of what each name describes (Arc, //! Arch, Bulge, Shell, Flag, Wave, Fish, Rise, Fisheye, Inflate, Squeeze, Twist), matched by //! behaviour, not numerically. @@ -59,7 +60,11 @@ pub struct Warp { /// The eight numbers of a transform entry (`Trnf`, `nonAffineTransform`), when it has exactly eight. fn eight(d: &Descriptor, key: &str) -> Option<[f64; 8]> { - d.get_numbers(key).try_into().ok() + d.get_numbers(key).into_iter().map(finite).collect::>().try_into().ok() +} + +fn finite(value: f64) -> f64 { + if value.is_finite() { value } else { 0.0 } } /// The corner quad (top-left, top-right, bottom-right, bottom-left) from x0 y0 … x3 y3. @@ -76,17 +81,45 @@ fn quilt_slices(env: &Descriptor, key: &str) -> Vec { } } +/// The public mesh has no slice coordinates, so only uniform divisions can be +/// represented faithfully. Keep the legacy absent-slices single-patch convention. +fn quilt_patches(slices: &[f64]) -> Result { + if slices.is_empty() { + return Ok(1); + } + if slices.len() < 2 || slices.iter().any(|v| !v.is_finite()) { + return Err(PsdError::Unsupported("invalid quilt divisions".into())); + } + let step = slices[1] - slices[0]; + if !step.is_finite() || step <= 0.0 { + return Err(PsdError::Unsupported("invalid quilt divisions".into())); + } + let tolerance = step.abs() * 1e-9; + if slices.windows(2).any(|pair| { + let width = pair[1] - pair[0]; + !width.is_finite() || width <= 0.0 || (width - step).abs() > tolerance + }) { + return Err(PsdError::Unsupported("unequal quilt divisions".into())); + } + Ok(slices.len() - 1) +} impl Warp { /// Reads a `warp` descriptor; `None` for no warp (the identity, or a custom warp without a - /// usable mesh). + /// usable mesh), or an unsupported quilt. Use [`Self::try_from_descriptor`] to report unsupported geometry. pub fn from_descriptor(d: &Descriptor) -> Option { + Self::try_from_descriptor(d).ok().flatten() + } + + /// Reads a warp, rejecting unequal or invalid quilt divisions rather than + /// interpreting them as equal-sized patches. Nonfinite geometry becomes zero. + pub fn try_from_descriptor(d: &Descriptor) -> Result> { let style = d.get_enum("warpStyle").unwrap_or_else(|| "warpNone".to_string()); - let side = |b: &Descriptor, k: &str| b.get_number(k).unwrap_or(0.0); + let side = |b: &Descriptor, k: &str| finite(b.get_number(k).unwrap_or(0.0)); let bounds = d.get_object("bounds").map_or([0.0; 4], |b| [side(b, "Left"), side(b, "Top "), side(b, "Rght"), side(b, "Btom")]); let mut w = Warp { - bend: d.get_number("warpValue").unwrap_or(0.0), - horizontal: d.get_number("warpPerspective").unwrap_or(0.0), - vertical: d.get_number("warpPerspectiveOther").unwrap_or(0.0), + bend: finite(d.get_number("warpValue").unwrap_or(0.0)), + horizontal: finite(d.get_number("warpPerspective").unwrap_or(0.0)), + vertical: finite(d.get_number("warpPerspectiveOther").unwrap_or(0.0)), rotate_vertical: d.get_enum("warpRotate").as_deref() == Some("Vrtc"), bounds, cols: 1, @@ -95,8 +128,33 @@ impl Warp { style, }; if let Some(env) = d.get_object("customEnvelopeWarp") { - let cols = quilt_slices(env, "quiltSliceX").len().saturating_sub(1).max(1); - let rows = quilt_slices(env, "quiltSliceY").len().saturating_sub(1).max(1); + let slice_x = quilt_slices(env, "quiltSliceX"); + let slice_y = quilt_slices(env, "quiltSliceY"); + let cols = quilt_patches(&slice_x)?; + let rows = quilt_patches(&slice_y)?; + if !slice_x.is_empty() || !slice_y.is_empty() { + // The evaluator normalizes over bounds, not stored slice coordinates. + // Infer a missing rectangle only when both explicit axes define it. + if !(w.bounds[2] > w.bounds[0] && w.bounds[3] > w.bounds[1]) { + let (Some(&left), Some(&right), Some(&top), Some(&bottom)) = (slice_x.first(), slice_x.last(), slice_y.first(), slice_y.last()) + else { + return Err(PsdError::Unsupported("quilt divisions need bounds or both axes".into())); + }; + w.bounds = [left, top, right, bottom]; + } + for (slices, start, end) in [(&slice_x, w.bounds[0], w.bounds[2]), (&slice_y, w.bounds[1], w.bounds[3])] { + if let (Some(&first), Some(&last)) = (slices.first(), slices.last()) { + let extent = end - start; + if !extent.is_finite() { + return Err(PsdError::Unsupported("quilt bounds overflow".into())); + } + let tolerance = extent.abs() * 1e-9; + if (first - start).abs() > tolerance || (last - end).abs() > tolerance { + return Err(PsdError::Unsupported("quilt divisions do not match warp bounds".into())); + } + } + } + } if let Some(Value::ObjectArray(pts)) = env.get("meshPoints") { let xs = pts.body.get_numbers("Hrzn"); let ys = pts.body.get_numbers("Vrtc"); @@ -104,13 +162,13 @@ impl Warp { if n.is_some_and(|n| xs.len() == n && ys.len() == n) { w.cols = cols; w.rows = rows; - w.mesh = xs.into_iter().zip(ys).map(|(x, y)| [x, y]).collect(); + w.mesh = xs.into_iter().zip(ys).map(|(x, y)| [finite(x), finite(y)]).collect(); } } } let identity = w.style == "warpNone" || (w.style != "warpCustom" && w.bend == 0.0 && w.horizontal == 0.0 && w.vertical == 0.0); let custom_ok = w.style != "warpCustom" || !w.mesh.is_empty(); - (!identity && custom_ok).then_some(w) + Ok((!identity && custom_ok).then_some(w)) } /// The warp of a content point (content pixels → content pixels). @@ -273,9 +331,12 @@ impl SmartObject { let t = eight(&d, "Trnf").unwrap_or([0.0; 8]); // The non-affine transform when present (perspective), else the transform. let t = eight(&d, "nonAffineTransform").unwrap_or(t); - let size = d.get_object("Sz ").and_then(|s| Some([s.get_number("Wdth")?, s.get_number("Hght")?])); + let size = d.get_object("Sz ").and_then(|s| Some([finite(s.get_number("Wdth")?), finite(s.get_number("Hght")?)])); // A split warp is in `quiltWarp`, with `warp` holding none. - let warp = d.get_object("quiltWarp").and_then(Warp::from_descriptor).or_else(|| d.get_object("warp").and_then(Warp::from_descriptor)); + let mut warp = d.get_object("quiltWarp").map(Warp::try_from_descriptor).transpose()?.flatten(); + if warp.is_none() { + warp = d.get_object("warp").map(Warp::try_from_descriptor).transpose()?.flatten(); + } Ok(SmartObject { uuid, quad: quad_from(t), size, warp }) } @@ -949,6 +1010,96 @@ mod tests { assert!(select_linked_records(&unicode, &|uuid, _| uuid == "\u{fffd}").unwrap().is_none()); } + #[test] + fn placement_normalizes_nonfinite_geometry_before_classification() { + let data = placed_layer_data("finite", [f64::NAN, 0.0, 20.0, 0.0, 20.0, 10.0, 0.0, 10.0], |d| { + let warp = Descriptor::new("warp") + .with("warpStyle", Value::Enumerated { type_id: Id::new("warpStyle"), value: Id::new("warpArc") }) + .with("warpValue", Value::Double(f64::NAN)) + .with("warpPerspective", Value::Double(f64::INFINITY)) + .with("warpPerspectiveOther", Value::Double(f64::NEG_INFINITY)); + let size = Descriptor::new("Pnt ").with("Wdth", Value::Double(f64::INFINITY)).with("Hght", Value::Double(10.0)); + d.with("warp", Value::Descriptor(warp)).with("Sz ", Value::Descriptor(size)) + }); + let object = SmartObject::from_placed_layer_data(&data).unwrap(); + assert_eq!(object.quad, [[0.0, 0.0], [20.0, 0.0], [20.0, 10.0], [0.0, 10.0]]); + assert_eq!(object.size, Some([0.0, 10.0])); + assert!(!object.needs_bake()); + assert_eq!(object.map([5.0, 5.0], 20.0, 10.0), [5.0, 5.0]); + } + + fn quilt_descriptor(xs: Vec, ys: Vec) -> Descriptor { + let unfl = |values| Value::UnitFloats { unit: *b"#Pxl", values }; + // Identity control points for a 7 x 4 mesh with a split at x=5. + let x = [0.0, 5.0 / 3.0, 10.0 / 3.0, 5.0, 10.0, 15.0, 20.0]; + let body = Descriptor::new("rationalPoint") + .with("Hrzn", unfl((0..4).flat_map(|_| x).collect())) + .with("Vrtc", unfl((0..4).flat_map(|j| [j as f64 * 10.0 / 3.0; 7]).collect())); + let env = Descriptor::new("customEnvelopeWarp") + .with("quiltSliceX", unfl(xs)) + .with("quiltSliceY", unfl(ys)) + .with("meshPoints", Value::ObjectArray(ObjectArray { prefix: 16, body })); + Descriptor::new("warp") + .with("warpStyle", Value::Enumerated { type_id: Id::new("warpStyle"), value: Id::new("warpCustom") }) + .with("customEnvelopeWarp", Value::Descriptor(env)) + } + + #[test] + fn unequal_quilts_are_errors_not_uniform_meshes_or_fallback_warps() { + for (xs, ys) in [(vec![0.0, 5.0, 20.0], vec![0.0, 10.0]), (vec![0.0, 10.0, 20.0], vec![0.0, 2.0, 10.0])] { + let warp = quilt_descriptor(xs, ys); + assert!(matches!(Warp::try_from_descriptor(&warp), Err(PsdError::Unsupported(_)))); + for key in ["warp", "quiltWarp"] { + let data = placed_layer_data("quilt", [0.0; 8], |d| { + let d = if key == "quiltWarp" { d.with("warp", Value::Descriptor(Descriptor::new("warp"))) } else { d }; + d.with(key, Value::Descriptor(warp.clone())) + }); + assert!(matches!(SmartObject::from_placed_layer_data(&data), Err(PsdError::Unsupported(_)))); + } + } + for slices in [vec![0.0], vec![0.0, 0.0], vec![10.0, 0.0], vec![0.0, f64::NAN]] { + assert!(quilt_patches(&slices).is_err()); + } + assert_eq!(quilt_patches(&[]).unwrap(), 1); + assert_eq!(quilt_patches(&[0.0, 10.0, 20.0]).unwrap(), 2); + } + + #[test] + fn quilt_endpoints_define_or_match_the_normalization_bounds() { + let equal = quilt_descriptor(vec![0.0, 10.0, 20.0], vec![0.0, 10.0]); + assert_eq!(Warp::try_from_descriptor(&equal).unwrap().unwrap().bounds, [0.0, 0.0, 20.0, 10.0]); + let bounds = Descriptor::new("bounds") + .with("Left", Value::Double(0.0)) + .with("Top ", Value::Double(0.0)) + .with("Rght", Value::Double(40.0)) + .with("Btom", Value::Double(10.0)); + assert!(Warp::try_from_descriptor(&equal.with("bounds", Value::Descriptor(bounds))).is_err()); + let missing = quilt_descriptor(vec![0.0, 10.0, 20.0], vec![]); + assert!(Warp::try_from_descriptor(&missing).is_err()); + } + #[test] + fn finite_warp_views_preserve_raw_descriptor_values() { + let mut warp = quilt_descriptor(vec![0.0, 10.0, 20.0], vec![0.0, 10.0]); + let bounds = Descriptor::new("bounds") + .with("Left", Value::Double(f64::NAN)) + .with("Top ", Value::Double(f64::NEG_INFINITY)) + .with("Rght", Value::Double(20.0)) + .with("Btom", Value::Double(10.0)); + warp = warp.with("bounds", Value::Descriptor(bounds)); + let env = warp.items.iter_mut().find(|(key, _)| key.as_bytes() == b"customEnvelopeWarp").unwrap(); + let Value::Descriptor(env) = &mut env.1 else { panic!("envelope") }; + let points = env.items.iter_mut().find(|(key, _)| key.as_bytes() == b"meshPoints").unwrap(); + let Value::ObjectArray(points) = &mut points.1 else { panic!("mesh") }; + let values = &mut points.body.items[0].1; + let Value::UnitFloats { values, .. } = values else { panic!("coordinates") }; + values[0] = f64::NAN; + let bytes = warp.to_bytes(); + let view = Warp::try_from_descriptor(&warp).unwrap().unwrap(); + assert_eq!(view.bounds, [0.0, 0.0, 20.0, 10.0]); + assert_eq!(view.mesh[0], [0.0, 0.0]); + assert_eq!(warp.to_bytes(), bytes); + } + #[test] fn placed_layer_data_gives_the_id_quad_size_and_warp() { let quad = [20.0, 4.0, 40.0, 4.0, 40.0, 44.0, 20.0, 44.0]; From 80f1cedd4bc66b927a6fd8fbc979ca9995523bd9 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Wed, 18 Nov 2026 12:39:50 +0700 Subject: [PATCH 154/183] fix(xfa): retain original source ranges after UTF-8 BOM (#2160) * test(xfa): reproduce BOM-relative source ranges * fix(xfa): translate BOM-stripped spans to original input --- crates/xfa/src/xml.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/crates/xfa/src/xml.rs b/crates/xfa/src/xml.rs index 70fe5d580..7afab7600 100644 --- a/crates/xfa/src/xml.rs +++ b/crates/xfa/src/xml.rs @@ -191,7 +191,11 @@ impl Document { opts.limits.max_nodes = options.nodes_limit as usize; opts.limits.max_depth = crate::MAX_XML_DEPTH; - let mut events = opts.events(text.as_bytes()); + // quick-xml excludes a leading UTF-8 BOM from its buffer positions. + // Parse it explicitly so every stored range still addresses the original input. + let input = text.strip_prefix('\u{feff}').unwrap_or(text); + let source_offset = text.len() - input.len(); + let mut events = opts.events(input.as_bytes()); let mut nodes: Vec = Vec::new(); let mut open: Vec<(usize, usize)> = Vec::new(); // (node_id, scope_len_before) let mut scope: Vec<(String, String)> = Vec::new(); @@ -199,6 +203,7 @@ impl Document { while let Some(ev) = events.next().map_err(|e| e.to_string())? { let span = events.span(); + let span = span.start + source_offset..span.end + source_offset; match ev { craft_xml::Event::Start { name, attrs } => { if nodes.len() >= options.nodes_limit as usize { @@ -413,6 +418,23 @@ impl<'a> Node<'a> { mod tests { use super::*; + #[test] + fn element_ranges_slice_original_input_with_utf8_bom() { + for prefix in ["", "\u{feff}", "\u{feff}"] { + for child_xml in ["<é/>", "<é>text"] { + let root_xml = format!("{child_xml}"); + let input = format!("{prefix}{root_xml}"); + let doc = Document::parse(&input).unwrap(); + let root = doc.root_element(); + let child = root.children().next().unwrap(); + assert_eq!(input.get(root.range()), Some(root_xml.as_str())); + assert_eq!(input.get(child.range()), Some(child_xml)); + assert_eq!(root.range(), prefix.len()..input.len()); + assert_eq!(child.range(), prefix.len() + 3..prefix.len() + 3 + child_xml.len()); + } + } + } + #[test] fn inherited_namespace_copies_obey_aggregate_byte_admission() { let uri = format!("urn:{}", "x".repeat(124)); From 172f5c78c742145ccc516326181d65e9032040c6 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 18 Nov 2026 00:54:39 -0500 Subject: [PATCH 155/183] fix(svg): reject malformed path tokens instead of truncating --- crates/svg/src/path_data.rs | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/crates/svg/src/path_data.rs b/crates/svg/src/path_data.rs index fc31fbaf2..8db13faa2 100644 --- a/crates/svg/src/path_data.rs +++ b/crates/svg/src/path_data.rs @@ -156,19 +156,21 @@ impl<'a> Tokenizer<'a> { Some(v) } - fn next_tok(&mut self) -> Option { + fn next_tok(&mut self) -> Result> { let mut nums = Numbers { s: self.s, i: self.i }; nums.skip_seps(); self.i = nums.i; self.tok_start = self.i; - let c = self.s.get(self.i).copied()?; + let Some(c) = self.s.get(self.i).copied() else { return Ok(None) }; if c.is_ascii_alphabetic() { self.i += 1; - return Some(Tok::Cmd(c)); + return Ok(Some(Tok::Cmd(c))); } let tok = nums.next_num().map(Tok::Num); self.i = nums.i; - tok + // Invalid bytes and malformed/non-finite numbers are not EOF: returning a + // successful prefix here would silently discard the rest of the shape. + tok.map(Some).ok_or_else(|| Error("SVG: invalid path token".into())) } } @@ -193,7 +195,7 @@ pub fn parse_path(d: &str) -> Result> { *look = Some(other); Err(Error("SVG: path command is missing coordinates".into())) } - None => match tk.next_tok() { + None => match tk.next_tok()? { Some(Tok::Num(v)) => Ok(v), Some(other @ Tok::Cmd(_)) => { *look = Some(other); @@ -204,7 +206,10 @@ pub fn parse_path(d: &str) -> Result> { } }; - while let Some(tok) = lookahead.take().or_else(|| tk.next_tok()) { + while let Some(tok) = match lookahead.take() { + Some(tok) => Some(tok), + None => tk.next_tok()?, + } { let rel = match tok { Tok::Cmd(c) => { if c.eq_ignore_ascii_case(&b'z') { @@ -459,6 +464,25 @@ mod tests { assert!((sweep - std::f64::consts::PI).abs() < 1e-10); } + #[test] + fn rejects_invalid_tokens_instead_of_returning_a_partial_path() { + for input in ["@", "M0 0 L1 1@ L2 2", "M0 0 L1 1@", "M0 0 Z@", "M0 0 L1 1é", "M0 0 L1 1 +", "M0 0 L1 1 .", "M0 0 L1 1 2e+", "M0 0 L1 1 1e999"] + { + assert!(parse_path(input).is_err(), "accepted malformed path: {input}"); + } + } + + #[test] + fn token_errors_do_not_change_clean_eof_or_compact_numbers() { + assert!(parse_path(" \t\r\n,").unwrap().is_empty()); + let paths = parse_path("M.5-.5 L1e1-2e0 A6 7 30 0110 12 z ,\n").unwrap(); + assert_eq!(paths.len(), 1); + assert!(paths[0].closed); + assert_eq!(paths[0].start, Point::new(0.5, -0.5)); + assert_eq!(paths[0].segs[0], Segment::Line(Point::new(10.0, -2.0))); + assert_eq!(paths[0].segs[1], Segment::Arc { rx: 6.0, ry: 7.0, rot: 30.0, large: false, sweep: true, end: Point::new(10.0, 12.0) }); + } + #[test] fn rejects_invalid_flags_and_limits_segments() { assert!(parse_path("M0 0 A1 1 0 5 1 2 2").is_err()); From 6a18b99d6f719467780da4333e6b2b49a5c937fa Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 18 Nov 2026 01:01:37 -0500 Subject: [PATCH 156/183] fix(dex): report partial instruction decoding and encode fixture UTF-16 --- crates/dex/src/dex.rs | 55 ++++++++++++++++++++++++++++++++-- crates/dex/src/test_support.rs | 3 +- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/crates/dex/src/dex.rs b/crates/dex/src/dex.rs index 3ecc8224c..253af049c 100644 --- a/crates/dex/src/dex.rs +++ b/crates/dex/src/dex.rs @@ -691,7 +691,7 @@ pub struct Reference { const MAX_REFERENCE_BYTES: usize = 64 << 20; /// Every instruction that refers to class `desc` (optionally only its methods named `method`). -/// Returns a truncated prefix when the count or aggregate caller/target byte budget is exhausted. +/// Reports truncation when instruction decoding is incomplete or the count or byte budget is exhausted. pub fn references(dex: &Dex<'_>, desc: &str, method: Option<&str>, max: usize) -> (Vec, bool) { references_with_byte_limit(dex, desc, method, max, MAX_REFERENCE_BYTES) } @@ -699,11 +699,13 @@ pub fn references(dex: &Dex<'_>, desc: &str, method: Option<&str>, max: usize) - fn references_with_byte_limit(dex: &Dex<'_>, desc: &str, method: Option<&str>, max: usize, max_bytes: usize) -> (Vec, bool) { let mut bytes_left = max_bytes; let mut out = Vec::new(); + let mut complete = true; for c in &dex.classes { let cd = dex.class_data(c); for m in cd.direct_methods.iter().chain(&cd.virtual_methods) { let Some(code) = dex.code(m.code_off) else { continue }; - let (insns, _) = crate::dex_ops::decode(&code.insns, 200_000); + let (insns, decoded) = crate::dex_ops::decode(&code.insns, 200_000); + complete &= decoded; for i in &insns { let Some(idx) = i.index else { continue }; let hit = match i.index_kind { @@ -735,7 +737,7 @@ fn references_with_byte_limit(dex: &Dex<'_>, desc: &str, method: Option<&str>, m } } } - (out, false) + (out, !complete) } #[cfg(test)] @@ -990,4 +992,51 @@ mod tests { assert!(zero.is_empty()); assert_eq!(references(&dex, &desc, Some("run"), 100), (all, false)); } + #[test] + fn references_report_incomplete_instruction_decoding() { + for (insns, incomplete) in [(vec![0x000e], false), (vec![0x0071], true), (vec![0; 200_001], true)] { + let mut b = fx::DexBuilder::default(); + let class = b.ty("Ltest;"); + let method = b.method("Ltest;", "run", "V", &[]); + b.classes.push(fx::ClassSpec { + class, + direct: vec![fx::MethodSpec { method, access: 0, code: Some(fx::CodeSpec { insns, ..Default::default() }) }], + ..Default::default() + }); + let bytes = b.build(); + let dex = parse(&bytes).unwrap(); + let (hits, truncated) = references(&dex, "Lmissing;", None, 100); + assert!(hits.is_empty()); + assert_eq!(truncated, incomplete); + } + } + + #[test] + fn references_keep_incompleteness_across_later_complete_methods() { + let mut b = fx::DexBuilder::default(); + let class = b.ty("Ltest;"); + let broken = b.method("Ltest;", "broken", "V", &[]); + let complete = b.method("Ltest;", "complete", "V", &[]); + b.classes.push(fx::ClassSpec { + class, + direct: vec![ + fx::MethodSpec { method: broken, access: 0, code: Some(fx::CodeSpec { insns: vec![0x0071], ..Default::default() }) }, + fx::MethodSpec { method: complete, access: 0, code: Some(fx::CodeSpec { insns: vec![0x000e], ..Default::default() }) }, + ], + ..Default::default() + }); + let bytes = b.build(); + let dex = parse(&bytes).unwrap(); + assert_eq!(references(&dex, "Lmissing;", None, 100), (Vec::new(), true)); + } + + #[test] + fn fixture_strings_round_trip_supplementary_and_null_characters() { + let mut b = fx::DexBuilder::default(); + let text = "a\0é😀z"; + let id = b.string(text); + let bytes = b.build(); + let dex = parse(&bytes).unwrap(); + assert_eq!(dex.string(id), text); + } } diff --git a/crates/dex/src/test_support.rs b/crates/dex/src/test_support.rs index 5d50cd671..772a9f0e4 100644 --- a/crates/dex/src/test_support.rs +++ b/crates/dex/src/test_support.rs @@ -176,8 +176,7 @@ pub mod android { for s in &self.strings { string_offs.push(at(&d)); uleb(&mut d, s.encode_utf16().count() as u32); - for ch in s.chars() { - let c = ch as u32; + for c in s.encode_utf16() { if c == 0 { d.extend_from_slice(&[0xc0, 0x80]); } else if c < 0x80 { From 6811f1c2b1725d37ea4baf04917e0f9ceeb07405 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 18 Nov 2026 01:03:27 -0500 Subject: [PATCH 157/183] fix(ps): bound every decoded string-token append --- crates/ps/src/read/scan.rs | 63 +++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/crates/ps/src/read/scan.rs b/crates/ps/src/read/scan.rs index 9f6aa14c3..166fad5f0 100644 --- a/crates/ps/src/read/scan.rs +++ b/crates/ps/src/read/scan.rs @@ -188,6 +188,10 @@ fn string(srcs: &mut Sources, src: usize) -> Result, String> { } fn hex(srcs: &mut Sources, src: usize) -> Result, String> { + hex_with_limit(srcs, src, MAX_TOKEN) +} + +fn hex_with_limit(srcs: &mut Sources, src: usize, max: usize) -> Result, String> { let mut out = Vec::new(); let mut hi: Option = None; loop { @@ -205,20 +209,21 @@ fn hex(srcs: &mut Sources, src: usize) -> Result, String> { _ => return Err("bad hex string".into()), }; match hi.take() { - Some(h) => out.push(h << 4 | v), + Some(h) => append_string_bytes(&mut out, &[h << 4 | v], max)?, None => hi = Some(v), } - if out.len() > MAX_TOKEN { - return Err("string too long".into()); - } } if let Some(h) = hi { - out.push(h << 4); + append_string_bytes(&mut out, &[h << 4], max)?; } Ok(out) } fn ascii85(srcs: &mut Sources, src: usize) -> Result, String> { + ascii85_with_limit(srcs, src, MAX_TOKEN) +} + +fn ascii85_with_limit(srcs: &mut Sources, src: usize, max: usize) -> Result, String> { let mut out = Vec::new(); let mut group = [0u64; 5]; let mut n = 0; @@ -234,7 +239,7 @@ fn ascii85(srcs: &mut Sources, src: usize) -> Result, String> { break; } if c == b'z' && n == 0 { - out.extend([0; 4]); + append_string_bytes(&mut out, &[0; 4], max)?; continue; } if !(b'!'..=b'u').contains(&c) { @@ -246,12 +251,9 @@ fn ascii85(srcs: &mut Sources, src: usize) -> Result, String> { n += 1; if n == 5 { let v = group.iter().fold(0u64, |a, d| a * 85 + d); - out.extend(u32::try_from(v).map_err(|_| "ASCII85 overflow")?.to_be_bytes()); + append_string_bytes(&mut out, &u32::try_from(v).map_err(|_| "ASCII85 overflow")?.to_be_bytes(), max)?; n = 0; } - if out.len() > MAX_TOKEN { - return Err("string too long".into()); - } } if n > 1 { for g in group.iter_mut().skip(n) { @@ -259,11 +261,21 @@ fn ascii85(srcs: &mut Sources, src: usize) -> Result, String> { } let v = group.iter().fold(0u64, |a, d| a * 85 + d).min(u64::from(u32::MAX)); let v = u32::try_from(v).unwrap_or(u32::MAX); - out.extend(v.to_be_bytes().iter().take(n - 1)); + append_string_bytes(&mut out, v.to_be_bytes().get(..n - 1).unwrap_or_default(), max)?; } Ok(out) } +// Check before every decoded append: zero shorthand and final partial groups can +// produce bytes without passing through the ordinary complete-group branch. +fn append_string_bytes(out: &mut Vec, bytes: &[u8], max: usize) -> Result<(), String> { + if bytes.len() > max.saturating_sub(out.len()) { + return Err("string too long".into()); + } + out.extend_from_slice(bytes); + Ok(()) +} + /// An integer, radix number (`16#FF`) or real; None for anything else. pub fn number(t: &[u8]) -> Option { let s = std::str::from_utf8(t).ok()?; @@ -321,6 +333,35 @@ mod tests { out } + #[test] + fn encoded_strings_obey_the_decoded_budget_at_every_append() { + fn decode(input: &[u8], max: usize, ascii85: bool) -> Result, String> { + let mut sources = Sources::default(); + let id = sources.add(Source::bytes(input.to_vec())); + if ascii85 { ascii85_with_limit(&mut sources, id, max) } else { hex_with_limit(&mut sources, id, max) } + } + for (input, expected) in [ + (b"~>".as_slice(), vec![]), + (b"z~>", vec![0; 4]), + (b"zz~>", vec![0; 8]), + (b"!!!!!~>", vec![0; 4]), + (b"z!!~>", vec![0; 5]), + (b"!!!!!!!!~>", vec![0; 6]), + (b"!!!!~>", vec![0; 3]), + ] { + assert_eq!(decode(input, expected.len(), true).unwrap(), expected); + if !expected.is_empty() { + assert_eq!(decode(input, expected.len() - 1, true).unwrap_err(), "string too long"); + } + } + for (input, expected) in [(b">".as_slice(), vec![]), (b"41>", vec![0x41]), (b"414>", vec![0x41, 0x40]), (b"4>", vec![0x40])] { + assert_eq!(decode(input, expected.len(), false).unwrap(), expected); + if !expected.is_empty() { + assert_eq!(decode(input, expected.len() - 1, false).unwrap_err(), "string too long"); + } + } + } + #[test] fn scans_the_token_kinds() { let t = all(b"12 -3.5 1e3 16#FF /lit name (a\\(b\\)\\101\\\n c) <41 42> <~87cURDZ~> {1 {2} add} //x [ ] << >> % note\n.5 1.e2 -."); From af1a6b42616930b11b8a55c39dc0bba4a79aeabe Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Wed, 18 Nov 2026 13:05:18 +0700 Subject: [PATCH 158/183] test(ci): never execute workflow text in shell harness (#2130) Co-authored-by: FredApps --- scripts/test-workspace-tests.py | 80 ++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 6 deletions(-) diff --git a/scripts/test-workspace-tests.py b/scripts/test-workspace-tests.py index fada6dc9b..9572cac31 100644 --- a/scripts/test-workspace-tests.py +++ b/scripts/test-workspace-tests.py @@ -5,6 +5,7 @@ import re import subprocess import tomllib import unittest +from unittest.mock import patch from pathlib import Path ROOT = Path(__file__).resolve().parent.parent @@ -18,19 +19,65 @@ def block(text, name): return "\n".join(line[8:] for line in match[1].splitlines()) -def commands(os_name, fail="", name="command"): - # Functions avoid executing any caller-supplied cargo command or changing the workspace. - # The real bash -euo pipefail semantics still apply, including failures inside a branch. - stub = """ +# Only these literal programs may be exercised. Workflow text is compared, never executed. +LINT_SOURCE = """ +if [ "$RUNNER_OS" = Linux ]; then + python3 scripts/test-workspace-concurrency.py + python3 scripts/test-workspace-tests.py +fi +cargo fmt --check +cargo clippy --workspace --all-targets --locked -- -D warnings +cargo clippy --workspace --all-targets --all-features --locked -- -D warnings +""" +TEST_SOURCE = """ +cargo nextest run --workspace --all-features --locked --profile ci +cargo test --workspace --doc --all-features --locked +cargo nextest run -p craft-image-codecs -p craft-text --locked --profile ci +""" +WINDOWS_SETUP = """powershell.exe -NoProfile -Command '$ErrorActionPreference = "Stop"; Start-Service Spooler; Add-PrinterDriver -Name "Generic / Text Only"'""" +EXPECTED_SOURCE = { + "lint-command": LINT_SOURCE, + "command": TEST_SOURCE, + "windows-command": WINDOWS_SETUP + "\n" + TEST_SOURCE, +} + + +def source_lines(source): + return [line.strip() for line in source.splitlines() + if line.strip() and not line.lstrip().startswith("#")] + + +def validate_source(text, name): + if name not in EXPECTED_SOURCE: + raise AssertionError(f"unsupported command block: {name}") + if source_lines(block(text, name)) != source_lines(EXPECTED_SOURCE[name]): + raise AssertionError(f"unexpected command source: {name}") + + +# The child shell only receives this checked-in literal, never bytes read from the workflow. +HARNESS = """ cargo() { printf '%s\\n' "$*" if [ -n "$FAIL" ] && [ "$*" = "$FAIL" ]; then return 17; fi } python3() { :; } +case "$BLOCK" in + lint-command) +""" + LINT_SOURCE + """ + ;; + command) +""" + TEST_SOURCE + """ + ;; + *) exit 29 ;; +esac """ + + +def commands(os_name, fail="", name="command", source=None): + validate_source(WORKFLOW.read_text() if source is None else source, name) return subprocess.run( - ["bash", "-euo", "pipefail", "-c", stub + block(WORKFLOW.read_text(), name)], - env={**os.environ, "RUNNER_OS": os_name, "FAIL": fail}, + ["bash", "-euo", "pipefail", "-c", HARNESS], + env={**os.environ, "RUNNER_OS": os_name, "FAIL": fail, "BLOCK": name}, text=True, capture_output=True, check=False, ) @@ -71,10 +118,31 @@ class WorkspaceTests(unittest.TestCase): self.assertEqual(result.stdout.splitlines(), stages[:index + 1]) def test_windows_runs_the_same_tests(self): + validate_source(WORKFLOW.read_text(), "windows-command") source = block(WORKFLOW.read_text(), "windows-command") cargo = [line.strip() for line in source.splitlines() if line.strip().startswith("cargo ")] self.assertEqual(cargo, ["cargo " + command for command in TESTS]) + def test_workflow_source_is_rejected_before_starting_any_process(self): + source = WORKFLOW.read_text() + for payload in ("cargo fmt --check; echo injected", "cargo fmt $(echo injected)", + "cargo fmt --check | cat", "cargo fmt --check > injected", + "echo injected", "cargo fmt --check\n touch injected"): + with self.subTest(payload=payload), patch("subprocess.run") as child: + changed = source.replace("cargo fmt --check", payload, 1) + with self.assertRaisesRegex(AssertionError, "unexpected command source"): + commands("Linux", name="lint-command", source=changed) + child.assert_not_called() + + def test_added_or_missing_stage_is_rejected_before_execution(self): + source = WORKFLOW.read_text() + for replacement in ("", "cargo fmt --check\n cargo fmt --check"): + with self.subTest(replacement=replacement), patch("subprocess.run") as child: + with self.assertRaisesRegex(AssertionError, "unexpected command source"): + commands("Linux", name="lint-command", + source=source.replace("cargo fmt --check", replacement, 1)) + child.assert_not_called() + def test_ci_profile_keeps_its_failure_policy_without_retries_or_filtering(self): config = tomllib.loads((ROOT / ".config/nextest.toml").read_text()) self.assertIs(config["profile"]["ci"]["fail-fast"], False) From e646d9307e96fa4603583aed3bbb219ce81efc8e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 18 Nov 2026 01:15:42 -0500 Subject: [PATCH 159/183] fix(docx): charge rejected nested roots against shared element budget --- crates/docx/src/read/chunk.rs | 46 ++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/crates/docx/src/read/chunk.rs b/crates/docx/src/read/chunk.rs index 9bdde064d..113c701ff 100644 --- a/crates/docx/src/read/chunk.rs +++ b/crates/docx/src/read/chunk.rs @@ -120,7 +120,17 @@ impl Reader<'_> { .ok()?; self.chunks.bytes = self.chunks.bytes.saturating_sub(pkg.size()); let state = ChunkState { nesting: self.chunks.nesting + 1, depth: depth + 1, ..self.chunks }; - let (doc, left, bytes, graphic, elements) = match super::read_opened_in(&pkg, state) { + let read = super::read_opened_in(&pkg, state); + // A parsed main part can still fail semantic validation (for example, a non-Word + // root). Charge its elements before returning that error, so later siblings cannot + // reuse the reservation. On success this is the same single charge as before. + let elements = pkg.elements_left(); + self.chunks.elements = elements; + let spent = cap.saturating_sub(elements); + if let Err(e) = self.pkg.charge(spent) { + log::warn!("docx: nested document chunk outspent the container's element budget: {e}"); + } + let (doc, left, bytes, graphic, _) = match read { Ok(read) => read, Err(e) => { log::warn!("docx: unreadable nested document chunk: {e}"); @@ -131,16 +141,6 @@ impl Reader<'_> { self.chunks.left = left; self.chunks.bytes = bytes; self.chunks.graphic = graphic; - self.chunks.elements = elements; - // The nested document's XML usage comes out of the container's budget too: a later - // sibling chunk and the container's own remaining parts parse against what is left - // of it. The charge can't refuse: the cap is the lesser of the file's remaining - // elements and what the container has left, and the container's budget doesn't move - // while the nested read goes. - let spent = cap.saturating_sub(elements); - if let Err(e) = self.pkg.charge(spent) { - log::warn!("docx: nested document chunk outspent the container's element budget: {e}"); - } Some(doc) } } @@ -186,7 +186,7 @@ mod tests { use craft_wordmodel::{Block, Document, InlineObject}; use super::ChunkState; - use crate::package::Package; + use crate::package::{MAX_PART, MAX_TOTAL, Package}; /// A package whose body is `body`, with the document relationship `rel` (id, type, target) to /// the part `(name, bytes)`. @@ -360,4 +360,26 @@ mod tests { // XML (8 paragraphs) doesn't, so it's left out instead of getting a fresh cap. assert_eq!(read(40), (true, true, false)); } + + #[test] + fn a_rejected_nested_root_still_charges_the_siblings_budget() { + // Four outer elements, sixty rejected elements, five sibling elements: 69 in total. + let bad_xml = format!("{}", "
    ".repeat(59)); + let mut zip = zip::ZipWriter::new(std::io::Cursor::new(Vec::new())); + zip.start_file("word/document.xml", zip::write::SimpleFileOptions::default()).unwrap(); + zip.write_all(bad_xml.as_bytes()).unwrap(); + let bad = zip.finish().unwrap().into_inner(); + let sibling = package_parts(r#"sibling"#, &[], &[]); + let outer = package_parts( + r#""#, + &[("bad", "aFChunk", "bad.docx"), ("good", "aFChunk", "good.docx")], + &[("word/bad.docx", &bad), ("word/good.docx", &sibling)], + ); + for (cap, included, remaining) in [(69, true, 0), (68, false, 4)] { + let pkg = Package::open_limited_within(&outer, MAX_PART, MAX_TOTAL, cap).unwrap(); + let doc = super::super::read_opened(&pkg, None).unwrap(); + assert_eq!(has(&doc, "sibling"), included, "budget {cap}"); + assert_eq!(pkg.elements_left(), remaining, "budget {cap}"); + } + } } From 4078682a5179b831c73303ff37a24d9b17749cfa Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 18 Nov 2026 01:17:12 -0500 Subject: [PATCH 160/183] mesh: expose strict UTF-8 URI percent decoding --- crates/mesh/src/gltf.rs | 10 ++++++++++ crates/mesh/src/tests/gltf.rs | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/crates/mesh/src/gltf.rs b/crates/mesh/src/gltf.rs index c92051b84..d074f1ed1 100644 --- a/crates/mesh/src/gltf.rs +++ b/crates/mesh/src/gltf.rs @@ -120,6 +120,16 @@ pub fn uri_decode(s: &str) -> String { String::from_utf8_lossy(&percent_decode(s)).into_owned() } +/// Percent-decode a URI, rejecting decoded bytes that are not UTF-8. +/// +/// As with [`uri_decode`], incomplete or non-hex escapes stay literal and `+` stays +/// `+`. This does not validate or confine a filesystem path; callers must retain +/// their own reference policy. Decoding is linear and output is no larger than input. +/// Use this instead of the lossy decoder when a resolver requires exact UTF-8 names. +pub fn uri_decode_strict(s: &str) -> Option { + String::from_utf8(percent_decode(s)).ok() +} + /// [`uri_decode`] as bytes, so escaped bytes that are not UTF-8 survive. fn percent_decode(s: &str) -> Vec { let b = s.as_bytes(); diff --git a/crates/mesh/src/tests/gltf.rs b/crates/mesh/src/tests/gltf.rs index 8892fe241..c47b911df 100644 --- a/crates/mesh/src/tests/gltf.rs +++ b/crates/mesh/src/tests/gltf.rs @@ -950,3 +950,32 @@ fn morph_targets_and_other_scenes_are_named_in_warnings() { let s = parse(&one_mesh(&b, plain.clone())).unwrap(); assert!(s.warnings.is_empty(), "{:?}", s.warnings); } + +#[test] +fn strict_uri_decoding_preserves_exact_names_and_rejects_invalid_utf8() { + use crate::gltf::uri_decode_strict; + for (input, expected) in [ + ("", Some("")), + ("a+b", Some("a+b")), + ("a%20b", Some("a b")), + ("é/%E2%82%AC", Some("é/€")), + ("%", Some("%")), + ("%2", Some("%2")), + ("%GG", Some("%GG")), + ("%252e%252e", Some("%2e%2e")), + ("%2e%2e%2fmesh.bin", Some("../mesh.bin")), + ("%00", Some("\0")), + ("%FF", None), + ("%C0%AF", None), + ("%ED%A0%80", None), + ("%E2%82", None), + ] { + assert_eq!(uri_decode_strict(input).as_deref(), expected, "{input}"); + } + // Keep the existing API's replacement-character behavior unchanged. + assert_eq!(uri_decode("%FF"), "�"); + let input = "%41%GG+é".repeat(100_000); + let decoded = uri_decode_strict(&input).unwrap(); + assert_eq!(decoded, "A%GG+é".repeat(100_000)); + assert!(decoded.len() <= input.len()); +} From 133b15453c0d695db0245776c46feb045e605693 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 18 Nov 2026 01:21:44 -0500 Subject: [PATCH 161/183] fix(rtf): retain hidden-result and empty-field revision state --- crates/rtf/src/doc/field.rs | 22 +++++++++++++++------- crates/rtf/src/doc/tests_fields.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/crates/rtf/src/doc/field.rs b/crates/rtf/src/doc/field.rs index 78d5f7d81..ccc12f4cf 100644 --- a/crates/rtf/src/doc/field.rs +++ b/crates/rtf/src/doc/field.rs @@ -64,7 +64,11 @@ impl Reader { /// `\chpgn`, the current page number: a `PAGE` field. pub(super) fn page_number_symbol(&mut self) { - if self.marks_on && self.st.dest == Dest::Body && !self.st.hidden { + if self.st.dest == Dest::Body && self.st.hidden { + self.hidden_text_dropped(); + return; + } + if self.marks_on && self.st.dest == Dest::Body { // Tracked like text, so Accept and Reject apply to it. let fmt = self.text_fmt(); self.para.inlines.push(Inline::Field { instr: "PAGE".into(), result: String::new(), fmt, locked: false }); @@ -75,10 +79,11 @@ impl Reader { /// Hidden text left out of the body: an open field's result is then not what showed, and the /// field is left as read rather than made a field that would show. pub(super) fn hidden_text_dropped(&mut self) { - if let Some(f) = self.open_fields.last_mut() - && f.result - { - f.hidden = true; + // An omitted nested result is also omitted from each enclosing result. + for f in &mut self.open_fields { + if f.result { + f.hidden = true; + } } } @@ -95,8 +100,11 @@ impl Reader { if !page_dependent(instr) { return; } - let Some((result, fmt)) = result_text(&self.para.inlines, &f, &self.st.fmt) else { return }; - let field = Inline::Field { instr: instr.to_string(), result, fmt, locked: f.locked }; + let instr = instr.to_string(); + // An empty result has no run to carry the group's revision marks. + let group = self.text_fmt(); + let Some((result, fmt)) = result_text(&self.para.inlines, &f, &group) else { return }; + let field = Inline::Field { instr, result, fmt, locked: f.locked }; let inlines = &mut self.para.inlines; inlines.truncate(f.start); if let (Some(n), Some(Inline::Text(t, _))) = (f.tail_from, inlines.last_mut()) { diff --git a/crates/rtf/src/doc/tests_fields.rs b/crates/rtf/src/doc/tests_fields.rs index ae1ab691f..4931356e8 100644 --- a/crates/rtf/src/doc/tests_fields.rs +++ b/crates/rtf/src/doc/tests_fields.rs @@ -206,3 +206,30 @@ fn a_result_whose_text_is_hidden_inside_it_stays_as_read() { // A result that is really empty is still a field. assert_eq!(f[1].1.len(), 1, "{f:?}"); } + +#[test] +fn hidden_page_symbols_and_nested_results_do_not_reappear_as_fields() { + for result in [r"{\v\chpgn}", r"{\field{\*\fldinst DATE}{\fldrslt {\v 2}}}"] { + let rtf = format!(r"{{\rtf1\ansi\pard x{{\field{{\*\fldinst PAGE}}{{\fldrslt {result}}}}}y\par}}"); + let d = import(rtf.as_bytes()).unwrap(); + let f = fields_of(&d.body); + assert_eq!(f[0], ("xy".into(), Vec::new()), "{result}: {f:?}"); + } + // A visible nested result remains eligible for conversion by its enclosing PAGE field. + let d = import(br"{\rtf1\ansi{\field{\*\fldinst PAGE}{\fldrslt {\field{\*\fldinst DATE}{\fldrslt 2}}}}\par}").unwrap(); + assert_eq!(fields_of(&d.body)[0].1, [("PAGE".into(), "2".into(), false)]); +} + +#[test] +fn empty_page_fields_keep_insertion_and_deletion_marks() { + for (mark, insertion) in [(r"\revised\revauth1", true), (r"\deleted\revauthdel1", false)] { + let rtf = format!(r"{{\rtf1\ansi{{\*\revtbl{{Unknown;}}{{Ann;}}}}\pard {{{mark}{{\field{{\*\fldinst PAGE}}{{\fldrslt }}}}}}\par}}"); + let d = import(rtf.as_bytes()).unwrap(); + let fields = fields_of(&d.body); + assert_eq!(fields[0].1, [("PAGE".into(), String::new(), false)]); + let p = d.body[0].as_para().unwrap(); + assert_eq!(p.text, "\u{FFFC}", "the sole character is the field marker"); + let props = p.props_at(0); + assert!(if insertion { props.ins.is_some() } else { props.del.is_some() }, "{mark}: {props:?}"); + } +} From 1139798521fa28a0b474ab9c5580edeaf72f822c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 18 Nov 2026 01:22:10 -0500 Subject: [PATCH 162/183] refactor(pkcs7): define certificate representations from one schema --- crates/pkcs7/src/x509.rs | 126 ++++++++++----------------------------- 1 file changed, 33 insertions(+), 93 deletions(-) diff --git a/crates/pkcs7/src/x509.rs b/crates/pkcs7/src/x509.rs index 5738e9c46..ae8c45fbb 100644 --- a/crates/pkcs7/src/x509.rs +++ b/crates/pkcs7/src/x509.rs @@ -106,9 +106,39 @@ impl Name { } } -/// A parsed certificate. -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct Certificate { +// One field schema keeps the parsed representation and consuming adapter in sync. +// Visibility belongs to Certificate; parts are explicitly unverified public data. +macro_rules! certificate_representations { + ($( $(#[$attr:meta])* $vis:vis $field:ident: $ty:ty, )*) => { + /// A parsed certificate. Signed material remains private until consumed. + /// + /// ```compile_fail + /// fn replace_signed_bytes(cert: &mut craft_pkcs7::x509::Certificate) { + /// cert.tbs.clear(); + /// } + /// ``` + #[derive(Clone, Debug, PartialEq, Eq)] + pub struct Certificate { + $( $(#[$attr])* $vis $field: $ty, )* + } + + /// Owned parsed components for adapters. This is not a signature or trust verdict. + /// Consuming conversion moves buffers without reparsing or cloning signed material. + pub struct CertificateParts { + $( $(#[$attr])* pub $field: $ty, )* + } + + impl Certificate { + /// Move parsed fields into a caller-owned representation; verification remains separate. + pub fn into_parts(self) -> CertificateParts { + let Self { $( $field, )* } = self; + CertificateParts { $( $field, )* } + } + } + }; +} + +certificate_representations! { /// The whole DER encoding. pub raw: Vec, tbs: Vec, @@ -144,96 +174,6 @@ pub struct Certificate { pub unknown_critical: Vec, } -/// Owned parsed components for adapters. This is not a signature or trust verdict. -/// Consuming conversion moves buffers without reparsing or cloning signed material. -pub struct CertificateParts { - /// The whole DER encoding. - pub raw: Vec, - pub tbs: Vec, - pub sig_alg: Vec, - pub signature: Vec, - pub serial: Vec, - pub issuer: Name, - pub subject: Name, - pub not_before: Time, - pub not_after: Time, - pub public_key: PublicKey, - /// Basic constraints: a CA certificate. - pub is_ca: bool, - /// Whether the certificate has a basicConstraints extension at all (old v1 roots don't). - pub has_basic_constraints: bool, - /// Basic constraints `pathLenConstraint`: how many CA certificates may follow this one - /// before the end-entity certificate. - pub path_len: Option, - /// Key usage bits (bit 0 = digitalSignature, 1 = nonRepudiation, 5 = keyCertSign), if present. - pub key_usage: Option, - pub subject_key_id: Option>, - /// Authority key identifier (2.5.29.35), when present. - pub authority_key_id: Option>, - /// Extended key usage OIDs (2.5.29.37), when present. - pub extended_key_usage: Option>, - /// OCSP responder URLs from the Authority Information Access (1.3.6.1.5.5.7.1.1). - pub ocsp_urls: Vec, - /// CRL distribution point URLs (2.5.29.31). - pub crl_urls: Vec, - /// The `version` field: 0 for v1, 1 for v2, 2 for v3. - pub version: u64, - /// OIDs of extensions marked critical that this crate does not process (RFC 5280 §4.2). - pub unknown_critical: Vec, -} - -impl Certificate { - /// Move parsed fields into a caller-owned representation; verification remains separate. - pub fn into_parts(self) -> CertificateParts { - let Self { - raw, - tbs, - sig_alg, - signature, - serial, - issuer, - subject, - not_before, - not_after, - public_key, - is_ca, - has_basic_constraints, - path_len, - key_usage, - subject_key_id, - authority_key_id, - extended_key_usage, - ocsp_urls, - crl_urls, - version, - unknown_critical, - } = self; - CertificateParts { - raw, - tbs, - sig_alg, - signature, - serial, - issuer, - subject, - not_before, - not_after, - public_key, - is_ca, - has_basic_constraints, - path_len, - key_usage, - subject_key_id, - authority_key_id, - extended_key_usage, - ocsp_urls, - crl_urls, - version, - unknown_critical, - } - } -} - /// Extensions this crate reads or may safely ignore when they are critical: the ones /// `Extensions::read` handles, subject/issuer alternative names, and certificate policies /// (accepted as any policy). From 2dc55f434142ce20e4b89c5986199849a65f6f8b Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Wed, 18 Nov 2026 13:35:40 +0700 Subject: [PATCH 163/183] test(texture): make preserved golden float type explicit (#2131) --- crates/texture/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/texture/src/lib.rs b/crates/texture/src/lib.rs index 54dffcb17..884488ac6 100644 --- a/crates/texture/src/lib.rs +++ b/crates/texture/src/lib.rs @@ -1124,7 +1124,7 @@ mod tests { let cases = [ (0.3, 0.7, [true, false], [1.473_799_7, -0.072_800_055, 0.645_000_2, 0.733_799_8]), (0.3, 0.7, [false, true], [1.473_799_7, -0.072_800_055, 0.645_000_2, 0.733_799_8]), - (1.2, -0.4, [true, false], [-1.722_999_5, 0.127_000_57, 0.089_999_32, 1.939_999_3]), + (1.2, -0.4, [true, false], [-1.722_999_5, 0.127_000_57, 0.089_999_32_f32, 1.939_999_3]), (1.2, -0.4, [false, true], [-1.057_000_3, -1.094, 0.756_000_1, 2.606_000_2]), (-0.15, 1.1, [true, false], [2.051, -1.76, 0.090_000_15, 1.311_000_1]), (-0.15, 1.1, [false, true], [-1.834_000_6, 0.015_999_317, 0.608_000_5, 2.458_000_7]), From 5ae0786c5bb1206d70c5d26cd3778253deed06b6 Mon Sep 17 00:00:00 2001 From: chasse20 Date: Wed, 18 Nov 2026 01:54:53 -0500 Subject: [PATCH 164/183] Publish MCMAT v3 as a bounded procedural source archive --- crates/mcmat/README.md | 21 +-- crates/mcmat/src/lib.rs | 283 ++++++++++++++++++---------------------- 2 files changed, 133 insertions(+), 171 deletions(-) diff --git a/crates/mcmat/README.md b/crates/mcmat/README.md index 074a0ac44..2f69e68c9 100644 --- a/crates/mcmat/README.md +++ b/crates/mcmat/README.md @@ -1,17 +1,10 @@ # craft-mcmat -A bounded reader and writer for portable MaterialCraft `.mcmat` ZIP packages. A package -contains `material.json`, named texture maps and a source package. Applications interpret -parameter values and cook or render maps themselves; this crate does not depend on an app's -model. It supports callers that read either version 1 or version 2 of the manifest, or both. +The MCMAT v3 portable material is a ZIP containing a version-only `material.json`, one +`source.sbs`, and the required source assets under `resources/`. The sole root-level +material graph in the SBS is the entry. Applications inspect its exposed controls and +cook its outputs through MaterialCraft. Texture maps and MaterialX documents are generated +by exporters. Earlier archives must be republished from their original projects. -`is_material` checks for a manifest with a bounded ZIP index; `Material::open` takes caller-provided version, entry-count, map-count, per-entry and total -expanded-byte limits. Each subsequent `read` and `read_source` shares that budget, including -repeated references to the same ZIP member. Duplicate member names are refused. The manifest -preserves unknown fields at the top level and on maps; parameter, input and preset objects are -kept as JSON values so their unknown fields survive too. `write` preserves the caller's source -entry name and map names, and rejects duplicate archive member names through `craft-zip`. - -The source package is opaque. Version 1 commonly names `source.mcraft`; MaterialCraft's version 2 -writer names `source.sbs`. Callers that invoke another application must preserve the source's -format and extension rather than infer it from `.mcmat` alone. +`Material::open` checks archive entries and expansion budgets before returning source +files. `write` compresses the XML and version marker and preserves source asset bytes. diff --git a/crates/mcmat/src/lib.rs b/crates/mcmat/src/lib.rs index 75b8709ef..076fe636a 100644 --- a/crates/mcmat/src/lib.rs +++ b/crates/mcmat/src/lib.rs @@ -1,133 +1,126 @@ #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] #![forbid(unsafe_code)] -//! Bounded interchange for MaterialCraft portable materials (`.mcmat`). -//! -//! The manifest and its version belong to the format, while interpreting parameter values, -//! cooking maps and opening the source package belong to the caller. Unknown fields survive -//! deserialization and serialization, including fields added by later versions. - -use std::collections::BTreeMap; +//! The clean-room MCMAT v3 source archive. Applications interpret the SBS entry graph. use craft_zip::{Archive, Compression, Writer}; -use serde::{Deserialize, Serialize}; -use serde_json::Value; +use serde::Deserialize; +use std::collections::{BTreeMap, BTreeSet}; -pub const FORMAT: &str = "craft-material"; +pub const VERSION: u32 = 3; pub const MANIFEST_ENTRY: &str = "material.json"; +pub const SOURCE_ENTRY: &str = "source.sbs"; +const MARKER: &[u8] = br#"{"version":3}"#; -/// A portable manifest; typed parameter values remain JSON so applications can adapt their own model. -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct Manifest { - pub format: String, - pub version: u32, - pub name: String, - pub graph: String, - pub size: [u32; 2], - pub maps: Vec, - #[serde(default)] - pub parameters: Vec, - #[serde(default)] - pub inputs: Vec, - #[serde(default)] - pub presets: Vec, - pub source: String, - #[serde(flatten)] - pub extra: BTreeMap, -} - -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct MapEntry { - pub usage: String, - pub file: String, - #[serde(flatten)] - pub extra: BTreeMap, -} - -/// All limits are supplied by the consumer, including the versions it understands. #[derive(Clone, Copy, Debug)] pub struct Limits { - pub min_version: u32, - pub max_version: u32, pub max_entries: u64, - pub max_maps: usize, pub max_manifest_bytes: u64, pub max_entry_bytes: u64, pub max_total_bytes: u64, } +impl Default for Limits { + fn default() -> Self { + Self { max_entries: 100_000, max_manifest_bytes: 64 << 20, max_entry_bytes: 256 << 20, max_total_bytes: 1 << 30 } + } +} + #[derive(Debug, thiserror::Error)] pub enum Error { #[error("invalid portable material: {0}")] Invalid(String), - #[error("unsupported portable material version {0}")] + #[error("unsupported .mcmat version {0} (expected 3). Republish from the original authoring project")] Version(u32), - #[error("portable material limit: {0}")] - Limit(String), #[error("portable material archive: {0}")] Archive(#[from] craft_zip::Error), } -/// Whether a bounded ZIP index contains a material manifest. This does not validate the manifest. +/// File sniffing also recognizes old manifests so the reader can give republishing guidance. pub fn is_material(bytes: &[u8], max_entries: u64) -> bool { - Archive::open(bytes, craft_zip::Limits { max_entries, max_total_bytes: 0 }) - .is_ok_and(|archive| !archive.has_duplicate_names() && archive.contains(MANIFEST_ENTRY)) + Archive::open(bytes, craft_zip::Limits { max_entries, max_total_bytes: 0 }).is_ok_and(|archive| archive.contains(MANIFEST_ENTRY)) } -/// Manifest and original archive, retaining one shared expanded-byte budget across reads. -pub struct Material<'a> { - pub manifest: Manifest, - archive: Archive<'a>, - max_entry_bytes: u64, +fn valid_resource(name: &str) -> bool { + name.len() <= 4096 + && name.starts_with("resources/") + && !name.contains(['\\', ':']) + && !name.chars().any(char::is_control) + && name.split('/').all(|part| !matches!(part, "" | "." | "..")) } -impl<'a> Material<'a> { - pub fn open(bytes: &'a [u8], limits: Limits) -> Result { +#[derive(Debug)] +pub struct Material { + pub source: Vec, + /// Keys are paths relative to source.sbs, including the resources/ prefix. + pub resources: BTreeMap>, +} + +impl Material { + pub fn open(bytes: &[u8], limits: Limits) -> Result { let mut archive = Archive::open(bytes, craft_zip::Limits { max_entries: limits.max_entries, max_total_bytes: limits.max_total_bytes })?; - if archive.has_duplicate_names() { - return Err(Error::Invalid("duplicate archive entries".into())); + if archive.has_duplicate_names() || archive.has_overlapping_files()? { + return Err(Error::Invalid("duplicate or overlapping archive entries".into())); } - let json = archive.read(MANIFEST_ENTRY, limits.max_manifest_bytes)?.ok_or_else(|| Error::Invalid("material.json is missing".into()))?; - let manifest: Manifest = serde_json::from_slice(&json).map_err(|e| Error::Invalid(format!("material.json: {e}")))?; - if manifest.format != FORMAT { - return Err(Error::Invalid(format!("format `{}`", manifest.format))); + let json = archive.read(MANIFEST_ENTRY, limits.max_manifest_bytes)?.ok_or_else(|| Error::Invalid("missing material.json".into()))?; + #[derive(Deserialize)] + struct Version { + version: u32, } - if !(limits.min_version..=limits.max_version).contains(&manifest.version) { - return Err(Error::Version(manifest.version)); + let marker: Version = serde_json::from_slice(&json).map_err(|err| Error::Invalid(format!("material.json: {err}")))?; + if marker.version != VERSION { + return Err(Error::Version(marker.version)); } - if manifest.maps.len() > limits.max_maps { - return Err(Error::Limit(format!("{} maps exceeds {}", manifest.maps.len(), limits.max_maps))); + #[derive(Deserialize)] + #[serde(deny_unknown_fields)] + struct Marker { + version: u32, } - Ok(Self { manifest, archive, max_entry_bytes: limits.max_entry_bytes }) - } - - /// Read one named member, charging it to the same budget as previous reads. - pub fn read(&mut self, name: &str) -> Result, Error> { - self.archive.read(name, self.max_entry_bytes)?.ok_or_else(|| Error::Invalid(format!("{name} is missing"))) - } - - pub fn read_source(&mut self) -> Result, Error> { - self.read(&self.manifest.source.clone()) + if !serde_json::from_slice::(&json).is_ok_and(|m| m.version == VERSION) { + return Err(Error::Invalid("material.json must contain only the version".into())); + } + let source = archive.read(SOURCE_ENTRY, limits.max_entry_bytes)?.ok_or_else(|| Error::Invalid("missing source.sbs".into()))?; + let mut resources = BTreeMap::new(); + let mut seen = BTreeSet::new(); + for index in 0..archive.len() { + let name = archive.entry_name(index)?.ok_or_else(|| Error::Invalid("invalid entry name".into()))?; + if name == SOURCE_ENTRY || name == MANIFEST_ENTRY { + continue; + } + if name.strip_suffix('/').is_some_and(|dir| dir == "resources" || valid_resource(dir)) { + continue; + } + if !valid_resource(&name) || !seen.insert(name.to_ascii_lowercase()) { + return Err(Error::Invalid(format!("invalid or ambiguous resource path `{name}`"))); + } + let data = archive.read(&name, limits.max_entry_bytes)?.ok_or_else(|| Error::Invalid(format!("missing `{name}`")))?; + resources.insert(name, data); + } + Ok(Self { source, resources }) } } -/// Write a manifest, its named maps, and the source. Duplicate member names are rejected. -pub fn write(manifest: &Manifest, maps: &[(String, Vec)], source: &[u8]) -> Result, Error> { - // Flattened fields must not serialize a second copy of a known key. - const KNOWN: &[&str] = &["format", "version", "name", "graph", "size", "maps", "parameters", "inputs", "presets", "source"]; - if manifest.extra.keys().any(|key| KNOWN.contains(&key.as_str())) - || manifest.maps.iter().any(|map| map.extra.contains_key("usage") || map.extra.contains_key("file")) - { - return Err(Error::Invalid("an extra field duplicates a known field".into())); - } - let json = serde_json::to_vec_pretty(manifest).map_err(|e| Error::Invalid(format!("material.json: {e}")))?; +/// Write one SBS document with its referenced source assets. +pub fn write<'a>(source: &[u8], resources: impl IntoIterator) -> Result, Error> { + let limits = Limits::default(); let mut writer = Writer::new(); - writer.add(MANIFEST_ENTRY, &json, Compression::Deflated)?; - for (name, bytes) in maps { - writer.add(name, bytes, Compression::Stored)?; + let mut seen = BTreeSet::new(); + let mut total = (source.len() as u64).saturating_add(MARKER.len() as u64); + if source.len() as u64 > limits.max_entry_bytes { + return Err(Error::Invalid("source.sbs exceeds the entry limit".into())); + } + writer.add(MANIFEST_ENTRY, MARKER, Compression::Deflated)?; + writer.add(SOURCE_ENTRY, source, Compression::Deflated)?; + for (name, bytes) in resources { + if !valid_resource(name) || !seen.insert(name.to_ascii_lowercase()) { + return Err(Error::Invalid(format!("invalid or ambiguous resource path `{name}`"))); + } + total = total.saturating_add(bytes.len() as u64); + if bytes.len() as u64 > limits.max_entry_bytes || total > limits.max_total_bytes || seen.len() as u64 + 2 > limits.max_entries { + return Err(Error::Invalid(format!("archive limits exceeded at `{name}`"))); + } + let compression = if name.ends_with(".svg") { Compression::Deflated } else { Compression::Stored }; + writer.add(name, bytes, compression)?; } - writer.add(&manifest.source, source, Compression::Stored)?; Ok(writer.finish()?) } @@ -135,82 +128,58 @@ pub fn write(manifest: &Manifest, maps: &[(String, Vec)], source: &[u8]) -> mod tests { use super::*; - fn limits() -> Limits { - Limits { - min_version: 1, - max_version: 2, - max_entries: 100, - max_maps: 4, - max_manifest_bytes: 4096, - max_entry_bytes: 100, - max_total_bytes: 8192, - } - } - - fn sample(version: u32) -> Manifest { - serde_json::from_value(serde_json::json!({ - "format": "craft-material", "version": version, "name": "Stone", "graph": "Stone", "size": [64, 64], - "maps": [{"usage": "baseColor", "file": "maps/base.png", "colorSpace": "srgb", "futureMap": true}], - "parameters": [{"id": "rough", "value": {"t": "float", "v": 0.25}, "futureParam": 42}], - "inputs": [{"identifier": "curvature", "kind": "gray"}], "presets": [], - "source": if version == 1 { "source.mcraft" } else { "source.sbs" }, "futureField": {"keep": true} - })) - .unwrap() - } - #[test] - fn both_protocol_versions_keep_unknown_fields_and_payloads() { - for version in [1, 2] { - let manifest = sample(version); - let bytes = write(&manifest, &[("maps/base.png".into(), vec![1, 2, 3])], b"source").unwrap(); - assert!(is_material(&bytes, 100)); - assert!(!is_material(&bytes, 1)); - let mut material = Material::open(&bytes, limits()).unwrap(); - assert_eq!(material.manifest, manifest); - assert_eq!(material.read("maps/base.png").unwrap(), [1, 2, 3]); - assert_eq!(material.read_source().unwrap(), b"source"); - let json = serde_json::to_value(&material.manifest).unwrap(); - assert_eq!(json["futureField"]["keep"], true); - assert_eq!(json["maps"][0]["futureMap"], true); - assert_eq!(json["parameters"][0]["futureParam"], 42); + fn procedural_source_and_assets_round_trip_under_one_budget() { + let bytes = write(b"", [("resources/oak.png", b"image".as_slice())]).unwrap(); + let pkg = Material::open(&bytes, Limits::default()).unwrap(); + assert_eq!(pkg.source, b""); + assert_eq!(pkg.resources["resources/oak.png"], b"image"); + let mut archive = Archive::open(&bytes, craft_zip::Limits { max_entries: 3, max_total_bytes: 128 }).unwrap(); + assert_eq!(archive.read(MANIFEST_ENTRY, 32).unwrap().unwrap(), MARKER); + assert_eq!(archive.is_stored(SOURCE_ENTRY), Some(false)); + assert_eq!(archive.is_stored("resources/oak.png"), Some(true)); + for limits in [ + Limits { max_entries: 2, ..Default::default() }, + Limits { max_entry_bytes: 2, ..Default::default() }, + Limits { max_total_bytes: 24, ..Default::default() }, + ] { + assert!(Material::open(&bytes, limits).is_err()); } } #[test] - fn limits_apply_to_the_manifest_maps_and_aggregate_reads() { - let manifest = sample(2); - let bytes = write(&manifest, &[("maps/base.png".into(), vec![1; 8])], &[2; 8]).unwrap(); - let mut unsupported = limits(); - unsupported.max_version = 1; - assert!(matches!(Material::open(&bytes, unsupported), Err(Error::Version(2)))); - let mut no_maps = limits(); - no_maps.max_maps = 0; - assert!(matches!(Material::open(&bytes, no_maps), Err(Error::Limit(_)))); - let mut tiny_entry = limits(); - tiny_entry.max_entry_bytes = 7; - assert!(Material::open(&bytes, tiny_entry).unwrap().read("maps/base.png").is_err()); - let json_len = serde_json::to_vec_pretty(&manifest).unwrap().len() as u64; - let mut aggregate = limits(); - aggregate.max_total_bytes = json_len + 15; - let mut material = Material::open(&bytes, aggregate).unwrap(); - assert_eq!(material.read("maps/base.png").unwrap().len(), 8); - assert!(material.read_source().is_err()); + fn rejects_previous_versions_before_requiring_the_v3_layout() { + for version in [0, 1, 2, 4] { + let mut zip = Writer::new(); + zip.add(MANIFEST_ENTRY, format!(r#"{{"format":"craft-material","version":{version}}}"#).as_bytes(), Compression::Deflated).unwrap(); + let bytes = zip.finish().unwrap(); + assert!(is_material(&bytes, 2)); + assert!(matches!(Material::open(&bytes, Limits::default()), Err(Error::Version(v)) if v == version)); + } } #[test] - fn refuses_extra_fields_that_duplicate_known_keys() { - let mut manifest = sample(2); - manifest.extra.insert("version".into(), 3.into()); - assert!(write(&manifest, &[], b"source").is_err()); - manifest.extra.remove("version"); - manifest.maps[0].extra.insert("file".into(), "other".into()); - assert!(write(&manifest, &[], b"source").is_err()); + fn v3_requires_source_and_a_version_only_marker() { + for (marker, source) in [(MARKER, None), (br#"{"version":3,"graph":"Other"}"#.as_slice(), Some(b"".as_slice()))] { + let mut zip = Writer::new(); + zip.add(MANIFEST_ENTRY, marker, Compression::Deflated).unwrap(); + if let Some(source) = source { + zip.add(SOURCE_ENTRY, source, Compression::Deflated).unwrap(); + } + assert!(Material::open(&zip.finish().unwrap(), Limits::default()).is_err()); + } } #[test] - fn refuses_duplicate_names_on_write() { - let manifest = sample(2); - let duplicate = [("maps/base.png".to_string(), vec![1]), ("maps/base.png".to_string(), vec![2])]; - assert!(write(&manifest, &duplicate, b"source").is_err()); + fn rejects_ambiguous_or_nonlocal_resource_members() { + for name in ["resources/../../x", "resources/a\\x", "/x", "maps/color.png", "resources/C:/x", "preview.png"] { + assert!(write(b"x", [(name, &b"x"[..])]).is_err()); + let mut zip = Writer::new(); + zip.add(MANIFEST_ENTRY, MARKER, Compression::Stored).unwrap(); + zip.add(SOURCE_ENTRY, b"x", Compression::Deflated).unwrap(); + zip.add(name, b"x", Compression::Stored).unwrap(); + assert!(Material::open(&zip.finish().unwrap(), Limits::default()).is_err()); + } + assert!(write(b"x", [("resources/A", &b"a"[..]), ("resources/a", &b"b"[..])]).is_err()); } } From 14176282fd02834652a34e81a34c19a393e8c9f4 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Wed, 18 Nov 2026 14:06:25 +0700 Subject: [PATCH 165/183] fix(dex): preserve decode completeness and fixture UTF-16 encoding (#2164) --- crates/dex/src/dex.rs | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/crates/dex/src/dex.rs b/crates/dex/src/dex.rs index 253af049c..528ec334e 100644 --- a/crates/dex/src/dex.rs +++ b/crates/dex/src/dex.rs @@ -745,6 +745,51 @@ mod tests { use super::*; use crate::test_support::android as fx; + #[test] + fn reference_queries_preserve_incomplete_decode_across_methods() { + for incomplete in [false, true] { + let mut builder = fx::DexBuilder::default(); + let class = builder.ty("LTest;"); + let first = builder.method("LTest;", "first", "V", &[]); + let second = builder.method("LTest;", "second", "V", &[]); + let mut first_code = vec![0x0071, second as u16, 0]; + if incomplete { + first_code.push(0x0071); // truncated invoke-static + } + let code = |insns| Some(fx::CodeSpec { insns, ..Default::default() }); + builder.classes.push(fx::ClassSpec { + class, + direct: vec![ + fx::MethodSpec { method: first, access: 0, code: code(first_code) }, + fx::MethodSpec { method: second, access: 0, code: code(vec![0x000e]) }, + ], + ..Default::default() + }); + let data = builder.build(); + let dex = parse(&data).unwrap(); + let (found, truncated) = references(&dex, "LTest;", Some("second"), 10); + assert_eq!(found.len(), 1); + assert_eq!(found[0].caller, "LTest;->first()V"); + assert_eq!(found[0].target, "LTest;->second()V"); + assert_eq!(truncated, incomplete); + let (absent, truncated) = references(&dex, "LAbsent;", None, 10); + assert!(absent.is_empty()); + assert_eq!(truncated, incomplete); + } + } + + #[test] + fn fixture_strings_round_trip_utf16_surrogate_pairs() { + let mut builder = fx::DexBuilder::default(); + let text = "A\0é😀"; + let index = builder.string(text); + let data = builder.build(); + let dex = parse(&data).unwrap(); + assert_eq!(dex.string(index), text); + let offset = Reader::new(&data).u32_le(0x70).unwrap() as usize; + assert_eq!(&data[offset..offset + 13], &[5, 0x41, 0xc0, 0x80, 0xc3, 0xa9, 0xed, 0xa0, 0xbd, 0xed, 0xb8, 0x80, 0]); + } + #[test] fn parses_fixture() { let data = fx::notes_dex(); From b3960accde1b540b2fe9364f8b6b848284564601 Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 18 Nov 2026 08:08:01 +0100 Subject: [PATCH 166/183] psd: reject invalid quilt bounds and discard unsupported templates --- crates/psd/src/smart.rs | 16 +++++++++++++++- crates/psd/src/smart/write.rs | 30 +++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/crates/psd/src/smart.rs b/crates/psd/src/smart.rs index efa3cee2e..9a95c61f3 100644 --- a/crates/psd/src/smart.rs +++ b/crates/psd/src/smart.rs @@ -134,8 +134,11 @@ impl Warp { let rows = quilt_patches(&slice_y)?; if !slice_x.is_empty() || !slice_y.is_empty() { // The evaluator normalizes over bounds, not stored slice coordinates. - // Infer a missing rectangle only when both explicit axes define it. + // Infer an absent rectangle only when both explicit axes define it. if !(w.bounds[2] > w.bounds[0] && w.bounds[3] > w.bounds[1]) { + if d.get("bounds").is_some() { + return Err(PsdError::Unsupported("invalid explicit quilt bounds".into())); + } let (Some(&left), Some(&right), Some(&top), Some(&bottom)) = (slice_x.first(), slice_x.last(), slice_y.first(), slice_y.last()) else { return Err(PsdError::Unsupported("quilt divisions need bounds or both axes".into())); @@ -1074,6 +1077,17 @@ mod tests { .with("Rght", Value::Double(40.0)) .with("Btom", Value::Double(10.0)); assert!(Warp::try_from_descriptor(&equal.with("bounds", Value::Descriptor(bounds))).is_err()); + let wrong_type = quilt_descriptor(vec![0.0, 10.0, 20.0], vec![0.0, 10.0]).with("bounds", Value::Integer(1)); + assert!(Warp::try_from_descriptor(&wrong_type).is_err()); + let invalid_bounds = Descriptor::new("bounds") + .with("Left", Value::Double(0.0)) + .with("Top ", Value::Double(0.0)) + .with("Rght", Value::Double(40.0)) + .with("Btom", Value::Double(0.0)); + let explicit_invalid = quilt_descriptor(vec![0.0, 10.0, 20.0], vec![0.0, 10.0]).with("bounds", Value::Descriptor(invalid_bounds)); + assert!(Warp::try_from_descriptor(&explicit_invalid).is_err()); + let data = placed_layer_data("invalid bounds", [0.0; 8], |d| d.with("quiltWarp", Value::Descriptor(explicit_invalid))); + assert!(matches!(SmartObject::from_placed_layer_data(&data), Err(PsdError::Unsupported(_)))); let missing = quilt_descriptor(vec![0.0, 10.0, 20.0], vec![]); assert!(Warp::try_from_descriptor(&missing).is_err()); } diff --git a/crates/psd/src/smart/write.rs b/crates/psd/src/smart/write.rs index d409d726c..413b0f406 100644 --- a/crates/psd/src/smart/write.rs +++ b/crates/psd/src/smart/write.rs @@ -180,7 +180,8 @@ impl SmartObject { } set(&mut d, "warp", Value::Descriptor(warp.to_descriptor())); // The imported `quiltWarp` stays while it still says what the warp is. - let kept = t.get_object("quiltWarp").is_some_and(|q| Warp::from_descriptor(q).as_ref() == self.warp.as_ref()); + let kept = + t.get_object("quiltWarp").is_some_and(|q| Warp::try_from_descriptor(q).is_ok_and(|parsed| parsed.as_ref() == self.warp.as_ref())); if !kept { match quilt { Some(q) => set_before(&mut d, "quiltWarp", Value::Descriptor(q), "warp"), @@ -289,6 +290,33 @@ mod tests { ] } + #[test] + fn templates_drop_unsupported_quilts_but_retain_valid_none() { + let bounds = [0.0, 0.0, 20.0, 10.0]; + let unfl = |values| Value::UnitFloats { unit: *b"#Pxl", values }; + let unequal = + Descriptor::new("warp").with("warpStyle", Value::Enumerated { type_id: Id::new("warpStyle"), value: Id::new("warpCustom") }).with( + "customEnvelopeWarp", + Value::Descriptor( + Descriptor::new("customEnvelopeWarp").with("quiltSliceX", unfl(vec![0.0, 5.0, 20.0])).with("quiltSliceY", unfl(vec![0.0, 10.0])), + ), + ); + assert!(Warp::try_from_descriptor(&unequal).is_err()); + let valid_none = Warp::none(bounds).to_descriptor(); + assert!(matches!(Warp::try_from_descriptor(&valid_none), Ok(None))); + for (quilt, keep) in [(unequal, false), (valid_none, true)] { + let template = Descriptor::new("null").with("quiltWarp", Value::Descriptor(quilt.clone())); + let bytes = placed(None).to_placed_layer_data(&PlacedLayerOptions { + placed: "layer", + resolution: 72.0, + filter_fx: None, + template: Some(&template), + }); + let written = VersionedDescriptor::parse_prefix(&bytes[8..]).unwrap().0.descriptor; + assert_eq!(written.get_object("quiltWarp"), keep.then_some(&quilt)); + assert!(SmartObject::from_placed_layer_data(&bytes).unwrap().warp.is_none()); + } + } #[test] fn placed_layer_data_reads_back_and_passes_the_strict_check() { let filter = Descriptor::new("filterFX") From b0f25d641840bea1dda99c1e5e0c8db9221bcf28 Mon Sep 17 00:00:00 2001 From: chasse20 Date: Wed, 18 Nov 2026 02:15:10 -0500 Subject: [PATCH 167/183] Compress raw MCMAT source assets --- crates/mcmat/src/lib.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/mcmat/src/lib.rs b/crates/mcmat/src/lib.rs index 076fe636a..fe328cceb 100644 --- a/crates/mcmat/src/lib.rs +++ b/crates/mcmat/src/lib.rs @@ -118,7 +118,11 @@ pub fn write<'a>(source: &[u8], resources: impl IntoIterator limits.max_entry_bytes || total > limits.max_total_bytes || seen.len() as u64 + 2 > limits.max_entries { return Err(Error::Invalid(format!("archive limits exceeded at `{name}`"))); } - let compression = if name.ends_with(".svg") { Compression::Deflated } else { Compression::Stored }; + let extension = name.rsplit_once('.').map(|(_, ext)| ext.to_ascii_lowercase()); + let compression = match extension.as_deref() { + Some("png" | "jpg" | "jpeg" | "webp" | "gif" | "exr" | "woff" | "woff2") => Compression::Stored, + _ => Compression::Deflated, + }; writer.add(name, bytes, compression)?; } Ok(writer.finish()?) @@ -147,6 +151,14 @@ mod tests { } } + #[test] + fn compresses_unencoded_source_assets() { + let bytes = write(b"", [("resources/shape.svg", b"".as_slice()), ("resources/font.ttf", b"font".as_slice())]).unwrap(); + let mut archive = Archive::open(&bytes, craft_zip::Limits { max_entries: 4, max_total_bytes: 128 }).unwrap(); + assert_eq!(archive.is_stored("resources/shape.svg"), Some(false)); + assert_eq!(archive.is_stored("resources/font.ttf"), Some(false)); + } + #[test] fn rejects_previous_versions_before_requiring_the_v3_layout() { for version in [0, 1, 2, 4] { From c03ba68ab363bcf337a5f2c9548ead0b941b427f Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Wed, 18 Nov 2026 14:36:07 +0700 Subject: [PATCH 168/183] fix(xfa): reject repeated leading BOM before parsing spans (#2176) --- crates/xfa/src/xml.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/xfa/src/xml.rs b/crates/xfa/src/xml.rs index 7afab7600..7d6dd8193 100644 --- a/crates/xfa/src/xml.rs +++ b/crates/xfa/src/xml.rs @@ -194,6 +194,10 @@ impl Document { // quick-xml excludes a leading UTF-8 BOM from its buffer positions. // Parse it explicitly so every stored range still addresses the original input. let input = text.strip_prefix('\u{feff}').unwrap_or(text); + // A second U+FEFF is content outside the root, not another encoding marker. + if input.starts_with('\u{feff}') { + return Err("multiple leading XML byte-order marks".to_string()); + } let source_offset = text.len() - input.len(); let mut events = opts.events(input.as_bytes()); let mut nodes: Vec = Vec::new(); @@ -435,6 +439,15 @@ mod tests { } } + #[test] + fn repeated_leading_bom_is_rejected_before_event_parsing() { + for prefix in ["\u{feff}\u{feff}", "\u{feff}\u{feff}\u{feff}"] { + for body in ["<é/>", "<é>text"] { + assert!(Document::parse(&format!("{prefix}{body}")).is_err()); + } + } + } + #[test] fn inherited_namespace_copies_obey_aggregate_byte_admission() { let uri = format!("urn:{}", "x".repeat(124)); From be556bedcbc3fcd63d3146fd7fcec9bc488fc7ae Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 18 Nov 2026 08:43:10 +0100 Subject: [PATCH 169/183] psd: align quilt serialization and strict slice admission --- crates/psd/src/smart.rs | 77 ++++++++++++++++++++++++++++------- crates/psd/src/smart/write.rs | 71 ++++++++++++++++++++++++++++---- 2 files changed, 126 insertions(+), 22 deletions(-) diff --git a/crates/psd/src/smart.rs b/crates/psd/src/smart.rs index 9a95c61f3..7ed444f45 100644 --- a/crates/psd/src/smart.rs +++ b/crates/psd/src/smart.rs @@ -74,11 +74,17 @@ fn quad_from(t: [f64; 8]) -> [[f64; 2]; 4] { /// The patch boundaries of a custom envelope: a list of numbers, or (as Photoshop writes a /// `quiltWarp`) an object array whose body holds them under the same key. -fn quilt_slices(env: &Descriptor, key: &str) -> Vec { - match env.get(key) { - Some(Value::ObjectArray(o)) => o.body.get_numbers(key), - _ => env.get_numbers(key), - } +fn quilt_slices(env: &Descriptor, key: &str) -> Result> { + let Some(value) = env.get(key) else { return Ok(vec![]) }; + // Filtering nonnumbers would change the number and positions of patches. + // Only absence, not a malformed or empty present value, means one patch. + let value = if let Value::ObjectArray(o) = value { o.body.get(key) } else { Some(value) }; + let values = match value { + Some(Value::UnitFloats { values, .. }) => Some(values.clone()), + Some(Value::List(values)) => values.iter().map(Value::as_number).collect::>>(), + _ => None, + }; + values.filter(|values| !values.is_empty()).ok_or_else(|| PsdError::Unsupported("invalid quilt slice values".into())) } /// The public mesh has no slice coordinates, so only uniform divisions can be @@ -90,18 +96,23 @@ fn quilt_patches(slices: &[f64]) -> Result { if slices.len() < 2 || slices.iter().any(|v| !v.is_finite()) { return Err(PsdError::Unsupported("invalid quilt divisions".into())); } - let step = slices[1] - slices[0]; - if !step.is_finite() || step <= 0.0 { + let patches = slices.len() - 1; + let extent = slices[patches] - slices[0]; + if !extent.is_finite() || extent <= 0.0 { return Err(PsdError::Unsupported("invalid quilt divisions".into())); } - let tolerance = step.abs() * 1e-9; - if slices.windows(2).any(|pair| { - let width = pair[1] - pair[0]; - !width.is_finite() || width <= 0.0 || (width - step).abs() > tolerance - }) { + // Compare against the same endpoint interpolation the writer uses. At large + // coordinate offsets a uniform grid can have differently rounded adjacent widths. + let tolerance = (extent / patches as f64) * 1e-9; + if slices.windows(2).any(|pair| pair[1] <= pair[0]) + || slices.iter().enumerate().any(|(i, value)| { + let expected = slices[0] + extent * (i as f64 / patches as f64); + (value - expected).abs() > tolerance + }) + { return Err(PsdError::Unsupported("unequal quilt divisions".into())); } - Ok(slices.len() - 1) + Ok(patches) } impl Warp { /// Reads a `warp` descriptor; `None` for no warp (the identity, or a custom warp without a @@ -128,8 +139,8 @@ impl Warp { style, }; if let Some(env) = d.get_object("customEnvelopeWarp") { - let slice_x = quilt_slices(env, "quiltSliceX"); - let slice_y = quilt_slices(env, "quiltSliceY"); + let slice_x = quilt_slices(env, "quiltSliceX")?; + let slice_y = quilt_slices(env, "quiltSliceY")?; let cols = quilt_patches(&slice_x)?; let rows = quilt_patches(&slice_y)?; if !slice_x.is_empty() || !slice_y.is_empty() { @@ -1065,8 +1076,44 @@ mod tests { } assert_eq!(quilt_patches(&[]).unwrap(), 1); assert_eq!(quilt_patches(&[0.0, 10.0, 20.0]).unwrap(), 2); + assert_eq!(quilt_patches(&[1e16, 1e16 + 2.0, 1e16 + 6.0, 1e16 + 8.0]).unwrap(), 3); + assert!(quilt_patches(&[1e16, 1e16 + 4.0, 1e16 + 6.0, 1e16 + 8.0]).is_err()); } + #[test] + fn quilt_slice_values_are_strict_in_lists_and_object_arrays() { + let list = Value::List(vec![Value::Integer(0), Value::Double(10.0), Value::UnitFloat { unit: *b"#Pxl", value: 20.0 }]); + let unfl = Value::UnitFloats { unit: *b"#Pxl", values: vec![0.0, 10.0, 20.0] }; + let bad_list = Value::List(vec![Value::Double(0.0), Value::Text(UnicodeString::new("bad")), Value::Double(10.0), Value::Double(20.0)]); + for wrapped in [false, true] { + for (value, valid) in [ + (list.clone(), true), + (unfl.clone(), true), + (bad_list.clone(), false), + (Value::List(vec![]), false), + (Value::UnitFloats { unit: *b"#Pxl", values: vec![] }, false), + (Value::Integer(1), false), + ] { + let value = if wrapped { + Value::ObjectArray(ObjectArray { prefix: 3, body: Descriptor::new("UntF").with("quiltSliceX", value) }) + } else { + value + }; + let mut d = quilt_descriptor(vec![0.0, 10.0, 20.0], vec![0.0, 10.0]); + let Value::Descriptor(env) = &mut d.items.iter_mut().find(|(key, _)| key.is("customEnvelopeWarp")).unwrap().1 else { + panic!("envelope") + }; + env.items.iter_mut().find(|(key, _)| key.is("quiltSliceX")).unwrap().1 = value; + assert_eq!(Warp::try_from_descriptor(&d).is_ok(), valid); + let bytes = placed_layer_data("slices", [0.0; 8], |parent| parent.with("quiltWarp", Value::Descriptor(d))); + assert_eq!(SmartObject::from_placed_layer_data(&bytes).is_ok(), valid); + } + } + let absent = Descriptor::new("customEnvelopeWarp"); + assert!(quilt_slices(&absent, "quiltSliceX").unwrap().is_empty()); + let missing_body = absent.with("quiltSliceX", Value::ObjectArray(ObjectArray { prefix: 0, body: Descriptor::new("UntF") })); + assert!(quilt_slices(&missing_body, "quiltSliceX").is_err()); + } #[test] fn quilt_endpoints_define_or_match_the_normalization_bounds() { let equal = quilt_descriptor(vec![0.0, 10.0, 20.0], vec![0.0, 10.0]); diff --git a/crates/psd/src/smart/write.rs b/crates/psd/src/smart/write.rs index 413b0f406..0c9eb4588 100644 --- a/crates/psd/src/smart/write.rs +++ b/crates/psd/src/smart/write.rs @@ -78,7 +78,10 @@ impl Warp { /// Style, bend, distortions, axis, bounds and order: the keys a `warp` and a `quiltWarp` /// share, in Photoshop's order. fn head(&self, class: &str) -> Descriptor { - let [l, t, r, b] = self.bounds; + self.head_with_bounds(class, self.bounds) + } + + fn head_with_bounds(&self, class: &str, [l, t, r, b]: [f64; 4]) -> Descriptor { let bounds = Descriptor::new("classFloatRect") .with("Top ", Value::Double(t)) .with("Left", Value::Double(l)) @@ -119,15 +122,20 @@ impl Warp { /// The `quiltWarp` descriptor of a split warp, in Photoshop's layout: the control points, /// `deformNumCols` × `deformNumRows` of them, and the patch boundaries (`quiltSliceX` / - /// `quiltSliceY`) evenly across the warp's bounds. `None` for any other warp. + /// `quiltSliceY`) evenly across the warp's bounds. Invalid axes use 0..1 because this standalone + /// method has no content size; the placed-layer writer supplies that size when available. + /// `None` for any other warp. pub fn quilt_descriptor(&self) -> Option { if !self.is_split() { return None; } - let [l, t, r, b] = self.bounds; + // The header and the divisions must describe the same rectangle, including + // when a caller leaves bounds at their default or supplies an invalid axis. + let axis = |lo: f64, hi: f64| if (hi - lo).is_finite() && hi > lo { (lo, hi) } else { (0.0, 1.0) }; + let (l, r) = axis(self.bounds[0], self.bounds[2]); + let (t, b) = axis(self.bounds[1], self.bounds[3]); let slices = |key: &str, n: usize, lo: f64, hi: f64| { - let (lo, hi) = if (hi - lo).is_finite() && hi > lo { (lo, hi) } else { (0.0, 1.0) }; - let values: Vec = (0..=n).map(|i| lo + (hi - lo) * i as f64 / n as f64).collect(); + let values: Vec = (0..=n).map(|i| lo + (hi - lo) * (i as f64 / n as f64)).collect(); let prefix = values.len() as u32; Value::ObjectArray(ObjectArray { prefix, body: Descriptor::new("UntF").with(key, Value::UnitFloats { unit: *b"#Pxl", values }) }) }; @@ -137,7 +145,7 @@ impl Warp { .with("meshPoints", self.mesh_points()); let count = |n: usize| Value::Integer(i32::try_from(n.saturating_mul(3).saturating_add(1)).unwrap_or(i32::MAX)); Some( - self.head("quiltWarp") + self.head_with_bounds("quiltWarp", [l, t, r, b]) .with("deformNumRows", count(self.rows)) .with("deformNumCols", count(self.cols)) .with("customEnvelopeWarp", Value::Descriptor(envelope)), @@ -159,7 +167,13 @@ impl SmartObject { /// The warp written, over the content (or `[0, 0, 0, 0]` without a size) when there is none. fn warp_or_none(&self) -> Warp { let [w, h] = self.size.unwrap_or([0.0; 2]); - self.warp.clone().unwrap_or_else(|| Warp::none([0.0, 0.0, w, h])) + let mut warp = self.warp.clone().unwrap_or_else(|| Warp::none([0.0, 0.0, w, h])); + // Match Warp::apply's whole-rectangle fallback before encoding explicit + // quilt slices. Otherwise default bounds would change the mapping on readback. + if warp.is_split() && !(warp.bounds[2] > warp.bounds[0] && warp.bounds[3] > warp.bounds[1]) { + warp.bounds = [0.0, 0.0, w, h]; + } + warp } /// The data of a `SoLd` block (`soLD`, version 4, a version-16 descriptor, padded to 4). @@ -290,6 +304,49 @@ mod tests { ] } + #[test] + fn quilt_writer_uses_one_rectangle_for_header_slices_and_roundtrip() { + for (bounds, expected) in [ + ([0.0; 4], [0.0, 0.0, 1.0, 1.0]), + ([2.0, 3.0, 22.0, 13.0], [2.0, 3.0, 22.0, 13.0]), + ([2.0, 3.0, 22.0, 3.0], [2.0, 0.0, 22.0, 1.0]), + ([f64::NAN, 3.0, 22.0, 13.0], [0.0, 3.0, 1.0, 13.0]), + ([-f64::MAX, 0.0, f64::MAX, 1.0], [0.0, 0.0, 1.0, 1.0]), + ([0.0, 0.0, 1e308, 10.0], [0.0, 0.0, 1e308, 10.0]), + ] { + let warp = Warp { style: "warpCustom".into(), bounds, cols: 2, rows: 1, mesh: grid(2, 1, 20.0, 10.0), ..Warp::default() }; + let descriptor = warp.quilt_descriptor().unwrap(); + let back = Warp::try_from_descriptor(&descriptor).unwrap().unwrap(); + assert_eq!(back.bounds, expected); + assert_eq!((back.cols, back.rows, &back.mesh), (2, 1, &warp.mesh)); + assert_eq!(back.quilt_descriptor().unwrap(), descriptor); + } + let high_offset = Warp { + style: "warpCustom".into(), + bounds: [1e16, 0.0, 1e16 + 8.0, 10.0], + cols: 3, + rows: 1, + mesh: grid(3, 1, 20.0, 10.0), + ..Warp::default() + }; + assert_eq!(Warp::try_from_descriptor(&high_offset.quilt_descriptor().unwrap()).unwrap(), Some(high_offset)); + // At the placed-layer boundary content size is available: preserve the + // evaluator's fallback mapping, not merely the ability to parse the output. + for bounds in [[0.0; 4], [2.0, 3.0, 22.0, 3.0], [f64::NAN, 0.0, 20.0, 10.0]] { + let warp = Warp { style: "warpCustom".into(), bounds, cols: 2, rows: 1, mesh: grid(2, 1, 20.0, 10.0), ..Warp::default() }; + let so = SmartObject { size: Some([20.0, 10.0]), ..placed(Some(warp.clone())) }; + let bytes = so.to_placed_layer_data(&PlacedLayerOptions::default()); + let back = SmartObject::from_placed_layer_data(&bytes).unwrap(); + let parsed = back.warp.as_ref().unwrap(); + assert_eq!(parsed.bounds, [0.0, 0.0, 20.0, 10.0]); + for p in [[0.0, 0.0], [5.0, 4.0], [10.0, 5.0], [20.0, 10.0]] { + assert_eq!(parsed.apply(p, 20.0, 10.0), warp.apply(p, 20.0, 10.0)); + } + let template = VersionedDescriptor::parse_prefix(&bytes[8..]).unwrap().0.descriptor; + let rewritten = back.to_placed_layer_data(&PlacedLayerOptions { template: Some(&template), ..Default::default() }); + assert_eq!(SmartObject::from_placed_layer_data(&rewritten).unwrap(), back); + } + } #[test] fn templates_drop_unsupported_quilts_but_retain_valid_none() { let bounds = [0.0, 0.0, 20.0, 10.0]; From e9ec4813311264ee1857079c2edd10a70e2389a6 Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 18 Nov 2026 09:11:45 +0100 Subject: [PATCH 170/183] psd: preserve canonical quilt grids across numeric extremes --- crates/psd/src/smart.rs | 54 +++++++++++++++++++++++++++++------ crates/psd/src/smart/write.rs | 53 ++++++++++++++++++++++++++++++---- 2 files changed, 94 insertions(+), 13 deletions(-) diff --git a/crates/psd/src/smart.rs b/crates/psd/src/smart.rs index 7ed444f45..0cd5ac433 100644 --- a/crates/psd/src/smart.rs +++ b/crates/psd/src/smart.rs @@ -67,6 +67,10 @@ fn finite(value: f64) -> f64 { if value.is_finite() { value } else { 0.0 } } +/// A usable normalization rectangle needs finite positive extents on both axes. +fn valid_bounds([l, t, r, b]: [f64; 4]) -> bool { + [l, t, r, b].iter().all(|v| v.is_finite()) && (r - l).is_finite() && r > l && (b - t).is_finite() && b > t +} /// The corner quad (top-left, top-right, bottom-right, bottom-left) from x0 y0 … x3 y3. fn quad_from(t: [f64; 8]) -> [[f64; 2]; 4] { [[t[0], t[1]], [t[2], t[3]], [t[4], t[5]], [t[6], t[7]]] @@ -102,12 +106,14 @@ fn quilt_patches(slices: &[f64]) -> Result { return Err(PsdError::Unsupported("invalid quilt divisions".into())); } // Compare against the same endpoint interpolation the writer uses. At large - // coordinate offsets a uniform grid can have differently rounded adjacent widths. + // coordinate offsets a uniform grid can have differently rounded adjacent widths, + // including coincident boundaries. Only canonical rounded positions are accepted; + // the model keeps the patch count and evaluates in its uniform parameter domain. let tolerance = (extent / patches as f64) * 1e-9; - if slices.windows(2).any(|pair| pair[1] <= pair[0]) - || slices.iter().enumerate().any(|(i, value)| { + if slices.windows(2).any(|pair| pair[1] < pair[0]) + || slices.iter().enumerate().take(patches).skip(1).any(|(i, value)| { let expected = slices[0] + extent * (i as f64 / patches as f64); - (value - expected).abs() > tolerance + !expected.is_finite() || (value - expected).abs() > tolerance }) { return Err(PsdError::Unsupported("unequal quilt divisions".into())); @@ -122,7 +128,10 @@ impl Warp { } /// Reads a warp, rejecting unequal or invalid quilt divisions rather than - /// interpreting them as equal-sized patches. Nonfinite geometry becomes zero. + /// interpreting them as equal-sized patches. Canonical uniform boundaries may coincide + /// after floating-point rounding; their patch count is retained. This is the internal + /// uniform-model contract, not a guarantee of other readers' handling of coincident slices. + /// Nonfinite geometry becomes zero. pub fn try_from_descriptor(d: &Descriptor) -> Result> { let style = d.get_enum("warpStyle").unwrap_or_else(|| "warpNone".to_string()); let side = |b: &Descriptor, k: &str| finite(b.get_number(k).unwrap_or(0.0)); @@ -146,7 +155,7 @@ impl Warp { if !slice_x.is_empty() || !slice_y.is_empty() { // The evaluator normalizes over bounds, not stored slice coordinates. // Infer an absent rectangle only when both explicit axes define it. - if !(w.bounds[2] > w.bounds[0] && w.bounds[3] > w.bounds[1]) { + if !valid_bounds(w.bounds) { if d.get("bounds").is_some() { return Err(PsdError::Unsupported("invalid explicit quilt bounds".into())); } @@ -155,6 +164,9 @@ impl Warp { return Err(PsdError::Unsupported("quilt divisions need bounds or both axes".into())); }; w.bounds = [left, top, right, bottom]; + if !valid_bounds(w.bounds) { + return Err(PsdError::Unsupported("invalid inferred quilt bounds".into())); + } } for (slices, start, end) in [(&slice_x, w.bounds[0], w.bounds[2]), (&slice_y, w.bounds[1], w.bounds[3])] { if let (Some(&first), Some(&last)) = (slices.first(), slices.last()) { @@ -187,7 +199,7 @@ impl Warp { /// The warp of a content point (content pixels → content pixels). pub fn apply(&self, p: [f64; 2], w: f64, h: f64) -> [f64; 2] { - let [l, t, r, b] = if self.bounds[2] > self.bounds[0] && self.bounds[3] > self.bounds[1] { self.bounds } else { [0.0, 0.0, w, h] }; + let [l, t, r, b] = if valid_bounds(self.bounds) { self.bounds } else { [0.0, 0.0, w, h] }; let (bw, bh) = (r - l, b - t); let (u, v) = ((p[0] - l) / bw, (p[1] - t) / bh); if self.style == "warpCustom" { @@ -1078,6 +1090,14 @@ mod tests { assert_eq!(quilt_patches(&[0.0, 10.0, 20.0]).unwrap(), 2); assert_eq!(quilt_patches(&[1e16, 1e16 + 2.0, 1e16 + 6.0, 1e16 + 8.0]).unwrap(), 3); assert!(quilt_patches(&[1e16, 1e16 + 4.0, 1e16 + 6.0, 1e16 + 8.0]).is_err()); + let lo = 3.0 * 2.0_f64.powi(970); + assert!((f64::MAX - lo).is_finite()); + assert!((lo + (f64::MAX - lo)).is_infinite()); + assert_eq!(quilt_patches(&[lo, f64::MAX]).unwrap(), 1); + assert_eq!(quilt_patches(&[1e16, 1e16, 1e16, 1e16 + 2.0, 1e16 + 2.0]).unwrap(), 4); + for invalid in [vec![0.0, 0.0, 20.0], vec![0.0, 10.0, 10.0, 20.0], vec![1e16, 1e16 + 2.0, 1e16, 1e16 + 2.0]] { + assert!(quilt_patches(&invalid).is_err()); + } } #[test] @@ -1135,8 +1155,26 @@ mod tests { assert!(Warp::try_from_descriptor(&explicit_invalid).is_err()); let data = placed_layer_data("invalid bounds", [0.0; 8], |d| d.with("quiltWarp", Value::Descriptor(explicit_invalid))); assert!(matches!(SmartObject::from_placed_layer_data(&data), Err(PsdError::Unsupported(_)))); - let missing = quilt_descriptor(vec![0.0, 10.0, 20.0], vec![]); + let mut missing = quilt_descriptor(vec![0.0, 10.0, 20.0], vec![0.0, 10.0]); + let Value::Descriptor(env) = &mut missing.items.iter_mut().find(|(key, _)| key.is("customEnvelopeWarp")).unwrap().1 else { + panic!("envelope") + }; + env.items.retain(|(key, _)| !key.is("quiltSliceY")); assert!(Warp::try_from_descriptor(&missing).is_err()); + let bounds = |top, bottom| { + Descriptor::new("bounds") + .with("Left", Value::Double(0.0)) + .with("Top ", Value::Double(top)) + .with("Rght", Value::Double(20.0)) + .with("Btom", Value::Double(bottom)) + }; + let present = missing.clone().with("bounds", Value::Descriptor(bounds(0.0, 10.0))); + let parsed = Warp::try_from_descriptor(&present).unwrap().unwrap(); + assert_eq!((parsed.cols, parsed.rows), (2, 1)); + assert_eq!(parsed.bounds, [0.0, 0.0, 20.0, 10.0]); + // Even the absent slice axis needs a finite normalization extent. + let overflow = missing.with("bounds", Value::Descriptor(bounds(-f64::MAX, f64::MAX))); + assert!(Warp::try_from_descriptor(&overflow).is_err()); } #[test] fn finite_warp_views_preserve_raw_descriptor_values() { diff --git a/crates/psd/src/smart/write.rs b/crates/psd/src/smart/write.rs index 0c9eb4588..f1edf82df 100644 --- a/crates/psd/src/smart/write.rs +++ b/crates/psd/src/smart/write.rs @@ -3,7 +3,7 @@ //! read back. Came from PhotoCraft's `crates/io/src/smart_map/placed.rs`, on this crate's //! placement types: the caller works out the quad and the warp from its own geometry. -use super::{SmartObject, Warp}; +use super::{SmartObject, Warp, valid_bounds}; use crate::descriptor::{Descriptor, Id, ObjectArray, UnicodeString, Value, VersionedDescriptor}; use crate::io::WriteExt; @@ -124,7 +124,9 @@ impl Warp { /// `deformNumCols` × `deformNumRows` of them, and the patch boundaries (`quiltSliceX` / /// `quiltSliceY`) evenly across the warp's bounds. Invalid axes use 0..1 because this standalone /// method has no content size; the placed-layer writer supplies that size when available. - /// `None` for any other warp. + /// Canonical boundaries may coincide after rounding at large offsets. The shared reader + /// preserves their uniform-model parameterization; external reader interoperability for + /// coincident slices is not guaranteed. `None` for any other warp. pub fn quilt_descriptor(&self) -> Option { if !self.is_split() { return None; @@ -135,7 +137,17 @@ impl Warp { let (l, r) = axis(self.bounds[0], self.bounds[2]); let (t, b) = axis(self.bounds[1], self.bounds[3]); let slices = |key: &str, n: usize, lo: f64, hi: f64| { - let values: Vec = (0..=n).map(|i| lo + (hi - lo) * (i as f64 / n as f64)).collect(); + let values: Vec = (0..=n) + .map(|i| { + if i == 0 { + lo + } else if i == n { + hi + } else { + lo + (hi - lo) * (i as f64 / n as f64) + } + }) + .collect(); let prefix = values.len() as u32; Value::ObjectArray(ObjectArray { prefix, body: Descriptor::new("UntF").with(key, Value::UnitFloats { unit: *b"#Pxl", values }) }) }; @@ -170,7 +182,7 @@ impl SmartObject { let mut warp = self.warp.clone().unwrap_or_else(|| Warp::none([0.0, 0.0, w, h])); // Match Warp::apply's whole-rectangle fallback before encoding explicit // quilt slices. Otherwise default bounds would change the mapping on readback. - if warp.is_split() && !(warp.bounds[2] > warp.bounds[0] && warp.bounds[3] > warp.bounds[1]) { + if warp.is_split() && !valid_bounds(warp.bounds) { warp.bounds = [0.0, 0.0, w, h]; } warp @@ -313,6 +325,7 @@ mod tests { ([f64::NAN, 3.0, 22.0, 13.0], [0.0, 3.0, 1.0, 13.0]), ([-f64::MAX, 0.0, f64::MAX, 1.0], [0.0, 0.0, 1.0, 1.0]), ([0.0, 0.0, 1e308, 10.0], [0.0, 0.0, 1e308, 10.0]), + ([3.0 * 2.0_f64.powi(970), 0.0, f64::MAX, 10.0], [3.0 * 2.0_f64.powi(970), 0.0, f64::MAX, 10.0]), ] { let warp = Warp { style: "warpCustom".into(), bounds, cols: 2, rows: 1, mesh: grid(2, 1, 20.0, 10.0), ..Warp::default() }; let descriptor = warp.quilt_descriptor().unwrap(); @@ -332,7 +345,7 @@ mod tests { assert_eq!(Warp::try_from_descriptor(&high_offset.quilt_descriptor().unwrap()).unwrap(), Some(high_offset)); // At the placed-layer boundary content size is available: preserve the // evaluator's fallback mapping, not merely the ability to parse the output. - for bounds in [[0.0; 4], [2.0, 3.0, 22.0, 3.0], [f64::NAN, 0.0, 20.0, 10.0]] { + for bounds in [[0.0; 4], [2.0, 3.0, 22.0, 3.0], [f64::NAN, 0.0, 20.0, 10.0], [-f64::MAX, 0.0, f64::MAX, 10.0]] { let warp = Warp { style: "warpCustom".into(), bounds, cols: 2, rows: 1, mesh: grid(2, 1, 20.0, 10.0), ..Warp::default() }; let so = SmartObject { size: Some([20.0, 10.0]), ..placed(Some(warp.clone())) }; let bytes = so.to_placed_layer_data(&PlacedLayerOptions::default()); @@ -348,6 +361,36 @@ mod tests { } } #[test] + fn canonically_collapsed_boundaries_preserve_both_axes_mapping() { + let lo = 1e16; + let hi = lo + 2.0; + for (cols, rows, bounds, axis) in + [(4, 1, [lo, 0.0, hi, 10.0], "quiltSliceX"), (1, 4, [0.0, lo, 20.0, hi], "quiltSliceY"), (4, 4, [lo, lo, hi, hi], "quiltSliceX")] + { + let warp = Warp { style: "warpCustom".into(), bounds, cols, rows, mesh: grid(cols, rows, 20.0, 10.0), ..Warp::default() }; + let descriptor = warp.quilt_descriptor().unwrap(); + let env = descriptor.get_object("customEnvelopeWarp").unwrap(); + let Value::ObjectArray(slices) = env.get(axis).unwrap() else { panic!("slices") }; + let values = slices.body.get_numbers(axis); + assert_eq!(values, vec![lo, lo, lo, hi, hi]); + // The first, middle and last intervals all have rounded coincident endpoints. + assert_eq!(values[0], values[1]); + assert_eq!(values[1], values[2]); + assert_eq!(values[3], values[4]); + let so = placed(Some(warp.clone())); + let bytes = so.to_placed_layer_data(&PlacedLayerOptions::default()); + let back = SmartObject::from_placed_layer_data(&bytes).unwrap(); + assert_eq!(back.warp, Some(warp.clone())); + let parsed = back.warp.as_ref().unwrap(); + for p in [[bounds[0], bounds[1]], [bounds[2], bounds[1]], [bounds[0], bounds[3]], [bounds[2], bounds[3]]] { + assert_eq!(parsed.apply(p, 20.0, 10.0), warp.apply(p, 20.0, 10.0)); + } + let template = VersionedDescriptor::parse_prefix(&bytes[8..]).unwrap().0.descriptor; + let rewritten = back.to_placed_layer_data(&PlacedLayerOptions { template: Some(&template), ..Default::default() }); + assert_eq!(SmartObject::from_placed_layer_data(&rewritten).unwrap(), back); + } + } + #[test] fn templates_drop_unsupported_quilts_but_retain_valid_none() { let bounds = [0.0, 0.0, 20.0, 10.0]; let unfl = |values| Value::UnitFloats { unit: *b"#Pxl", values }; From c9862964df7f73ad37706539a06e346fc4865ca3 Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 18 Nov 2026 09:38:28 +0100 Subject: [PATCH 171/183] psd: require complete numeric explicit quilt bounds --- crates/psd/src/smart.rs | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/crates/psd/src/smart.rs b/crates/psd/src/smart.rs index 0cd5ac433..32cec043c 100644 --- a/crates/psd/src/smart.rs +++ b/crates/psd/src/smart.rs @@ -153,6 +153,13 @@ impl Warp { let cols = quilt_patches(&slice_x)?; let rows = quilt_patches(&slice_y)?; if !slice_x.is_empty() || !slice_y.is_empty() { + // Defaulting a missing or nonnumeric side to zero would invent an + // explicit rectangle. Numeric nonfinite sides still follow finite(). + if d.get("bounds").is_some() + && !d.get_object("bounds").is_some_and(|b| ["Left", "Top ", "Rght", "Btom"].iter().all(|key| b.get_number(key).is_some())) + { + return Err(PsdError::Unsupported("incomplete explicit quilt bounds".into())); + } // The evaluator normalizes over bounds, not stored slice coordinates. // Infer an absent rectangle only when both explicit axes define it. if !valid_bounds(w.bounds) { @@ -1177,6 +1184,41 @@ mod tests { assert!(Warp::try_from_descriptor(&overflow).is_err()); } #[test] + fn explicit_quilt_bounds_require_every_numeric_side() { + let sides = [("Left", 0.0), ("Top ", 0.0), ("Rght", 20.0), ("Btom", 10.0)]; + for omit_y in [false, true] { + let mut quilt = quilt_descriptor(vec![0.0, 10.0, 20.0], vec![0.0, 10.0]); + if omit_y { + let Value::Descriptor(env) = &mut quilt.items.iter_mut().find(|(key, _)| key.is("customEnvelopeWarp")).unwrap().1 else { + panic!("envelope") + }; + env.items.retain(|(key, _)| !key.is("quiltSliceY")); + } + let complete = sides.iter().fold(Descriptor::new("bounds"), |d, (key, value)| d.with(key, Value::Double(*value))); + assert!(Warp::try_from_descriptor(&quilt.clone().with("bounds", Value::Descriptor(complete))).unwrap().is_some()); + for (side, _) in sides { + for missing in [true, false] { + let bounds = sides.iter().fold(Descriptor::new("bounds"), |d, (key, value)| { + if *key != side { + d.with(key, Value::Double(*value)) + } else if missing { + d + } else { + d.with(key, Value::Text(UnicodeString::new("not a number"))) + } + }); + let invalid = quilt.clone().with("bounds", Value::Descriptor(bounds)); + assert!( + matches!(Warp::try_from_descriptor(&invalid), Err(PsdError::Unsupported(_))), + "{side}, missing={missing}, omit_y={omit_y}" + ); + let bytes = placed_layer_data("incomplete", [0.0; 8], |d| d.with("quiltWarp", Value::Descriptor(invalid))); + assert!(matches!(SmartObject::from_placed_layer_data(&bytes), Err(PsdError::Unsupported(_)))); + } + } + } + } + #[test] fn finite_warp_views_preserve_raw_descriptor_values() { let mut warp = quilt_descriptor(vec![0.0, 10.0, 20.0], vec![0.0, 10.0]); let bounds = Descriptor::new("bounds") From d78a99a0a79dcec0ee9cdc49a415c7fd38607454 Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 18 Nov 2026 10:10:41 +0100 Subject: [PATCH 172/183] psd: validate explicit bounds in unsliced quilt context --- crates/psd/src/smart.rs | 121 +++++++++++++++++++++++++++++++--- crates/psd/src/smart/write.rs | 8 ++- 2 files changed, 117 insertions(+), 12 deletions(-) diff --git a/crates/psd/src/smart.rs b/crates/psd/src/smart.rs index 32cec043c..8cc140490 100644 --- a/crates/psd/src/smart.rs +++ b/crates/psd/src/smart.rs @@ -71,6 +71,20 @@ fn finite(value: f64) -> f64 { fn valid_bounds([l, t, r, b]: [f64; 4]) -> bool { [l, t, r, b].iter().all(|v| v.is_finite()) && (r - l).is_finite() && r > l && (b - t).is_finite() && b > t } +/// Explicit quilt rectangles must be complete even without subdivision keys. +fn validate_quilt_bounds(d: &Descriptor) -> Result<()> { + if d.get("bounds").is_none() { + return Ok(()); + } + let bounds = d + .get_object("bounds") + .and_then(|b| Some([b.get_number("Left")?, b.get_number("Top ")?, b.get_number("Rght")?, b.get_number("Btom")?])) + .ok_or_else(|| PsdError::Unsupported("incomplete explicit quilt bounds".into()))?; + if !valid_bounds(bounds.map(finite)) { + return Err(PsdError::Unsupported("invalid explicit quilt bounds".into())); + } + Ok(()) +} /// The corner quad (top-left, top-right, bottom-right, bottom-left) from x0 y0 … x3 y3. fn quad_from(t: [f64; 8]) -> [[f64; 2]; 4] { [[t[0], t[1]], [t[2], t[3]], [t[4], t[5]], [t[6], t[7]]] @@ -133,6 +147,14 @@ impl Warp { /// uniform-model contract, not a guarantee of other readers' handling of coincident slices. /// Nonfinite geometry becomes zero. pub fn try_from_descriptor(d: &Descriptor) -> Result> { + Self::try_from_descriptor_kind(d, d.class_id.is("quiltWarp")) + } + + // The containing SoLd key is authoritative even if an embedded class differs. + fn try_from_descriptor_kind(d: &Descriptor, quilt: bool) -> Result> { + if quilt { + validate_quilt_bounds(d)?; + } let style = d.get_enum("warpStyle").unwrap_or_else(|| "warpNone".to_string()); let side = |b: &Descriptor, k: &str| finite(b.get_number(k).unwrap_or(0.0)); let bounds = d.get_object("bounds").map_or([0.0; 4], |b| [side(b, "Left"), side(b, "Top "), side(b, "Rght"), side(b, "Btom")]); @@ -153,13 +175,8 @@ impl Warp { let cols = quilt_patches(&slice_x)?; let rows = quilt_patches(&slice_y)?; if !slice_x.is_empty() || !slice_y.is_empty() { - // Defaulting a missing or nonnumeric side to zero would invent an - // explicit rectangle. Numeric nonfinite sides still follow finite(). - if d.get("bounds").is_some() - && !d.get_object("bounds").is_some_and(|b| ["Left", "Top ", "Rght", "Btom"].iter().all(|key| b.get_number(key).is_some())) - { - return Err(PsdError::Unsupported("incomplete explicit quilt bounds".into())); - } + validate_quilt_bounds(d)?; + // The evaluator normalizes over bounds, not stored slice coordinates. // Infer an absent rectangle only when both explicit axes define it. if !valid_bounds(w.bounds) { @@ -366,9 +383,9 @@ impl SmartObject { let t = eight(&d, "nonAffineTransform").unwrap_or(t); let size = d.get_object("Sz ").and_then(|s| Some([finite(s.get_number("Wdth")?), finite(s.get_number("Hght")?)])); // A split warp is in `quiltWarp`, with `warp` holding none. - let mut warp = d.get_object("quiltWarp").map(Warp::try_from_descriptor).transpose()?.flatten(); + let mut warp = d.get_object("quiltWarp").map(|q| Warp::try_from_descriptor_kind(q, true)).transpose()?.flatten(); if warp.is_none() { - warp = d.get_object("warp").map(Warp::try_from_descriptor).transpose()?.flatten(); + warp = d.get_object("warp").map(|w| Warp::try_from_descriptor_kind(w, false)).transpose()?.flatten(); } Ok(SmartObject { uuid, quad: quad_from(t), size, warp }) } @@ -1184,6 +1201,92 @@ mod tests { assert!(Warp::try_from_descriptor(&overflow).is_err()); } #[test] + fn quilt_bounds_policy_covers_every_slice_axis_and_descriptor_context() { + let rect = |l, t, r, b| { + Value::Descriptor( + Descriptor::new("bounds") + .with("Left", Value::Double(l)) + .with("Top ", Value::Double(t)) + .with("Rght", Value::Double(r)) + .with("Btom", Value::Double(b)), + ) + }; + let cases = [ + (None, true), + (Some(rect(0.0, 0.0, 20.0, 10.0)), true), + (Some(Value::Integer(0)), false), + ( + Some(Value::Descriptor( + Descriptor::new("bounds").with("Left", Value::Double(0.0)).with("Rght", Value::Double(20.0)).with("Btom", Value::Double(10.0)), + )), + false, + ), + ( + Some(Value::Descriptor( + Descriptor::new("bounds") + .with("Left", Value::Double(0.0)) + .with("Top ", Value::Text(UnicodeString::new("bad"))) + .with("Rght", Value::Double(20.0)) + .with("Btom", Value::Double(10.0)), + )), + false, + ), + (Some(rect(0.0, 10.0, 20.0, 10.0)), false), + (Some(rect(0.0, -f64::MAX, 20.0, f64::MAX)), false), + (Some(rect(f64::NAN, f64::NEG_INFINITY, 20.0, 10.0)), true), + ]; + for axes in 0..4 { + for class in ["warp", "quiltWarp"] { + for (bounds, valid) in &cases { + let mut d = Warp { + style: "warpCustom".into(), + cols: 1, + rows: 1, + mesh: (0..4).flat_map(|y| (0..4).map(move |x| [x as f64 * 20.0 / 3.0, y as f64 * 10.0 / 3.0])).collect(), + ..Warp::default() + } + .to_descriptor(); + d.class_id = Id::new(class); + d.items.retain(|(key, _)| !key.is("bounds")); + if let Some(bounds) = bounds { + d.items.push((Id::new("bounds"), bounds.clone())); + } + let Value::Descriptor(env) = &mut d.items.iter_mut().find(|(key, _)| key.is("customEnvelopeWarp")).unwrap().1 else { + panic!("envelope") + }; + for (bit, key, end) in [(1, "quiltSliceX", 20.0), (2, "quiltSliceY", 10.0)] { + if axes & bit != 0 { + env.items.push((Id::new(key), Value::UnitFloats { unit: *b"#Pxl", values: vec![0.0, end] })); + } + } + let expected = |quilt| { + if bounds.is_none() { axes == 0 || axes == 3 } else { *valid || (!quilt && axes == 0) } + }; + assert_eq!( + Warp::try_from_descriptor(&d).is_ok(), + expected(class == "quiltWarp"), + "direct {class}, axes={axes}, bounds={bounds:?}" + ); + for field in ["warp", "quiltWarp"] { + let bytes = placed_layer_data("context", [0.0; 8], |parent| parent.with(field, Value::Descriptor(d.clone()))); + assert_eq!( + SmartObject::from_placed_layer_data(&bytes).is_ok(), + expected(field == "quiltWarp"), + "{field}/{class}, axes={axes}, bounds={bounds:?}" + ); + } + } + } + } + // No envelope and identity style must not bypass explicit quilt bounds. + for class in ["warp", "quiltWarp"] { + let d = Descriptor::new(class).with("bounds", rect(0.0, 10.0, 20.0, 10.0)); + assert_eq!(Warp::try_from_descriptor(&d).is_ok(), class == "warp"); + let bytes = placed_layer_data("identity", [0.0; 8], |parent| parent.with("quiltWarp", Value::Descriptor(d))); + assert!(SmartObject::from_placed_layer_data(&bytes).is_err()); + } + } + #[test] fn explicit_quilt_bounds_require_every_numeric_side() { let sides = [("Left", 0.0), ("Top ", 0.0), ("Rght", 20.0), ("Btom", 10.0)]; for omit_y in [false, true] { diff --git a/crates/psd/src/smart/write.rs b/crates/psd/src/smart/write.rs index f1edf82df..6976417b2 100644 --- a/crates/psd/src/smart/write.rs +++ b/crates/psd/src/smart/write.rs @@ -206,8 +206,9 @@ impl SmartObject { } set(&mut d, "warp", Value::Descriptor(warp.to_descriptor())); // The imported `quiltWarp` stays while it still says what the warp is. - let kept = - t.get_object("quiltWarp").is_some_and(|q| Warp::try_from_descriptor(q).is_ok_and(|parsed| parsed.as_ref() == self.warp.as_ref())); + let kept = t + .get_object("quiltWarp") + .is_some_and(|q| Warp::try_from_descriptor_kind(q, true).is_ok_and(|parsed| parsed.as_ref() == self.warp.as_ref())); if !kept { match quilt { Some(q) => set_before(&mut d, "quiltWarp", Value::Descriptor(q), "warp"), @@ -404,7 +405,8 @@ mod tests { assert!(Warp::try_from_descriptor(&unequal).is_err()); let valid_none = Warp::none(bounds).to_descriptor(); assert!(matches!(Warp::try_from_descriptor(&valid_none), Ok(None))); - for (quilt, keep) in [(unequal, false), (valid_none, true)] { + let invalid_none = Warp::none([0.0, 10.0, 20.0, 10.0]).to_descriptor(); + for (quilt, keep) in [(unequal, false), (valid_none, true), (invalid_none, false)] { let template = Descriptor::new("null").with("quiltWarp", Value::Descriptor(quilt.clone())); let bytes = placed(None).to_placed_layer_data(&PlacedLayerOptions { placed: "layer", From e1fc4b1376148197c2cfd2381eeb400e2731269a Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 18 Nov 2026 10:39:08 +0100 Subject: [PATCH 173/183] psd: annotate quilt policy test closure parameter --- crates/psd/src/smart.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/psd/src/smart.rs b/crates/psd/src/smart.rs index 8cc140490..38f382292 100644 --- a/crates/psd/src/smart.rs +++ b/crates/psd/src/smart.rs @@ -1259,7 +1259,7 @@ mod tests { env.items.push((Id::new(key), Value::UnitFloats { unit: *b"#Pxl", values: vec![0.0, end] })); } } - let expected = |quilt| { + let expected = |quilt: bool| { if bounds.is_none() { axes == 0 || axes == 3 } else { *valid || (!quilt && axes == 0) } }; assert_eq!( From 486319f5ff8bf2a7fa80aa9df3196d20750ec257 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 18 Nov 2026 05:18:38 -0500 Subject: [PATCH 174/183] fix(dex): retain reference-query parse incompleteness --- crates/dex/src/dex.rs | 71 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/crates/dex/src/dex.rs b/crates/dex/src/dex.rs index 528ec334e..8c0b25573 100644 --- a/crates/dex/src/dex.rs +++ b/crates/dex/src/dex.rs @@ -691,7 +691,8 @@ pub struct Reference { const MAX_REFERENCE_BYTES: usize = 64 << 20; /// Every instruction that refers to class `desc` (optionally only its methods named `method`). -/// Reports truncation when instruction decoding is incomplete or the count or byte budget is exhausted. +/// Reports truncation for incomplete class data, unreadable nonzero code offsets, incomplete +/// instruction decoding, or an exhausted count or byte budget. pub fn references(dex: &Dex<'_>, desc: &str, method: Option<&str>, max: usize) -> (Vec, bool) { references_with_byte_limit(dex, desc, method, max, MAX_REFERENCE_BYTES) } @@ -702,8 +703,14 @@ fn references_with_byte_limit(dex: &Dex<'_>, desc: &str, method: Option<&str>, m let mut complete = true; for c in &dex.classes { let cd = dex.class_data(c); + complete &= cd.complete; for m in cd.direct_methods.iter().chain(&cd.virtual_methods) { - let Some(code) = dex.code(m.code_off) else { continue }; + let Some(code) = dex.code(m.code_off) else { + // Zero means no implementation (native/abstract), not damaged code. + // A nonzero unreadable body may hide references from this query. + complete &= m.code_off == 0; + continue; + }; let (insns, decoded) = crate::dex_ops::decode(&code.insns, 200_000); complete &= decoded; for i in &insns { @@ -778,6 +785,66 @@ mod tests { } } + #[test] + fn reference_queries_keep_class_data_and_code_parse_failures() { + let mut builder = fx::DexBuilder::default(); + let class = builder.ty("LTest;"); + let target = builder.method("LTest;", "target", "V", &[]); + let caller = builder.method("LTest;", "caller", "V", &[]); + builder.classes.push(fx::ClassSpec { + class, + direct: vec![ + fx::MethodSpec { method: target, access: 0, code: Some(fx::CodeSpec { insns: vec![0x000e], ..Default::default() }) }, + fx::MethodSpec { + method: caller, + access: 0, + code: Some(fx::CodeSpec { insns: vec![0x0071, target as u16, 0], ..Default::default() }), + }, + ], + ..Default::default() + }); + let bytes = builder.build(); + let mut dex = parse(&bytes).unwrap(); + let expected = references(&dex, "LTest;", Some("target"), 10); + assert_eq!(expected.0.len(), 1); + assert!(!expected.1); + + // A damaged class before a valid one must not hide the valid result or reset truncation. + let mut bad = dex.classes[0]; + bad.class_data_off = bytes.len() as u32; + dex.classes.insert(0, bad); + assert!(!dex.class_data(&dex.classes[0]).complete); + assert_eq!(references(&dex, "LTest;", Some("target"), 10), (expected.0.clone(), true)); + assert_eq!(references(&dex, "LAbsent;", None, 10), (Vec::new(), true)); + + // Locate the first method's code offset, after four counts and its index/access. + let original = parse(&bytes).unwrap(); + let reader = Reader::new(&bytes); + let mut at = original.classes[0].class_data_off as usize; + for _ in 0..6 { + at += reader.uleb128(at).unwrap().1; + } + let width = reader.uleb128(at).unwrap().1; + for missing in [false, true] { + let mut changed = bytes.clone(); + // Preserve the encoded width so the later valid method stays aligned. + changed[at..at + width].fill(if missing { 0xff } else { 0x80 }); + changed[at + width - 1] = if missing { 0x7f } else { 0 }; + let dex = parse(&changed).unwrap(); + let methods = dex.class_data(&dex.classes[0]); + assert!(methods.complete); + let offset = methods.direct_methods[0].code_off; + if missing { + assert!(offset as usize >= changed.len()); + } else { + assert_eq!(offset, 0); + } + assert!(dex.code(offset).is_none()); + assert_eq!(references(&dex, "LTest;", Some("target"), 10), (expected.0.clone(), missing)); + assert_eq!(references(&dex, "LAbsent;", None, 10), (Vec::new(), missing)); + } + } + #[test] fn fixture_strings_round_trip_utf16_surrogate_pairs() { let mut builder = fx::DexBuilder::default(); From abde74fa7dcb6e35beffa6cb98e90ba5595d33ba Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 18 Nov 2026 06:33:33 -0500 Subject: [PATCH 175/183] fix(mcmat): validate manifests and read resources by index --- crates/mcmat/src/lib.rs | 90 +++++++++++++++++++++++++++++++++------ crates/zip/src/archive.rs | 34 +++++++++++++++ 2 files changed, 110 insertions(+), 14 deletions(-) diff --git a/crates/mcmat/src/lib.rs b/crates/mcmat/src/lib.rs index fe328cceb..ca3fa7641 100644 --- a/crates/mcmat/src/lib.rs +++ b/crates/mcmat/src/lib.rs @@ -3,7 +3,8 @@ //! The clean-room MCMAT v3 source archive. Applications interpret the SBS entry graph. use craft_zip::{Archive, Compression, Writer}; -use serde::Deserialize; +use serde::Deserializer; +use serde::de::{IgnoredAny, MapAccess, Visitor}; use std::collections::{BTreeMap, BTreeSet}; pub const VERSION: u32 = 3; @@ -62,20 +63,36 @@ impl Material { return Err(Error::Invalid("duplicate or overlapping archive entries".into())); } let json = archive.read(MANIFEST_ENTRY, limits.max_manifest_bytes)?.ok_or_else(|| Error::Invalid("missing material.json".into()))?; - #[derive(Deserialize)] - struct Version { - version: u32, + struct Marker; + impl<'de> Visitor<'de> for Marker { + type Value = (u32, bool); + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("a version object") + } + fn visit_map>(self, mut map: A) -> Result { + let mut version = None; + let mut extra = false; + while let Some(key) = map.next_key::()? { + if key == "version" { + if version.is_some() { + return Err(serde::de::Error::duplicate_field("version")); + } + version = Some(map.next_value::()?); + } else { + map.next_value::()?; + extra = true; + } + } + Ok((version.ok_or_else(|| serde::de::Error::missing_field("version"))?, extra)) + } } - let marker: Version = serde_json::from_slice(&json).map_err(|err| Error::Invalid(format!("material.json: {err}")))?; - if marker.version != VERSION { - return Err(Error::Version(marker.version)); + let mut deserializer = serde_json::Deserializer::from_slice(&json); + let (version, extra) = deserializer.deserialize_map(Marker).map_err(|err| Error::Invalid(format!("material.json: {err}")))?; + deserializer.end().map_err(|err| Error::Invalid(format!("material.json: {err}")))?; + if version != VERSION { + return Err(Error::Version(version)); } - #[derive(Deserialize)] - #[serde(deny_unknown_fields)] - struct Marker { - version: u32, - } - if !serde_json::from_slice::(&json).is_ok_and(|m| m.version == VERSION) { + if extra { return Err(Error::Invalid("material.json must contain only the version".into())); } let source = archive.read(SOURCE_ENTRY, limits.max_entry_bytes)?.ok_or_else(|| Error::Invalid("missing source.sbs".into()))?; @@ -87,12 +104,15 @@ impl Material { continue; } if name.strip_suffix('/').is_some_and(|dir| dir == "resources" || valid_resource(dir)) { + if archive.entry_sizes(index)? != Some((0, 0)) { + return Err(Error::Invalid("directory entries must have no payload".into())); + } continue; } if !valid_resource(&name) || !seen.insert(name.to_ascii_lowercase()) { return Err(Error::Invalid(format!("invalid or ambiguous resource path `{name}`"))); } - let data = archive.read(&name, limits.max_entry_bytes)?.ok_or_else(|| Error::Invalid(format!("missing `{name}`")))?; + let data = archive.read_index(index, limits.max_entry_bytes)?.ok_or_else(|| Error::Invalid(format!("missing `{name}`")))?; resources.insert(name, data); } Ok(Self { source, resources }) @@ -151,6 +171,48 @@ mod tests { } } + #[test] + fn marker_requires_an_object_and_complete_input() { + for marker in [b"[3]".as_slice(), b"[2]", b"null", b"3", br#"{"version":3} {}"#, br#"{"version":3,"version":3}"#] { + let mut zip = Writer::new(); + zip.add(MANIFEST_ENTRY, marker, Compression::Stored).unwrap(); + zip.add(SOURCE_ENTRY, b"source", Compression::Stored).unwrap(); + assert!(matches!(Material::open(&zip.finish().unwrap(), Limits::default()), Err(Error::Invalid(_)))); + } + } + + #[test] + fn directory_members_must_be_empty() { + for payload in [b"".as_slice(), b"hidden"] { + let mut zip = Writer::new(); + zip.add(MANIFEST_ENTRY, MARKER, Compression::Stored).unwrap(); + zip.add(SOURCE_ENTRY, b"source", Compression::Stored).unwrap(); + zip.add("resources/", payload, Compression::Stored).unwrap(); + assert_eq!(Material::open(&zip.finish().unwrap(), Limits::default()).is_ok(), payload.is_empty()); + } + } + + #[test] + fn legacy_encoded_resource_names_read_by_index_under_one_budget() { + let mut zip = Writer::new(); + zip.add(MANIFEST_ENTRY, MARKER, Compression::Stored).unwrap(); + zip.add(SOURCE_ENTRY, b"s", Compression::Stored).unwrap(); + zip.add("resources/a.bin", b"data", Compression::Stored).unwrap(); + let mut bytes = zip.finish().unwrap(); + // Same-length CP437 name in both headers: no UTF-8 flag, 0x82 decodes to é. + let offsets: Vec<_> = + bytes.windows(b"resources/a.bin".len()).enumerate().filter_map(|(i, n)| (n == b"resources/a.bin").then_some(i + 10)).collect(); + assert_eq!(offsets.len(), 2); + for offset in offsets { + bytes[offset] = 0x82; + } + let total = MARKER.len() as u64 + 1 + 4; + let limits = Limits { max_total_bytes: total, ..Default::default() }; + let material = Material::open(&bytes, limits).unwrap(); + assert_eq!(material.resources["resources/é.bin"], b"data"); + assert!(Material::open(&bytes, Limits { max_total_bytes: total - 1, ..limits }).is_err()); + } + #[test] fn compresses_unencoded_source_assets() { let bytes = write(b"", [("resources/shape.svg", b"".as_slice()), ("resources/font.ttf", b"font".as_slice())]).unwrap(); diff --git a/crates/zip/src/archive.rs b/crates/zip/src/archive.rs index 49da63585..d00be89d0 100644 --- a/crates/zip/src/archive.rs +++ b/crates/zip/src/archive.rs @@ -108,6 +108,15 @@ impl<'a> Archive<'a> { Ok(Some(file.is_dir())) } + /// Declared decoded and compressed sizes at `index`, without name lookup. + pub fn entry_sizes(&mut self, index: usize) -> Result, Error> { + if index >= self.zip.len() { + return Ok(None); + } + let file = self.zip.by_index_raw(index).map_err(|e| Error::NotZip(e.to_string()))?; + Ok(Some((file.size(), file.compressed_size()))) + } + /// Do two entries share a name? `zip` then keeps one of them, and which one a writer meant /// is not known: a format that must not guess refuses the archive. pub fn has_duplicate_names(&self) -> bool { @@ -178,6 +187,16 @@ impl<'a> Archive<'a> { /// Only the bytes of a read that succeeds are charged to the total. pub fn read(&mut self, name: &str, max: u64) -> Result>, Error> { let Some(index) = self.zip.index_for_name(name) else { return Ok(None) }; + self.read_index(index, max) + } + + /// Read the entry at `index` under the same size, checksum and aggregate budget + /// rules as [`Self::read`], without repeating a decoded-name lookup. + pub fn read_index(&mut self, index: usize, max: u64) -> Result>, Error> { + if index >= self.zip.len() { + return Ok(None); + } + let name = self.entry_name(index)?.unwrap_or_default(); let entry = |msg: String| Error::Entry { name: name.to_string(), msg }; let f = self.zip.by_index(index).map_err(|e| entry(e.to_string()))?; let declared = f.size(); @@ -213,6 +232,21 @@ impl Archive<'static> { mod ownership_tests { use super::*; + #[test] + fn indexed_reads_charge_the_same_budget_and_enforce_entry_limits() { + let mut writer = crate::Writer::new(); + writer.add("a", b"abc", crate::Compression::Stored).unwrap(); + writer.add("b", b"def", crate::Compression::Deflated).unwrap(); + let bytes = writer.finish().unwrap(); + let mut archive = Archive::open(&bytes, Limits { max_entries: 2, max_total_bytes: 5 }).unwrap(); + assert!(archive.read_index(0, 2).is_err()); + assert_eq!(archive.read_index(0, 3).unwrap().unwrap(), b"abc"); + assert!(archive.read_index(1, 3).is_err()); + assert_eq!(archive.read_index(2, 3).unwrap(), None); + assert_eq!(archive.entry_sizes(0).unwrap(), Some((3, 3))); + assert_eq!(archive.entry_sizes(2).unwrap(), None); + } + #[test] fn owned_storage_lives_until_last_archive_clone_is_dropped() { let bytes = crate::Writer::new().finish().unwrap(); From 1cc156dcc3c4226f2aa25f3ff341c1cee69e9039 Mon Sep 17 00:00:00 2001 From: David Mann Date: Wed, 18 Nov 2026 12:43:50 +0100 Subject: [PATCH 176/183] ci: skip cargo fmt on the Windows lint leg (#2200) One rustfmt call with every source root of the workspace is now longer than a Windows command line may be (os error 206). rustfmt's result is the same on every system; the Linux and macOS legs keep checking it. The lint-command guard states the per-system stages. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/workspace.yml | 7 ++++++- scripts/test-workspace-tests.py | 11 ++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml index af7e04769..5a9e4989d 100644 --- a/.github/workflows/workspace.yml +++ b/.github/workflows/workspace.yml @@ -64,7 +64,12 @@ jobs: python3 scripts/test-workspace-concurrency.py python3 scripts/test-workspace-tests.py fi - cargo fmt --check + # One rustfmt call gets every source root of the workspace, which is longer than + # Windows allows for a command line (os error 206). rustfmt's result is the same on + # every system, so the Linux and macOS legs check it. + if [ "$RUNNER_OS" != Windows ]; then + cargo fmt --check + fi cargo clippy --workspace --all-targets --locked -- -D warnings cargo clippy --workspace --all-targets --all-features --locked -- -D warnings command: | diff --git a/scripts/test-workspace-tests.py b/scripts/test-workspace-tests.py index 9572cac31..ac65da9c1 100644 --- a/scripts/test-workspace-tests.py +++ b/scripts/test-workspace-tests.py @@ -25,7 +25,9 @@ if [ "$RUNNER_OS" = Linux ]; then python3 scripts/test-workspace-concurrency.py python3 scripts/test-workspace-tests.py fi -cargo fmt --check +if [ "$RUNNER_OS" != Windows ]; then + cargo fmt --check +fi cargo clippy --workspace --all-targets --locked -- -D warnings cargo clippy --workspace --all-targets --all-features --locked -- -D warnings """ @@ -96,11 +98,14 @@ TESTS = [ class WorkspaceTests(unittest.TestCase): def test_every_leg_lints_with_both_feature_sets(self): - for os_name in ("Linux", "macOS", "Windows"): + # Windows skips only rustfmt: one call with every source root of the workspace is longer + # than a Windows command line may be (os error 206), and Linux and macOS check the same + # formatting. + for os_name, expected in (("Linux", COMMON), ("macOS", COMMON), ("Windows", COMMON[1:])): with self.subTest(os=os_name): result = commands(os_name, name="lint-command") self.assertEqual(result.returncode, 0, result.stderr) - self.assertEqual(result.stdout.splitlines(), COMMON) + self.assertEqual(result.stdout.splitlines(), expected) def test_linux_and_macos_run_one_feature_set_with_doctests(self): for os_name in ("Linux", "macOS"): From a557fed94e0f528c281b4bab241eb518b7f756ac Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 18 Nov 2026 13:15:03 +0100 Subject: [PATCH 177/183] psd: expose path record knot decoding for consumer adapters --- crates/psd/src/path.rs | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/crates/psd/src/path.rs b/crates/psd/src/path.rs index 17604e654..dc1a091c9 100644 --- a/crates/psd/src/path.rs +++ b/crates/psd/src/path.rs @@ -64,6 +64,15 @@ impl PathRecord { pub fn is_knot(&self) -> bool { matches!(self.selector, 1 | 2 | 4 | 5) } + /// Decodes a knot's signed 8.24 coordinates as `(x, y)` document fractions. + /// Non-knot records return `None`; grouping and recovery policy remain with the caller. + pub fn knot(&self) -> Option { + if !self.is_knot() { + return None; + } + let pt = |i: usize| (fixed_to_f64(self.i32_at(i * 8 + 4)), fixed_to_f64(self.i32_at(i * 8))); + Some(PsdKnot { linked: matches!(self.selector, 1 | 4), pre: pt(0), anchor: pt(1), post: pt(2) }) + } } /// A Bézier knot as fractions of the document size: `(x, y)` pairs. @@ -158,15 +167,14 @@ impl PathData { // No preallocation: the count is untrusted (u16) and PsdKnot is 56 bytes. knots: Vec::new(), }); - } else if r.is_knot() { + } else if let Some(knot) = r.knot() { let closed = r.selector <= 2; if remaining == 0 && out.last().is_none_or(|s| s.closed != closed) { out.push(PsdSubpath { closed, operation: -1, knots: Vec::new() }); } remaining = remaining.saturating_sub(1); - let pt = |i: usize| (fixed_to_f64(r.i32_at(i * 8 + 4)), fixed_to_f64(r.i32_at(i * 8))); if let Some(s) = out.last_mut() { - s.knots.push(PsdKnot { linked: matches!(r.selector, 1 | 4), pre: pt(0), anchor: pt(1), post: pt(2) }); + s.knots.push(knot); } } } @@ -248,6 +256,23 @@ impl VectorMaskBlock { mod tests { use super::*; + #[test] + fn record_knot_decodes_signed_y_first_coordinates_without_grouping() { + let mut data = [0; 24]; + for (chunk, value) in data.chunks_exact_mut(4).zip([-(1i32 << 23), 1 << 22, 1 << 24, -(1 << 24), i32::MIN, i32::MAX]) { + chunk.copy_from_slice(&value.to_be_bytes()); + } + for selector in [1, 2, 4, 5] { + let knot = PathRecord { selector, data }.knot().unwrap(); + assert_eq!(knot.linked, matches!(selector, 1 | 4)); + assert_eq!(knot.pre, (0.25, -0.5)); + assert_eq!(knot.anchor, (-1.0, 1.0)); + assert_eq!(knot.post, (f64::from(i32::MAX) / 16_777_216.0, -128.0)); + } + for selector in [0, 3, 6, 7, 8, u16::MAX] { + assert_eq!(PathRecord { selector, data }.knot(), None); + } + } fn sample() -> Vec { vec![ PsdSubpath { From ce732d2b8b29f689fd43bef545fbc513306b18b1 Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 18 Nov 2026 13:25:09 +0100 Subject: [PATCH 178/183] ci: preserve full Windows formatting with package-sized invocations --- scripts/ci-format-workspace.py | 46 ++++++++++++++++ scripts/ci-full-validation.sh | 7 ++- scripts/test-full-validation.py | 95 ++++++++++++++++++++++++++++++--- 3 files changed, 141 insertions(+), 7 deletions(-) create mode 100644 scripts/ci-format-workspace.py diff --git a/scripts/ci-format-workspace.py b/scripts/ci-format-workspace.py new file mode 100644 index 000000000..a9b1569a2 --- /dev/null +++ b/scripts/ci-format-workspace.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +"""Check every workspace package separately to bound rustfmt's Windows argv.""" +import json +from pathlib import Path +import re +import subprocess + +ROOT = Path(__file__).resolve().parents[1] + + +def workspace_names(metadata): + members = metadata["workspace_members"] + packages = metadata["packages"] + if not members or len(members) != len(set(members)): + raise ValueError("workspace member inventory is empty or duplicated") + by_id = {package["id"]: package for package in packages} + if len(by_id) != len(packages): + raise ValueError("metadata contains duplicate package IDs") + names = [] + for member in members: + name = by_id[member]["name"] + # Package names are data, never command text or option fragments. + if not isinstance(name, str) or not re.fullmatch(r"[A-Za-z0-9_][A-Za-z0-9_-]*", name): + raise ValueError("invalid workspace package name") + names.append(name) + if len(names) != len(set(names)): + raise ValueError("workspace package names are ambiguous") + return sorted(names) + + +def check_workspace(): + result = subprocess.run( + ["cargo", "metadata", "--no-deps", "--offline", "--locked", "--format-version", "1"], + cwd=ROOT, check=True, stdout=subprocess.PIPE, text=True, + ) + names = workspace_names(json.loads(result.stdout)) + # From this virtual workspace root, cargo fmt normally checks all workspace packages. + # Keep Cargo responsible for target kinds, editions and rustfmt configuration. + # One package per call retains all its targets without the workspace-sized argv. + print(f"Checking formatting for {len(names)} workspace packages", flush=True) + for name in names: + subprocess.run(["cargo", "fmt", "--check", "--package", name], cwd=ROOT, check=True) + + +if __name__ == "__main__": + check_workspace() diff --git a/scripts/ci-full-validation.sh b/scripts/ci-full-validation.sh index 6e9509b5e..3b413ec88 100644 --- a/scripts/ci-full-validation.sh +++ b/scripts/ci-full-validation.sh @@ -5,7 +5,12 @@ unset CRAFT_HOSTILE_DIVISOR PROPTEST_CASES if [ "${RUNNER_OS:-}" = Windows ]; then powershell.exe -NoProfile -Command '$ErrorActionPreference = "Stop"; Start-Service Spooler; Add-PrinterDriver -Name "Generic / Text Only"' fi -cargo fmt --check +# Windows cannot spawn one rustfmt command with every workspace target (#2200). +if [ "${RUNNER_OS:-}" = Windows ]; then + python scripts/ci-format-workspace.py +else + cargo fmt --check +fi cargo clippy --workspace --all-targets --locked -- -D warnings cargo clippy --workspace --all-targets --all-features --locked -- -D warnings # cargo test includes docs and ordinary example linking, as required by AGENTS.md. diff --git a/scripts/test-full-validation.py b/scripts/test-full-validation.py index 658f49f54..4181ef7cc 100644 --- a/scripts/test-full-validation.py +++ b/scripts/test-full-validation.py @@ -29,7 +29,11 @@ unset CRAFT_HOSTILE_DIVISOR PROPTEST_CASES if [ "${RUNNER_OS:-}" = Windows ]; then powershell.exe -NoProfile -Command '$ErrorActionPreference = "Stop"; Start-Service Spooler; Add-PrinterDriver -Name "Generic / Text Only"' fi -cargo fmt --check +if [ "${RUNNER_OS:-}" = Windows ]; then + python scripts/ci-format-workspace.py +else + cargo fmt --check +fi cargo clippy --workspace --all-targets --locked -- -D warnings cargo clippy --workspace --all-targets --all-features --locked -- -D warnings cargo test --workspace --locked @@ -54,6 +58,7 @@ cargo() { if [ "$*" = "$FAIL" ]; then return 17; fi } powershell.exe() { printf 'print-queue\n'; } +python() { test "$*" = "scripts/ci-format-workspace.py" || return 31; cargo fmt --check; } """ return subprocess.run([BASH, "-c", mock + SOURCE], env=env, capture_output=True, text=True, check=False) @@ -89,11 +94,13 @@ class FullValidation(unittest.TestCase): (["print-queue"] if name == "Windows" else []) + COMMANDS) def test_every_failure_stops_the_gate(self): - for i, command in enumerate(COMMANDS): - with self.subTest(command=command): - p = run("Linux", command) - self.assertEqual(p.returncode, 17, p.stdout + p.stderr) - self.assertEqual(p.stdout.splitlines(), COMMANDS[:i + 1]) + for name in ["Linux", "macOS", "Windows"]: + for i, command in enumerate(COMMANDS): + with self.subTest(os=name, command=command): + p = run(name, command) + self.assertEqual(p.returncode, 17, p.stdout + p.stderr) + self.assertEqual(p.stdout.splitlines(), + (["print-queue"] if name == "Windows" else []) + COMMANDS[:i + 1]) def test_workflow_preserves_fork_and_platform_boundaries(self): text = (ROOT / ".github/workflows/full-validation.yml").read_text() @@ -120,5 +127,81 @@ class FullValidation(unittest.TestCase): self.assertIn("macos-latest", pdf) + +class PackageFormatting(unittest.TestCase): + @staticmethod + def helper(): + import importlib.util + spec = importlib.util.spec_from_file_location("ci_format_workspace", ROOT / "scripts/ci-format-workspace.py") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + @staticmethod + def metadata(): + return {"workspace_members": ["id-b", "id-a"], "workspace_default_members": ["id-a"], + "packages": [{"id": "id-a", "name": "craft-a"}, + {"id": "id-b", "name": "craft-b"}, + {"id": "external", "name": "not-a-member"}]} + + def test_all_workspace_members_not_only_defaults_and_no_external_dependencies(self): + helper = self.helper() + self.assertEqual(helper.workspace_names(self.metadata()), ["craft-a", "craft-b"]) + + def test_new_package_automatically_included(self): + helper = self.helper() + data = self.metadata() + data["workspace_members"].append("id-new") + data["packages"].append({"id": "id-new", "name": "craft-new"}) + self.assertEqual(helper.workspace_names(data), ["craft-a", "craft-b", "craft-new"]) + + def test_bad_inventory_fails_closed(self): + helper = self.helper() + for members in ([], ["id-a", "id-a"], ["missing"]): + data = self.metadata() + data["workspace_members"] = members + with self.subTest(members=members), self.assertRaises((ValueError, KeyError)): + helper.workspace_names(data) + for name in ("--all", "craft-a;echo injected", "craft-a", ""): + data = self.metadata() + data["packages"][1]["name"] = name + with self.subTest(name=name), self.assertRaises(ValueError): + helper.workspace_names(data) + + def test_calls_cargo_with_one_package_and_no_shell(self): + import json + helper = self.helper() + result = subprocess.CompletedProcess([], 0, stdout=json.dumps(self.metadata())) + with patch.object(helper.subprocess, "run", return_value=result) as execute: + helper.check_workspace() + self.assertEqual([call.args[0] for call in execute.call_args_list], [ + ["cargo", "metadata", "--no-deps", "--offline", "--locked", "--format-version", "1"], + ["cargo", "fmt", "--check", "--package", "craft-a"], + ["cargo", "fmt", "--check", "--package", "craft-b"], + ]) + for call in execute.call_args_list: + self.assertEqual(call.kwargs["cwd"], ROOT) + self.assertTrue(call.kwargs["check"]) + self.assertNotIn("shell", call.kwargs) + + def test_metadata_failure_prevents_formatting(self): + helper = self.helper() + failure = subprocess.CalledProcessError(17, ["cargo", "metadata"]) + with patch.object(helper.subprocess, "run", side_effect=failure) as execute: + with self.assertRaises(subprocess.CalledProcessError): + helper.check_workspace() + self.assertEqual(execute.call_count, 1) + + def test_first_format_failure_stops_later_packages(self): + import json + helper = self.helper() + result = subprocess.CompletedProcess([], 0, stdout=json.dumps(self.metadata())) + failure = subprocess.CalledProcessError(17, ["cargo", "fmt"]) + with patch.object(helper.subprocess, "run", side_effect=[result, failure]) as execute: + with self.assertRaises(subprocess.CalledProcessError): + helper.check_workspace() + self.assertEqual(execute.call_count, 2) + + if __name__ == "__main__": unittest.main() From 83131112ab21848f577f87ccabfb31360913edb4 Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 18 Nov 2026 13:26:52 +0100 Subject: [PATCH 179/183] Decode Cargo metadata as UTF-8 on Windows --- scripts/ci-format-workspace.py | 2 +- scripts/test-full-validation.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci-format-workspace.py b/scripts/ci-format-workspace.py index a9b1569a2..32605af70 100644 --- a/scripts/ci-format-workspace.py +++ b/scripts/ci-format-workspace.py @@ -31,7 +31,7 @@ def workspace_names(metadata): def check_workspace(): result = subprocess.run( ["cargo", "metadata", "--no-deps", "--offline", "--locked", "--format-version", "1"], - cwd=ROOT, check=True, stdout=subprocess.PIPE, text=True, + cwd=ROOT, check=True, stdout=subprocess.PIPE, text=True, encoding="utf-8", ) names = workspace_names(json.loads(result.stdout)) # From this virtual workspace root, cargo fmt normally checks all workspace packages. diff --git a/scripts/test-full-validation.py b/scripts/test-full-validation.py index 4181ef7cc..b37e979c8 100644 --- a/scripts/test-full-validation.py +++ b/scripts/test-full-validation.py @@ -179,6 +179,7 @@ class PackageFormatting(unittest.TestCase): ["cargo", "fmt", "--check", "--package", "craft-a"], ["cargo", "fmt", "--check", "--package", "craft-b"], ]) + self.assertEqual(execute.call_args_list[0].kwargs["encoding"], "utf-8") for call in execute.call_args_list: self.assertEqual(call.kwargs["cwd"], ROOT) self.assertTrue(call.kwargs["check"]) From 4d2784ec90413e53b8f6c1a1c6b8526b8077e8c5 Mon Sep 17 00:00:00 2001 From: FredApps Date: Wed, 18 Nov 2026 13:38:03 +0100 Subject: [PATCH 180/183] psd: use fixed-size chunks in vector record fixture --- crates/psd/src/path.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/psd/src/path.rs b/crates/psd/src/path.rs index dc1a091c9..3520a71d8 100644 --- a/crates/psd/src/path.rs +++ b/crates/psd/src/path.rs @@ -259,7 +259,7 @@ mod tests { #[test] fn record_knot_decodes_signed_y_first_coordinates_without_grouping() { let mut data = [0; 24]; - for (chunk, value) in data.chunks_exact_mut(4).zip([-(1i32 << 23), 1 << 22, 1 << 24, -(1 << 24), i32::MIN, i32::MAX]) { + for (chunk, value) in data.as_chunks_mut::<4>().0.iter_mut().zip([-(1i32 << 23), 1 << 22, 1 << 24, -(1 << 24), i32::MIN, i32::MAX]) { chunk.copy_from_slice(&value.to_be_bytes()); } for selector in [1, 2, 4, 5] { From 74b198524b3909ec376b6a3882f8d1d1b8acd468 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 18 Nov 2026 07:47:03 -0500 Subject: [PATCH 181/183] fix(zip): preserve named read error contracts --- crates/zip/src/archive.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/zip/src/archive.rs b/crates/zip/src/archive.rs index d00be89d0..b9b3b3d80 100644 --- a/crates/zip/src/archive.rs +++ b/crates/zip/src/archive.rs @@ -187,7 +187,7 @@ impl<'a> Archive<'a> { /// Only the bytes of a read that succeeds are charged to the total. pub fn read(&mut self, name: &str, max: u64) -> Result>, Error> { let Some(index) = self.zip.index_for_name(name) else { return Ok(None) }; - self.read_index(index, max) + self.read_index_named(index, name, max) } /// Read the entry at `index` under the same size, checksum and aggregate budget @@ -197,6 +197,10 @@ impl<'a> Archive<'a> { return Ok(None); } let name = self.entry_name(index)?.unwrap_or_default(); + self.read_index_named(index, &name, max) + } + + fn read_index_named(&mut self, index: usize, name: &str, max: u64) -> Result>, Error> { let entry = |msg: String| Error::Entry { name: name.to_string(), msg }; let f = self.zip.by_index(index).map_err(|e| entry(e.to_string()))?; let declared = f.size(); @@ -232,6 +236,17 @@ impl Archive<'static> { mod ownership_tests { use super::*; + #[test] + fn named_read_preserves_entry_error_for_a_corrupt_local_header() { + let mut writer = crate::Writer::new(); + writer.add("a", b"abc", crate::Compression::Stored).unwrap(); + let mut bytes = writer.finish().unwrap(); + bytes[0] = 0; // The central directory remains valid; the local signature does not. + let mut archive = Archive::open(&bytes, Limits { max_entries: 1, max_total_bytes: 3 }).unwrap(); + assert!(matches!(archive.read("a", 3), Err(Error::Entry { name, .. }) if name == "a")); + assert_eq!(archive.budget().remaining(), 3); + } + #[test] fn indexed_reads_charge_the_same_budget_and_enforce_entry_limits() { let mut writer = crate::Writer::new(); From bc4aae37bb219049596327fca971046dab0b78be Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 18 Nov 2026 12:12:13 -0500 Subject: [PATCH 182/183] Merge pull request #2245 from storytold/fix/ocsp-certificate-wrapper-20261118 fix(pkcs7): read standard OCSP certificate sequence wrappers --- crates/pkcs7/src/revocation.rs | 17 ++++++++++++++--- crates/pkcs7/tests/it/crypto.rs | 10 +++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/crates/pkcs7/src/revocation.rs b/crates/pkcs7/src/revocation.rs index dfb398cae..91d69730a 100644 --- a/crates/pkcs7/src/revocation.rs +++ b/crates/pkcs7/src/revocation.rs @@ -249,10 +249,21 @@ impl OcspResponse { for t in it { if t.tag == tag::ctx(0) { for c in t.children()? { - if c.tag == tag::SEQUENCE - && let Ok(cert) = Certificate::parse(c.raw) - { + if c.tag != tag::SEQUENCE { + continue; + } + // Preserve the historical direct-certificate form. RFC 6960 instead wraps + // certificates in one SEQUENCE OF inside [0]; unwrap only that one level. + if let Ok(cert) = Certificate::parse(c.raw) { responder_cert.get_or_insert(cert); + } else if let Ok(certs) = c.children() { + for cert in certs { + if cert.tag == tag::SEQUENCE + && let Ok(cert) = Certificate::parse(cert.raw) + { + responder_cert.get_or_insert(cert); + } + } } } } diff --git a/crates/pkcs7/tests/it/crypto.rs b/crates/pkcs7/tests/it/crypto.rs index 75ab5415d..d92612a5e 100644 --- a/crates/pkcs7/tests/it/crypto.rs +++ b/crates/pkcs7/tests/it/crypto.rs @@ -498,9 +498,17 @@ fn a_responder_that_copies_the_issuers_name_does_not_answer_for_it() { let single = der::seq(&[&cert_id, &revoked, &this.encode(), &der::tlv(tag::ctx(0), &next.encode())]); let by_key = der::tlv(tag::ctx(2), &der::octets(&DigestAlg::Sha1.digest(&[&impostor.public_key.key_bits()]))); // RFC 6960's `[0] EXPLICIT SEQUENCE OF Certificate`, and the certificate directly in `[0]`. - for certs in [der::explicit(0, &der::seq(&[&impostor.raw])), der::explicit(0, &impostor.raw)] { + for certs in [ + der::explicit(0, &der::seq(&[&impostor.raw])), + der::explicit(0, &impostor.raw), + // An unreadable entry must not hide the first readable certificate; later entries + // must not replace it. Parsing it still does not authorize the impostor. + der::explicit(0, &der::seq(&[&der::seq(&[]), &impostor.raw, &issuer.raw])), + ] { let forged = OcspResponse::parse(&signed_ocsp(&key, &by_key, Some(&certs), &single, this)).unwrap(); assert_eq!(forged.check(issuer, issuer, mid_june()), RevocationStatus::Unknown); + // Rejection must follow verification policy, not failure to read the embedded certificate. + assert_eq!(forged.into_parts().responder_cert.map(|cert| cert.raw), Some(impostor.raw.clone())); } } From f4b5fdebc1bc5426961289f459a7bd7a7e830b51 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 18 Nov 2026 12:36:15 -0500 Subject: [PATCH 183/183] Exercise valid delegated OCSP evidence and isolated rejection policies (#2249) --- crates/pkcs7/tests/it/chain.rs | 59 ++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/crates/pkcs7/tests/it/chain.rs b/crates/pkcs7/tests/it/chain.rs index 004f6d9e5..8e706d803 100644 --- a/crates/pkcs7/tests/it/chain.rs +++ b/crates/pkcs7/tests/it/chain.rs @@ -310,3 +310,62 @@ fn an_issuer_with_an_unprocessed_critical_extension_does_not_vouch() { let pool = [i.cert.clone(), constrained_root.cert.clone()]; assert_eq!(names(&build_chain(&l.cert, &pool, None)), ["Leaf", "Under Constrained Root", "Name Constrained Root"]); } + +/// Standards-shaped evidence signed by a directly issued responder, not merely a parse fixture. +#[test] +fn delegated_ocsp_requires_the_issuer_signature_eku_and_response_signature() { + use craft_pkcs7::keys::DigestAlg; + use craft_pkcs7::revocation::{OcspResponse, RevocationStatus}; + + let issuer = root(); + let leaf = end_entity("OCSP Leaf", &issuer); + let responder = signer_with("OCSP Responder", &issuer, &[extended_key_usage(&["1.3.6.1.5.5.7.3.9"])]); + let missing_eku = signer_with("No OCSP EKU", &issuer, &[]); + let wrong_eku = signer_with("Wrong OCSP EKU", &issuer, &[extended_key_usage(&[SERVER_AUTH])]); + // Same issuer name, different key: name equality alone must not authorize delegation. + let other_issuer = root(); + let wrong_issuer = signer_with("Wrong Issuer", &other_issuer, &[extended_key_usage(&["1.3.6.1.5.5.7.3.9"])]); + let at = time(2026); + let hash = DigestAlg::Sha256; + let id = der::seq(&[ + &hash.algorithm(), + &der::octets(&hash.digest(&[&leaf.cert.issuer.raw])), + &der::octets(&hash.digest(&[&issuer.key.public_key().key_bits()])), + &der::uint(&leaf.cert.serial), + ]); + let single = der::seq(&[&id, &der::tlv(tag::ctx_prim(0), &[]), &at.encode(), &der::explicit(0, &time(2027).encode())]); + let evidence = |responder: &Party, key: &PrivateKey, certs: &[u8], by_key: bool| { + let identity = if by_key { + der::explicit(2, &der::octets(&DigestAlg::Sha1.digest(&[&responder.key.public_key().key_bits()]))) + } else { + der::explicit(1, &responder.name.raw) + }; + let tbs = der::seq(&[&identity, &at.encode(), &der::seq(&[&single])]); + let signature = key.sign(hash, &tbs).unwrap(); + let basic = der::seq(&[&tbs, &key.signature_algorithm(hash), &der::bit_string(&signature), certs]); + der::seq(&[&der::tlv(tag::ENUMERATED, &[0]), &der::explicit(0, &der::seq(&[&der::oid("1.3.6.1.5.5.7.48.1.1"), &der::octets(&basic)]))]) + }; + for by_key in [false, true] { + for (party, signing_key, expected) in [ + (&responder, &responder.key, RevocationStatus::Good), + (&responder, &other_issuer.key, RevocationStatus::Unknown), + (&missing_eku, &missing_eku.key, RevocationStatus::Unknown), + (&wrong_eku, &wrong_eku.key, RevocationStatus::Unknown), + (&wrong_issuer, &wrong_issuer.key, RevocationStatus::Unknown), + ] { + let certs = der::explicit(0, &der::seq(&[&party.cert.raw])); + let response = OcspResponse::parse(&evidence(party, signing_key, &certs, by_key)).unwrap(); + assert_eq!(response.check(&leaf.cert, &issuer.cert, at), expected); + // Even each rejected case must reach policy with a parsed responder certificate. + assert_eq!(response.into_parts().responder_cert.as_ref(), Some(&party.cert)); + } + // Extra wrapper nesting is not recursively searched for a usable certificate. + let nested = der::explicit(0, &der::seq(&[&der::seq(&[&responder.cert.raw])])); + let response = OcspResponse::parse(&evidence(&responder, &responder.key, &nested, by_key)).unwrap(); + assert_eq!(response.check(&leaf.cert, &issuer.cert, at), RevocationStatus::Unknown); + assert!(response.into_parts().responder_cert.is_none()); + // A truncated DER child inside [0] is malformed, not missing evidence to trust. + let malformed = der::explicit(0, &[tag::SEQUENCE, 0x82, 0x01]); + assert!(OcspResponse::parse(&evidence(&responder, &responder.key, &malformed, by_key)).is_err()); + } +}

    &xld0P_>}QJ?&C08V5c_R zhJW**Lw5WmtJ_D=e@HV)AA0UHq#G-1jOT1t9BViL-HJDtspEsK$t>Hy$Yz6B>;;=0 z75qUnA`rxQ7F}}$&fe%Zr9HlbWq|T)@qur2md$&6Cr_N`9x0jZIBH=dwH8`io@L>8 zsnv9MqQBvA_!I5^L>CX2$Sq@)50{FA0yAz4m#F@|{$OpVOb~o?_7%$57ag$cS7`^H zD8cUsaFRSY1Ak{J;_C>REM%9hyW;_VOsLJ@Ks=F`rKNub@{@bX9zz}Cb*flm)$^Gp$Xhhu)`LE~Pue7Ui8!n0tj;$n=w8Tc zRT3fCh4}jtlbo=*IS+WO>D-a4T_htTu~<=ThNVTWZ`3VL;3UOhFM(ger{=b2Z+p>l zem0s{k;<~%V)~v^&0gGgKF((tE!O0l(8G5j(70Rkbd|i;K)@#r_1Y%SQlFl)<4tGE zXx!i3xZVZ-W`n3In{;*8`?t6kTJCRYh8oGaFvJ7d(d4PVu#0&?R2$DgSD`X<;-eeD z#{H-7!TuFc$e+10jlaujJhvmk`?qdRLv6Ow=Ip6VeSl65Oy@^|_72a^L$=fW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