forgejo/modules/charset
Gusted 5b3a82d621
[FEAT] Enable ambiguous character detection in configured contexts
- The ambiguous character detection is an important security feature to
combat against sourcebase attacks (https://trojansource.codes/).
- However there are a few problems with the feature as it stands
today (i) it's apparantly an big performance hitter, it's twice as slow
as syntax highlighting (ii) it contains false positives, because it's
reporting valid problems but not valid within the context of a
programming language (ambiguous charachters in code comments being a
prime example) that can lead to security issues (iii) charachters from
certain languages always being marked as ambiguous. It's a lot of effort
to fix the aforementioned issues.
- Therefore, make it configurable in which context the ambiguous
character detection should be run, this avoids running detection in all
contexts such as file views, but still enable it in commits and pull
requests diffs where it matters the most. Ideally this also becomes an
per-repository setting, but the code architecture doesn't allow for a
clean implementation of that.
- Adds unit test.
- Adds integration tests to ensure that the contexts and instance-wide
is respected (and that ambigious charachter detection actually work in
different places).
- Ref: https://codeberg.org/forgejo/forgejo/pulls/2395#issuecomment-1575547
- Ref: https://codeberg.org/forgejo/forgejo/issues/564
2024-02-23 13:12:17 +01:00
..
ambiguous
invisible
ambiguous.go
ambiguous_gen.go
ambiguous_gen_test.go
breakwriter.go
breakwriter_test.go
charset.go
charset_test.go
escape.go [FEAT] Enable ambiguous character detection in configured contexts 2024-02-23 13:12:17 +01:00
escape_status.go
escape_stream.go Refactor locale&string&template related code (#29165) 2024-02-16 15:20:52 +01:00
escape_test.go [FEAT] Enable ambiguous character detection in configured contexts 2024-02-23 13:12:17 +01:00
htmlstream.go
invisible_gen.go