File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616
1717import os
1818import time
19+ from html import escape
1920
2021# --- Provide safe defaults BEFORE importing the core module ----------------
2122# The core module reads these via os.getenv() at call time. Setting them here
172173if res :
173174 st .markdown ("### Result" )
174175 display = res ["password" ] if show_pw else "•" * len (res ["password" ])
175- st .markdown (f'<div class="tl-pw">{ display } </div>' , unsafe_allow_html = True )
176+ # Escape before injecting: generated passwords contain HTML-special chars
177+ # like < > & " which would otherwise break the markup (InvalidCharacterError).
178+ st .markdown (f'<div class="tl-pw">{ escape (display )} </div>' , unsafe_allow_html = True )
176179 st .markdown ('<div class="tl-note">Triple-click to select · nothing is stored server-side</div>' ,
177180 unsafe_allow_html = True )
178181
You can’t perform that action at this time.
0 commit comments