Closed
Description
Homoglyphs are different unicode characters that to the naked eye look the same.
#![feature(non_ascii_idents)]
fn main() {
let a = 2;
let а = 3;
assert_eq!(a, 2);
assert_eq!(а, 3);
}
where a
is latin lower case a, and а
is cyrillic lower case a. Another example is: A, Α, А (Latin-A, Greek Alpha, Cyrillic-A).
This binary runs on my machine without errors, but it seems that the Rust playground doesn't support unicode yet.
Homoglyph-based attacks are typically used in domain names, and underhanded code.
To prevent this attacks we can check whether any two identifiers in scope are homoglyphs, and warn about it.