Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/concepts/privacy-transformations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Redaction replaces each selected finding with an unnumbered entity placeholder.

Masking replaces every non-revealed Unicode code point. The default character
is `*`. A custom character must be exactly one non-whitespace, non-control
Unicode code point.
Unicode code point. Reveal counts leave at least one code point masked, even when the requested count reaches the length of the finding.

```json
{
Expand Down
16 changes: 6 additions & 10 deletions docs/core/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,16 @@ Text scans recognize these entities without a locale:
- `IP_ADDRESS`
- `DATE`
- `ZIP_CODE`
- `BEARER_TOKEN` (0.4.1; [explicit Authorization headers](/reference/bearer-token))
- [`ACCOUNT_NUMBER`](/reference/account-number) and [`STREET_ADDRESS`](/reference/street-address) in supported labeled contexts
- [`US_ROUTING_NUMBER`](/reference/us-routing-number) and [`NPI`](/reference/npi) with explicit context
- [`CREDENTIAL_URI`](/reference/credential-uri) for supported PostgreSQL URIs
- `BEARER_TOKEN` ([explicit Authorization headers](/reference/bearer-token))
- `JWT` ([recognition rules](/reference/jwt))
- `API_KEY` (0.4.1; [supported providers](/reference/api-keys))
- `API_KEY` ([supported providers](/reference/api-keys))
- `PRIVATE_KEY` (complete PEM blocks — [format and boundaries](/reference/private-keys))

Structured scans also discover `PERSON` in supported name fields. See
[structured person discovery](/guides/person-discovery) for field mappings.
[structured person discovery](/guides/person-discovery) for field mappings. For recipient names and mailing-address blocks in prose, use the [embedded CNN](/reference/embedded-cnn). To detect application-specific phrases, supply [literal deny rules](/reference/literal-denylists).

<Note>
**Credit cards and decimal numbers:** contiguous card candidates immediately
Expand Down Expand Up @@ -111,10 +114,3 @@ explicit scan-then-transform convenience operation.
Detect and redact an email address in a few lines.
</Card>
</Columns>

[US routing number detection](/reference/us-routing-number) adds `US_ROUTING_NUMBER` with explicit text context.
[National Provider Identifiers detection](/reference/npi) adds `NPI` with explicit text context.

[datafog core 0.4.1](/releases/0-4-1) is published across all four runtimes and includes Rust/Python capability discovery and a [compatibility policy](/reference/compatibility). The higher-level Python adapter is integrated in [merged PR #179](https://github.com/DataFog/datafog-python/pull/179); its package release is separate.

[Core 0.4.1](/releases/0-4-1) adds default `API_KEY`, `BEARER_TOKEN`, and `CREDENTIAL_URI` detection. The runtime registry reports 23 supported entities and 14 defaults. The local Python 4.9 adapter integration gate passed against the exact candidate wheel; the release notes record its evidence and limits.
64 changes: 9 additions & 55 deletions docs/development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,19 @@ cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features
```

## Node.js installed-package test
## Cross-SDK verification

```bash
npm ci --prefix bindings/node
npm run test:package --prefix bindings/node
```

## Browser/WASM installed-package test
Use the repository verifier to check toolchain pins, build the bindings and exercise the installed packages.

```bash
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli --version 0.2.127 --locked
npm ci --prefix bindings/wasm
npx --prefix bindings/wasm playwright install chromium
npm run test:package --prefix bindings/wasm
cargo dfv doctor
cargo dfv build
cargo dfv check
cargo dfv smoke
cargo dfv parity --live
```

## Python installed-package test

```bash
python -m venv .venv
.venv/bin/python -m pip install maturin
.venv/bin/maturin build --manifest-path bindings/python/Cargo.toml --release
.venv/bin/python -m pip install --force-reinstall target/wheels/*.whl
.venv/bin/python bindings/python/tests/test_installed.py
.venv/bin/python -m pip install -r bindings/python/tests/requirements-typing.txt
.venv/bin/python bindings/python/tests/test_typing.py
```
Run `cargo dfv check --models` for model changes. Each run writes a report under `target/dfv/runs/`.

## Documentation preview

Expand Down Expand Up @@ -75,38 +60,7 @@ docs/ Architecture records and Mintlify documentation

## Publish a release from GitHub Actions

Keep the four Cargo package versions, Python project version, both npm
package versions, and their lockfiles aligned. The publishing workflows run
`python3 scripts/check-release.py <runtime>` and reject inconsistent versions
or a release tag that does not match the package version.

