AdguardTeam / FiltersCompiler

A tool that compiles & validates filters
GNU Lesser General Public License v3.0
52 stars 12 forks source link

`!#include` directive problem #220

Closed Alex-302 closed 3 months ago

Alex-302 commented 3 months ago

https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareAdGuard.txt has (had - it was updated) the directive !#include uBO%20list%20extensions/Dandelion%20Sprout's%20Anti-Malware%20List%20—%20AdGuardOnlyEntries.txt

Actual behaviour

AdGuard transform path to non existing https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/uBO%20list%20extensions/Dandelion%20Sprout's%20Anti-Malware%20List%20—%20AdGuardOnlyEntries.txt

Expected behaviour

Correct path (like in uBO): https://raw.githubusercontent.com/DandelionSprout/adfilt/master/uBO%20list%20extensions/Dandelion%20Sprout's%20Anti-Malware%20List%20—%20AdGuardOnlyEntries.txt

Our and uBO's specs are not fully compatible

ameshkov commented 3 months ago

In addition to that, AdGuard should verify that the included file is inside the directory where the parent file is located.

I.e., for a file /dir1/dir2/filter.txt

! Allowed:
!#include /dir1/dir2/inclusion.txt
!#include /dir1/dir2/dir3/inclusion.txt
!#include /dir1/dir2/dir3/dir4/inclusion.txt

! Not allowed:
!#include /dir1/inclusion.txt
Alex-302 commented 3 months ago

Moved to https://github.com/AdguardTeam/FiltersDownloader/issues/27 Comment also copied.