Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Set true user agent on adobe domains
Browse files Browse the repository at this point in the history
Auditors: @bbondy
  • Loading branch information
diracdeltas committed Jun 27, 2016
1 parent 3a6b80a commit 811e742
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ function registerForBeforeSendHeaders (session) {
}

let requestHeaders = details.requestHeaders
let parsedUrl = urlParse(details.url || '')

if (!spoofedUserAgent) {
// To minimize fingerprintability, remove Brave from the UA string.
Expand All @@ -167,7 +168,9 @@ function registerForBeforeSendHeaders (session) {
appActions.changeSetting(settings.USERAGENT, spoofedUserAgent)
}

requestHeaders['User-Agent'] = spoofedUserAgent
if (!appConfig.uaExceptionHosts.includes(parsedUrl.hostname)) {
requestHeaders['User-Agent'] = spoofedUserAgent
}

for (let i = 0; i < beforeSendHeadersFilteringFns.length; i++) {
let results = beforeSendHeadersFilteringFns[i](details)
Expand All @@ -183,7 +186,6 @@ function registerForBeforeSendHeaders (session) {
}
}

let parsedUrl = urlParse(details.url || '')
if (module.exports.isResourceEnabled(appConfig.resourceNames.COOKIEBLOCK, details.firstPartyUrl)) {
if (module.exports.isThirdPartyHost(urlParse(details.firstPartyUrl || '').hostname,
parsedUrl.hostname)) {
Expand Down
5 changes: 4 additions & 1 deletion js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const consoleStrings = require('../constants/console')
const { aboutUrls, isSourceAboutUrl, isTargetAboutUrl, getTargetAboutUrl, getBaseUrl } = require('../lib/appUrlUtil')
const { isFrameError } = require('../lib/errorUtil')
const locale = require('../l10n')
const appConfig = require('../constants/appConfig')

class Frame extends ImmutableComponent {
constructor () {
Expand Down Expand Up @@ -142,9 +143,11 @@ class Frame extends ImmutableComponent {
}
this.webview.setAttribute('allowDisplayingInsecureContent', true)
this.webview.setAttribute('data-frame-key', this.props.frame.get('key'))
this.webview.setAttribute('useragent', getSetting(settings.USERAGENT) || '')

const parsedUrl = urlParse(location)
if (!appConfig.uaExceptionHosts.includes(parsedUrl.hostname)) {
this.webview.setAttribute('useragent', getSetting(settings.USERAGENT) || '')
}
const hack = siteHacks[parsedUrl.hostname]
if (hack && hack.userAgent) {
this.webview.setAttribute('useragent', hack.userAgent)
Expand Down
5 changes: 4 additions & 1 deletion js/constants/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,8 @@ module.exports = {
'general.disable-title-mode': process.platform === 'win32',
'advanced.hardware-acceleration-enabled': true,
'advanced.default-zoom-level': null
}
},
uaExceptionHosts: [
'get.adobe.com', 'adobe.com', 'www.adobe.com', 'helpx.adobe.com'
] // hosts to send true UA to
}

1 comment on commit 811e742

@bbondy
Copy link
Member

@bbondy bbondy commented on 811e742 Jul 2, 2016

Choose a reason for hiding this comment

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

++

Please sign in to comment.