Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Closes #7142: Sanitize url in HttpIconLoader #7160

Merged
merged 1 commit into from
Jun 3, 2020

Conversation

Amejia481
Copy link
Contributor


Pull Request checklist

  • Quality: This PR builds and passes detekt/ktlint checks (A pre-push hook is recommended)
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry or does not need one
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features

After merge

  • Milestone: Make sure issues closed by this pull request are added to the milestone of the version currently in development.
  • Breaking Changes: If this is a breaking change, please push a draft PR on Reference Browser to address the breaking issues.

@Amejia481 Amejia481 added the 🕵️‍♀️ needs review PRs that need to be reviewed label May 28, 2020
@Amejia481 Amejia481 requested a review from pocmo May 28, 2020 15:43
@codecov
Copy link

codecov bot commented May 28, 2020

Codecov Report

Merging #7160 into master will decrease coverage by 0.45%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #7160      +/-   ##
============================================
- Coverage     77.23%   76.78%   -0.46%     
+ Complexity     5044     4783     -261     
============================================
  Files           674      652      -22     
  Lines         24692    23519    -1173     
  Branches       3643     3435     -208     
============================================
- Hits          19070    18058    -1012     
+ Misses         4113     4023      -90     
+ Partials       1509     1438      -71     
Impacted Files Coverage Δ Complexity Δ
.../components/browser/icons/extension/IconMessage.kt 75.00% <100.00%> (ø) 0.00 <0.00> (ø)
...onents/support/sync/telemetry/BaseGleanSyncPing.kt 100.00% <0.00%> (ø) 11.00% <0.00%> (ø%)
...a/components/browser/search/SearchEngineManager.kt
...owser/search/suggestions/SearchSuggestionClient.kt
...la/components/browser/search/suggestions/Parser.kt
.../mozilla/components/browser/search/SearchEngine.kt
...in/java/mozilla/components/lib/jexl/lexer/Token.kt
...zilla/components/lib/jexl/evaluator/JexlContext.kt
...mozilla/components/lib/jexl/parser/StateMachine.kt
...va/mozilla/components/lib/jexl/lexer/LexerInput.kt
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bec28a5...98158c8. Read the comment docs.

@Amejia481
Copy link
Contributor Author

@pocmo I preferred to not add a IllegalArgumentException to the exception list on HttpIconLoader.load as it is a implementation detail of GeckoViewFetch/GeckoWebExecutor, that is not necessary true for all implementation of Client. What do you think?

Copy link
Contributor

@pocmo pocmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pocmo I preferred to not add a IllegalArgumentException to the exception list on HttpIconLoader.load as it is a implementation detail of GeckoViewFetch/GeckoWebExecutor, that is not necessary true for all implementation of Client. What do you think?

Hm. I think I would prefer if we sanitize one level higher. This came from BrowserIcons and that code is reading values from the website. This code should take care of sanitizing and probably not blindly trust all values it gets. A Client bailing out if you feed it something that is not a valid URL sounds okay to me tbh. - I think it's good if it fails and the caller has to think about potentially broken/untrusted values being passed to the Client.

@Amejia481 Amejia481 changed the title Closes #7142: Sanitize url in GeckoViewFetch before download Closes #7142: Sanitize url in HttpIconLoader Jun 1, 2020
@Amejia481 Amejia481 requested a review from pocmo June 1, 2020 13:41
@Amejia481
Copy link
Contributor Author

@pocmo 👍 I updated the pr. Now we are sanitizing in both levels HttpIconLoader and GeckoViewFetch

@Amejia481
Copy link
Contributor Author

I updated the pr :)

Copy link
Contributor

@pocmo pocmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. 👍

bors r+

bors bot pushed a commit that referenced this pull request Jun 3, 2020
7160:  Closes #7142: Sanitize url in HttpIconLoader  r=pocmo a=Amejia481



Co-authored-by: Arturo Mejia <[email protected]>
@Amejia481 Amejia481 added 🛬 needs landing PRs that are ready to land and removed 🕵️‍♀️ needs review PRs that need to be reviewed labels Jun 3, 2020
@bors
Copy link

bors bot commented Jun 3, 2020

Build failed:

@Amejia481
Copy link
Contributor Author

bors retry

@bors
Copy link

bors bot commented Jun 3, 2020

Build succeeded:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🛬 needs landing PRs that are ready to land
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash IllegalArgumentException: Unsupported URI scheme when downloading icon
2 participants