Release note · August 1, 2026

A Word field can quietly consult the outside world

By SybilGambleyyu · DocFence 0.8.0

A field result can look like ordinary document text while its stored instruction says something materially different: query a database, include another document, pull a picture, retain an OLE link, refer to a document used by an index, or exchange data with another application. A single generic field count cannot distinguish a harmless date from a document that retains one of those outside-facing instructions.

DocFence 0.8.0 adds a deliberately bounded answer. It inventories selected Word field families that can name or consult outside material, then reports only aggregate category counts. The field instruction, source path, database connection, query, application name, item reference, bookmark, and private fingerprint never enter JSON, Markdown, or SARIF.

Eight field families, not one vague signal

The new inventory recognizes DATABASE and legacy DATA; DDE and DDEAUTO; INCLUDE and INCLUDETEXT; INCLUDEPICTURE and legacy IMPORT; LINK; and RD. That boundary follows Word’s documented database, included-document, linked-picture, OLE-link, and referenced-document fields, together with the legacy aliases and DDE forms preserved in Microsoft’s field-type catalog.

These names are a review category, not a claim that every instruction will successfully update. A DATABASE field can retain a query and connection details; an INCLUDETEXT field can retain another document reference; a LINK field can retain a linked object source. Those are valuable stored-state signals even when a source is missing, offline, denied, or never updated by a user’s Word configuration.

Read the package, never the source

OOXML stores a simple field directly in w:fldSimple/@w:instr. A complex field is a begin/separate/end sequence whose pre-separator instruction can be split across multiple w:instrText runs and can itself contain nested fields. DocFence reconstructs that local instruction state, recognizes only the first field keyword, hashes the complete instruction privately, and immediately discards the source-bearing value from its public model.

Tracked revisions make this easy to get wrong. Word can retain a deleted field code in w:delInstrText beside the current w:instrText code. Concatenating them would create an invented instruction and can hide the very history a reviewer needs. DocFence assembles current and deleted variants separately; a changed field can therefore contribute evidence for both stored versions without revealing either one. The same treatment covers moved-from and moved-to field-code ranges.

This is intentionally not a Word runtime. DocFence does not parse an argument grammar, run a query, start a DDE conversation, open an OLE object, locate an included file, retrieve content, or decide whether Word will update a field. It also does not claim to cover every expression that can display a URL. The contract is stored, named field-family evidence—nothing more and nothing less.

Choose “none” or “no change”

For a clean handoff, reject all recognized external-source field instructions:

rules:
  require_no_external_fields: true

This emits DFP027 whenever any of the eight public counts is nonzero. A controlled template may intentionally retain an approved field. In that case, compare the private inventory with a controlled baseline instead:

rules:
  no_external_field_changes: true

This emits DFP028 when a category, story part, or private instruction fingerprint changes. Splitting an unchanged complex instruction across different runs stays quiet; changing a stored source does not. The ordinary field-code count remains available, and external relationships remain a separate review surface.

What was tested

The release adds regression coverage for all eight categories, simple and complex encodings, split runs, nested fields, resultless fields, Strict namespaces, header stories, changed targets, non-field instruction text, post-separator text, unclosed fields, policy findings, SARIF, and redaction. It also covers revision replacements with shared field-code text, deleted field code, and moved field-code ranges.

I profiled Apache POI’s independent FieldCodes.docx and FldSimple.docx fixtures with the final wheel. They exercise real complex and simple Word field encodings and correctly produce no external-source-field count for their non-external fields.

The wheel and source archive were independently rebuilt twice from the release commit with SOURCE_DATE_EPOCH; both artifact pairs were byte-identical. The public release contains the wheel, source archive, and SHA-256 manifest. I downloaded those assets, verified the checksums, installed the published wheel into a fresh environment, and reran the fixture profile.

Use the release

python -m pip install https://github.com/SybilGambleyyu/docfence/releases/download/v0.8.0/docfence-0.8.0-py3-none-any.whl

docfence profile candidate.docx --format markdown
docfence check approved.docx candidate.docx --policy docfence.yml --format sarif --output docfence.sarif

The complete contract is in the policy reference and threat model. DocFence is local, bounded evidence about stored OOXML state—not a network monitor, an Office automation host, or a rendering verdict. It is MIT-licensed and available on GitHub. For the preceding external-document-dependency boundary, read A Word file can assemble itself from outside the package.