From 3e665a7910acabecc647faba6db4123cb9c04aee Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 17:49:28 -0800 Subject: [PATCH 1/8] Stop EMAIL matches at script boundaries in non-ASCII text A non-ASCII letter between two addresses was taken as part of the first address's top-level domain together with the next local part, leaving the second domain unreported. Sentences written without spaces were taken as a local part, covering neighboring values. Refs #272 Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01Smu5UBDZuKK1PoTZh8DNKv --- crates/core/src/email_context.rs | 134 ++++++++++++++++++++++++++++++- crates/core/src/lib.rs | 39 +++++++-- 2 files changed, 166 insertions(+), 7 deletions(-) diff --git a/crates/core/src/email_context.rs b/crates/core/src/email_context.rs index 7cbbe35a..626582ec 100644 --- a/crates/core/src/email_context.rs +++ b/crates/core/src/email_context.rs @@ -1,5 +1,11 @@ //! Delimit original source slices before applying the shared email matcher. -use crate::{Candidate, ScanFormat, detect_email, detect_email_with_context}; +use std::sync::LazyLock; + +use regex::Regex; + +use crate::{ + Candidate, EMAIL_CONTINUATION_RE, ScanFormat, detect_email, detect_email_with_context, +}; pub(super) fn detect(text: &str, format: ScanFormat, candidates: &mut Vec) { match format { @@ -61,6 +67,132 @@ fn label_value_start(text: &str, start: usize, at: usize) -> Option { } } +/// A letter or digit outside ASCII and the Latin script. Combining marks take +/// the script of their base and are classified separately. +static OTHER_SCRIPT_RE: LazyLock = + LazyLock::new(|| Regex::new(r"[^\x00-\x7F\p{Latin}\p{M}]").expect("script regex is valid")); + +static MARK_RE: LazyLock = + LazyLock::new(|| Regex::new(r"\p{M}").expect("mark regex is valid")); + +fn is_other_script(character: char) -> bool { + OTHER_SCRIPT_RE.is_match(character.encode_utf8(&mut [0; 4])) +} + +fn is_mark(character: char) -> bool { + MARK_RE.is_match(character.encode_utf8(&mut [0; 4])) +} + +/// Narrow a match from text containing non-ASCII letters to the address. +/// +/// The matcher accepts every letter, so in text written without spaces it runs +/// an address into the prose and the values around it: `alice@example.comとbob` +/// takes the local part of the next address as a top-level domain, and +/// `SSNは123-45-6789でメールはalice@example.com` takes the sentence as a +/// local part. Internationalized addresses stay whole: a part is only split +/// where an ASCII or accented-Latin address meets another script, or where the +/// end of a domain is the beginning of another address. +pub(super) fn script_bounds(text: &str, start: usize, end: usize) -> (usize, usize) { + let Some(at) = text[start..end].find('@').map(|offset| start + offset) else { + return (start, end); + }; + let end = domain_end(text, at + 1, end); + (local_start(text, start, at, end), end) +} + +/// End of the domain that starts at `domain_start`, at or before `end`. +/// +/// The domain stops at its first non-ASCII character when the labels before it +/// are a complete ASCII or accented-Latin domain and either another address +/// begins there (`alice@example.comébob@example.net`) or the character starts +/// a different script in the last label (`alice@example.comです`): no +/// top-level domain continues from Latin letters into another script. A +/// combining mark stays with its base letter, so composed and decomposed +/// spellings split at the same place. When no such point exists and another +/// address still begins inside the domain, the domain ends where that +/// address's ASCII local part begins, so both remain covered. +fn domain_end(text: &str, domain_start: usize, end: usize) -> usize { + let domain = &text[domain_start..end]; + if domain.is_ascii() { + return end; + } + let mut address_follows = None; + let mut address_follows = + || *address_follows.get_or_insert_with(|| EMAIL_CONTINUATION_RE.is_match(&text[end..])); + let mut has_dot = false; + let mut label_characters = 0; + let mut label_is_alphabetic = true; + // Offset of the latest non-mark character, and whether the domain was + // complete before it. + let mut base = (0, false); + for (offset, character) in domain.char_indices() { + let complete = has_dot && label_characters >= 2 && label_is_alphabetic; + let mark = !character.is_ascii() && is_mark(character); + if !mark { + base = (offset, complete); + } + if !character.is_ascii() { + let other_script = !mark && is_other_script(character); + let (cut, complete) = if mark { base } else { (offset, complete) }; + if complete && ((other_script && !domain[offset..].contains('.')) || address_follows()) + { + return domain_start + cut; + } + if other_script { + // Past this point the domain itself is internationalized and + // has no script boundary to split at. + break; + } + } + if character == '.' { + has_dot = true; + label_characters = 0; + label_is_alphabetic = true; + } else { + label_characters += 1; + label_is_alphabetic &= character != '-' && !character.is_numeric(); + } + } + if !address_follows() { + return end; + } + // A domain that ends on a non-ASCII letter has no boundary to give the + // next address. + domain + .char_indices() + .rev() + .find(|(_, character)| !character.is_ascii()) + .map_or(end, |(offset, character)| { + domain_start + offset + character.len_utf8() + }) +} + +/// Start of the local part that ends at `at`, at or after `start`. +/// +/// In front of an ASCII or accented-Latin domain, letters of another script +/// are surrounding text when ASCII or Latin characters follow them, so the +/// local part starts after the last such letter: `メールはalice@example.com` +/// reports `alice@example.com`. A local part that ends in another script +/// (`用户@example.com`) and any local part of an internationalized domain +/// (`用户@例子.广告`) are kept whole, because nothing separates such a mailbox +/// name from text written before it. +fn local_start(text: &str, start: usize, at: usize, end: usize) -> usize { + if OTHER_SCRIPT_RE.is_match(&text[at + 1..end]) { + return start; + } + let Some(other_script) = OTHER_SCRIPT_RE.find_iter(&text[start..at]).last() else { + return start; + }; + let mut local = start + other_script.end(); + for character in text[local..at].chars() { + if character != '.' && !(!character.is_ascii() && is_mark(character)) { + break; + } + local += character.len_utf8(); + } + if local < at { local } else { start } +} + fn detect_slice(text: &str, start: usize, end: usize, candidates: &mut Vec) { let first = candidates.len(); detect_email(&text[start..end], candidates); diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index 4e802de2..8c19218d 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -3464,23 +3464,50 @@ fn detect_phone_in_line( } } +/// Characters of one dot-separated run of a local part, and of a domain label. +const EMAIL_LOCAL_CLASS: &str = r"[\p{L}\p{M}\p{N}!#$%&'*+/=?^_`{|}~-]"; +const EMAIL_DOMAIN: &str = + r"(?:[\p{L}\p{M}\p{N}](?:[\p{L}\p{M}\p{N}-]{0,61}[\p{L}\p{M}\p{N}])?\.)+[\p{L}\p{M}]{2,}"; + static EMAIL_RE: LazyLock = LazyLock::new(|| { - Regex::new( - r"(?i)[\p{L}\p{M}\p{N}!#$%&'*+/=?^_`{|}~-]+(?:\.[\p{L}\p{M}\p{N}!#$%&'*+/=?^_`{|}~-]+)*@(?:[\p{L}\p{M}\p{N}](?:[\p{L}\p{M}\p{N}-]{0,61}[\p{L}\p{M}\p{N}])?\.)+[\p{L}\p{M}]{2,}", - ) + Regex::new(&format!( + r"(?i){EMAIL_LOCAL_CLASS}+(?:\.{EMAIL_LOCAL_CLASS}+)*@{EMAIL_DOMAIN}" + )) .expect("email regex is valid") }); +/// The rest of an address whose local part is already under way: the remaining +/// local-part characters, then `@` and a domain. +static EMAIL_CONTINUATION_RE: LazyLock = LazyLock::new(|| { + Regex::new(&format!( + r"^{EMAIL_LOCAL_CLASS}*(?:\.{EMAIL_LOCAL_CLASS}+)*@{EMAIL_DOMAIN}" + )) + .expect("email continuation regex is valid") +}); + fn detect_email(text: &str, candidates: &mut Vec) { detect_email_with_context(text, candidates, false); } fn detect_email_with_context(text: &str, candidates: &mut Vec, text_context: bool) { - for matched in EMAIL_RE.find_iter(text) { + // Only non-ASCII letters can join an address to its surroundings, so ASCII + // text keeps the matcher's own boundaries. + let is_ascii = text.is_ascii(); + let mut search_start = 0; + while let Some(matched) = EMAIL_RE.find_at(text, search_start) { + let (matched_start, end) = if is_ascii { + (matched.start(), matched.end()) + } else { + email_context::script_bounds(text, matched.start(), matched.end()) + }; + // The next search resumes at the reported end, so letters removed from + // this domain can begin the following address. + search_start = end; // A match never starts on a dot, so an address written after dots // (`see [1].alice@example.com`, `me...alice@example.com`) is reported // from its first local-part character instead of being dropped. - let neighbor_start = email_start_after_neighbor(text, matched.start(), matched.end()); + // Neighbor and wrapping-quote checks look at the matcher's own end. + let neighbor_start = email_start_after_neighbor(text, matched_start, matched.end()); let start = if text_context { // Text field syntax is removed from the span; explicit ENV/SQL // slices keep their punctuation. @@ -3496,7 +3523,7 @@ fn detect_email_with_context(text: &str, candidates: &mut Vec, text_c candidates.push(Candidate { label: Label::Email, start_byte: start, - end_byte: matched.end(), + end_byte: end, }); } } From f46775efd524d437e9e773fac9473ed96671f431 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 17:49:48 -0800 Subject: [PATCH 2/8] Add script-boundary EMAIL fixtures, regression test, changelog and guide Refs #272 Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01Smu5UBDZuKK1PoTZh8DNKv --- CHANGELOG.md | 14 ++++++++++ crates/core/tests/review_regressions.rs | 35 +++++++++++++++++++++++++ docs/guides/email-boundaries.mdx | 28 ++++++++++++++++++++ fixtures/email-context.jsonl | 21 +++++++++++++++ 4 files changed, 98 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eee712c8..8547fe50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,20 @@ Earlier release notes are in [docs/releases](docs/releases/). ## [Unreleased] +### Fixed + +- Report every ASCII-form EMAIL in text written without spaces (#272). Since + 1.5.0 a non-ASCII letter between two addresses was read as part of the first + address's top-level domain, so `alice@example.comとbob@example.net` produced + one finding and redacted to `[EMAIL]@example.net`; both addresses are now + found. A sentence in another script in front of an address is no longer read + as its local part, so `SSNは123-45-6789でメールはalice@example.comです` + reports `alice@example.com` and the SSN separately. Internationalized and + accented addresses such as `用户@例子.广告` and `jörg@müller.de` keep their + full span. A local part that mixes another script with a trailing ASCII name + in front of a Latin domain (`用户alice@example.com`) is now reported from the + ASCII name. See the [email boundaries guide](docs/guides/email-boundaries.mdx). + ## [1.7.0] - 2026-11-17 ### Changed diff --git a/crates/core/tests/review_regressions.rs b/crates/core/tests/review_regressions.rs index db5898ad..90fbf111 100644 --- a/crates/core/tests/review_regressions.rs +++ b/crates/core/tests/review_regressions.rs @@ -379,3 +379,38 @@ fn context_suppression_and_encoded_wrappers_cover_review_edges() { assert_eq!(values(&wrapped, "PRIVATE_KEY"), [key]); } } + +#[test] +fn email_in_unspaced_text_leaves_neighboring_values_and_addresses_reported() { + for (text, entity_type, value) in [ + ( + "SSNは123-45-6789でメールはalice@example.comです", + "SSN", + "123-45-6789", + ), + ( + "カード番号は4111 1111 1111 1111でメールはalice@example.comです", + "CREDIT_CARD", + "4111 1111 1111 1111", + ), + ( + "電話は(212) 555-0100でメールはalice@example.comです", + "PHONE", + "(212) 555-0100", + ), + ] { + assert_eq!(values(text, entity_type), [value], "{text}"); + assert_eq!(values(text, "EMAIL"), ["alice@example.com"], "{text}"); + } + for separator in ["と", "é", "à", "и", "和", "와", "或", "و", "\u{301}", "é."] { + let text = format!("alice@example.com{separator}bob@example.net"); + let emails = values(&text, "EMAIL"); + assert_eq!(emails.len(), 2, "{text}"); + assert!(emails[0].starts_with("alice@example.co"), "{text}"); + assert!(emails[1].ends_with("bob@example.net"), "{text}"); + } + // Internationalized and accented addresses keep their full span. + for address in ["用户@例子.广告", "josé@example.com", "jörg@müller.de"] { + assert_eq!(values(address, "EMAIL"), [address]); + } +} diff --git a/docs/guides/email-boundaries.mdx b/docs/guides/email-boundaries.mdx index fbb11e54..237da3ea 100644 --- a/docs/guides/email-boundaries.mdx +++ b/docs/guides/email-boundaries.mdx @@ -16,6 +16,34 @@ text mode leaves alone. This setting changes email boundaries only; other detectors keep their existing behavior. It does not validate the file or guarantee syntax preservation for every entity type or SQL dialect. +## Addresses next to other scripts + +Unicode letters are valid in addresses, and text in many languages is written +without spaces, so the letters around an address cannot all belong to it. In +text that contains non-ASCII letters, a match is narrowed as follows: + +- A domain made of ASCII or accented-Latin labels ends at the first letter of + another script in its last label: `alice@example.comです` reports + `alice@example.com`. +- A domain ends at its first non-ASCII letter when another address begins + there: `alice@example.comとbob@example.net` and + `alice@example.comébob@example.net` each report two addresses. With an + accented Latin letter the letter is reported with the second address + (`ébob@example.net`), because it could belong to it. +- In front of an ASCII or accented-Latin domain, the local part starts after + the last letter of another script: `メールはalice@example.com` reports + `alice@example.com`, so a sentence and the SSN, card or phone number in it + are not covered by the EMAIL finding. `用户alice@example.com` is therefore + reported as `alice@example.com`. + +Internationalized addresses are kept whole: `用户@例子.广告`, +`jörg@müller.de`, `josé@example.com`, and `joséalice@example.com` each report +their full span. A local part that ends in a non-Latin script +(`用户@example.com`) or belongs to a non-Latin domain is not narrowed, since +nothing marks where it starts; in unspaced text such a finding can still +include the words before it. The full-width at sign `@` and full-width dot +`.` are not treated as address syntax. ASCII-only text is unaffected. + ## Usage ```python diff --git a/fixtures/email-context.jsonl b/fixtures/email-context.jsonl index da664c37..fa6a3b0a 100644 --- a/fixtures/email-context.jsonl +++ b/fixtures/email-context.jsonl @@ -77,3 +77,24 @@ {"id":"sql-dot-after-parenthesis","config":{"format":"sql"},"text":"SELECT f(x).alice@example.com; -- [1].bob@example.org","matches":[{"text":"alice@example.com","start":12,"end":29},{"text":"bob@example.org","start":38,"end":53}],"outputs":{"redact":"SELECT f(x).[EMAIL]; -- [1].[EMAIL]","mask":"SELECT f(x).*****************; -- [1].***************","remove":"SELECT f(x).; -- [1]."}} {"id":"text-label-after-delimiter-dot","config":{"format":"text"},"text":"Reach ?.email=alice@example.com","matches":[{"text":"alice@example.com","start":14,"end":31}],"outputs":{"redact":"Reach ?.email=[EMAIL]","mask":"Reach ?.email=*****************","remove":"Reach ?.email="}} {"id":"text-markup-after-delimiter-dot","config":{"format":"text"},"text":"x|.{alice@example.com}","matches":[{"text":"alice@example.com","start":4,"end":21}],"outputs":{"redact":"x|.{[EMAIL]}","mask":"x|.{*****************}","remove":"x|.{}"}} +{"id":"text-script-boundary-hiragana","config":{"format":"text"},"text":"alice@example.comとbob@example.net","matches":[{"text":"alice@example.com","start":0,"end":17},{"text":"bob@example.net","start":18,"end":33}],"outputs":{"redact":"[EMAIL]と[EMAIL]","mask":"*****************と***************","remove":"と"}} +{"id":"text-script-boundary-han","config":{"format":"text"},"text":"alice@example.com和bob@example.net","matches":[{"text":"alice@example.com","start":0,"end":17},{"text":"bob@example.net","start":18,"end":33}],"outputs":{"redact":"[EMAIL]和[EMAIL]","mask":"*****************和***************","remove":"和"}} +{"id":"text-script-boundary-cyrillic","config":{"format":"text"},"text":"alice@example.comиbob@example.net","matches":[{"text":"alice@example.com","start":0,"end":17},{"text":"bob@example.net","start":18,"end":33}],"outputs":{"redact":"[EMAIL]и[EMAIL]","mask":"*****************и***************","remove":"и"}} +{"id":"text-script-boundary-hangul","config":{"format":"text"},"text":"alice@example.com와bob@example.net","matches":[{"text":"alice@example.com","start":0,"end":17},{"text":"bob@example.net","start":18,"end":33}],"outputs":{"redact":"[EMAIL]와[EMAIL]","mask":"*****************와***************","remove":"와"}} +{"id":"text-script-boundary-arabic","config":{"format":"text"},"text":"العنوانalice@example.comو bob@example.net","matches":[{"text":"alice@example.com","start":7,"end":24},{"text":"bob@example.net","start":26,"end":41}],"outputs":{"redact":"العنوان[EMAIL]و [EMAIL]","mask":"العنوان*****************و ***************","remove":"العنوانو "}} +{"id":"text-script-boundary-latin-accent","config":{"format":"text"},"text":"alice@example.comébob@example.net","matches":[{"text":"alice@example.com","start":0,"end":17},{"text":"ébob@example.net","start":17,"end":33}],"outputs":{"redact":"[EMAIL][EMAIL]","mask":"*********************************","remove":""}} +{"id":"text-script-boundary-combining-mark","config":{"format":"text"},"text":"alice@example.comébob@example.net","matches":[{"text":"alice@example.com","start":0,"end":17},{"text":"ébob@example.net","start":17,"end":34}],"outputs":{"redact":"[EMAIL][EMAIL]","mask":"**********************************","remove":""}} +{"id":"text-script-boundary-accent-dot","config":{"format":"text"},"text":"alice@example.comé.bob@example.net","matches":[{"text":"alice@example.com","start":0,"end":17},{"text":"é.bob@example.net","start":17,"end":34}],"outputs":{"redact":"[EMAIL][EMAIL]","mask":"**********************************","remove":""}} +{"id":"text-script-boundary-japanese-sentence","config":{"format":"text"},"text":"連絡先はalice@example.comまたはbob@example.netです","matches":[{"text":"alice@example.com","start":4,"end":21},{"text":"bob@example.net","start":24,"end":39}],"outputs":{"redact":"連絡先は[EMAIL]または[EMAIL]です","mask":"連絡先は*****************または***************です","remove":"連絡先はまたはです"}} +{"id":"text-script-boundary-ssn-sentence","config":{"format":"text"},"text":"SSNは123-45-6789でメールはalice@example.comです","matches":[{"text":"alice@example.com","start":20,"end":37}],"outputs":{"redact":"SSNは123-45-6789でメールは[EMAIL]です","mask":"SSNは123-45-6789でメールは*****************です","remove":"SSNは123-45-6789でメールはです"}} +{"id":"text-script-boundary-card-sentence","config":{"format":"text"},"text":"カード番号は4111 1111 1111 1111でメールはalice@example.comです","matches":[{"text":"alice@example.com","start":30,"end":47}],"outputs":{"redact":"カード番号は4111 1111 1111 1111でメールは[EMAIL]です","mask":"カード番号は4111 1111 1111 1111でメールは*****************です","remove":"カード番号は4111 1111 1111 1111でメールはです"}} +{"id":"text-script-boundary-phone-sentence","config":{"format":"text"},"text":"電話は(212) 555-0100でメールはalice@example.comです","matches":[{"text":"alice@example.com","start":22,"end":39}],"outputs":{"redact":"電話は(212) 555-0100でメールは[EMAIL]です","mask":"電話は(212) 555-0100でメールは*****************です","remove":"電話は(212) 555-0100でメールはです"}} +{"id":"text-script-boundary-emoji","config":{"format":"text"},"text":"alice@example.com😀bob@example.net","matches":[{"text":"alice@example.com","start":0,"end":17},{"text":"bob@example.net","start":18,"end":33}],"outputs":{"redact":"[EMAIL]😀[EMAIL]","mask":"*****************😀***************","remove":"😀"}} +{"id":"text-internationalized-address-kept","config":{"format":"text"},"text":"用户@例子.广告","matches":[{"text":"用户@例子.广告","start":0,"end":8}],"outputs":{"redact":"[EMAIL]","mask":"********","remove":""}} +{"id":"text-accented-local-kept","config":{"format":"text"},"text":"josé@example.com","matches":[{"text":"josé@example.com","start":0,"end":16}],"outputs":{"redact":"[EMAIL]","mask":"****************","remove":""}} +{"id":"text-accented-prefix-kept","config":{"format":"text"},"text":"joséalice@example.com","matches":[{"text":"joséalice@example.com","start":0,"end":21}],"outputs":{"redact":"[EMAIL]","mask":"*********************","remove":""}} +{"id":"text-internationalized-domain-then-address","config":{"format":"text"},"text":"用户@例子.中文网bob@example.net","matches":[{"text":"用户@例子.中文网","start":0,"end":9},{"text":"bob@example.net","start":9,"end":24}],"outputs":{"redact":"[EMAIL][EMAIL]","mask":"************************","remove":""}} +{"id":"text-fullwidth-at-unsupported","config":{"format":"text"},"text":"alice@example.com","matches":[],"outputs":{"redact":"alice@example.com","mask":"alice@example.com","remove":"alice@example.com"}} +{"id":"text-fullwidth-dot-unsupported","config":{"format":"text"},"text":"alice@example.com","matches":[],"outputs":{"redact":"alice@example.com","mask":"alice@example.com","remove":"alice@example.com"}} +{"id":"sql-script-boundary","config":{"format":"sql"},"text":"SELECT 'alice@example.comとbob@example.net';","matches":[{"text":"alice@example.com","start":8,"end":25},{"text":"bob@example.net","start":26,"end":41}],"outputs":{"redact":"SELECT '[EMAIL]と[EMAIL]';","mask":"SELECT '*****************と***************';","remove":"SELECT 'と';"}} +{"id":"env-script-boundary","config":{"format":"env"},"text":"EMAIL=メールはalice@example.comです","matches":[{"text":"alice@example.com","start":10,"end":27}],"outputs":{"redact":"EMAIL=メールは[EMAIL]です","mask":"EMAIL=メールは*****************です","remove":"EMAIL=メールはです"}} From 89b0f0dc0fc58ee9e881ec8b1c57e8c61ca3247f Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 18:03:10 -0800 Subject: [PATCH 3/8] Keep every address covered when a domain runs into the next address A short differential run against 0.4.4 and 1.7.0 showed two losses in the first version of the boundary rule: a domain followed by label syntax was truncated, and a combining mark moved its base letter out of the first address. Split only at the non-ASCII character itself, hand trailing letters to a directly following address, and report both addresses as one span when no boundary exists. Refs #272 Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01Smu5UBDZuKK1PoTZh8DNKv --- crates/core/src/email_context.rs | 84 +++++++++++++++++++------------- docs/guides/email-boundaries.mdx | 4 ++ fixtures/email-context.jsonl | 2 +- 3 files changed, 56 insertions(+), 34 deletions(-) diff --git a/crates/core/src/email_context.rs b/crates/core/src/email_context.rs index 626582ec..c6fff3a9 100644 --- a/crates/core/src/email_context.rs +++ b/crates/core/src/email_context.rs @@ -92,51 +92,49 @@ fn is_mark(character: char) -> bool { /// local part. Internationalized addresses stay whole: a part is only split /// where an ASCII or accented-Latin address meets another script, or where the /// end of a domain is the beginning of another address. +/// +/// The returned end can lie past `end` when two addresses share letters that +/// cannot be assigned to either; see [`domain_end`]. pub(super) fn script_bounds(text: &str, start: usize, end: usize) -> (usize, usize) { let Some(at) = text[start..end].find('@').map(|offset| start + offset) else { return (start, end); }; - let end = domain_end(text, at + 1, end); - (local_start(text, start, at, end), end) + let domain_end = domain_end(text, at + 1, end); + ( + local_start(text, start, at, domain_end.min(end)), + domain_end, + ) } -/// End of the domain that starts at `domain_start`, at or before `end`. +/// End of the domain that starts at `domain_start`; `end` is the matcher's. /// /// The domain stops at its first non-ASCII character when the labels before it /// are a complete ASCII or accented-Latin domain and either another address /// begins there (`alice@example.comébob@example.net`) or the character starts /// a different script in the last label (`alice@example.comです`): no -/// top-level domain continues from Latin letters into another script. A -/// combining mark stays with its base letter, so composed and decomposed -/// spellings split at the same place. When no such point exists and another -/// address still begins inside the domain, the domain ends where that -/// address's ASCII local part begins, so both remain covered. +/// top-level domain continues from Latin letters into another script. +/// +/// A domain that runs straight into the `@` of another address without such a +/// point gives up its trailing ASCII or Latin letters to that address. When it +/// has none, the two addresses cannot be told apart and are reported as one +/// span, so the second domain is never left out. fn domain_end(text: &str, domain_start: usize, end: usize) -> usize { let domain = &text[domain_start..end]; - if domain.is_ascii() { - return end; - } let mut address_follows = None; let mut address_follows = || *address_follows.get_or_insert_with(|| EMAIL_CONTINUATION_RE.is_match(&text[end..])); let mut has_dot = false; let mut label_characters = 0; let mut label_is_alphabetic = true; - // Offset of the latest non-mark character, and whether the domain was - // complete before it. - let mut base = (0, false); for (offset, character) in domain.char_indices() { - let complete = has_dot && label_characters >= 2 && label_is_alphabetic; - let mark = !character.is_ascii() && is_mark(character); - if !mark { - base = (offset, complete); - } if !character.is_ascii() { - let other_script = !mark && is_other_script(character); - let (cut, complete) = if mark { base } else { (offset, complete) }; - if complete && ((other_script && !domain[offset..].contains('.')) || address_follows()) + let other_script = is_other_script(character); + if has_dot + && label_characters >= 2 + && label_is_alphabetic + && ((other_script && !domain[offset..].contains('.')) || address_follows()) { - return domain_start + cut; + return domain_start + offset; } if other_script { // Past this point the domain itself is internationalized and @@ -153,18 +151,38 @@ fn domain_end(text: &str, domain_start: usize, end: usize) -> usize { label_is_alphabetic &= character != '-' && !character.is_numeric(); } } - if !address_follows() { + if !text[end..].starts_with('@') { return end; } - // A domain that ends on a non-ASCII letter has no boundary to give the - // next address. - domain - .char_indices() - .rev() - .find(|(_, character)| !character.is_ascii()) - .map_or(end, |(offset, character)| { - domain_start + offset + character.len_utf8() + let next_local = OTHER_SCRIPT_RE + .find_iter(domain) + .last() + .map(|other_script| other_script.end()) + .or_else(|| { + domain + .char_indices() + .rev() + .find(|(_, character)| !character.is_ascii()) + .map(|(offset, character)| offset + character.len_utf8()) }) + .map(|tail| { + tail + domain[tail..] + .chars() + .take_while(|character| !character.is_ascii() && is_mark(*character)) + .map(char::len_utf8) + .sum::() + }); + if let Some(next_local) = next_local.filter(|next_local| *next_local < domain.len()) { + return domain_start + next_local; + } + let mut end = end; + while text[end..].starts_with('@') { + match EMAIL_CONTINUATION_RE.find(&text[end..]) { + Some(continuation) => end += continuation.end(), + None => break, + } + } + end } /// Start of the local part that ends at `at`, at or after `start`. @@ -185,7 +203,7 @@ fn local_start(text: &str, start: usize, at: usize, end: usize) -> usize { }; let mut local = start + other_script.end(); for character in text[local..at].chars() { - if character != '.' && !(!character.is_ascii() && is_mark(character)) { + if character != '.' && (character.is_ascii() || !is_mark(character)) { break; } local += character.len_utf8(); diff --git a/docs/guides/email-boundaries.mdx b/docs/guides/email-boundaries.mdx index 237da3ea..faa755c3 100644 --- a/docs/guides/email-boundaries.mdx +++ b/docs/guides/email-boundaries.mdx @@ -30,6 +30,10 @@ text that contains non-ASCII letters, a match is narrowed as follows: `alice@example.comébob@example.net` each report two addresses. With an accented Latin letter the letter is reported with the second address (`ébob@example.net`), because it could belong to it. +- When a non-Latin domain runs into the next address with no such point + (`用户@例子.中文网bob@example.net`), the trailing ASCII letters go to the + second address. If there are none, the two addresses are reported as one + span, so the second domain is always covered. - In front of an ASCII or accented-Latin domain, the local part starts after the last letter of another script: `メールはalice@example.com` reports `alice@example.com`, so a sentence and the SSN, card or phone number in it diff --git a/fixtures/email-context.jsonl b/fixtures/email-context.jsonl index fa6a3b0a..2d4c6a72 100644 --- a/fixtures/email-context.jsonl +++ b/fixtures/email-context.jsonl @@ -83,7 +83,7 @@ {"id":"text-script-boundary-hangul","config":{"format":"text"},"text":"alice@example.com와bob@example.net","matches":[{"text":"alice@example.com","start":0,"end":17},{"text":"bob@example.net","start":18,"end":33}],"outputs":{"redact":"[EMAIL]와[EMAIL]","mask":"*****************와***************","remove":"와"}} {"id":"text-script-boundary-arabic","config":{"format":"text"},"text":"العنوانalice@example.comو bob@example.net","matches":[{"text":"alice@example.com","start":7,"end":24},{"text":"bob@example.net","start":26,"end":41}],"outputs":{"redact":"العنوان[EMAIL]و [EMAIL]","mask":"العنوان*****************و ***************","remove":"العنوانو "}} {"id":"text-script-boundary-latin-accent","config":{"format":"text"},"text":"alice@example.comébob@example.net","matches":[{"text":"alice@example.com","start":0,"end":17},{"text":"ébob@example.net","start":17,"end":33}],"outputs":{"redact":"[EMAIL][EMAIL]","mask":"*********************************","remove":""}} -{"id":"text-script-boundary-combining-mark","config":{"format":"text"},"text":"alice@example.comébob@example.net","matches":[{"text":"alice@example.com","start":0,"end":17},{"text":"ébob@example.net","start":17,"end":34}],"outputs":{"redact":"[EMAIL][EMAIL]","mask":"**********************************","remove":""}} +{"id":"text-script-boundary-combining-mark","config":{"format":"text"},"text":"alice@example.comébob@example.net","matches":[{"text":"alice@example.come","start":0,"end":18},{"text":"́bob@example.net","start":18,"end":34}],"outputs":{"redact":"[EMAIL][EMAIL]","mask":"**********************************","remove":""}} {"id":"text-script-boundary-accent-dot","config":{"format":"text"},"text":"alice@example.comé.bob@example.net","matches":[{"text":"alice@example.com","start":0,"end":17},{"text":"é.bob@example.net","start":17,"end":34}],"outputs":{"redact":"[EMAIL][EMAIL]","mask":"**********************************","remove":""}} {"id":"text-script-boundary-japanese-sentence","config":{"format":"text"},"text":"連絡先はalice@example.comまたはbob@example.netです","matches":[{"text":"alice@example.com","start":4,"end":21},{"text":"bob@example.net","start":24,"end":39}],"outputs":{"redact":"連絡先は[EMAIL]または[EMAIL]です","mask":"連絡先は*****************または***************です","remove":"連絡先はまたはです"}} {"id":"text-script-boundary-ssn-sentence","config":{"format":"text"},"text":"SSNは123-45-6789でメールはalice@example.comです","matches":[{"text":"alice@example.com","start":20,"end":37}],"outputs":{"redact":"SSNは123-45-6789でメールは[EMAIL]です","mask":"SSNは123-45-6789でメールは*****************です","remove":"SSNは123-45-6789でメールはです"}} From d04ff8df1623b8733b0c9e67e76ae36fac66e75d Mon Sep 17 00:00:00 2001 From: Sid Mohan <61345237+sidmohan0@users.noreply.github.com> Date: Wed, 18 Nov 2026 02:48:12 -0800 Subject: [PATCH 4/8] test: qualify mixed-script email coverage against published releases --- .github/workflows/fuzz.yml | 2 +- crates/core/fuzz/.gitignore | 4 + crates/core/fuzz/Cargo.lock | 2 +- crates/core/fuzz/Cargo.toml | 7 + crates/core/fuzz/README.md | 12 +- .../corpus/email_context/combining_mark.bin | 1 + .../email_context/international_domain.bin | 1 + .../corpus/email_context/japanese_ascii.bin | Bin 0 -> 70 bytes .../core/fuzz/fuzz_targets/email_context.rs | 58 ++++ scripts/email-boundary-comparison/.gitignore | 1 + scripts/email-boundary-comparison/Cargo.lock | 309 ++++++++++++++++++ scripts/email-boundary-comparison/Cargo.toml | 13 + scripts/email-boundary-comparison/README.md | 21 ++ scripts/email-boundary-comparison/result.json | 62 ++++ scripts/email-boundary-comparison/src/main.rs | 188 +++++++++++ 15 files changed, 676 insertions(+), 5 deletions(-) create mode 100644 crates/core/fuzz/corpus/email_context/combining_mark.bin create mode 100644 crates/core/fuzz/corpus/email_context/international_domain.bin create mode 100644 crates/core/fuzz/corpus/email_context/japanese_ascii.bin create mode 100644 crates/core/fuzz/fuzz_targets/email_context.rs create mode 100644 scripts/email-boundary-comparison/.gitignore create mode 100644 scripts/email-boundary-comparison/Cargo.lock create mode 100644 scripts/email-boundary-comparison/Cargo.toml create mode 100644 scripts/email-boundary-comparison/README.md create mode 100644 scripts/email-boundary-comparison/result.json create mode 100644 scripts/email-boundary-comparison/src/main.rs diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 6ea25bc9..d57cd1a5 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -60,7 +60,7 @@ jobs: strategy: fail-fast: false matrix: - target: [workspace_snapshot, utf16_range] + target: [workspace_snapshot, utf16_range, email_context] steps: - uses: actions/checkout@v4 with: diff --git a/crates/core/fuzz/.gitignore b/crates/core/fuzz/.gitignore index c58d7519..5f02d2b6 100644 --- a/crates/core/fuzz/.gitignore +++ b/crates/core/fuzz/.gitignore @@ -13,3 +13,7 @@ !/corpus/workspace_snapshot/legacy_v1.cbor !/corpus/workspace_snapshot/legacy_v2.cbor !/corpus/workspace_snapshot/retired.cbor +/corpus/email_context/* +!/corpus/email_context/japanese_ascii.bin +!/corpus/email_context/combining_mark.bin +!/corpus/email_context/international_domain.bin diff --git a/crates/core/fuzz/Cargo.lock b/crates/core/fuzz/Cargo.lock index fbc9fcfa..f7c199a2 100644 --- a/crates/core/fuzz/Cargo.lock +++ b/crates/core/fuzz/Cargo.lock @@ -71,7 +71,7 @@ dependencies = [ [[package]] name = "datafog-core" -version = "1.4.0" +version = "1.7.0" dependencies = [ "base64", "hmac", diff --git a/crates/core/fuzz/Cargo.toml b/crates/core/fuzz/Cargo.toml index 045651e5..6b68d70c 100644 --- a/crates/core/fuzz/Cargo.toml +++ b/crates/core/fuzz/Cargo.toml @@ -28,3 +28,10 @@ path = "fuzz_targets/utf16_range.rs" test = false doc = false bench = false + +[[bin]] +name = "email_context" +path = "fuzz_targets/email_context.rs" +test = false +doc = false +bench = false diff --git a/crates/core/fuzz/README.md b/crates/core/fuzz/README.md index baab200a..cf18f73d 100644 --- a/crates/core/fuzz/README.md +++ b/crates/core/fuzz/README.md @@ -1,6 +1,6 @@ # Fuzz targets -Two `cargo-fuzz` targets for the surfaces that parse untrusted bytes: +Three `cargo-fuzz` targets for the surfaces that parse untrusted bytes: - `workspace_snapshot` — the CBOR workspace snapshot decoder, through the same entry point production uses. Every accepted snapshot must re-encode to the @@ -8,6 +8,10 @@ Two `cargo-fuzz` targets for the surfaces that parse untrusted bytes: - `utf16_range` — UTF-8 byte range to UTF-16 offset conversion. Text is derived from arbitrary bytes via `String::from_utf8_lossy`, and ranges are derived from the text length so out-of-bounds and mid-character endpoints occur. +- `email_context` — two planted ASCII or internationalized addresses in + mixed-script context, with arbitrary UTF-8 text before and after them. Every + address must stay covered by EMAIL findings, and every returned finding must + have faithful byte and UTF-16 ranges. This crate is intentionally not a member of the root workspace: libfuzzer link flags and the nightly-only sanitizer setup must not reach the published crates. @@ -19,11 +23,12 @@ rustup toolchain install nightly cargo install cargo-fuzz --locked --version 0.13.2 cargo +nightly fuzz run workspace_snapshot cargo +nightly fuzz run utf16_range +cargo dfv fuzz run email_context ``` A short bounded run, for example `cargo dfv fuzz run utf16_range -- -runs=20000`, is enough for a smoke check. `cargo dfv fuzz list` lists the targets and -`cargo dfv fuzz build` format-checks and builds both without fuzzing. +`cargo dfv fuzz build` format-checks and builds all three without fuzzing. Crash artefacts land in `artifacts/` (git-ignored). Reproduce one with `cargo +nightly fuzz run artifacts//`, and keep it in @@ -33,6 +38,7 @@ Crash artefacts land in `artifacts/` (git-ignored). Reproduce one with `corpus//` holds a handful of small curated seeds per target so a fresh clone has something to bite on: snapshots from `Workspace::export_bundle`, -`` byte strings for `utf16_range`. A run also grows the +`` byte strings for `utf16_range`, and three context and +address selectors followed by arbitrary text for `email_context`. A run also grows the corpus locally; commit only curated seeds and regression inputs, not the generated output, so the tree stays reviewable. diff --git a/crates/core/fuzz/corpus/email_context/combining_mark.bin b/crates/core/fuzz/corpus/email_context/combining_mark.bin new file mode 100644 index 00000000..446ab47c --- /dev/null +++ b/crates/core/fuzz/corpus/email_context/combining_mark.bin @@ -0,0 +1 @@ +éalice@example.comébob@example.net \ No newline at end of file diff --git a/crates/core/fuzz/corpus/email_context/international_domain.bin b/crates/core/fuzz/corpus/email_context/international_domain.bin new file mode 100644 index 00000000..837e3c4d --- /dev/null +++ b/crates/core/fuzz/corpus/email_context/international_domain.bin @@ -0,0 +1 @@ +用户@例子.广告とjörg@müller.de \ No newline at end of file diff --git a/crates/core/fuzz/corpus/email_context/japanese_ascii.bin b/crates/core/fuzz/corpus/email_context/japanese_ascii.bin new file mode 100644 index 0000000000000000000000000000000000000000..642b20a80c47045bb093b44e2d3d1d32d06cd10d GIT binary patch literal 70 zcmZQzU = text.encode_utf16().collect(); + assert_eq!( + String::from_utf16(&units[mapped.start..mapped.end]).unwrap(), + finding.matched_text + ); + } + for (start, end) in [(first_start, first_end), (second_start, second_end)] { + assert!( + findings.iter().any(|finding| { + finding.entity_type == "EMAIL" + && finding.byte_range.start <= start + && finding.byte_range.end >= end + }), + "planted email was left partly uncovered: {text:?}" + ); + } +}); diff --git a/scripts/email-boundary-comparison/.gitignore b/scripts/email-boundary-comparison/.gitignore new file mode 100644 index 00000000..b83d2226 --- /dev/null +++ b/scripts/email-boundary-comparison/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/scripts/email-boundary-comparison/Cargo.lock b/scripts/email-boundary-comparison/Cargo.lock new file mode 100644 index 00000000..7e1b5630 --- /dev/null +++ b/scripts/email-boundary-comparison/Cargo.lock @@ -0,0 +1,309 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "datafog-core" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "740d0a7a8985f0f4f2f72af1186f6658d6bfc1ca7adb3c9afa951acbaaeed49e" +dependencies = [ + "base64", + "hmac", + "regex", + "serde", + "serde_json", + "sha2", + "zeroize", +] + +[[package]] +name = "datafog-core" +version = "1.7.0" +dependencies = [ + "base64", + "hmac", + "minicbor", + "regex", + "serde", + "serde_json", + "sha2", + "zeroize", +] + +[[package]] +name = "datafog-core" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a88087d5c81a082cf0e9b6d67abaa813474c6e08fb9f5f99e3e018c97b0e9c5e" +dependencies = [ + "base64", + "hmac", + "minicbor", + "regex", + "serde", + "serde_json", + "sha2", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "email-boundary-comparison" +version = "0.0.0" +dependencies = [ + "datafog-core 0.4.4", + "datafog-core 1.7.0", + "datafog-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "minicbor" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c12b4033ffaa92fbf9df03df38d19324f52bad130dd223f811734a8006dd2d69" + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "zeroize" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/scripts/email-boundary-comparison/Cargo.toml b/scripts/email-boundary-comparison/Cargo.toml new file mode 100644 index 00000000..7e5041da --- /dev/null +++ b/scripts/email-boundary-comparison/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "email-boundary-comparison" +version = "0.0.0" +edition = "2024" +publish = false + +[dependencies] +candidate = { package = "datafog-core", path = "../../crates/core" } +before_unicode = { package = "datafog-core", version = "=0.4.4" } +before_fix = { package = "datafog-core", version = "=1.7.0" } +serde_json = "1" + +[workspace] diff --git a/scripts/email-boundary-comparison/README.md b/scripts/email-boundary-comparison/README.md new file mode 100644 index 00000000..0c60a040 --- /dev/null +++ b/scripts/email-boundary-comparison/README.md @@ -0,0 +1,21 @@ +Run from the repository root: + +```sh +cargo run --release --manifest-path scripts/email-boundary-comparison/Cargo.toml > target/email-boundary-comparison.json +``` + +The committed harness compares this checkout with exact published Rust versions +0.4.4 and 1.7.0. It visits every combination of 20 surrounding contexts, 12 email +shapes, eight separators and three source wrappers: 1,382,400 texts containing +6,912,000 planted emails, SSNs, cards and phones. The contexts include ASCII, +Latin accents and combining marks, Hiragana, Han, Hangul, Cyrillic, Arabic, +Hebrew, Devanagari, Bengali, Thai, Khmer, Georgian, Armenian, Greek and emoji. +Wrappers are text, ENV and SQL syntax; all versions use their default scanner. + +The run fails if a planted value covered by its own detector in either baseline +loses that coverage. It separately reports incidental coverage lost when a +different detector's over-wide span previously swallowed a value. Each category +includes its first source text and complete findings, so these cases can be +reproduced and judged without treating accidental EMAIL coverage as a PHONE +detection guarantee. This finite matrix is a regression comparison, not a claim +that every Unicode address or context is recognized. diff --git a/scripts/email-boundary-comparison/result.json b/scripts/email-boundary-comparison/result.json new file mode 100644 index 00000000..0de4bbcb --- /dev/null +++ b/scripts/email-boundary-comparison/result.json @@ -0,0 +1,62 @@ +{ + "cases": 1382400, + "elapsed_seconds": 34.327893333, + "first_example_per_category": { + "1.7.0/PHONE/incidental": { + "baseline_findings": [ + [ + "EMAIL", + 15, + 76 + ] + ], + "candidate_findings": [ + [ + "EMAIL", + 43, + 100 + ] + ], + "planted": { + "end_byte": 31, + "entity": "PHONE", + "start_byte": 19 + }, + "text": "4111 1111 1111 1111212-555-0100メールは123-45-6789alice@example.comalice@example.comメールは" + }, + "1.7.0/SSN/incidental": { + "baseline_findings": [ + [ + "EMAIL", + 27, + 88 + ] + ], + "candidate_findings": [ + [ + "EMAIL", + 66, + 100 + ] + ], + "planted": { + "end_byte": 54, + "entity": "SSN", + "start_byte": 43 + }, + "text": "メールは4111 1111 1111 1111212-555-0100123-45-6789メールはalice@example.comalice@example.com" + } + }, + "incidental_cross_entity_coverage_losses": { + "1.7.0/PHONE/incidental": 505680, + "1.7.0/SSN/incidental": 118440 + }, + "matrix": { + "contexts": 20, + "email_shapes": 12, + "separators": 8, + "source_wrappers": 3 + }, + "planted_values": 6912000, + "same_entity_coverage_losses": {} +} diff --git a/scripts/email-boundary-comparison/src/main.rs b/scripts/email-boundary-comparison/src/main.rs new file mode 100644 index 00000000..b3d55cc0 --- /dev/null +++ b/scripts/email-boundary-comparison/src/main.rs @@ -0,0 +1,188 @@ +//! Exhaustive, deterministic differential coverage check for PR #273. +use serde_json::json; +use std::collections::BTreeMap; +use std::time::Instant; + +type Span = (String, usize, usize); + +fn covered(spans: &[Span], entity: Option<&str>, start: usize, end: usize) -> bool { + let mut ranges: Vec<_> = spans + .iter() + .filter(|(kind, _, _)| entity.is_none_or(|entity| kind == entity)) + .map(|(_, start, end)| (*start, *end)) + .collect(); + ranges.sort_unstable(); + let mut cursor = start; + for (left, right) in ranges { + if left > cursor { + break; + } + cursor = cursor.max(right); + if cursor >= end { + return true; + } + } + false +} + +macro_rules! spans { + ($api:ident, $text:expr) => { + $api::scan($text) + .into_iter() + .map(|finding| { + ( + finding.entity_type, + finding.byte_range.start, + finding.byte_range.end, + ) + }) + .collect::>() + }; +} + +fn plant(text: &mut String, planted: &mut Vec, entity: &str, value: &str) { + let start = text.len(); + text.push_str(value); + planted.push((entity.to_owned(), start, text.len())); +} + +fn main() { + // Every combination is visited; there is no random seed or sampling cutoff. + let contexts = [ + "", + "contact", + "メールは", + "です", + "用户", + "电子邮件", + "연락처", + "почта", + "البريد", + "דוא״ל", + "ईमेल", + "ইমেইল", + "อีเมล", + "អ៊ីមែល", + "ელფოსტა", + "էլփոստ", + "ηλεκτρονικό", + "jörg", + "e\u{301}", + "😀", + ]; + let emails = [ + "alice@example.com", + "b@example.net", + "first.last+tag@example.co.uk", + "user_name@sub.example.org", + "a-b@a-b.example", + "123@example.com", + "josé@example.com", + "jörg@müller.de", + "e\u{301}@example.com", + "用户@例子.广告", + "почта@пример.рф", + "ébob@example.net", + ]; + let separators = ["", ".", "-", "/", " ", "\n", ",", "です"]; + let started = Instant::now(); + let mut cases = 0usize; + let mut values = 0usize; + let mut same_entity_losses = BTreeMap::::new(); + let mut incidental_losses = BTreeMap::::new(); + let mut examples = BTreeMap::new(); + for prefix in contexts { + for suffix in contexts { + for first in emails { + for second in emails { + for separator in separators { + for format in ["text", "env", "sql"] { + let mut text = match format { + "env" => "CONTACT=\"".to_owned(), + "sql" => "INSERT INTO contacts VALUES ('".to_owned(), + _ => String::new(), + }; + let mut planted = Vec::new(); + text.push_str(prefix); + plant( + &mut text, + &mut planted, + "CREDIT_CARD", + "4111 1111 1111 1111", + ); + text.push_str(separator); + plant(&mut text, &mut planted, "PHONE", "212-555-0100"); + text.push_str(suffix); + plant(&mut text, &mut planted, "SSN", "123-45-6789"); + text.push_str(prefix); + plant(&mut text, &mut planted, "EMAIL", first); + text.push_str(separator); + plant(&mut text, &mut planted, "EMAIL", second); + text.push_str(suffix); + match format { + "env" => text.push('"'), + "sql" => text.push_str("');"), + _ => {} + } + let candidate = spans!(candidate, &text); + let baselines = [ + ("0.4.4", spans!(before_unicode, &text)), + ("1.7.0", spans!(before_fix, &text)), + ]; + for (baseline, findings) in baselines { + for (entity, start, end) in &planted { + if covered(&candidate, Some(entity), *start, *end) { + continue; + } + let same_entity = + covered(&findings, Some(entity), *start, *end); + let incidental = covered(&findings, None, *start, *end) + && !covered(&candidate, None, *start, *end); + if !same_entity && !incidental { + continue; + } + let category = if same_entity { + "same_entity" + } else { + "incidental" + }; + let key = format!("{baseline}/{entity}/{category}"); + let counts = if same_entity { + &mut same_entity_losses + } else { + &mut incidental_losses + }; + *counts.entry(key.clone()).or_default() += 1; + examples.entry(key).or_insert_with(|| json!({ + "text": text, + "planted": {"entity":entity, "start_byte":start,"end_byte":end}, + "baseline_findings": findings, + "candidate_findings": candidate, + })); + } + } + cases += 1; + values += planted.len(); + } + } + } + } + } + } + println!( + "{}", + serde_json::to_string_pretty(&json!({ + "matrix": {"contexts":contexts.len(), "email_shapes":emails.len(), + "separators":separators.len(), "source_wrappers":3}, + "cases":cases, "planted_values":values, + "elapsed_seconds":started.elapsed().as_secs_f64(), + "same_entity_coverage_losses":same_entity_losses, + "incidental_cross_entity_coverage_losses":incidental_losses, + "first_example_per_category":examples, + })) + .unwrap() + ); + if !same_entity_losses.is_empty() { + std::process::exit(1); + } +} From e94b2e328d9f6b2ceb0738d66a2d9a925d501460 Mon Sep 17 00:00:00 2001 From: Sid Mohan <61345237+sidmohan0@users.noreply.github.com> Date: Wed, 18 Nov 2026 02:53:04 -0800 Subject: [PATCH 5/8] test: document deliberate mixed-script mailbox narrowing --- CHANGELOG.md | 6 ++++++ docs/guides/email-boundaries.mdx | 9 ++++++++- fixtures/email-context.jsonl | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8547fe50..436ceca9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,12 @@ Earlier release notes are in [docs/releases](docs/releases/). full span. A local part that mixes another script with a trailing ASCII name in front of a Latin domain (`用户alice@example.com`) is now reported from the ASCII name. See the [email boundaries guide](docs/guides/email-boundaries.mdx). +- The same policy narrows mixed-script local parts and final domain labels: + `δοκιμήtest@example.com` reports `test@example.com`, and + `alice@example.coм` (Cyrillic `м`) reports `alice@example.co`. The excluded + letters stay visible. These shapes cannot be distinguished from surrounding + unspaced prose; complete coverage of every mixed-script address is not + guaranteed. Both examples have shared Rust/Python/Node/WASM fixtures. ## [1.7.0] - 2026-11-17 diff --git a/docs/guides/email-boundaries.mdx b/docs/guides/email-boundaries.mdx index faa755c3..844b618a 100644 --- a/docs/guides/email-boundaries.mdx +++ b/docs/guides/email-boundaries.mdx @@ -40,7 +40,7 @@ text that contains non-ASCII letters, a match is narrowed as follows: are not covered by the EMAIL finding. `用户alice@example.com` is therefore reported as `alice@example.com`. -Internationalized addresses are kept whole: `用户@例子.广告`, +Addresses such as `用户@例子.广告`, `jörg@müller.de`, `josé@example.com`, and `joséalice@example.com` each report their full span. A local part that ends in a non-Latin script (`用户@example.com`) or belongs to a non-Latin domain is not narrowed, since @@ -48,6 +48,13 @@ nothing marks where it starts; in unspaced text such a finding can still include the words before it. The full-width at sign `@` and full-width dot `.` are not treated as address syntax. ASCII-only text is unaffected. +These rules deliberately narrow some mixed-script addresses as well as prose. +`δοκιμήtest@example.com` reports `test@example.com`, leaving `δοκιμή` visible. +`alice@example.coм` (a Cyrillic final `м`) reports `alice@example.co`, leaving +that final letter visible. The scanner cannot distinguish those valid address +shapes from surrounding unspaced text. Complete coverage of every mixed-script +mailbox is therefore not guaranteed. + ## Usage ```python diff --git a/fixtures/email-context.jsonl b/fixtures/email-context.jsonl index 2d4c6a72..d99b1b04 100644 --- a/fixtures/email-context.jsonl +++ b/fixtures/email-context.jsonl @@ -98,3 +98,5 @@ {"id":"text-fullwidth-dot-unsupported","config":{"format":"text"},"text":"alice@example.com","matches":[],"outputs":{"redact":"alice@example.com","mask":"alice@example.com","remove":"alice@example.com"}} {"id":"sql-script-boundary","config":{"format":"sql"},"text":"SELECT 'alice@example.comとbob@example.net';","matches":[{"text":"alice@example.com","start":8,"end":25},{"text":"bob@example.net","start":26,"end":41}],"outputs":{"redact":"SELECT '[EMAIL]と[EMAIL]';","mask":"SELECT '*****************と***************';","remove":"SELECT 'と';"}} {"id":"env-script-boundary","config":{"format":"env"},"text":"EMAIL=メールはalice@example.comです","matches":[{"text":"alice@example.com","start":10,"end":27}],"outputs":{"redact":"EMAIL=メールは[EMAIL]です","mask":"EMAIL=メールは*****************です","remove":"EMAIL=メールはです"}} +{"id":"text-mixed-script-local-narrowing","config":{"format":"text"},"text":"δοκιμήtest@example.com","matches":[{"text":"test@example.com","start":6,"end":22}],"outputs":{"redact":"δοκιμή[EMAIL]","mask":"δοκιμή****************","remove":"δοκιμή"}} +{"id":"text-mixed-script-final-label-narrowing","config":{"format":"text"},"text":"alice@example.coм","matches":[{"text":"alice@example.co","start":0,"end":16}],"outputs":{"redact":"[EMAIL]м","mask":"****************м","remove":"м"}} From a092ff5a0f6fd93ea7ffc9d6578687d25c938b0e Mon Sep 17 00:00:00 2001 From: Sid Mohan <61345237+sidmohan0@users.noreply.github.com> Date: Wed, 18 Nov 2026 02:54:03 -0800 Subject: [PATCH 6/8] chore: prepare coordinated Core 1.8.0 release --- CHANGELOG.md | 8 ++ Cargo.lock | 8 +- README.md | 28 +++---- bindings/node/Cargo.toml | 4 +- bindings/node/package-lock.json | 4 +- bindings/node/package.json | 2 +- bindings/python/Cargo.toml | 4 +- bindings/python/pyproject.toml | 2 +- bindings/wasm/Cargo.toml | 4 +- bindings/wasm/package-lock.json | 4 +- bindings/wasm/package.json | 2 +- crates/core/Cargo.toml | 2 +- crates/core/fuzz/Cargo.lock | 2 +- docs/docs.json | 1 + docs/get-started/installation.mdx | 11 ++- docs/releases/1-8-0.mdx | 74 +++++++++++++++++++ integrations/fogvault-browser/package.json | 4 +- .../fogvault-legacy-browser/package-lock.json | 8 +- .../fogvault-legacy-browser/package.json | 6 +- integrations/fogvault-migration/Cargo.lock | 4 +- integrations/fogvault-migration/Cargo.toml | 4 +- integrations/fogvault-native/Cargo.lock | 12 +-- integrations/fogvault-native/Cargo.toml | 6 +- integrations/fogvault-node/Cargo.lock | 10 +-- integrations/fogvault-node/Cargo.toml | 8 +- integrations/fogvault-node/package-lock.json | 4 +- integrations/fogvault-node/package.json | 2 +- integrations/fogvault-python/Cargo.lock | 10 +-- integrations/fogvault-python/Cargo.toml | 8 +- integrations/fogvault-python/pyproject.toml | 2 +- integrations/sqlite-browser/package.json | 4 +- scripts/email-boundary-comparison/Cargo.lock | 8 +- 32 files changed, 171 insertions(+), 89 deletions(-) create mode 100644 docs/releases/1-8-0.mdx diff --git a/CHANGELOG.md b/CHANGELOG.md index 8547fe50..dbeb34b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ Earlier release notes are in [docs/releases](docs/releases/). ## [Unreleased] +## [1.8.0] - 2026-11-18 + +### Changed + +- Release coordinated Core SDK and companion packages at 1.8.0. Finding + boundaries change for EMAIL; consumers pinned to `<1.8` must admit the new + minor line to receive the mixed-script boundary fix. + ### Fixed - Report every ASCII-form EMAIL in text written without spaces (#272). Since diff --git a/Cargo.lock b/Cargo.lock index 609a4be4..34acb941 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -122,7 +122,7 @@ checksum = "914a755b7c2d4af2bdcff7ce1739e2db9a1b81a9b07123d8015786ae03c0980d" [[package]] name = "datafog-core" -version = "1.7.0" +version = "1.8.0" dependencies = [ "base64", "futures", @@ -137,7 +137,7 @@ dependencies = [ [[package]] name = "datafog-core-python" -version = "1.7.0" +version = "1.8.0" dependencies = [ "datafog-core", "pyo3", @@ -149,7 +149,7 @@ dependencies = [ [[package]] name = "datafog-node" -version = "1.7.0" +version = "1.8.0" dependencies = [ "datafog-core", "napi", @@ -161,7 +161,7 @@ dependencies = [ [[package]] name = "datafog-wasm" -version = "1.7.0" +version = "1.8.0" dependencies = [ "datafog-core", "serde", diff --git a/README.md b/README.md index 6a7065cc..b04a5bae 100644 --- a/README.md +++ b/README.md @@ -26,22 +26,22 @@ datafog core is a Rust library with Python, Node.js, and browser WebAssembly bin Rule-based scanning runs locally without model weights or downloads. Optional local model sessions add datafog and GLiNER2 support in Rust, Python, and Node.js. -**Release:** coordinated [Core 1.7.0](https://github.com/DataFog/datafog-core/releases/tag/v1.7.0) for Python, Rust, Node.js, WASM and the Core-owned companion packages · [1.7 release notes](docs/releases/1-7-0.mdx) · [Python release history](https://pypi.org/project/datafog-core/#history) · [1.5 migration guide](docs/guides/migrating-to-core-1-5.mdx) · [Earlier cross-SDK 1.1.0 notes](docs/releases/1-1-0.mdx) · [Extension installation and testing](docs/releases/1-1-0-extension-testing.md). +**Release:** coordinated [Core 1.8.0](https://github.com/DataFog/datafog-core/releases/tag/v1.8.0) for Python, Rust, Node.js, WASM and the Core-owned companion packages · [1.8 release notes](docs/releases/1-8-0.mdx) · [Python release history](https://pypi.org/project/datafog-core/#history) · [1.5 migration guide](docs/guides/migrating-to-core-1-5.mdx) · [Earlier cross-SDK 1.1.0 notes](docs/releases/1-1-0.mdx) · [Extension installation and testing](docs/releases/1-1-0-extension-testing.md). -Core 1.5.0 and 1.6.0 have the known [EMAIL boundary regression (#266)](https://github.com/DataFog/datafog-core/issues/266). Core 1.7.0 includes the fixes ([#267](https://github.com/DataFog/datafog-core/pull/267), [#270](https://github.com/DataFog/datafog-core/pull/270)); consumers need to admit 1.7.0 in their version constraints to receive them. Earlier notes: [1.6 release notes](docs/releases/1-6-0.mdx). +Core 1.8.0 fixes EMAIL matching in text written without spaces ([#272](https://github.com/DataFog/datafog-core/issues/272)): `alice@example.comとbob@example.net` now finds both addresses, and `SSNは123-45-6789でメールはalice@example.comです` reports the SSN and address separately. It retains the EMAIL and PHONE fixes from [1.7](docs/releases/1-7-0.mdx). Consumers need to admit 1.8.0 in their version constraints to receive the new fix. Core 1.0 freezes Workspace contract 1 across Rust, Python, Node and browser WASM, with optional native/browser [FogVault integrations](docs/integrations/fogvault.md). Snapshot v3 writes and v1/v2/v3 reads keep their existing semantics. Exact published [0.5.0-beta.3](docs/releases/0-5-0-beta-3.mdx) interchange remains tested; FogVault is independently versioned 0.1.0. ## Quickstart -The coordinated Core release is 1.7.0 across PyPI, crates.io and npm. Applications should lock the exact version they have qualified. The `datafog` Python application and FogVault version independently of Core. +The coordinated Core release is 1.8.0 across PyPI, crates.io and npm. Applications should lock the exact version they have qualified. The `datafog` Python application and FogVault version independently of Core. | SDK | Published install | Requirements | | --- | --- | --- | -| [Python](https://pypi.org/project/datafog-core/) | `python -m pip install datafog-core==1.7.0` | Python 3.10+ | -| [Node.js](https://www.npmjs.com/package/@datafog/node) | `npm install --save-exact @datafog/node@1.7.0` | Node.js 24+ | -| [Rust](https://crates.io/crates/datafog-core) | `cargo add datafog-core@=1.7.0` | Rust 1.88+ | -| [Browser / WASM](https://www.npmjs.com/package/@datafog/wasm) | `npm install --save-exact @datafog/wasm@1.7.0` | Browser with WebAssembly support | +| [Python](https://pypi.org/project/datafog-core/) | `python -m pip install datafog-core==1.8.0` | Python 3.10+ | +| [Node.js](https://www.npmjs.com/package/@datafog/node) | `npm install --save-exact @datafog/node@1.8.0` | Node.js 24+ | +| [Rust](https://crates.io/crates/datafog-core) | `cargo add datafog-core@=1.8.0` | Rust 1.88+ | +| [Browser / WASM](https://www.npmjs.com/package/@datafog/wasm) | `npm install --save-exact @datafog/wasm@1.8.0` | Browser with WebAssembly support | ### Python @@ -121,10 +121,10 @@ console.log(result.text); // Email [EMAIL] -The Python 1.7.0 package ships CPython 3.10+ ABI3 wheels for Linux x64 and +The Python 1.8.0 package ships CPython 3.10+ ABI3 wheels for Linux x64 and ARM64 (`manylinux_2_28` and `musllinux_1_2`), Linux s390x and ppc64le (`manylinux_2_28`), macOS Apple Silicon 11+, and Windows x64/ARM64. The -Node.js 1.7.0 package ships Linux x64/ARM64 GNU, macOS Apple Silicon, and +Node.js 1.8.0 package ships Linux x64/ARM64 GNU, macOS Apple Silicon, and Windows x64 binaries. After 1.6.0, release CI no longer builds or qualifies Intel macOS: future @@ -202,7 +202,7 @@ vault core through the registered native adapter. Install the browser integration: ```bash -npm install --save-exact @datafog/wasm@1.7.0 @datafog/fogvault-browser@0.1.0 @datafog/core-fogvault-browser@1.7.0 +npm install --save-exact @datafog/wasm@1.8.0 @datafog/fogvault-browser@0.1.0 @datafog/core-fogvault-browser@1.8.0 ``` [Integration guide and supported profiles →](docs/integrations/fogvault.md) @@ -217,15 +217,15 @@ Core 1.0 includes optional local sessions for the datafog PII model and GLiNER2 Install the published SDK version for your registry: ```bash -python -m pip install 'datafog-core==1.7.0' -npm install --save-exact @datafog/node@1.7.0 -cargo add datafog-core@=1.7.0 --features models +python -m pip install 'datafog-core==1.8.0' +npm install --save-exact @datafog/node@1.8.0 +cargo add datafog-core@=1.8.0 --features models ``` For GLiNER2, install its optional dependencies in the Python environment used by the runner: ```bash -python -m pip install 'datafog-core[gliner2]==1.7.0' +python -m pip install 'datafog-core[gliner2]==1.8.0' ``` ### Embedded name and address detection diff --git a/bindings/node/Cargo.toml b/bindings/node/Cargo.toml index 462dc725..c1d55a6e 100644 --- a/bindings/node/Cargo.toml +++ b/bindings/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "datafog-node" -version = "1.7.0" +version = "1.8.0" edition = "2024" rust-version = "1.88" description = "Node.js bindings for datafog-core" @@ -11,7 +11,7 @@ repository = "https://github.com/DataFog/datafog-core" crate-type = ["cdylib"] [dependencies] -datafog-core = { version = "=1.7.0", path = "../../crates/core", features = ["models"] } +datafog-core = { version = "=1.8.0", path = "../../crates/core", features = ["models"] } napi = { version = "=3.12.2", features = ["serde-json"] } napi-derive = "=3.6.3" serde_json = "1" diff --git a/bindings/node/package-lock.json b/bindings/node/package-lock.json index 96be78db..ca780e28 100644 --- a/bindings/node/package-lock.json +++ b/bindings/node/package-lock.json @@ -1,12 +1,12 @@ { "name": "@datafog/node", - "version": "1.7.0", + "version": "1.8.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@datafog/node", - "version": "1.7.0", + "version": "1.8.0", "license": "MIT", "devDependencies": { "@napi-rs/cli": "3.8.6", diff --git a/bindings/node/package.json b/bindings/node/package.json index 334973d7..59fba6c8 100644 --- a/bindings/node/package.json +++ b/bindings/node/package.json @@ -1,6 +1,6 @@ { "name": "@datafog/node", - "version": "1.7.0", + "version": "1.8.0", "description": "Fast structured PII detection for Node.js, powered by Rust", "license": "MIT", "repository": { diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml index f56a9201..5ca8fbb0 100644 --- a/bindings/python/Cargo.toml +++ b/bindings/python/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "datafog-core-python" -version = "1.7.0" +version = "1.8.0" edition = "2024" rust-version = "1.88" description = "Python bindings for datafog-core" @@ -16,7 +16,7 @@ crate-type = ["cdylib"] pyo3 = { version = "0.29", features = ["auto-initialize"] } [dependencies] -datafog-core = { version = "=1.7.0", path = "../../crates/core", features = ["models", "embedded-cnn"] } +datafog-core = { version = "=1.8.0", path = "../../crates/core", features = ["models", "embedded-cnn"] } pyo3 = { version = "0.29", features = ["abi3-py310"] } pyo3-async-runtimes = { version = "0.29", features = ["tokio-runtime"] } serde_json = "1" diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index 00512124..4b15f9ea 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "datafog-core" -version = "1.7.0" +version = "1.8.0" description = "Fast structured PII detection implemented in Rust" readme = "../../README.md" license = "MIT" diff --git a/bindings/wasm/Cargo.toml b/bindings/wasm/Cargo.toml index 334b0f12..fffe5c7d 100644 --- a/bindings/wasm/Cargo.toml +++ b/bindings/wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "datafog-wasm" -version = "1.7.0" +version = "1.8.0" edition = "2024" rust-version = "1.88" description = "WebAssembly bindings for datafog-core" @@ -11,7 +11,7 @@ repository = "https://github.com/DataFog/datafog-core" crate-type = ["cdylib"] [dependencies] -datafog-core = { version = "=1.7.0", path = "../../crates/core", features = ["embedded-cnn"] } +datafog-core = { version = "=1.8.0", path = "../../crates/core", features = ["embedded-cnn"] } serde = { version = "1", features = ["derive"] } serde-wasm-bindgen = "0.6" serde_json = "1" diff --git a/bindings/wasm/package-lock.json b/bindings/wasm/package-lock.json index 0b245479..f2d21c78 100644 --- a/bindings/wasm/package-lock.json +++ b/bindings/wasm/package-lock.json @@ -1,12 +1,12 @@ { "name": "@datafog/wasm", - "version": "1.7.0", + "version": "1.8.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@datafog/wasm", - "version": "1.7.0", + "version": "1.8.0", "license": "MIT", "dependencies": { "@huggingface/tokenizers": "0.2.0", diff --git a/bindings/wasm/package.json b/bindings/wasm/package.json index 844b3ef2..ee5c25a8 100644 --- a/bindings/wasm/package.json +++ b/bindings/wasm/package.json @@ -1,6 +1,6 @@ { "name": "@datafog/wasm", - "version": "1.7.0", + "version": "1.8.0", "description": "Fast structured PII detection for browsers, powered by Rust and WebAssembly", "license": "MIT", "repository": { diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index c385184e..fd430676 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "datafog-core" -version = "1.7.0" +version = "1.8.0" edition = "2024" rust-version = "1.88" description = "Fast structured PII detection library" diff --git a/crates/core/fuzz/Cargo.lock b/crates/core/fuzz/Cargo.lock index f7c199a2..cf3827d6 100644 --- a/crates/core/fuzz/Cargo.lock +++ b/crates/core/fuzz/Cargo.lock @@ -71,7 +71,7 @@ dependencies = [ [[package]] name = "datafog-core" -version = "1.7.0" +version = "1.8.0" dependencies = [ "base64", "hmac", diff --git a/docs/docs.json b/docs/docs.json index 89cc916a..ff0ad186 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -151,6 +151,7 @@ { "group": "Releases", "pages": [ + "releases/1-8-0", "releases/1-7-0", "releases/1-6-0", "releases/1-0-0", diff --git a/docs/get-started/installation.mdx b/docs/get-started/installation.mdx index 60ac72c2..202f33c9 100644 --- a/docs/get-started/installation.mdx +++ b/docs/get-started/installation.mdx @@ -56,11 +56,11 @@ npm install @datafog/wasm ## Python wheel and source-build requirements -Python 1.4.0 has CPython 3.10+ ABI3 wheels for: +Python 1.8.0 has CPython 3.10+ ABI3 wheels for: - Linux x64/ARM64 with glibc 2.28+ or musl 1.2+ - Linux s390x/ppc64le with glibc 2.28+ -- macOS Intel 10.12+ or Apple Silicon 11+ +- macOS Apple Silicon 11+ - Windows x64/ARM64 PyPy, free-threaded CPython, older libc versions and other architectures use @@ -72,12 +72,11 @@ Offline installs need these prerequisites provisioned in advance. To require a prebuilt wheel and avoid source-build prerequisites: ```bash -python -m pip install --only-binary=:all: datafog-core==1.4.0 +python -m pip install --only-binary=:all: datafog-core==1.8.0 ``` -The Python registry currently publishes 1.4.0; Rust and npm publish 1.1.0. Use -the versions from the [README](https://github.com/DataFog/datafog-core#quickstart) -when matching findings across runtimes. +The coordinated Core release is 1.8.0 across PyPI, crates.io and npm. Use the +same exact version across runtimes when matching findings. ## Intel macOS release policy diff --git a/docs/releases/1-8-0.mdx b/docs/releases/1-8-0.mdx new file mode 100644 index 00000000..e8b41b6f --- /dev/null +++ b/docs/releases/1-8-0.mdx @@ -0,0 +1,74 @@ +--- +title: "1.8.0" +description: "Keep email addresses covered in text written without spaces." +--- + +Core 1.8.0 fixes EMAIL boundaries in mixed-script text, including Japanese and +Chinese sentences written without spaces around addresses. It is coordinated +across Rust, Python, Node.js, WASM and the Core-owned companion packages. +Workspace contract 1, marker syntax, snapshot formats and supported platforms +remain unchanged from [1.7.0](/releases/1-7-0). + +## Install + +```sh +python -m pip install datafog-core==1.8.0 datafog-fogvault==1.8.0 +npm install --save-exact @datafog/node@1.8.0 @datafog/wasm@1.8.0 +cargo add datafog-core@=1.8.0 +``` + +Consumers constrained to `<1.8` must update their allowed minor line. The +independent FogVault engine keeps its own version; it is not relabeled 1.8.0. + +## EMAIL changes + +- `alice@example.comとbob@example.net` reports both addresses. Versions + 1.5.0–1.7.0 reported one over-wide address and could leave the second domain + in a transformed copy. +- `SSNは123-45-6789でメールはalice@example.comです` reports the SSN and address + separately. A card or phone in the same kind of sentence can also be counted + under its own selected type instead of being swallowed by EMAIL. +- Internationalized addresses such as `用户@例子.广告`, `jörg@müller.de` and + `josé@example.com` retain their complete spans. +- A local part mixing another script with a trailing ASCII name before a Latin + domain, such as `用户alice@example.com`, is now reported from `alice`. The + leading text stays visible unless another selected detector covers it. +- Mixed-script final domain labels can narrow too: `alice@example.coм`, with + Cyrillic `м`, reports `alice@example.co` and leaves that final letter visible. + `δοκιμήtest@example.com` likewise leaves `δοκιμή` visible. These valid + address shapes cannot be distinguished from surrounding unspaced prose; + complete coverage of every mixed-script mailbox is not guaranteed. +- An accented Latin letter between adjacent addresses belongs to the second + address when it can begin that address. Some ambiguous adjacent addresses + are covered as one span. Coverage is preserved without claiming that every + input can be separated into independent mailboxes. + +See [email boundaries](/guides/email-boundaries) for the exact rules and +remaining limitations. ASCII-only matching is unchanged by this release. + +## Coverage and limits + +Tighter EMAIL findings stop removing nearby text as a side effect. A malformed +SSN or phone that its own detector rejects can therefore remain visible where +an over-wide EMAIL previously swallowed it. A clean scan is not proof that the +source contains no sensitive data. Select the relevant types and inspect copies. + +The committed [comparison harness](https://github.com/DataFog/datafog-core/tree/main/scripts/email-boundary-comparison) +visits 1,382,400 mixed-script texts with 6,912,000 planted values against exact +published Rust 0.4.4 and 1.7.0. No value covered by its own EMAIL, SSN, +CREDIT_CARD or PHONE detector in either baseline loses that coverage. The +report separately records lost incidental coverage from another detector. +This finite matrix is regression evidence, not exhaustive Unicode coverage. + +## Coordinated package set + +The 15 Core-owned distributions use 1.8.0: three Rust crates, two Python +distributions and ten npm packages, including platform-specific Node packages +and native/browser adapters. Base Python targets Linux x64/ARM64 GNU and musl, +Linux s390x/ppc64le, macOS ARM64 and Windows x64/ARM64. Base Node targets macOS +ARM64, Linux x64/ARM64 GNU and Windows x64. Optional native Node/Python adapters +retain macOS ARM64, Linux x64 GNU and Windows x64. Intel macOS requires an +unqualified source build. + +Publication requires the exact versioned commit to pass ordinary CI, the +Core/FogVault gate's 19 required scopes and all 12 required native model checks. diff --git a/integrations/fogvault-browser/package.json b/integrations/fogvault-browser/package.json index 8149141b..3e0772ba 100644 --- a/integrations/fogvault-browser/package.json +++ b/integrations/fogvault-browser/package.json @@ -1,6 +1,6 @@ { "name": "@datafog/core-fogvault-browser", - "version": "1.7.0", + "version": "1.8.0", "type": "module", "license": "MIT", "repository": { @@ -23,7 +23,7 @@ "LICENSE" ], "peerDependencies": { - "@datafog/wasm": "^1.7.0", + "@datafog/wasm": "^1.8.0", "@datafog/fogvault-browser": "0.1.0" }, "scripts": { diff --git a/integrations/fogvault-legacy-browser/package-lock.json b/integrations/fogvault-legacy-browser/package-lock.json index 171de3e4..0719b247 100644 --- a/integrations/fogvault-legacy-browser/package-lock.json +++ b/integrations/fogvault-legacy-browser/package-lock.json @@ -1,12 +1,12 @@ { "name": "@datafog/core-fogvault-legacy-browser", - "version": "1.7.0", + "version": "1.8.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@datafog/core-fogvault-legacy-browser", - "version": "1.7.0", + "version": "1.8.0", "license": "MIT", "devDependencies": { "esbuild": "0.28.2", @@ -16,8 +16,8 @@ "typescript": "7.0.2" }, "peerDependencies": { - "@datafog/wasm": "^1.7.0", - "@datafog/core-fogvault-browser": "^1.7.0" + "@datafog/wasm": "^1.8.0", + "@datafog/core-fogvault-browser": "^1.8.0" } }, "node_modules/@esbuild/aix-ppc64": { diff --git a/integrations/fogvault-legacy-browser/package.json b/integrations/fogvault-legacy-browser/package.json index ee019797..3bda2a71 100644 --- a/integrations/fogvault-legacy-browser/package.json +++ b/integrations/fogvault-legacy-browser/package.json @@ -1,6 +1,6 @@ { "name": "@datafog/core-fogvault-legacy-browser", - "version": "1.7.0", + "version": "1.8.0", "type": "module", "license": "MIT", "repository": { @@ -27,8 +27,8 @@ "THIRD_PARTY_NOTICES.md" ], "peerDependencies": { - "@datafog/wasm": "^1.7.0", - "@datafog/core-fogvault-browser": "^1.7.0" + "@datafog/wasm": "^1.8.0", + "@datafog/core-fogvault-browser": "^1.8.0" }, "devDependencies": { "libsodium-wrappers-sumo": "0.8.4", diff --git a/integrations/fogvault-migration/Cargo.lock b/integrations/fogvault-migration/Cargo.lock index 3914df3c..02fb45f5 100644 --- a/integrations/fogvault-migration/Cargo.lock +++ b/integrations/fogvault-migration/Cargo.lock @@ -53,7 +53,7 @@ dependencies = [ [[package]] name = "datafog-core" -version = "1.7.0" +version = "1.8.0" dependencies = [ "base64", "hmac", @@ -67,7 +67,7 @@ dependencies = [ [[package]] name = "datafog-fogvault-migration" -version = "1.7.0" +version = "1.8.0" dependencies = [ "datafog-core", "serde_json", diff --git a/integrations/fogvault-migration/Cargo.toml b/integrations/fogvault-migration/Cargo.toml index e87a9917..eb4bc4b7 100644 --- a/integrations/fogvault-migration/Cargo.toml +++ b/integrations/fogvault-migration/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "datafog-fogvault-migration" -version = "1.7.0" +version = "1.8.0" edition = "2024" rust-version = "1.88" license = "MIT" @@ -10,7 +10,7 @@ readme = "README.md" [workspace] [dependencies] -datafog-core = { version = "=1.7.0", path = "../../crates/core", default-features = false } +datafog-core = { version = "=1.8.0", path = "../../crates/core", default-features = false } zeroize = "1" [dev-dependencies] diff --git a/integrations/fogvault-native/Cargo.lock b/integrations/fogvault-native/Cargo.lock index 16385c6b..c4acc356 100644 --- a/integrations/fogvault-native/Cargo.lock +++ b/integrations/fogvault-native/Cargo.lock @@ -231,7 +231,7 @@ dependencies = [ [[package]] name = "blocking" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" dependencies = [ @@ -444,7 +444,7 @@ dependencies = [ [[package]] name = "datafog-core" -version = "1.7.0" +version = "1.8.0" dependencies = [ "base64", "hmac 0.12.1", @@ -458,19 +458,19 @@ dependencies = [ [[package]] name = "datafog-fogvault-migration" -version = "1.7.0" +version = "1.8.0" dependencies = [ - "datafog-core 1.7.0", + "datafog-core 1.8.0", "zeroize", ] [[package]] name = "datafog-fogvault-native" -version = "1.7.0" +version = "1.8.0" dependencies = [ "chacha20poly1305", "datafog-core 0.5.0-beta.3", - "datafog-core 1.7.0", + "datafog-core 1.8.0", "datafog-fogvault-migration", "fogvault-native", "fs2", diff --git a/integrations/fogvault-native/Cargo.toml b/integrations/fogvault-native/Cargo.toml index 7ba1753c..266f0320 100644 --- a/integrations/fogvault-native/Cargo.toml +++ b/integrations/fogvault-native/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "datafog-fogvault-native" -version = "1.7.0" +version = "1.8.0" edition = "2024" rust-version = "1.89" license = "MIT" @@ -10,8 +10,8 @@ readme = "README.md" [workspace] [dependencies] -datafog-fogvault-migration = { version = "=1.7.0", path = "../fogvault-migration" } -datafog-core = { version = "=1.7.0", path = "../../crates/core", default-features = false } +datafog-fogvault-migration = { version = "=1.8.0", path = "../fogvault-migration" } +datafog-core = { version = "=1.8.0", path = "../../crates/core", default-features = false } fogvault-native = { version = "0.1.0", git = "https://github.com/DataFog/fogvault.git", rev = "f4dc492549b70f0bc44f5c6bf82fe3022353030f", default-features = false } zeroize = "=1.9.1" chacha20poly1305 = "=0.11.0" diff --git a/integrations/fogvault-node/Cargo.lock b/integrations/fogvault-node/Cargo.lock index 97033e9e..4f7083aa 100644 --- a/integrations/fogvault-node/Cargo.lock +++ b/integrations/fogvault-node/Cargo.lock @@ -231,7 +231,7 @@ dependencies = [ [[package]] name = "blocking" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" dependencies = [ @@ -443,7 +443,7 @@ dependencies = [ [[package]] name = "datafog-core" -version = "1.7.0" +version = "1.8.0" dependencies = [ "base64", "hmac 0.12.1", @@ -457,7 +457,7 @@ dependencies = [ [[package]] name = "datafog-fogvault-migration" -version = "1.7.0" +version = "1.8.0" dependencies = [ "datafog-core", "zeroize", @@ -465,7 +465,7 @@ dependencies = [ [[package]] name = "datafog-fogvault-native" -version = "1.7.0" +version = "1.8.0" dependencies = [ "chacha20poly1305", "datafog-core", @@ -482,7 +482,7 @@ dependencies = [ [[package]] name = "datafog-fogvault-node" -version = "1.7.0" +version = "1.8.0" dependencies = [ "datafog-core", "datafog-fogvault-migration", diff --git a/integrations/fogvault-node/Cargo.toml b/integrations/fogvault-node/Cargo.toml index c673d0d2..aeff4e89 100644 --- a/integrations/fogvault-node/Cargo.toml +++ b/integrations/fogvault-node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "datafog-fogvault-node" -version = "1.7.0" +version = "1.8.0" edition = "2024" rust-version = "1.94" publish = false @@ -12,9 +12,9 @@ license = "MIT" crate-type = ["cdylib"] [dependencies] -datafog-fogvault-native = { version = "=1.7.0", path = "../fogvault-native" } -datafog-fogvault-migration = { version = "=1.7.0", path = "../fogvault-migration" } -datafog-core = { version = "=1.7.0", path = "../../crates/core", default-features = false } +datafog-fogvault-native = { version = "=1.8.0", path = "../fogvault-native" } +datafog-fogvault-migration = { version = "=1.8.0", path = "../fogvault-migration" } +datafog-core = { version = "=1.8.0", path = "../../crates/core", default-features = false } napi = { version = "=3.12.2", features = ["serde-json"] } napi-derive = "=3.6.3" serde = { version = "1", features = ["derive"] } diff --git a/integrations/fogvault-node/package-lock.json b/integrations/fogvault-node/package-lock.json index 74f58443..0ec64dfb 100644 --- a/integrations/fogvault-node/package-lock.json +++ b/integrations/fogvault-node/package-lock.json @@ -1,12 +1,12 @@ { "name": "@datafog/core-fogvault-node", - "version": "1.7.0", + "version": "1.8.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@datafog/core-fogvault-node", - "version": "1.7.0", + "version": "1.8.0", "license": "MIT", "devDependencies": { "typescript": "7.0.2" diff --git a/integrations/fogvault-node/package.json b/integrations/fogvault-node/package.json index d627f31a..8819b99c 100644 --- a/integrations/fogvault-node/package.json +++ b/integrations/fogvault-node/package.json @@ -1,6 +1,6 @@ { "name": "@datafog/core-fogvault-node", - "version": "1.7.0", + "version": "1.8.0", "type": "module", "description": "Optional native Core\u2013FogVault integration candidate", "license": "MIT", diff --git a/integrations/fogvault-python/Cargo.lock b/integrations/fogvault-python/Cargo.lock index 84b6fd0e..b907d111 100644 --- a/integrations/fogvault-python/Cargo.lock +++ b/integrations/fogvault-python/Cargo.lock @@ -231,7 +231,7 @@ dependencies = [ [[package]] name = "blocking" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" dependencies = [ @@ -428,7 +428,7 @@ dependencies = [ [[package]] name = "datafog-core" -version = "1.7.0" +version = "1.8.0" dependencies = [ "base64", "hmac 0.12.1", @@ -442,7 +442,7 @@ dependencies = [ [[package]] name = "datafog-fogvault-migration" -version = "1.7.0" +version = "1.8.0" dependencies = [ "datafog-core", "zeroize", @@ -450,7 +450,7 @@ dependencies = [ [[package]] name = "datafog-fogvault-native" -version = "1.7.0" +version = "1.8.0" dependencies = [ "chacha20poly1305", "datafog-core", @@ -467,7 +467,7 @@ dependencies = [ [[package]] name = "datafog-fogvault-python" -version = "1.7.0" +version = "1.8.0" dependencies = [ "datafog-core", "datafog-fogvault-migration", diff --git a/integrations/fogvault-python/Cargo.toml b/integrations/fogvault-python/Cargo.toml index c7ce2d2f..70c9996f 100644 --- a/integrations/fogvault-python/Cargo.toml +++ b/integrations/fogvault-python/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "datafog-fogvault-python" -version = "1.7.0" +version = "1.8.0" edition = "2024" rust-version = "1.89" license = "MIT" @@ -13,9 +13,9 @@ name = "datafog_fogvault" crate-type = ["cdylib"] [dependencies] -datafog-fogvault-native = { version = "=1.7.0", path = "../fogvault-native" } -datafog-fogvault-migration = { version = "=1.7.0", path = "../fogvault-migration" } -datafog-core = { version = "=1.7.0", path = "../../crates/core", default-features = false } +datafog-fogvault-native = { version = "=1.8.0", path = "../fogvault-native" } +datafog-fogvault-migration = { version = "=1.8.0", path = "../fogvault-migration" } +datafog-core = { version = "=1.8.0", path = "../../crates/core", default-features = false } pyo3 = { version = "0.29", features = ["abi3-py310", "extension-module"] } serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/integrations/fogvault-python/pyproject.toml b/integrations/fogvault-python/pyproject.toml index d4f7e86c..4a771f5e 100644 --- a/integrations/fogvault-python/pyproject.toml +++ b/integrations/fogvault-python/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "datafog-fogvault" -version = "1.7.0" +version = "1.8.0" description = "Optional native FogVault persistence owner for DataFog Core workspaces" readme = "README.md" license-files = ["LICENSE"] diff --git a/integrations/sqlite-browser/package.json b/integrations/sqlite-browser/package.json index 83ef11bb..e5b04269 100644 --- a/integrations/sqlite-browser/package.json +++ b/integrations/sqlite-browser/package.json @@ -1,6 +1,6 @@ { "name": "@datafog/core-sqlite-browser", - "version": "1.7.0", + "version": "1.8.0", "type": "module", "license": "MIT", "repository": { @@ -30,7 +30,7 @@ "THIRD_PARTY_NOTICES.md" ], "peerDependencies": { - "@datafog/wasm": "^1.7.0" + "@datafog/wasm": "^1.8.0" }, "scripts": { "prepare:vendor": "python3 ../../scripts/provision-sqlite-browser.py", diff --git a/scripts/email-boundary-comparison/Cargo.lock b/scripts/email-boundary-comparison/Cargo.lock index 7e1b5630..511bf10f 100644 --- a/scripts/email-boundary-comparison/Cargo.lock +++ b/scripts/email-boundary-comparison/Cargo.lock @@ -69,6 +69,8 @@ dependencies = [ [[package]] name = "datafog-core" version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a88087d5c81a082cf0e9b6d67abaa813474c6e08fb9f5f99e3e018c97b0e9c5e" dependencies = [ "base64", "hmac", @@ -82,9 +84,7 @@ dependencies = [ [[package]] name = "datafog-core" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a88087d5c81a082cf0e9b6d67abaa813474c6e08fb9f5f99e3e018c97b0e9c5e" +version = "1.8.0" dependencies = [ "base64", "hmac", @@ -113,7 +113,7 @@ version = "0.0.0" dependencies = [ "datafog-core 0.4.4", "datafog-core 1.7.0", - "datafog-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "datafog-core 1.8.0", "serde_json", ] From 4ea60067e72ccd07fc45198295d3a0914b51d3eb Mon Sep 17 00:00:00 2001 From: Sid Mohan <61345237+sidmohan0@users.noreply.github.com> Date: Wed, 18 Nov 2026 02:59:11 -0800 Subject: [PATCH 7/8] fix: preserve third-party blocking version in release lockfiles --- integrations/fogvault-native/Cargo.lock | 2 +- integrations/fogvault-node/Cargo.lock | 2 +- integrations/fogvault-python/Cargo.lock | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/integrations/fogvault-native/Cargo.lock b/integrations/fogvault-native/Cargo.lock index c4acc356..195af67b 100644 --- a/integrations/fogvault-native/Cargo.lock +++ b/integrations/fogvault-native/Cargo.lock @@ -231,7 +231,7 @@ dependencies = [ [[package]] name = "blocking" -version = "1.8.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" dependencies = [ diff --git a/integrations/fogvault-node/Cargo.lock b/integrations/fogvault-node/Cargo.lock index 4f7083aa..8056736c 100644 --- a/integrations/fogvault-node/Cargo.lock +++ b/integrations/fogvault-node/Cargo.lock @@ -231,7 +231,7 @@ dependencies = [ [[package]] name = "blocking" -version = "1.8.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" dependencies = [ diff --git a/integrations/fogvault-python/Cargo.lock b/integrations/fogvault-python/Cargo.lock index b907d111..27cf29d3 100644 --- a/integrations/fogvault-python/Cargo.lock +++ b/integrations/fogvault-python/Cargo.lock @@ -231,7 +231,7 @@ dependencies = [ [[package]] name = "blocking" -version = "1.8.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" dependencies = [ From 6bae1b89dfb335c0ef9cfaba16ce778423f6b8a1 Mon Sep 17 00:00:00 2001 From: Sid Mohan <61345237+sidmohan0@users.noreply.github.com> Date: Wed, 18 Nov 2026 03:06:58 -0800 Subject: [PATCH 8/8] fix: replace unmaintained report timestamp dependency --- CHANGELOG.md | 3 + Cargo.lock | 170 ++++++++----------------------------- crates/xtask/Cargo.toml | 2 +- crates/xtask/src/report.rs | 8 +- 4 files changed, 45 insertions(+), 138 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3ac1a37..48f2cf54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ Earlier release notes are in [docs/releases](docs/releases/). - Release coordinated Core SDK and companion packages at 1.8.0. Finding boundaries change for EMAIL; consumers pinned to `<1.8` must admit the new minor line to receive the mixed-script boundary fix. +- Replace the verification CLI's unmaintained Chrono timestamp dependency with + Jiff, preserving UTC report and directory formats. Runtime SDK dependencies + are unchanged. ### Fixed diff --git a/Cargo.lock b/Cargo.lock index 34acb941..d4aa918d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,21 +11,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "android_system_properties" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" -dependencies = [ - "libc", -] - -[[package]] -name = "autocfg" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" - [[package]] name = "base64" version = "0.22.1" @@ -53,33 +38,12 @@ version = "3.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" -[[package]] -name = "cc" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0" -dependencies = [ - "find-msvc-tools", - "shlex", -] - [[package]] name = "cfg-if" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" -[[package]] -name = "chrono" -version = "0.4.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" -dependencies = [ - "iana-time-zone", - "num-traits", - "windows-link", -] - [[package]] name = "convert_case" version = "0.11.0" @@ -89,12 +53,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - [[package]] name = "cpufeatures" version = "0.2.17" @@ -181,12 +139,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "find-msvc-tools" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" - [[package]] name = "futures" version = "0.3.34" @@ -301,34 +253,45 @@ dependencies = [ ] [[package]] -name = "iana-time-zone" -version = "0.1.65" +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jiff" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +checksum = "ed5d126d72eb017f10b302e73bdeca446bea405ee449af4d9e7866d6b082d83e" dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", + "jiff-core", + "jiff-static", "log", - "wasm-bindgen", - "windows-core", + "portable-atomic", + "portable-atomic-util", + "serde_core", ] [[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" +name = "jiff-core" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +checksum = "b6b46a105a9874634dd96231021526bf24ca04955a5998c59a9c7666e634b7b8" dependencies = [ - "cc", + "log", ] [[package]] -name = "itoa" -version = "1.0.18" +name = "jiff-static" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" +checksum = "c0127e9bde3c6130d6169e7d8d68676e4be69c4bf7573c308b6f960a5089c428" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 3.0.4", +] [[package]] name = "js-sys" @@ -441,15 +404,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - [[package]] name = "once_cell" version = "1.21.4" @@ -468,6 +422,15 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + [[package]] name = "proc-macro2" version = "1.0.107" @@ -669,12 +632,6 @@ dependencies = [ "digest", ] -[[package]] -name = "shlex" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" - [[package]] name = "slab" version = "0.4.12" @@ -793,70 +750,17 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "windows-core" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link", - "windows-result", - "windows-strings", -] - -[[package]] -name = "windows-implement" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-interface" -version = "0.59.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" -[[package]] -name = "windows-result" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-strings" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" -dependencies = [ - "windows-link", -] - [[package]] name = "xtask" version = "0.1.0" dependencies = [ - "chrono", + "jiff", "serde", "serde_json", "sha2", diff --git a/crates/xtask/Cargo.toml b/crates/xtask/Cargo.toml index cd8f0325..43655318 100644 --- a/crates/xtask/Cargo.toml +++ b/crates/xtask/Cargo.toml @@ -10,7 +10,7 @@ name = "xtask" path = "src/main.rs" [dependencies] -chrono = { version = "0.4", default-features = false, features = ["std", "clock"] } +jiff = { version = "1", default-features = false, features = ["std"] } serde = { version = "1", features = ["derive"] } serde_json = "1" sha2 = "0.10" diff --git a/crates/xtask/src/report.rs b/crates/xtask/src/report.rs index b8e694c5..8b09bc26 100644 --- a/crates/xtask/src/report.rs +++ b/crates/xtask/src/report.rs @@ -1,4 +1,4 @@ -use chrono::Utc; +use jiff::Timestamp; use serde::{Deserialize, Serialize}; use std::fs; use std::path::{Path, PathBuf}; @@ -26,7 +26,7 @@ pub struct ToolVersions { impl RunMetadata { pub fn collect() -> Self { Self { - timestamp_utc: Utc::now().format("%Y-%m-%dT%H:%M:%SZ").to_string(), + timestamp_utc: Timestamp::now().strftime("%Y-%m-%dT%H:%M:%SZ").to_string(), git_commit_sha: get_git_sha(), git_branch: get_git_branch(), git_dirty: is_git_dirty(), @@ -114,7 +114,7 @@ fn discover_workspace_root(start: &Path) -> Option { } pub fn create_run_directory() -> std::io::Result { - let timestamp = Utc::now().format("%Y%m%dT%H%M%SZ").to_string(); + let timestamp = Timestamp::now().strftime("%Y%m%dT%H%M%SZ").to_string(); let run_dir = workspace_root() .join("target") .join("dfv") @@ -141,7 +141,7 @@ mod workspace_tests { let path = std::env::temp_dir().join(format!( "dfv-worktree-root-{}-{}", std::process::id(), - chrono::Utc::now().timestamp_nanos_opt().unwrap() + jiff::Timestamp::now().as_nanosecond() )); let nested = path.join(".worktrees/feature"); for root in [&path, &nested] {