i18n-security-lint
A command-line tool and CI action that scans locale files for security defects introduced through unreviewed translated strings.
It checks the four vulnerability classes documented in the parent repository's Security Scope:
- Bidirectional control misuse — overrides (
U+202D,U+202E) that make displayed text differ from actual file content, and controls left unterminated so they leak direction into surrounding UI. Balanced isolates (U+2066–U+2069) are the mechanism Unicode and W3C recommend and are not reported. - Cross-site scripting (XSS) in rendered locale content — HTML/script fragments embedded in translated strings.
- Format-specifier tampering — printf-family specifiers (
%s,%d,%1$d,%(name)s) added, removed, or retyped during translation. - Interpolation-variable integrity failures — brace- and template-style
variables (
{0},{name},{{var}},$t(key)) renamed or omitted, breaking string interpolation.
Full rule ids, severities, and detection methods are specified in
spec/translated-string-security-checks.md.
Supported formats
| Format | Extension | Source pair used for checks 3–4 |
|---|---|---|
| JSON | .json |
translation-only (checks 1–2) |
| gettext | .po |
msgid → msgstr (all checks) |
| XLIFF | .xliff, .xlf |
<target> text (checks 1–2) |
| Fluent | .ftl |
key = value (checks 1–2) |
Install
pip install i18n-security-lint
Or, for development, from this directory:
pip install -e .
Usage
# Scan one or more locale files
i18n-security-lint locale/*.po
# Scan a directory recursively, emit JSON, fail CI on any finding
i18n-security-lint --json --strict locale/
Exit code is 1 when --strict is set and at least one finding is reported,
so the tool drops straight into a CI pipeline.
GitHub Action
- uses: ecogetaway/oss-language-inclusion/tools/i18n-security-lint@main
with:
path: locale/
Status
v0.2. All four checks are implemented: bidi and XSS for every
supported format, format-specifier and interpolation-variable drift for .po
source/translation pairs. The test suite covers each check across JSON, gettext,
XLIFF, and Fluent corpus files, and the repository's CI dogfoods the scanner
against the malicious corpus on every push (it must flag every malicious file
and pass the clean one). This is the flagship security deliverable of the Open
Source Language Inclusion initiative, demonstrated as required.
Breaking change in v0.2: rule ids changed. BIDI_OVERRIDE now fires only on
true overrides (U+202D/U+202E), with BIDI_UNBALANCED and
BIDI_DEPRECATED_EMBEDDING covering the other cases; PLACEHOLDER_DRIFT is
replaced by FORMAT_SPECIFIER_DRIFT and INTERPOLATION_DRIFT. Update any CI
configuration that filters on rule ids. Migration table in the
spec.
Known limitations: detection is pattern-based, not parser-accurate — see the repository's SECURITY.md for scope and how to report bypasses.
License
Apache-2.0 (inherited from the parent repository).
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file i18n_security_lint-0.2.1.tar.gz.
File metadata
- Download URL: i18n_security_lint-0.2.1.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db79ca1480bfdb68ef175a94e93dc8edf1b2c723d77a82a53b6e47d95f02fa55
|
|
| MD5 |
c164b2e0a53d04b6b00a0dd659435846
|
|
| BLAKE2b-256 |
e3ddb18a314f8a307893a64c6d1d564f3d8dbc9e32c133bd155f34b1ca23e973
|
File details
Details for the file i18n_security_lint-0.2.1-py3-none-any.whl.
File metadata
- Download URL: i18n_security_lint-0.2.1-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d28fa763636d3df294d9658b91d5abbac550573ec875fb64c5f813f0161d5c4
|
|
| MD5 |
3177862fc8537d1eda59a95731333759
|
|
| BLAKE2b-256 |
75cf28693420e234497bba3d0dde3949c7efd4d90b82de2c0954391a34f50aac
|