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
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# WP37 — DOCX hidden content extraction helper
|
| 2 |
+
|
| 3 |
+
Status: completed helper/tests/documentation-only
|
| 4 |
+
Repository: `solidprivacy-nl/scrub`
|
| 5 |
+
|
| 6 |
+
WP37 adds a pure local, read-only helper for detecting and extracting text from high-risk DOCX package parts that are outside the current DOCX reinsert foundation scope.
|
| 7 |
+
|
| 8 |
+
The helper is:
|
| 9 |
+
|
| 10 |
+
```text
|
| 11 |
+
docx_hidden_content_extractor.py
|
| 12 |
+
```
|
| 13 |
+
|
| 14 |
+
Primary function:
|
| 15 |
+
|
| 16 |
+
```text
|
| 17 |
+
inspect_docx_hidden_content(content: bytes) -> dict
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
## 1. Purpose
|
| 23 |
+
|
| 24 |
+
The helper makes hidden-content risk audit-visible before any cleaner, removal policy or export-blocking policy is implemented.
|
| 25 |
+
|
| 26 |
+
It focuses on:
|
| 27 |
+
|
| 28 |
+
- headers;
|
| 29 |
+
- footers;
|
| 30 |
+
- comments / kantlijncommentaren;
|
| 31 |
+
- comment author/person-like metadata where present;
|
| 32 |
+
- tracked-change markers such as insertions, deletions and move markers.
|
| 33 |
+
|
| 34 |
+
This directly follows WP35 and WP36A.
|
| 35 |
+
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
## 2. What the helper reports
|
| 39 |
+
|
| 40 |
+
The helper returns an audit-oriented dictionary with fields such as:
|
| 41 |
+
|
| 42 |
+
```text
|
| 43 |
+
valid_docx
|
| 44 |
+
validation_issues
|
| 45 |
+
local_only
|
| 46 |
+
ai_processing
|
| 47 |
+
cloud_processing
|
| 48 |
+
extraction_only
|
| 49 |
+
cleaning_applied
|
| 50 |
+
export_blocking
|
| 51 |
+
docx_parts_seen
|
| 52 |
+
headers
|
| 53 |
+
footers
|
| 54 |
+
comments
|
| 55 |
+
tracked_changes
|
| 56 |
+
detected
|
| 57 |
+
warnings
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
Detection flags include:
|
| 61 |
+
|
| 62 |
+
```text
|
| 63 |
+
headers_detected
|
| 64 |
+
footers_detected
|
| 65 |
+
comments_detected
|
| 66 |
+
tracked_changes_detected
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
---
|
| 70 |
+
|
| 71 |
+
## 3. Supported extraction scope
|
| 72 |
+
|
| 73 |
+
The helper inspects these DOCX package patterns:
|
| 74 |
+
|
| 75 |
+
```text
|
| 76 |
+
word/header*.xml
|
| 77 |
+
word/footer*.xml
|
| 78 |
+
word/comments.xml
|
| 79 |
+
word/commentsExtended.xml
|
| 80 |
+
word/person.xml
|
| 81 |
+
word/*.xml for tracked-change markers
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
It extracts text from WordprocessingML text nodes and reports parse errors per part where applicable.
|
| 85 |
+
|
| 86 |
+
Tracked-change markers include:
|
| 87 |
+
|
| 88 |
+
```text
|
| 89 |
+
w:ins
|
| 90 |
+
w:del
|
| 91 |
+
w:delText
|
| 92 |
+
w:moveFrom
|
| 93 |
+
w:moveTo
|
| 94 |
+
w:moveFromRangeStart
|
| 95 |
+
w:moveFromRangeEnd
|
| 96 |
+
w:moveToRangeStart
|
| 97 |
+
w:moveToRangeEnd
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
---
|
| 101 |
+
|
| 102 |
+
## 4. Explicit non-goals
|
| 103 |
+
|
| 104 |
+
WP37 does not:
|
| 105 |
+
|
| 106 |
+
- clean DOCX files;
|
| 107 |
+
- remove comments;
|
| 108 |
+
- remove or accept tracked changes;
|
| 109 |
+
- remove metadata;
|
| 110 |
+
- block export;
|
| 111 |
+
- change export semantics;
|
| 112 |
+
- change DOCX reinsert behavior;
|
| 113 |
+
- change Scrub Key schema;
|
| 114 |
+
- change Streamlit UI;
|
| 115 |
+
- add dependencies;
|
| 116 |
+
- add cloud processing;
|
| 117 |
+
- add real-data fixtures.
|
| 118 |
+
|
| 119 |
+
The helper is deliberately extraction/audit-only.
|
| 120 |
+
|
| 121 |
+
---
|
| 122 |
+
|
| 123 |
+
## 5. Privacy boundary
|
| 124 |
+
|
| 125 |
+
The helper is local and side-effect free:
|
| 126 |
+
|
| 127 |
+
- no file-system persistence;
|
| 128 |
+
- no network calls;
|
| 129 |
+
- no AI calls;
|
| 130 |
+
- no cloud processing;
|
| 131 |
+
- no mutation of source bytes;
|
| 132 |
+
- no export package writing;
|
| 133 |
+
- no real-data test fixtures.
|
| 134 |
+
|
| 135 |
+
It accepts bytes and returns an in-memory audit dictionary.
|
| 136 |
+
|
| 137 |
+
---
|
| 138 |
+
|
| 139 |
+
## 6. Recommended next step
|
| 140 |
+
|
| 141 |
+
Recommended next package:
|
| 142 |
+
|
| 143 |
+
```text
|
| 144 |
+
WP38 — DOCX hygiene audit report
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
Purpose:
|
| 148 |
+
|
| 149 |
+
- Convert the extraction helper output into a user/support-facing hygiene audit structure.
|
| 150 |
+
- Keep it warning/report-only unless a later approved package defines export-blocking semantics.
|
| 151 |
+
|
| 152 |
+
Do not start comment removal, tracked-change removal or export blocking before the audit policy is explicit and tested.
|