mirror of
https://github.com/Sea-Haven-Industries/procurement-ingest.git
synced 2026-10-01 12:23:13 +00:00
Fix esc(None) TypeError and javascript: scheme in PO web UI
Coerce supplier name through `or ""` before escaping to handle nested None from DynamoDB. Add scheme allowlist on view_order_url to block javascript:/data: hrefs from LLM-extracted URLs.
This commit is contained in:
parent
afcd0eabe2
commit
b545bfed3d
1 changed files with 2 additions and 2 deletions
|
|
@ -71,7 +71,7 @@ def render_po_detail(po):
|
|||
("Email Type", render_badge(po.get("email_type", ""), EMAIL_TYPE_COLORS)),
|
||||
("Total Amount", fmt_currency(po.get("total_amount"))),
|
||||
("Currency", esc(po.get("currency", "")) or None),
|
||||
("Supplier", esc((po.get("supplier") or {}).get("name", "")) or None),
|
||||
("Supplier", esc((po.get("supplier") or {}).get("name") or "") or None),
|
||||
("Site Code", esc(po.get("site_code", "")) or None),
|
||||
("State", esc(po.get("state", "")) or None),
|
||||
("Trade", esc(po.get("trade", "")) or None),
|
||||
|
|
@ -102,7 +102,7 @@ def render_po_detail(po):
|
|||
fields.append(("Ship To", "<br>".join(ship_parts)))
|
||||
|
||||
view_url = po.get("view_order_url")
|
||||
if view_url:
|
||||
if view_url and view_url.startswith(("https://", "http://")):
|
||||
escaped_url = esc(view_url, quote=True)
|
||||
fields.append(
|
||||
(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue