1
0
Fork 0
gitea/modules
Alexander Scheel 1bf9e44bda
Fix sanitizer config - multiple rules (#11133)
In #9888, it was reported that my earlier pull request #9075 didn't quite function as expected. I was quite hopeful the `ValuesWithShadow()` worked as expected (and, I thought my testing showed it did) but I guess not. @zeripath proposed an alternative syntax which I like:

```ini
[markup.sanitizer.1]
ELEMENT=a
ALLOW_ATTR=target
REGEXP=something
[markup.sanitizer.2]
ELEMENT=a
ALLOW_ATTR=target
REGEXP=something
```

This was quite easy to adopt into the existing code. I've done so in a semi-backwards-compatible manner:

 - The value from `.Value()` is used for each element.
 - We parse `[markup.sanitizer]` and all `[markup.sanitizer.*]` sections and add them as rules.

This means that existing configs will load one rule (not all rules). It also means people can use string identifiers (`[markup.sanitiser.KaTeX]`) if they prefer, instead of numbered ones.

Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-29 12:34:59 +01:00
..
analyze Migrate to go-enry new version (#10906) 2020-04-15 20:40:39 +03:00
auth Add option to increase provided OAuth2 token maximum size (#11180) 2020-04-23 00:47:23 +02:00
avatar
base
cache
charset
context
convert Prevent merge of outdated PRs on protected branches (#11012) 2020-04-16 22:00:36 -03:00
cron
emoji Support unicode emojis and remove emojify.js (#11032) 2020-04-28 15:05:39 -03:00
generate
git Support unicode emojis and remove emojify.js (#11032) 2020-04-28 15:05:39 -03:00
gitgraph
graceful Prevent panic during wrappedConn close at hammertime (#11219) 2020-04-26 21:01:06 -03:00
highlight
httplib
indexer Log the indexer path on failure (#11172) 2020-04-22 16:16:58 -04:00
lfs
log
markup Support unicode emojis and remove emojify.js (#11032) 2020-04-28 15:05:39 -03:00
metrics
migrations When migrating from Gitlab map Approvals to approving Reviews (#11147) 2020-04-20 13:30:46 +01:00
notification
options
password
pprof
private
process
public Send 404 immediately for known public requests (#11117) 2020-04-18 22:01:06 +01:00
queue Improve config logging when WrappedQueue times out (#11174) 2020-04-22 13:38:40 +01:00
recaptcha
references
repofiles Fix GetContents(): Dont't ignore Executables (#11192) 2020-04-24 19:20:22 +03:00
repository Fix forked repo has no icon and language stat. (#10791) 2020-04-08 15:13:04 +03:00
secret
session
setting Fix sanitizer config - multiple rules (#11133) 2020-04-29 12:34:59 +01:00
ssh
structs Add support for migrating from Gitlab (#9084) 2020-04-19 23:44:11 +08:00
sync
task
templates Support unicode emojis and remove emojify.js (#11032) 2020-04-28 15:05:39 -03:00
test
timeutil
upload
user
util
validation [API] Get a single commit via Ref (#10915) 2020-04-07 22:54:46 -04:00
webhook