filemetadatastripping
Reactive icon

FileMetadataStripping

Stable version 0.1.5 (Compatible with OutSystems 11)
Uploaded
 on 30 Jul (22 hours ago)
 by 
0.0
 (0 ratings)
filemetadatastripping

FileMetadataStripping

Documentation
0.1.5

ADDING THE LIBRARY TO YOUR APP
-------------------------------

1. Open your ODC app or library in ODC Studio.
2. Click the Dependencies icon (puzzle piece) in the toolbar.
3. Search for FileMetadataStripping and select it.
4. Tick StripFileMetadata and the FileMetadataResult structure, then click Apply.

No further configuration is required.


USAGE
-----

Call StripFileMetadata at the earliest point in any flow that accepts a file upload, before the file is forwarded to an AI API, stored, or processed further.

Input parameters
----------------

RawFile (Binary Data) - the uploaded file in any supported format. Pass the Content field from a File Upload widget or a binary variable you have already loaded.

StripBodyAuthors (Boolean) - optional, default False. Set to True to also blank author names from tracked changes and comments inside OOXML and Word 2003 XML document bodies (w:author / w:initials, aml:author, XLSX comment authors, PPTX comment-author name / initials, and the Excel 365 threaded-comment person records). Leave False to strip only core, application, and custom properties.

Output - FileMetadataResult structure
--------------------------------------

CleanFile (Binary Data) - the file with all embedded metadata removed. Use this in place of the original when calling AI APIs or saving to storage.

ExtractedMetadata (Text) - JSON string of every metadata entry that was found and removed. Returns "[]" when no metadata was found. Use this for audit logging or security review.

RemovedEntryCount (Integer) - total number of metadata entries removed.

IsPassthrough (Boolean) - True when the file format has no supported metadata containers (e.g. TXT, CSV, JSON, XML, HTML, BMP). CleanFile is the unchanged input.

Recommended pattern in a Server Action
---------------------------------------

1. Receive the uploaded file as a Binary Data input parameter.
2. Call StripFileMetadata passing the binary as RawFile.
3. Use StripFileMetadata.CleanFile for all downstream calls (AI API, file storage, database).
4. If StripFileMetadata.RemovedEntryCount > 0, write StripFileMetadata.ExtractedMetadata to your audit log.
5. Optionally record IsPassthrough in the audit entry to separate passthrough files from clean processed files.


SUPPORTED FILE FORMATS
-----------------------

Every format below has an explicit xUnit test in the component's test project. Format detection is automatic and based on magic bytes.

IMAGES

Standard raster (JPEG, PNG, GIF, TIFF, WebP) - strips EXIF, IPTC, XMP, ICC profiles, and comments. Animated GIF / WebP and multi-frame TIFF are supported: metadata stripped from every frame, all frames preserved.

AVIF - fully supported round-trip.

HEIC / HEIF (mif1 / msf1 brands) - metadata stripped; output transcoded to JPEG because the x265 HEVC encoder is GPL-licensed and cannot be bundled. transcodedFormat key set.

APNG - all animation frames decoded and stripped. Writing APNG requires ImageMagick's video delegate (ffmpeg); without it the output is transcoded to JPEG.

RAW camera (ARW, CR2, DNG, NEF, ORF, PEF, RAF, X3F) - EXIF, XMP, ICC profiles removed via the underlying TIFF structure.

Modern / HDR (JXL, JP2, JXR / WDP, Ultra HDR, OpenEXR, Radiance HDR .hdr, QOI) - EXIF, XMP, ICC profiles, and encoder comments removed. Radiance HDR encoder-injected "# Created by ImageMagick" lines are stripped; the #?RADIANCE identification line is preserved. JPT (JPEG 2000 raw code stream) is decode-only and returned unchanged with a processingError note.

Legacy raster (PSD / PSB, TGA, DDS, PCX / DCX, SGI, SUN, PICT, PCD / PCDS, FITS, JBIG, WMF, ICO, XCF, Netpbm) - format-specific comments and profiles removed where present. XCF is transcoded to JPEG on write.

Film formats (DPX, CIN) - image profiles stripped plus per-image dpx:* / cin:* production attributes (film title, origination device, source filename, frame position). Values recorded under the dpx and cin keys.

Medical imaging (DICOM .dcm) - detected via 128-byte preamble + DICM signature; output transcoded to JPEG. DICOM tag parsing is out of scope; PHI tags in the DICOM header survive.

Multi-image containers (MPO, MNG) - every frame stripped and preserved.


DOCUMENTS

PDF - strips Title, Author, Subject, Keywords, Creator, Producer, the catalog XMP metadata stream, and the /Author entry from every comment, sticky-note, and markup annotation. Distinct annotation author names recorded under annotationAuthors.

