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

Dynamically set electron user agent #524

Merged
merged 5 commits into from
Oct 26, 2021

Conversation

MGibson1
Copy link
Member

@MGibson1 MGibson1 commented Oct 21, 2021

Overview

Asana ticket: https://app.asana.com/0/1169444489336079/1201245609926305

We're forcing our electron user agents to a specific FF version in order to protect users from external sources compiling user data.

However, this requires us to occasionally update our faked useragent when services start to balk at our years-old browser version. Really, we should be truthful about as much as possible. This edits the user agent built by electron to anonymize system information and remove bitwarden/electron data.

Related to bitwarden/desktop#399 (comment) (again)

electron/src/window.main.ts Outdated Show resolved Hide resolved
Copy link
Member

@Hinton Hinton left a comment

Choose a reason for hiding this comment

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

I think at least one test should use pre-defined data without variables. Just to have a ground-truth version.

@@ -69,6 +69,8 @@ jobs:
name: test-coverage
path: coverage/

- name: Run Node tests
Copy link
Member

Choose a reason for hiding this comment

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

Not sure how much I like sneaking this into an otherwise unrelated PR. Don't get me wrong, I think it's a great change just not sure if we want to do this here.

Copy link
Member Author

Choose a reason for hiding this comment

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

not really sneaking, we're just not running these tests if we don't do this change

@MGibson1 MGibson1 force-pushed the dynamically-anonymize-electron-user-agent branch from 925e459 to 5f12433 Compare October 22, 2021 19:05
@MGibson1 MGibson1 marked this pull request as ready for review October 22, 2021 19:06
@MGibson1 MGibson1 requested a review from Hinton October 22, 2021 19:06
electron/src/window.main.ts Outdated Show resolved Hide resolved
@MGibson1 MGibson1 requested a review from Hinton October 26, 2021 13:21
@MGibson1 MGibson1 force-pushed the dynamically-anonymize-electron-user-agent branch from 6debce0 to 8e893e0 Compare October 26, 2021 13:38
@MGibson1 MGibson1 merged commit 0f9c220 into master Oct 26, 2021
@MGibson1 MGibson1 deleted the dynamically-anonymize-electron-user-agent branch October 26, 2021 13:45
justindbaur added a commit that referenced this pull request Nov 10, 2021
* Add node tests to pipeline (#525)

* Add support for crypto agent (#520)

* feat: add an importer for Safari (CSV) (#512)

* feat(importers/safariCsvImporter): add the importer for Safari (CSV)

* Revert changes to package-lock.json

Co-authored-by: Thomas Rittson <trittson@bitwarden.com>

* Dynamically set electron user agent (#524)

* Dynamically set electron user agent

* PR review

* linter fixes

* Test agent static version does not change

* Fix formatting

* Add role="alert" to callouts only when enforceAlert is passed (#528)

* Add role="alert" to callouts when enforceAlert is passed

* Remove ElementRef and do a different way

* Rename input variable

* Add PR template (#529)

* Allow managers to create collections (#530)

* Pass in null for sso organziation for now. (#531)

This will bypass cryptoagent

* Add Linked Field as custom field type (#431)

* Basic proof of concept of Linked custom fields

* Linked Fields for all cipher types, use dropdown

* Move linkedFieldOptions to view models

* Move add-edit custom fields to own component

* Fix change handling if cipherType changes

* Use Field.LinkedId to store linked field info

* Refactor accessors in cipherView for type safety

* Use map for linkedFieldOptions

* Refactor: use decorators to record linkable info

* Add ItemView

* Use enums for linked field ids

* Add union type for linkedId enums, add jsdoc comment

* Use parameter properties for linkedFieldOption

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* Fix type casting

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* Update electron to 14.2.0 (#534)

* Update electron to 14.1.1

* Update electron to 14.2.0 and fix it to this version

* Removed ^ from electron in electron/package-lock.json

* [Linked fields] Reset linkedIds if cipher type changes (#535)

* Reset linkedIds if cipher type changes

* Only reset linkedId if !editmode

* Add call to server

* Fix linting

* Add call to server

* Fix linting

* Run linting

* Add new properties to organization

* Remove organizationUserId from request model

* Added in org sponsorship calls

* Sponsorship redeem existing org flow

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Oscar Hinton <oscar@oscarhinton.com>
Co-authored-by: pan93412 <pan93412@gmail.com>
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
justindbaur added a commit that referenced this pull request Nov 19, 2021
* Families for enterprise/account settings (#541)

* Add node tests to pipeline (#525)

* Add support for crypto agent (#520)

* feat: add an importer for Safari (CSV) (#512)

* feat(importers/safariCsvImporter): add the importer for Safari (CSV)

* Revert changes to package-lock.json

Co-authored-by: Thomas Rittson <trittson@bitwarden.com>

* Dynamically set electron user agent (#524)

* Dynamically set electron user agent

* PR review

* linter fixes

* Test agent static version does not change

* Fix formatting

* Add role="alert" to callouts only when enforceAlert is passed (#528)

* Add role="alert" to callouts when enforceAlert is passed

* Remove ElementRef and do a different way

* Rename input variable

* Add PR template (#529)

* Allow managers to create collections (#530)

* Pass in null for sso organziation for now. (#531)

This will bypass cryptoagent

* Add Linked Field as custom field type (#431)

* Basic proof of concept of Linked custom fields

* Linked Fields for all cipher types, use dropdown

* Move linkedFieldOptions to view models

* Move add-edit custom fields to own component

* Fix change handling if cipherType changes

* Use Field.LinkedId to store linked field info

* Refactor accessors in cipherView for type safety

* Use map for linkedFieldOptions

* Refactor: use decorators to record linkable info

* Add ItemView

* Use enums for linked field ids

* Add union type for linkedId enums, add jsdoc comment

* Use parameter properties for linkedFieldOption

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* Fix type casting

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* Update electron to 14.2.0 (#534)

* Update electron to 14.1.1

* Update electron to 14.2.0 and fix it to this version

* Removed ^ from electron in electron/package-lock.json

* [Linked fields] Reset linkedIds if cipher type changes (#535)

* Reset linkedIds if cipher type changes

* Only reset linkedId if !editmode

* Add call to server

* Fix linting

* Add call to server

* Fix linting

* Run linting

* Add new properties to organization

* Remove organizationUserId from request model

* Added in org sponsorship calls

* Sponsorship redeem existing org flow

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Oscar Hinton <oscar@oscarhinton.com>
Co-authored-by: pan93412 <pan93412@gmail.com>
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>

* Revoke sponsorship uses organization id

* Expect information in billing items on whether the item is sponsored

* Families for enterprise/redeem card (#546)

* Add userservice helper

* Run linter

* Add resend email to api service (#548)

* Remove unneeded imports

* Remove unneeded files

* Add newline

* Reorder import

* Remove accidental newline

* Fix lint issue

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Oscar Hinton <oscar@oscarhinton.com>
Co-authored-by: pan93412 <pan93412@gmail.com>
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants