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

Fix: external application requests via redirect URLs shows wrong origin. #1900

Merged
merged 7 commits into from
Dec 20, 2023

Conversation

not-a-rootkit
Copy link
Collaborator

@not-a-rootkit not-a-rootkit commented Nov 29, 2023

Task/Issue URL: https://app.asana.com/0/1176047645786601/1204521390227183/f

Description:
If the external application URL was the result of a cross-origin redirect, then we display the wrong origin in the external application request popup. Instead, I propose we check if redirects occurred, and use the origin of the most recent redirect as the first choice for the domain displayed to the user.

This is only a proposed fix, and will likely need a thorough review to ensure we don't cause breakage in legitimate external application requests.

Steps to test this PR:

  1. Visit https://alesandroortiz.com/security/chromium/external-protocol/spoof-links.html
  2. Click Tel
  3. Check the origin in the popup is aogarantiza.com and not alesandroortiz.com
  4. Manually enter tel://155555 into address bar
  5. Ensure popup appears with origin "155555"
  6. Visit this test page: https://crossorigin.site/tel.html
  7. Click the button
  8. Ensure the origin is displayed as "crossorigin.site"

Internal references:

Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation

If the external application URL was the result of a cross-origin redirect, then we incorrectly display the wrong origin in the external application request.

https://app.asana.com/0/1176047645786601/1204521390227183/f
@not-a-rootkit not-a-rootkit marked this pull request as ready for review November 30, 2023 13:06
@samsymons samsymons self-assigned this Nov 30, 2023
@samsymons
Copy link
Collaborator

I'll have this reviewed by EOD Monday, thanks for the patience!

@samsymons
Copy link
Collaborator

So far I believe this is looking good after testing this week - if it's okay I'll take one more day to bash on it some more just in case. Thanks!

@ayoy ayoy changed the base branch from develop to main December 6, 2023 16:01
Copy link
Collaborator

@samsymons samsymons left a comment

Choose a reason for hiding this comment

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

LGTM. I've been seeing some other strange behaviour with the popups while testing this, but it's behaviour that also affects main so it doesn't block this PR.

The steps in the PR description look good, and I haven't found any other ways to break this. We'll get this into an internal release on Monday. Thanks!

@not-a-rootkit not-a-rootkit merged commit 19c06f2 into main Dec 20, 2023
14 checks passed
@not-a-rootkit not-a-rootkit deleted the tespach/external-protocol-origin-spoof branch December 20, 2023 10:56
samsymons added a commit that referenced this pull request Dec 21, 2023
# By Dominik Kapusta (41) and others
# Via Dominik Kapusta (9) and others
* main: (138 commits)
  Make sure when we set custom config url, we don't expect etag in return (#1994)
  Add PixelKit source parameter (#1989)
  Fix internal user toggling (#2000)
  Show alert and display warning icon in Sync Settings when data syncing is disabled (#1996)
  DBP: Integrate subscription account authentication to DBP (#1995)
  Improve bookmarks html reader (#1986)
  Add Sync feature flags (#1992)
  Add daily stats pixel (#1993)
  Do not reload DBP tab when switching to it (#1942)
  Fix: external application requests via redirect URLs shows wrong origin. (#1900)
  Update clean-app.sh to work on macOS Sonoma and include NetP containers (#1988)
  Fix: "SwiftLintPlugin" must be enabled before it can be used (#1987)
  Prevent VPN server list persistence failures (#1985)
  add test can remove data (#1980)
  Remove VPN upgrade card (#1983)
  Fix low-res VPN warning asset (#1984)
  DBP: Fix unreliable date tests (#1981)
  Add search retention pixel for NetP (#1964)
  Sabrina/sync e2e tests (#1959)
  swiftlint build plugin (#1318)
  ...

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
#	DuckDuckGo/Application/AppDelegate.swift
samsymons added a commit that referenced this pull request Dec 22, 2023
# By Dominik Kapusta (2) and others
# Via GitHub
* main:
  Make sure when we set custom config url, we don't expect etag in return (#1994)
  Add PixelKit source parameter (#1989)
  Fix internal user toggling (#2000)
  Show alert and display warning icon in Sync Settings when data syncing is disabled (#1996)
  DBP: Integrate subscription account authentication to DBP (#1995)
  Improve bookmarks html reader (#1986)
  Add Sync feature flags (#1992)
  Add daily stats pixel (#1993)
  Do not reload DBP tab when switching to it (#1942)
  Fix: external application requests via redirect URLs shows wrong origin. (#1900)

# Conflicts:
#	DuckDuckGo/Statistics/PixelEvent.swift
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.

2 participants