Skip to content

JSE-85: report relationships to external targets ('externalTarget') - #144

Merged
securedeveloper merged 3 commits into
mainfrom
jse-85-external-targets
Dec 2, 2026
Merged

securedeveloper merged 3 commits into
mainfrom
jse-85-external-targets

Conversation

@securedeveloper

@securedeveloper securedeveloper commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

JSE-85. Before this change, a relationship with TargetMode="External" whose type was not an already-reported kind never reached the consumer. Example: a linked picture, an image relationship of a drawing with an http(s), UNC or file: target. Excel fetches the target when the file is opened (a tracking beacon, or an NTLM leak through UNC).

What changes (fail closed)

  • The package scan (src/internal/read/scan.ts) reports every relationship in every relationships part that is not a hyperlink and is either:
    • external, whatever its kind. A linked OLE object gives both 'oleObject' and 'externalTarget'. An external link's path, connections, queryTable, control, package and image work the same way.
    • read as internal but possibly external to another program (src/internal/read/opc.ts, Relationship.outside). This covers:
      • a TargetMode that is neither Internal nor External (any case, not trimmed);
      • a second, namespace-prefixed or differently cased TargetMode;
      • an internal target, or a second or prefixed Target, that starts with a URI scheme (RFC 3986) or //, or contains a backslash.
    • These checks are one pass over the attributes as written. The XML reader keeps duplicates, so it needs no change.
  • Hyperlinks (the transitional and Strict type URIs, compared whole and case-insensitively) are exempt everywhere.
  • read emits one UNSUPPORTED_PART warning with partKind 'externalTarget'. Its fields:
    • part: the first relationships part that holds one.
    • parts: each such relationships part once, so at most maxEntries.
    • relationshipTypes (new optional field on ExcelWarning): the first 16 distinct types, excerpted.
    • The message gives the count. No target text appears anywhere.
  • inspect returns the same warning (it reuses read's UNSUPPORTED_PART warnings), and importDataset passes it on.
  • No new refusals: the model still reads such targets as part names, as before. Nothing is fetched or resolved.
  • Docs: docs/api.md §5.2, the warning table, the inspect example and the security table; a README mention. Changeset: minor (new part kind and new optional field).

Tests

  • test/read/external-targets.test.ts (71 tests). Every case runs through both read and inspect and asserts identical warnings.
  • A survey of the 10 fixtures and the non-heavy written conformance corpus (external hyperlinks included) finds no externalTarget. Among the hostile inspect files, "external link" and "everything at once" now also get externalTarget, for their externalLinkPath. The writer emits no external relationship other than hyperlinks.

Not in this PR: F2 (a hyperlink-typed relationship used by a drawing's r:link) and F4. Tickets will be filed separately.

…'externalTarget'

A relationship with TargetMode="External" in any relationships part of the
package that is not a hyperlink and that no other kind covers (a linked OLE
object stays oleObject, an external link's own path stays externalLink) is
now reported by the package scan, so read, inspect and importDataset all
return it. Example: a linked picture under a drawing with an http(s), UNC or
file: target, which Excel fetches when the file is opened.

One warning for the whole package: part is the first relationships part
holding one, parts lists each such relationships part once (bounded by
maxEntries), and the new relationshipTypes field gives the first 16 distinct
types, excerpted. Targets are never included, resolved or fetched. No new
refusals.
…ships

- Every non-hyperlink relationship read as external now gives
  externalTarget whatever its kind: a linked OLE object, an external
  link's path, connections, queryTable, control, package and image get it
  next to their own kind. The exemptions by kind and for external link
  paths (and their dependence on walk order) are gone.
- Also reported, while the model still reads the target as a part name:
  a TargetMode that is neither Internal nor External; a second, prefixed
  or differently cased TargetMode; an internal target, or a second or
  prefixed Target, that starts with a URI scheme or // or contains a
  backslash. One pass over each Relationship's attributes as written.
- Hyperlinks stay exempt everywhere. No new refusals.
- docs/api.md (5.2, warning table, inspect example, security table),
  warnings.ts and the changeset follow.
@securedeveloper
securedeveloper merged commit abcdfce into main Dec 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant