Skip to content

Conversation

incertum
Copy link
Contributor

Add optional HELP line support (includes help text validation and sanitization).

Follow for #126

CC @ktoso @FranzBusch thanks in advance for your review!

@incertum
Copy link
Contributor Author

incertum commented Jul 31, 2025

Finalizes #127

return true
}

fileprivate func isValidHelpText() -> Bool {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a security person string sanitization always scares me as you usually get it wrong. Would you have better ideas here?

Copy link
Collaborator

@ktoso ktoso Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could "....".allSatisfy { character in character.isLetter || character.isNumber || punctuation?? } but also allow punctuation etc, or lean into CharacterSet from Foundation...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, I'll check tmrw and possibly re-push the last commit and add that in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ktoso besides adding all overloads, I refactored the HelpText sanitization a bit, however still without Foundation in order to limit some side-effects (such as increasing the binary size for adopters).
Would you be able to review these changes? Much appreciated ❤️

Copy link
Collaborator

@ktoso ktoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, minor nitpick

@ktoso ktoso added the 🆕 semver/minor Adds new public API. label Jul 31, 2025
Notably, add consistent overloads to maintain ABI stability

Plus adjust `ValidHelpText` approach for broader robustness

Signed-off-by: Melissa Kilby <[email protected]>
Co-authored-by: Konrad `ktoso` Malawski <[email protected]>
Copy link
Collaborator

@ktoso ktoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@ktoso ktoso merged commit fb9f489 into swift-server:main Aug 4, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants