Spaces:
Running
Running
File size: 3,119 Bytes
32289f4 | 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 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | # WP38 — DOCX hygiene audit report
Status: completed helper/tests/documentation-only
Repository: `solidprivacy-nl/scrub`
WP38 adds a report-only DOCX hygiene audit helper on top of the WP37 hidden-content extractor.
Helper:
```text
docx_hygiene_audit.py
```
Primary functions:
```text
build_docx_hygiene_audit_report(content: bytes) -> dict
render_docx_hygiene_audit_markdown(report: dict) -> str
```
---
## 1. Purpose
The audit report converts hidden DOCX content detection into a structured risk report.
It makes these findings visible:
- headers detected;
- footers detected;
- comments / kantlijncommentaren detected;
- comment/person metadata detected;
- tracked-change markers detected;
- invalid DOCX / unknown hygiene risk.
This helper is designed for future audit/report integration. It is not a cleaner and does not change product behavior.
---
## 2. Report fields
The report includes:
```text
document_type
audit_type
synthetic_safe_structure
local_only
ai_processing
cloud_processing
report_only
extraction_only
cleaning_applied
export_blocking
export_semantics_changed
valid_docx
validation_issues
summary
detected
counts
findings
warnings
recommended_next_step
unsupported_scope_note
source_extraction
```
Important fixed safety fields:
```text
report_only: true
extraction_only: true
cleaning_applied: false
export_blocking: false
export_semantics_changed: false
safe_to_claim_clean: false
```
---
## 3. Severity model
The MVP severity model is intentionally conservative:
| Situation | Severity |
| --- | --- |
| Invalid DOCX / cannot inspect | `medium` |
| No WP37-supported findings | `low` |
| Headers, footers, comments or tracked changes detected | `high` |
A `low` result is not a clean-DOCX guarantee. It only means no WP37-supported hidden-content parts were detected.
---
## 4. Findings
Current finding ids:
```text
headers_detected
footers_detected
comments_detected
tracked_changes_detected
invalid_docx
```
Each finding includes:
```text
id
severity
count
title
risk
recommended_action
```
---
## 5. Explicit non-goals
WP38 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.
---
## 6. Unsupported scope note
The helper explicitly states that it is based on WP37-supported parts only.
Still future work:
- footnotes;
- endnotes;
- document metadata;
- custom XML;
- text boxes;
- shapes;
- charts;
- embedded objects;
- product UI integration;
- export-blocking policy.
---
## 7. Recommended next step
Recommended next package:
```text
WP39 — Clean DOCX export policy
```
Purpose:
- Define when warnings are enough, when export should be blocked, and when a future clean-DOCX export may be claimed.
- Keep policy separate from cleaner/removal implementation.
Do not start comment removal, tracked-change removal, metadata cleaning or export blocking before the policy is explicit and tested.
|