Skip to content

Instantly share code, notes, and snippets.

@rmirabelli
Created December 8, 2021 18:22
Show Gist options
  • Save rmirabelli/d0dbf509878c72fca7994dd886a7696b to your computer and use it in GitHub Desktop.
Save rmirabelli/d0dbf509878c72fca7994dd886a7696b to your computer and use it in GitHub Desktop.
Exclude unicode in a SwiftLint rule
# Warns for presence of unicode characters, due to possible RTL security
# issues, as a quick-and-dirty protection against https://trojansource.codes
# Exceptions are from usage in a test control group.
# This has been tested against a reasonable set of verifyable exploits.
#
# Yes, this is a huge hammer instead of a scalpel.
#
# Yes, this means no more emoji for variable names. You shouldn't have
# been doing that anyhow.
Unicode_considered_harmful:
name: "Unicode may mask security risks"
regex: "[^[:ascii:]|(©'−•®é–'"")]"
message: "RTL languages and Homoglyphs may cause security issues. Please use ASCII when possible. See https://trojansource.codes for an introduction to the issue."
severity: warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment