Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
1aa77e66
authored
Jun 18, 2026
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(ui): enforce HTTPS for backend-provided image URLs and improve URL validation
parent
06f9dec9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
web/default/src/features/wallet/lib/ui.tsx
+7
-9
No files found.
web/default/src/features/wallet/lib/ui.tsx
View file @
1aa77e66
...
...
@@ -27,26 +27,24 @@ import { PAYMENT_TYPES, PAYMENT_ICON_COLORS } from '../constants'
// UI Helper Functions
// ============================================================================
const
HAS_LOCATION
=
typeof
globalThis
!==
'undefined'
&&
'location'
in
globalThis
/**
* Resolves a backend-provided image URL to http(s) only. Rejects javascript:,
* data:, blob:, file:, and URLs with userinfo, which are unsafe in <img src/>.
* Resolves a backend-provided image URL to https only. Rejects http:,
* data:, blob:, file:, relative paths, and URLs with userinfo, which are unsafe
* or ambiguous in <img src/>.
*/
function
normalizeHttpIconUrl
(
raw
:
string
|
undefined
|
null
):
string
|
null
{
if
(
!
raw
)
return
null
const
s
=
raw
.
trim
()
if
(
!
s
)
return
null
if
(
!
/^https:
\/\/
/i
.
test
(
s
))
return
null
let
url
:
URL
try
{
url
=
HAS_LOCATION
?
new
URL
(
s
,
(
globalThis
as
{
location
:
Location
}).
location
.
href
)
:
new
URL
(
s
)
url
=
new
URL
(
s
)
}
catch
{
return
null
}
if
(
url
.
protocol
!==
'http
:'
&&
url
.
protocol
!==
'http
s:'
)
{
if
(
url
.
protocol
!==
'https:'
)
{
return
null
}
if
(
url
.
username
||
url
.
password
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment