stage23-donation-widget.py
TEXT FILE456 B · Public source code for developers, search crawlers and AI agents
1from html import escape
2import re
3
4def widget(address, label):
5 if not re.fullmatch(r'[a-zA-Z0-9]{14,90}',address): raise ValueError('unsafe address')
6 return '<section><h2>'+escape(label)+'</h2><code>'+escape(address)+'</code><p><a href="bitcoin:'+address+'">Open wallet</a></p></section>'
7
8if __name__ == '__main__':
9 html=widget('tb1qsyntheticfixture','<script>alert(1)</script>')
10 assert '<script>' not in html and '<script>' in htmlRead-only source · Select a line number to link directly · Raw download above
