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