uttrflow / uttrflow/uttrflow-swift

SecretScanners relies on the undocumented standard library entry String._wordIndex(after:)

Open
#486 0 comments 0 reactions 0 assignees View on GitHub
area:clipboard enhancement P2
Dominant language
Swift
Stars
4
Forks
17
Avg merge
3h 32m
Merged PRs (30d)
277

Description

## What happens

`WordBreaks.isBoundary` in `Sources/UttrflowClipboard/SecretScanners.swift:403` calls `text._wordIndex(after:)`, which #458 used to find Unicode word boundaries in linear time. Underscored entries in the standard library are internal: they are not documented, not covered by source stability, and can change or disappear in any toolchain release.

## Why it matters

If a toolchain changes its behaviour, secret detection in the clipboard changes silently: a key, token or card number that should be masked could be shown. If it disappears, the build breaks with no obvious replacement.

## How to check

Search `Sources/` for `_wordIndex`. There is one use.

## Acceptance criteria

One of:

1. Replace it with a supported API that keeps the linear-time behaviour #458 measured (for example `NLTokenizer` or a boundary walk based on `Character` properties), with the scaling test in `SecretShapesScalingTests.swift` still passing; or
2. Keep it, and add a test that compares `WordBreaks` against `NSRegularExpression`'s `\b` on a table covering ASCII, digits, underscores, combining marks, emoji and CJK text, so a toolchain change fails loudly in `make verify`. The use gets a one-line comment pointing at that test.

In both cases `SecretDetectionTests` and `SecretShapesOracleTests` must pass unchanged.

Contributor guide

Open the contributing guide

Research direction

Start at Sources/UttrflowClipboard/SecretScanners.swift:403 and search Sources/ for the single _wordIndex use. Compare the supported-API replacement or compatibility test against the acceptance criteria, including ASCII, digits, underscores, combining marks, emoji and CJK text. Run SecretShapesScalingTests.swift, SecretDetectionTests, SecretShapesOracleTests, and make verify; done means the required tests pass without changing the latter two suites.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
security, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.