aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/policies/rule.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-10-22 13:47:40 +0200
committerWojtek Kosior <koszko@koszko.org>2022-10-22 14:00:35 +0200
commit59a4b477dd922d2f839a717fe199501e7cb71e6e (patch)
treed6120e13f493ef057ee5445c566e1aca11a9f7f5 /src/hydrilla/proxy/policies/rule.py
parent1fc2dbe5a3e867eb5e6c2f759409f1c94146a794 (diff)
downloadhaketilo-hydrilla-59a4b477dd922d2f839a717fe199501e7cb71e6e.tar.gz
haketilo-hydrilla-59a4b477dd922d2f839a717fe199501e7cb71e6e.zip
[proxy] simplify usage of class variables of `Policy` subtypes
This commit also prevents popup script injection to Haketilo-served pages like `https://hkt.mitm.it/`.
Diffstat (limited to 'src/hydrilla/proxy/policies/rule.py')
-rw-r--r--src/hydrilla/proxy/policies/rule.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/hydrilla/proxy/policies/rule.py b/src/hydrilla/proxy/policies/rule.py
index 2a6d8cb..8c5e69b 100644
--- a/src/hydrilla/proxy/policies/rule.py
+++ b/src/hydrilla/proxy/policies/rule.py
@@ -40,17 +40,15 @@ from . import base
class AllowPolicy(base.Policy):
- """...."""
- priority: t.ClassVar[base.PolicyPriority] = base.PolicyPriority._TWO
+ priority = base.PolicyPriority._TWO
script_csp_directives = ('script-src', 'script-src-elem', 'script-src-attr')
class BlockPolicy(base.Policy):
- """...."""
- _process_response: t.ClassVar[bool] = True
+ _process_response = base.MsgProcessOpt.MUST
- priority: t.ClassVar[base.PolicyPriority] = base.PolicyPriority._TWO
+ priority = base.PolicyPriority._TWO
@property
def current_popup_settings(self) -> state.PopupSettings:
@@ -67,13 +65,11 @@ class BlockPolicy(base.Policy):
@dc.dataclass(frozen=True)
class RuleAllowPolicy(AllowPolicy):
- """...."""
pattern: ParsedPattern
@dc.dataclass(frozen=True)
class RuleBlockPolicy(BlockPolicy):
- """...."""
pattern: ParsedPattern