For future releases, run the quality gates and installed-package tests above
on the release commit, complete the
[integration checklist](/releases/0-4-0#release-readiness-gate), and merge the
release preparation PR before creating runtime tags on that same commit.
Version 0.4.1 has already been published using the tags below; do not recreate
or move these tags. A source version bump alone does not publish packages:

| Tag | Workflow | Destination |
| --- | --- | --- |
| `rust-v0.4.1` | `publish-rust.yml` | crates.io |
| `python-v0.4.1` | `publish-python.yml` | PyPI |
| `node-v0.4.1` | `publish-node.yml` | npm: Node and five native platform packages |
| `wasm-v0.4.1` | `publish-wasm.yml` | npm: browser WASM |

Push runtime tags individually and confirm that each publishing workflow starts.
If a tag already exists without a run, dispatch its publishing workflow against
that existing tag; never move the tag to retrigger publication. For 0.4.1, the
workflows were dispatched after a batch tag push did not produce workflow events.
Check all four runs and install the published versions before announcing the
combined release. Registry
publication is not atomic across packages; inspect any partial result before
retrying. Never move a tag that has already published a package.

The npm workflows also accept a manual `dry_run` input, which defaults to
`true`. A dry run builds and verifies package contents without publishing.
For an actual manual publish, select the intended release tag and set
`dry_run` to `false`.
Qualify the release commit and publish the base SDKs and companion packages in dependency order. Push each runtime tag separately. If publication stops partway through, check the registry versions and completed workflow runs before retrying. The [publication runbook](https://github.com/DataFog/datafog-core/blob/main/docs/core-v1-publication.md) covers qualification, tag handling, companion workflows and installed-package checks.

### npm trusted publisher setup

Expand Down
3 changes: 3 additions & 0 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"group": "Guides",
"pages": [
"guides/migrating-from-datafog-python",
"guides/migrating-to-core-1-5",
"guides/configuration",
"guides/email-boundaries",
"guides/pseudonymization",
Expand Down Expand Up @@ -154,6 +155,8 @@
"releases/1-8-0",
"releases/1-7-0",
"releases/1-6-0",
"releases/1-5-0",
"releases/1-1-0",
"releases/1-0-0",
"releases/0-5-0-beta-3",
"releases/0-5-0-beta-2",
Expand Down
7 changes: 1 addition & 6 deletions docs/get-started/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ description: "Install datafog core for Rust, Python, Node.js, or browser WebAsse
icon: "download"
---

<Note>The expanded detectors are available in **0.4.0 or newer** across all four runtimes. Runtime capability discovery is available in Rust and Python. See the [0.4.0 release notes](/releases/0-4-0).</Note>

<Note>The three credential detectors require [Core 0.4.1](/releases/0-4-1) or newer.</Note>

## Package availability

The structured PERSON APIs require version **0.3.0 or newer** in every
binding. See the [0.3.0 release notes](/releases/0-3-0).
[Core 1.8.0](/releases/1-8-0) is available for all four runtimes.

| Runtime | Distribution | Import | Availability |
| --- | --- | --- | --- |
Expand Down
4 changes: 4 additions & 0 deletions docs/guides/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,7 @@ Use `{"detect_uuid":true}` in a text or structured scan configuration to enable
not change it. The option accepts only booleans, including an explicit `false`.
For scan-and-transform, place it under `scan` and use `transform.entities` to
select UUID replacements. Selection alone never enables scanning.

## Literal deny rules

Supply `deny` in the scan configuration to protect application-specific phrases. A matching phrase takes precedence over allowlists and entity filters for that request. See [literal denylists](/reference/literal-denylists) for word boundaries and case sensitivity.
59 changes: 24 additions & 35 deletions docs/guides/migrating-from-datafog-python.mdx
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
---
title: "Migrate from datafog Python"
description: "Move from datafog 4.8.x to the canonical datafog core 0.3.x Python API."
description: "Move from datafog 4.8.x to the canonical datafog core 1.8.x Python API."
icon: "arrow-right-arrow-left"
---

<Warning>
This guide covers migration of the synchronous text detection and
transformation API from `datafog` 4.8.x to `datafog-core` 0.2.x. datafog
core is a new canonical API, not a drop-in replacement for the established
datafog Python package.
</Warning>
This guide translates synchronous text detection and transformation calls from the
`datafog` 4.8.x API to `datafog-core` 1.8.x. The packages version independently.
The newer [`datafog` 4.12.0 release](https://github.com/DataFog/datafog-python/releases/tag/v4.12.0)
requires `datafog-core~=1.5.0`. Use separate environments to compare that adapter
with standalone Core 1.8.

datafog core makes detection results, text ranges, transformation policy, and
provider-backed operations consistent across Rust, Python, Node.js, and
browser/WASM. That consistency requires a few deliberate API changes in Python.

datafog core 0.3 does not replace the legacy package's optional spaCy, GLiNER,
The standalone Core SDK does not replace the legacy package's optional spaCy, GLiNER,
OCR, distributed-processing, CLI, or application-guardrail features. Keep the
established package for those workloads while adopting Core where its smaller,
cross-runtime contract fits.
Expand All @@ -25,11 +24,11 @@ cross-runtime contract fits.
<CodeGroup>

```bash datafog Python 4.8.x
python -m pip install datafog
python -m pip install 'datafog==4.8.*'
```

```bash datafog core 0.3.x
python -m pip install datafog-core
```bash datafog core 1.8.x
python -m pip install 'datafog-core==1.8.*'
```

</CodeGroup>
Expand All @@ -40,15 +39,14 @@ python -m pip install datafog-core
from datafog.engine import Entity, redact, scan, scan_and_redact
```

```python datafog core 0.3.x
```python datafog core 1.8.x
from datafog_core import Finding, scan, scan_and_transform, transform
```

</CodeGroup>

The distribution name uses a hyphen (`datafog-core`), while the Python import
uses an underscore (`datafog_core`). The two distributions can be installed at
the same time while an application is migrated incrementally.
uses an underscore (`datafog_core`).

## Update scan results

Expand All @@ -70,7 +68,7 @@ for entity in result.entities:
print(entity.type, entity.text, entity.start, entity.end)
```

```python datafog core 0.3.x
```python datafog core 1.8.x
from datafog_core import scan

findings = scan("Email jane@example.com")
Expand All @@ -90,7 +88,7 @@ Use `codepoint_range` when slicing a Python string. Use `byte_range` when
addressing the UTF-8 encoded input. Both ranges are zero-based and
end-exclusive.

| datafog Python 4.8.x | datafog core 0.3.x |
| datafog Python 4.8.x | datafog core 1.8.x |
| --- | --- |
| `ScanResult.entities` | The return value from `scan` |
| `Entity.type` | `Finding.entity_type` |
Expand Down Expand Up @@ -124,7 +122,7 @@ result = scan_and_redact(
print(result.redacted_text)
```

```python datafog core 0.3.x
```python datafog core 1.8.x
from datafog_core import scan_and_transform

result = scan_and_transform(
Expand All @@ -142,7 +140,7 @@ print(result.text)

</CodeGroup>

| datafog Python 4.8.x | datafog core 0.3.x |
| datafog Python 4.8.x | datafog core 1.8.x |
| --- | --- |
| `scan_and_redact(...)` | `scan_and_transform(text, {"scan": ..., "transform": ...})` |
| `redact(text, entities, ...)` | `transform(text, findings, config)` |
Expand Down Expand Up @@ -179,16 +177,13 @@ behavior and threat-model distinctions.
## Remove legacy engine selection

Do not translate `engine="regex"`, `"smart"`, `"spacy"`, or `"gliner"` into
Core configuration. datafog core 0.3 owns detector composition and exposes
`locale` as its scan setting. Detector provenance appears on each finding.
Core configuration. The default scan uses rules. For model-backed prose detection,
see the [embedded CNN reference](/reference/embedded-cnn).

Entity names are exact and case-sensitive. The built-in Core entities are:

`EMAIL`, `PHONE`, `SSN`, `CREDIT_CARD`, `IP_ADDRESS`, `DATE`, and `ZIP_CODE`.

Use canonical names such as `DATE` and `ZIP_CODE` rather than legacy aliases
such as `DOB` or `ZIP`. Entity selection belongs in the transformation config,
not the scan config.
Use canonical labels such as `DATE` and `ZIP_CODE`. Query `capabilities()` for the
[rule inventory and activation settings](/reference/capabilities). Supply `scan.entities`
to limit detection in a combined call or `transform.entities` to select findings
for replacement. Detector activation settings such as `locale` still apply.

## Migration checklist

Expand Down Expand Up @@ -229,14 +224,8 @@ All matching preserves source casing and separators. Allowlist entries must use
that source representation. Required context stays in the output, except postal
prefixes, which are part of the finding and are replaced too.

The Python adapter may translate explicit German entity requests into locale
`de` and then filter results, but must separately test legacy overlap and
selection semantics. Core adds no plural `locales`, engine switch or scan-time
entity selector. The capability-aware higher-level adapter and its
`datafog-core>=0.4.0,<0.5` dependency were merged in
[PR #179](https://github.com/DataFog/datafog-python/pull/179). The higher-level
Python package has its own release process; see the
[reviewed legacy NPI selection limitation](/releases/0-4-0#python-adapter-dependency-and-npi-selection).
For the original adapter’s overlap and selection behavior, see the
[legacy NPI selection limitation](/releases/0-4-0#python-adapter-dependency-and-npi-selection).

## Credential detector migration (0.4.1)

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/tokenization-and-restoration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,5 @@ Token envelopes use the canonical
Base64URL components. Treat the envelope as opaque application data; do not
parse or construct it yourself.

Browser/WASM rejects selected tokenization and every restoration call with
`unsupported_strategy`.
Browser/WASM rejects provider-backed tokenization and restoration with
`unsupported_strategy`. Use a [browser Workspace](/reference/browser-wasm) to restore its locally issued markers.
4 changes: 3 additions & 1 deletion docs/mcp/privacy-and-coverage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ icon: "shield-halved"
## Know what is checked

Default checks cover email, SSN, credit cards, labeled US routing numbers and
NPIs, and supported credentials. Phone, date, ZIP code, and IP address checks
NPIs, and supported credentials. Phone, date, ZIP code, IP address, labeled account number and labeled street address checks
are available but off by default. Plain-text names and unlabelled street addresses need a model or user review.
The bounded labelled street-line rule uses `STREET_ADDRESS`; full model `ADDRESS`
remains distinct.
Expand All @@ -21,6 +21,8 @@ logs, ENV, and SQL. CSV/TSV headers are preserved and not scanned by default;
use `has_header=false` when the first record must be checked. PDF, DOCX, XLSX,
images, and archives are not parsed. A refused scan means the file was not checked.

ENV assignments and SQL quoted strings use format-specific [email boundaries](/guides/email-boundaries). In mixed-script text, review the span when an address touches surrounding letters.

## Understand the privacy boundary

The running server processes file contents locally and makes no network
Expand Down
2 changes: 2 additions & 0 deletions docs/mcp/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ counts, locations, and copy paths, without file contents or matched values.
You need **Python 3.10 or later**, [uv](https://docs.astral.sh/uv/getting-started/installation/),
and Claude Code running on the machine that holds your files.

MCP 1.2.0 uses Core 1.8.x. On Intel macOS, install the Rust toolchain before installing MCP so the Core dependency can build from source. See [Core installation requirements](/get-started/installation).

<Steps>
<Step title="Install datafog MCP">
```bash
Expand Down
3 changes: 2 additions & 1 deletion docs/mcp/scanning-and-transformations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Put a CSV or text file inside an allowed folder. Ask Claude Code:

Use an absolute path if the file is outside the agent's current directory.
The scan returns counts by entity type and finding locations. CSV/TSV findings
include record and column numbers; text findings include character offsets.
include record and column numbers. Text findings include character offsets.
Scans with more than 700 findings return complete counts and omit individual locations.

You can try the [fictional customer CSV](https://github.com/DataFog/datafog-mcp/blob/main/docs/demo/customers.csv)
from the MCP repository. Save it inside an allowed folder first.
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/account-number.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: 'Bounded lexical account-number coverage with model compatibility.'
`ACCOUNT_NUMBER` detects 6–17 contiguous ASCII digits immediately after
`account number`, `account no.`, `acct number` or `acct no.` (ASCII case
insensitive). The value span excludes the label. Supported spacing, delimiters,
boundaries and exclusions are defined in the [rule contract](../account-number-rule-contract.md).
boundaries and exclusions are defined in the [rule contract](https://github.com/DataFog/datafog-core/blob/main/docs/account-number-rule-contract.md).
This is lexical coverage, not bank validation or universal account detection.

```python
Expand All @@ -28,7 +28,7 @@ console.assert(result.text === "bank account number: [ACCOUNT_NUMBER]");

Rules run by default across locales. Bare numbers, generic `account:` labels,
intervening prose, split numeric values and alphanumeric accounts are excluded.
The [masked-account contract](../masked-account-number-rule-contract.md) also
The [masked-account contract](https://github.com/DataFog/datafog-core/blob/main/docs/masked-account-number-rule-contract.md) also
accepts account-labelled four-digit endings and bounded X/asterisk masks. For
`account ending in 1234`, only `1234` is the value. For
`account number: XXXX1234`, the whole `XXXX1234` token is the value. A visible
Expand Down
Loading
Loading