Re: Privoxy-users Digest, Vol 25, Issue 2

Lee <[email protected]>
Newsgroups gmane.comp.web.privoxy.user
Message-ID <CAD8GWsudOQbBWL0T+Zph4iNXx3hczofoRuzonzm6C8a7av+AjQ@mail.gmail.com>
On 12/15/18, H. Hodges <[email protected]> wrote:
> What makes filters and blocks unreliable for blocking Javascript?

https - all privoxy sees is the host name, so blocking javascript is
not possible (without blocking the whole site).

For https:// sites all you can do is block or allow based on the host
part of the URL (eg: www.example.com)   Privoxy can't tell if the
browser is going for www.example.com/page.html or
www.example.com/script.js.  All it knows is the browser is asking for
an encrypted connection to www.example.com

If you're using http the traffic is 'in the clear' and privoxy can
filter, block, whatever.

> Can you add something to the documentation that actually explains how
> to construct filters?

Take a look at https://www.privoxy.org/user-manual/filter-file.html

> You've listed an example filter here and there
> are examples in the Privoxy documentation, but it's difficult to figure
> out the actual structure of filters from examples alone. When you say
> "use a filter like," that tells me nothing because I'm not sure what
> the individual parts of your example do, so I don't know which parts of
> it to use in my own filter. I can refresh my knowledge of regular
> expressions by myself, but it would be nice to know what to apply the
> regular expressions to.

The regular expressions are applied to the page source for filters
(eg. user.filter) & URLs for blocks (eg. user.action).  That isn't
clear from the docs?

Regards,
Lee

>
> On Wed, Nov 28, 2018 at 4:00 AM,
> [email protected] wrote:
>> Send Privoxy-users mailing list submissions to
>> 	[email protected]
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> 	https://lists.privoxy.org/mailman/listinfo/privoxy-users
>> or, via email, send a message with subject or body 'help' to
>> 	[email protected]
>>
>> You can reach the person managing the list at
>> 	[email protected]
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of Privoxy-users digest..."
>>
>>
>> Today's Topics:
>>
>>    1. How to Block/Allow Javascript? (H. Hodges)
>>    2. Re: How to Block/Allow Javascript? (Fabian Keil)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Mon, 12 Nov 2018 14:12:02 -0800
>> From: "H. Hodges" <[email protected]>
>> To: [email protected]
>> Subject: [Privoxy-users] How to Block/Allow Javascript?
>> Message-ID: <[email protected]>
>> Content-Type: text/plain; charset=utf-8; format=flowed
>>
>> I want to block Javascript by default and whitelist some scripts. I
>> assume that I need to use filters, but I don't know how to refer to
>> Javascript in the rules (for example, *.js or ^script).
>>
>> Thanks for any help.
>>
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Tue, 27 Nov 2018 16:25:00 +0100
>> From: Fabian Keil <[email protected]>
>> To: "H. Hodges" <[email protected]>, [email protected]
>> Subject: Re: [Privoxy-users] How to Block/Allow Javascript?
>> Message-ID: <[email protected]>
>> Content-Type: text/plain; charset="us-ascii"
>>
>> "H. Hodges" <[email protected]> wrote:
>>
>>>  I want to block Javascript by default and whitelist some scripts. I
>>>  assume that I need to use filters, but I don't know how to refer to
>>>  Javascript in the rules (for example, *.js or ^script).
>>
>> You can use both a filter and blocks, however this will
>> not work 100% reliable.
>>
>> To remove script regions you can use a filter like:
>>
>> FILTER: remove-scripts Remove script tags
>> s@<script[^>]*>.*</script>@@Ugis
>>
>> Additionally you can block URLs ending with js:
>>
>> {+block{JavaScript is disabled}}
>> /.*\.js
>>
>> Some sites embed JavaScript in other tags using event attributes:
>> https://en.wikipedia.org/wiki/HTML_attribute#Event_attributes
>>
>> Preventing this requires additional filter rules.
>>
>> Fabian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.