RTF - detected via {\rtf1. Blanks every string-bearing control word inside \info (author, title, subject, keywords, comment, operator, company, doccomm, category, hlinkbase, manager). Numeric control words preserved. Values recorded under the control-word name.

Office Open XML (DOCX, DOTX, DOCM, DOTM, XLSX, XLTX, XLSM, XLTM, PPTX, POTX, PPSX, PPTM, POTM, PPSM) - always strips core properties (Creator, LastModifiedBy, Created, Modified, Title, Subject, Description, Keywords, Category, Revision, LastPrinted, Identifier, Version), application properties (Application, Company, Manager, AppVersion, Template, HyperlinkBase), all custom properties, and the embedded page-preview thumbnail (docProps/thumbnail.*) along with its _rels/.rels relationship - preventing a rendered preview from reaching a vision model. When StripBodyAuthors = True, also blanks tracked-change and comment authors across DOCX / XLSX / PPTX and the Excel 365 threaded-comment person records. Values recorded under app* keys, customProperties, and strippedAuthors.

Legacy binary Office / CFBF (DOC, DOT, XLS, XLT, PPT, POT, PPS) - detected via the 8-byte magic D0 CF 11 E0 A1 B1 1A E1 checked before the ZIP signature. Deletes both OLE property-set streams: SummaryInformation (Title, Subject, Author, Keywords, Comments, Template, Last-Saved-By, Application) and DocumentSummaryInformation (Category, Manager, Company, ContentStatus, Language, user-defined properties). Freed sectors are dropped from the output so raw values do not survive in unallocated space. Values recorded under summaryInformation, documentSummaryInformation, and customProperties.

ODF (ODT, ODS, ODP, OTT, OTS, OTP, ODG, OTG, ODC, ODF, ODB, ODI) - strips dc:creator, dc:title, dc:description, dc:subject, meta:initial-creator, meta:generator, meta:editing-cycles, meta:editing-duration, and all meta:user-defined properties. Templates, drawings, charts, formulas, databases, and images all match the application/vnd.oasis.opendocument.* mimetype prefix and share the ODT / ODS / ODP strip path.

Flat ODF (FODT, FODS, FODP) - single-file XML variant, detected by the root in the OASIS office namespace. Same strip surface as ZIP-based ODF.

Word 2003 XML / WordProcessingML (.xml) - detected by the root. Strips every child of (Author, LastAuthor, Company, Manager, Title, Subject, Keywords, Description, Category, Template, HyperlinkBase, revision counters) and every child of . When StripBodyAuthors = True, also blanks w:author and aml:author attributes on tracked-change and comment elements. Values recorded under documentProperties, customDocumentProperties, and bodyAuthors.

EPUB - detected by the ZIP mimetype entry. Reads META-INF/container.xml to locate the OPF package, then blanks every Dublin Core element (creator, title, description, rights, subject, language, date, identifier, publisher) and every OPF refinement. Repeated elements preserved as arrays. OPF paths with .. segments are rejected as a Zip Slip guard.

ORA (Open Raster) - detected by the ZIP mimetype entry (image/openraster). Blanks the name and description attributes on every element in stack.xml. Structural attributes (dimensions, positions, opacity, source paths, composite operations, visibility) are preserved so the image still renders.

SVG - parsed as XML. Removes , <desc>, and <metadata> elements at every depth, matched by local name. Values recorded under title, desc, and metadata.<br><br><br>AUDIO AND VIDEO<br><br>Audio (MP3, WAV, FLAC, OGG Vorbis / Opus, M4A, M4B, WMA, AIFF / AIFC, APE, WavPack, MPC) - strips ID3 tags, Vorbis / Opus comments, RIFF INFO chunks, iTunes MP4 atoms, ASF header extension objects, AIFF ID3 chunks, and APE tags.<br><br>Video (MP4, MKV, AVI, MOV, WebM, WMV, M4V, 3GP, 3G2) - strips all metadata atoms and tags. 3GP and 3G2 are the ISOBMFF variants used by legacy mobile video recorders.<br><br><br>PASSTHROUGH<br><br>BMP, DIB, WBMP, XBM, XPM, TXT, CSV, MD, JSON, XML, HTML, and any unrecognised format - file returned unchanged, IsPassthrough = true, RemovedEntryCount = 0. HTML is deliberately excluded because meta tags are functional inline content (charset, viewport, http-equiv) required for rendering, and selective meta-name stripping would leave scripts and CSS intact - HTML hardening belongs to a dedicated sanitiser applied downstream.<br><br><br>NOTES<br>-----<br><br>Format is preserved: the output file is always in the same format as the input, with two documented exceptions - HEIC / HEIF and DICOM are transcoded to JPEG. Both set a transcodedFormat key.<br><br>If a file cannot be parsed (encrypted, password-protected, corrupted, or malformed), the original is returned unchanged, ExtractedMetadata contains a processingError key, RemovedEntryCount = 0, and IsPassthrough = false.<br><br>For animated GIFs and multi-frame TIFFs, metadata extraction reads the first frame only (file-level metadata is stored there). All frames are stripped in the output.<br><br>See the Limitations section for known gaps (DICOM PHI, animated WebP per-frame chunks, VBA / signatures, embedded objects).</p>