Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-12-11 14:01:58 +01:00
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 Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
invisible Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
ambiguous.go Ensure that Chinese punctuation is not ambiguous when locale is Chinese (#22019) 2022-12-04 17:57:30 +00:00
ambiguous_gen.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
ambiguous_gen_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
breakwriter.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
breakwriter_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
charset.go Preserve BOM in web editor (#28935) 2024-01-27 18:02:51 +00:00
charset_test.go Preserve BOM in web editor (#28935) 2024-01-27 18:02:51 +00:00
escape.go [FEAT] Enable ambiguous character detection in configured contexts 2024-02-23 13:12:17 +01:00
escape_status.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
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 Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
invisible_gen.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00