All buildsIn progress

Swift text-processing package / 2026 / In progress

RedactionCore.

A Swift engine that swaps sensitive text for placeholders where it sits, and leaves the rest exactly as written

Part of the Omitto journey
Role
Software engineering
Built with
Swift · Foundation · Swift Package Manager · XCTest

01What I built

The problem.

A redacted log is only worth sharing if it still reads like the log. One way to redact a settings file is to read it into the program and write it out again. That can lose the indentation, comments and order of settings that made it useful. And two detectors, the parts that spot secrets, can claim the same stretch of text. Picking the wrong one can leave the value in plain sight.

What I built.

RedactionCore is a Swift package, a bundle of code that apps can build on. It uses only Foundation, Apple’s basic Swift library. It has one call that does the whole job before it returns. Text and a policy go in. The policy says what to look for. Out come the redacted text, the findings with their values hidden, and a report. Inside, detectors suggest stretches of text to hide. Matches from switched-off groups are dropped, and overlapping matches are settled. Each winning match is swapped for a placeholder, a label that stands in for the value. It has no screens and no clipboard. It saves nothing and uses no network. Omitto decides when to run it and supplies the review screen.

The package

Swift, Foundation, Swift Package Manager, XCTest

Main call
One call takes text and a policy, does the whole job, then returns the redacted text, the findings and a report.
Detectors
Gathers the stretches of text that every detector suggests, and removes repeats.
Overlap resolver
Drops disabled groups first. Then it picks winners by priority, by how sure each match is, and by length.The storyStopping a disabled detector from beating an enabled one
Placeholders
Gives repeated values one shared placeholder within a call. Different values of the same kind get different numbers.
Text replacement
Edits the text from the end backwards, so earlier positions stay correct. It counts positions in UTF-16 units, a standard way of numbering the characters in text.
Findings
Each finding says where the match is, what kind it is, and how sure the scan is. It also gives a reason and a preview with the value hidden. It never holds the original value.

02The journey

What broke, and what changed.

Broke, then fixedA decisionA milestone

  1. 01 of 04Decided

    Edit the original text instead of rebuilding it

    The questionA redaction tool can read the whole file into the program and write it out again. Or it can change only the stretches of text it found.

    What I choseRedactionCore changes only those stretches, in the original text. It works from RedactionCore · The packageText replacementEdits the text from the end backwards, so earlier positions stay correct. It counts positions in UTF-16 units, a standard way of numbering the characters in text.See it in the map above, so the positions of earlier matches stay correct. Indentation and comments stay, and so do the order of settings and the line endings. How well it finds secrets is a separate question.

03Today

Where it stands.

The July audit shows 57 core tests passing. I cannot give a figure for how much it catches yet. First I need a fixed test set with a version number, checked by someone else. It must hold sensitive examples and ordinary text that should stay unchanged. Partway through a scan, the core does not check whether it was cancelled. So Omitto throws away results that arrive late.