Skip to content
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

Brave News won't include items with non-http-or-https destination urls #16519

Merged
merged 1 commit into from
Jan 6, 2023

Conversation

petemill
Copy link
Member

@petemill petemill commented Jan 4, 2023

Applies to both the combined feed (feed.json hosted on Brave's PCDN) and direct feeds (i.e. RSS feeds)

Resolves brave/brave-browser#27602

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run lint, npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

STR/Cases can be found via https://github.com/brave/internal/issues/987#issue-1526132512.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2023

⚠️ PR head is an unsigned commit
commit: 1bde50f47d5d2cf0e31db2fca25210650702f208
reason: unsigned
Please follow the handbook to configure commit signing
cc: @petemill

entry->data->score = entry->data->score * variety;
variety = variety * 2.0;
}
DirectFeedController::BuildArticles(articles, response->data,
Copy link
Member Author

@petemill petemill Jan 4, 2023

Choose a reason for hiding this comment

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

Moved this logic to a more testable function

Comment on lines +394 to +397
if (!item->data->url.SchemeIsHTTPOrHTTPS()) {
continue;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This bypasses non-http(s) items from direct-downloaded RSS feeds

Comment on lines +66 to +69
if (!url.SchemeIsHTTPOrHTTPS()) {
VLOG(1) << "Item url was not HTTP or HTTPS: " << url.spec();
return false;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This bypasses non-http(s) items from the combined feed hosted by Brave

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a corresponding backend change? I think ideally we wouldn't be including any non-https items in the combined feed in the first place.

Copy link
Member Author

Choose a reason for hiding this comment

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

I would hope it wouldn't include it but doesn't hurt to double-check. And there's always the possibility someone points the browser to a third party combined feed source via the cli param...

@petemill petemill requested a review from fmarier January 4, 2023 18:27
Applies to both the combined feed (feed.json hosted on Brave's PCDN) and direct feeds (i.e. RSS feeds)
@petemill petemill force-pushed the news-no-internal-protocol-links branch from 1bde50f to 435c8e3 Compare January 5, 2023 01:46
Copy link
Contributor

@fallaciousreasoning fallaciousreasoning left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +66 to +69
if (!url.SchemeIsHTTPOrHTTPS()) {
VLOG(1) << "Item url was not HTTP or HTTPS: " << url.spec();
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a corresponding backend change? I think ideally we wouldn't be including any non-https items in the combined feed in the first place.

// Convert from the "combined feed" hosted remotely to Brave News mojom items.
// TODO(petemill): Rename this file to combined_feed_parsing.h or similar,
// in order to differentiate the "Combined Feed" from
// a "Direct Feed" (a.k.a RSS).
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@sangwoo108 sangwoo108 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@petemill petemill merged commit e46731b into master Jan 6, 2023
@petemill petemill deleted the news-no-internal-protocol-links branch January 6, 2023 04:32
@github-actions github-actions bot added this to the 1.49.x - Nightly milestone Jan 6, 2023
petemill added a commit that referenced this pull request Jan 6, 2023
Brave News won't include items with non-http-or-https destination urls
petemill added a commit that referenced this pull request Jan 7, 2023
Brave News won't include items with non-http-or-https destination urls
@kjozwiak
Copy link
Member

kjozwiak commented Jan 9, 2023

Verification PASSED on Win 11 x64 using the following build(s):

Brave | 1.49.11 Chromium: 109.0.5414.80 (Official Build) nightly (64-bit)
-- | --
Revision | 0f69b168d36a06cace4365e9f029fa987afa5633-refs/branch-heads/5414@{#1178}
OS | Windows 11 Version 22H2 (Build 22621.963)

Verification notes can be found via https://github.com/brave/internal/issues/987#issuecomment-1376133449.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[hackerone] brave today url opening issue
7 participants