-
Notifications
You must be signed in to change notification settings - Fork 920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add encodeURIComponent for WebUI data URLs in FE code #27636
Conversation
A Storybook has been deployed to preview UI for the latest push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey so I think we don't want to use encodeURIComponent
on any chrome://favicon
urls (as it doesn't support URL encoded origins) or on any brave://wallet
urls (it looks like it will break routing).
chrome://image
looks fine to change though!
(also, if we migrate to chrome://favicon2
it does support url encoding the host name, so we could do that here too, if you're feeling keen!)
components/brave_wallet_ui/components/desktop/wallet-menus/wallet_settings_menu.tsx
Outdated
Show resolved
Hide resolved
components/brave_wallet_ui/components/desktop/wallet-menus/wallet_settings_menu.tsx
Outdated
Show resolved
Hide resolved
components/brave_wallet_ui/components/extension/allow-add-change-network-panel/index.tsx
Outdated
Show resolved
Hide resolved
components/brave_wallet_ui/components/extension/confirm-transaction-panel/common/origin.tsx
Outdated
Show resolved
Hide resolved
components/brave_wallet_ui/components/extension/confirm-transaction-panel/common/origin.tsx
Outdated
Show resolved
Hide resolved
...ts/brave_wallet_ui/components/shared/authorize-hardware-device/authorize-hardware-device.tsx
Show resolved
Hide resolved
components/brave_wallet_ui/components/shared/create-network-icon/index.tsx
Outdated
Show resolved
Hide resolved
components/brave_wallet_ui/components/shared/nft-icon/nft-icon.tsx
Outdated
Show resolved
Hide resolved
Chromium major version is behind target branch (133.0.6943.54 vs 134.0.6998.15). Please rebase. |
Probably needs a rebase on cr134 |
components/brave_wallet_ui/components/desktop/views/crypto/index.tsx
Outdated
Show resolved
Hide resolved
...nts/brave_wallet_ui/components/extension/connect-with-site-panel/connect-with-site-panel.tsx
Outdated
Show resolved
Hide resolved
a6b9b60
to
f4eb43e
Compare
Ok, all the feedback should be addressed at this point. When I messed up the rebase I had to cherry-pick my old commits off, and I think I messed up the order of the cherry-pick. So all the feedback has been collapsed back into the single commit rather than separating it out. At this point, no chrome://favicon URIs or brave://wallet URIs should be changed based on the feedback. I think the last things that still need to be looked at by @Douglashdaniel are the following comments and to double-check I didn't accidentally break any images with this change. Here's the comments: |
@Douglashdaniel mentioned to me that this is breaking some of the images currently. I spent some time doing some debugging yesterday in storybook (which seems to behave different from local build) and I found out I could get things working if I did a Additionally, I noticed we've got some NFT images that are calling out directly to |
Oh interesting - I wouldn't have thought we could access Web urls from an internal WebUI page 😨 |
@fallaciousreasoning we are not supposed to, but for some reason |
components/brave_wallet_ui/nft/components/nft-details/nft-screen.tsx
Outdated
Show resolved
Hide resolved
components/brave_wallet_ui/components/shared/nft-icon/nft-icon.tsx
Outdated
Show resolved
Hide resolved
components/brave_wallet_ui/components/asset-name-and-icon/index.tsx
Outdated
Show resolved
Hide resolved
components/brave_wallet_ui/components/shared/create-placeholder-icon/index.tsx
Outdated
Show resolved
Hide resolved
components/brave_wallet_ui/components/shared/nft-icon/nft-icon.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
security approving
It seems we shouldn't be updating chrome://favicon or brave://wallet URIs, so this is an updated commit that addresses just the limited set of URIs that require encodedURIComponents usage.
08ee4b1
to
b80b0ed
Compare
b80b0ed
to
e8dc4e4
Compare
Released in v1.78.4 |
Resolves brave/brave-browser#43367
This is meant to prevent query params that are being used to pass data like URLs and images around to avoid an external URL being able to inject parameters to
chrome://image
. The majority of the instances were inbrave_wallet_ui
, but I did also spot some instances inbrave_new_tab_ui
. This is primarily a find/replace fix, so it would be good to make sure this isn't going to accidentally break images from being rendered.Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: