§
sÃj4. ã óX — d dl Z d dlmZ d dlmZ d dlmZ dZd„ Z dZ
G d„ d e¦ « Z G d
„ de¦ « Z G d„ d
e¦ « Z
G d„ de¦ « Z G d„ de¦ « Z G d„ de¦ « Z G d„ de¦ « Z G d„ de¦ « Z G d„ de¦ « Z G d„ de¦ « ZdS )é N)Úurlsplit)Úgettext)Ú WposError)ú"ú<ú>c ó ‡ — t ‰ t ¦ « sdS t d„ ‰ D ¦ « ¦ « rdS t ‰ ¦ « j ¦ « }|dvrdS t ˆ fd„t D ¦ « ¦ « rdS ‰ S )aè Validate a caller-supplied url shared between the HTML templates and the
plain-text ``curl %(url)s`` fix_tip.
The same value feeds an HTML sink (the anchor in MESSAGE_TEMPLATE) and a
plain-text sink (the curl fix_tip), so it must not be html-escaped: that
would corrupt a legitimate url (e.g. ``?a=1&b=2`` -> ``?a=1&b=2``) in
the copy-pasteable command. Instead validate-and-reject: keep the url
byte-for-byte when its scheme is http/https and it contains no
attribute/tag-breaking characters; otherwise drop it to an empty string.
A scheme-validated url with no breaking chars is safe in the HTML anchor
(``&`` alone cannot break an attribute or inject script) and correct in the
curl command.
Ú c 3 óŠ K — | ]>}| ¦ « p%t |¦ « d k pt |¦ « dk V — Œ?dS )é é N)ÚisspaceÚord)Ú.0Úchs ú&py/clwpos/user/website_check/errors.pyú