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

Make extension have a static ID so it can be whitelisted #3674

Merged
merged 1 commit into from
Mar 15, 2019

Conversation

flotwig
Copy link
Contributor

@flotwig flotwig commented Mar 8, 2019

Fixes #3673
Fixes #1239

This PR makes the extension have a static ID so it can be whitelisted.

The extension ID for Cypress is: caljajdfkjjjdehjdoimjkkakekklcck

@bahmutov
Copy link
Contributor

bahmutov commented Mar 8, 2019 via email

@flotwig
Copy link
Contributor Author

flotwig commented Mar 9, 2019

@bahmutov it's funny you asked... I wrote a shell script to bruteforce extension IDs to do just that, then I realized you can only use characters from A to P (shifted hexadecimal):

https://gist.github.com/flotwig/37121c884d2f19712935eb1bc9a55efe

Too bad. This ID does begin with "c" though. I'm open to other ideas that only use characters between A and P.

@bahmutov
Copy link
Contributor

bahmutov commented Mar 9, 2019 via email

@brian-mann
Copy link
Member

Just curious why this needs to happen? since we build the extension locally and pass it in via command line arguments - in what scenario would a user need this to be whitelisted?

@flotwig
Copy link
Contributor Author

flotwig commented Mar 9, 2019

@brian-mann There's a Chrome policy that sets a whitelist of permitted extension IDs, apparently it has been causing problems with loading the extension: #1239 (comment)

@brian-mann
Copy link
Member

Can we instead accept this via a command line flag? I don’t think we want to embed the ID directly in the manifest for reasons. Then people could generate their own extension id and we’d load the extension with this in the manifest.

@jennifer-shehane
Copy link
Member

@brian-mann This is also helpful in situations where the user's company blocks extensions by id as detailed here: #2494

@flotwig flotwig changed the title [WIP] Make extension have a static ID so it can be whitelisted Make extension have a static ID so it can be whitelisted Mar 11, 2019
Copy link
Member

@brian-mann brian-mann left a comment

Choose a reason for hiding this comment

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

Approving. @jennifer-shehane we need to add this to the docs.

I think we should also accept the extension ID via CLI flags but that can be a separate PR.

@jennifer-shehane
Copy link
Member

🎶super caljajdfkjjjdehjdoimjkkakekklcck expialidocious 🎶

@jaredrada
Copy link

Hi @brian-mann could you elaborate more on the fact it's build locally? Is the extension built on users machine during the install process (and Chrome is provided with a location to the unpacked extension- or is there a CRX file involved)? My company does not allow whitelisting by ID and instead we must package an approved CRX file which can then be installed to users machines.

@flotwig
Copy link
Contributor Author

flotwig commented Apr 5, 2019

@jaredrada There is no .crx, the Cypress extension is an unpacked extension that's copied into Cypress's Chrome user profile when you run your tests, and forced to load via the --load-extension Chrome CLI argument. This all takes place in chrome.coffee, look for _writeExtension and _normalizeArgExtensions.

Is your organization using the ExtensionInstallForcelist Chrome policy? From those docs, maybe it would be enough to add the Cypress extension ID to the forcelist, but I'm not totally sure.

@jaredrada
Copy link

Thanks for the quick reply. Will have to look into that route or alternatively see if you'll add support for running in Chrome w/o using the extension as mentioned in #2494 (comment) as it appears most of the engineering was done for headless Chrome.

@benmonro that's a good idea! We may make the chrome extension optional, as we have already had to engineer that for headless chrome, which doesn't support extensions

@iackc
Copy link

iackc commented Jul 17, 2019

@flotwig @jaredrada / @brian-mann / @jennifer-shehane So, our company blocks all extension and selectively whitelists fe extension. I have the latest Cypress installed and IT has whitelisted the extension ID for Cypress is: caljajdfkjjjdehjdoimjkkakekklcck.

When using WINDOWS "admin" account the static extension id is available and tests get executed in chrome browser. However when using a windows local-user (non admin) the extension is not available ('cy' icon is not present in the browser and doesn't show up under extensions)and standard error page is displayed. The company policy prevents from users having an elevated or admin-like account so the tester's can't really run the tests. Any suggestions / workarounds?

I've already tried deleting the everything under "cy" folder from "View App Data" and restarted Cypress but that has not helped.

Here are the logs:

2019-07-17T15:37:48.607Z cypress:server:events sending ipc data { type: 'get:spe
cs', data: { id: 0.6542233886544999, data: { integration: [Array] } } }
2019-07-17T15:37:57.202Z cypress:server:events got request for event: close:brow
ser, undefined
2019-07-17T15:37:57.215Z cypress:server:events sending ipc data { type: 'close:b
rowser', data: { id: 0.44799581114381914, data: undefined } }
2019-07-17T15:37:57.224Z cypress:server:events got request for event: launch:bro
wser, { browser: { displayName: 'Chrome', family: 'chrome', isChosen: true, majo
rVersion: '72', name: 'chrome', path: 'C:\\Program Files (x86)\\Google\\Chrome\\
Application\\chrome.exe', version: '72.0.3626.121' }, spec: { absolute: 'C:/User
s/abcdef/Documents/cypress/resources/app/packages/example/cypress/integration/exa
mples/actions.spec.js', name: 'examples\\actions.spec.js', relative: 'cypress\\i
ntegration\\examples\\actions.spec.js' } }
2019-07-17T15:37:57.242Z cypress:server:openproject resetting project state, pre
paring to launch browser
2019-07-17T15:37:57.248Z cypress:server:project resetting project instance C:\Us
ers\abcdef\Documents\cypress\resources\app\packages\example
2019-07-17T15:37:57.252Z cypress:server:buffers resetting buffers
2019-07-17T15:37:57.254Z cypress:server:server Setting remoteAuth undefined
2019-07-17T15:37:57.256Z cypress:server:server Setting remoteOrigin http://local
host:49478
2019-07-17T15:37:57.258Z cypress:server:server Setting remoteStrategy file
2019-07-17T15:37:57.259Z cypress:server:server Setting remoteHostAndPort null
2019-07-17T15:37:57.260Z cypress:server:server Setting remoteDocDomain localhost

2019-07-17T15:37:57.262Z cypress:server:server Setting remoteFileServer http://l
ocalhost:49479
2019-07-17T15:37:57.264Z cypress:server:server Getting remote state: { auth: und
efined, props: null, origin: 'http://localhost:49478', strategy: 'file', visitin
g: undefined, domainName: 'localhost', fileServer: 'http://localhost:49479' }
2019-07-17T15:37:57.280Z cypress:server:openproject launching browser: { display
Name: 'Chrome', family: 'chrome', isChosen: true, majorVersion: '72', name: 'chr
ome', path: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
version: '72.0.3626.121', isHeaded: true, isHeadless: false }, spec: cypress\int
egration\examples\actions.spec.js
2019-07-17T15:37:57.301Z cypress:server:browsers opening browser { displayName:
'Chrome', family: 'chrome', isChosen: true, majorVersion: '72', name: 'chrome',
path: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', versio
n: '72.0.3626.121', isHeaded: true, isHeadless: false }
2019-07-17T15:37:57.311Z cypress:server:plugins plugin event registered? { event
: 'before:browser:launch', isRegistered: false }
2019-07-17T15:37:57.338Z cypress:server:appdata path: C:\Users\abcdef\AppData\Roa
ming\Cypress\cy\production\extensions
2019-07-17T15:37:57.417Z cypress:server:browsers launch in chrome: http://localh
ost:49478/__/#/tests/integration\examples\actions.spec.js, --test-type,--ignore-
certificate-errors,--start-maximized,--silent-debugger-extension-api,--no-defaul
t-browser-check,--no-first-run,--noerrdialogs,--enable-fixed-layout,--disable-po
pup-blocking,--disable-password-generation,--disable-save-password-bubble,--disa
ble-single-click-autofill,--disable-prompt-on-repos,--disable-background-timer-t
hrottling,--disable-renderer-backgrounding,--disable-renderer-throttling,--disab
le-restore-session-state,--disable-translate,--disable-new-profile-management,--
disable-new-avatar-menu,--allow-insecure-localhost,--reduce-security-for-testing
,--enable-automation,--disable-infobars,--disable-device-discovery-notifications
,--autoplay-policy=no-user-gesture-required,--disable-site-isolation-trials,--me
trics-recording-only,--disable-prompt-on-repost,--disable-hang-monitor,--disable
-sync,--disable-web-resources,--safebrowsing-disable-auto-update,--safebrowsing-
disable-download-protection,--disable-client-side-phishing-detection,--disable-c
omponent-update,--disable-default-apps,--use-fake-ui-for-media-stream,--use-fake
-device-for-media-stream,--proxy-server=http://localhost:49478,--proxy-bypass-li
st=<-loopback>,--load-extension=C:\Users\abcdef\AppData\Roaming\Cypress\cy\produc
tion\browsers\chrome\interactive\CypressExtension,C:\Users\abcdef\Documents\cypre
ss\resources\app\packages\extension\theme,--user-data-dir=C:\Users\abcdef\AppData
\Roaming\Cypress\cy\production\browsers\chrome\interactive,--disk-cache-dir=C:\U
sers\abcdef\AppData\Roaming\Cypress\cy\production\browsers\chrome\interactive\Cyp
ressCache
2019-07-17T15:37:57.472Z cypress:launcher launching browser { displayName: 'Chro
me', family: 'chrome', isChosen: true, majorVersion: '72', name: 'chrome', path:
 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', version: '7
2.0.3626.121', isHeaded: true, isHeadless: false } to open http://localhost:4947
8/__/#/tests/integration\examples\actions.spec.js
2019-07-17T15:37:57.483Z cypress:launcher spawning browser { displayName: 'Chrom
e', family: 'chrome', isChosen: true, majorVersion: '72', name: 'chrome', path:
'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', version: '72
.0.3626.121', isHeaded: true, isHeadless: false } with args http://localhost:494
78/__/#/tests/integration\examples\actions.spec.js --test-type --ignore-certific
ate-errors --start-maximized --silent-debugger-extension-api --no-default-browse
r-check --no-first-run --noerrdialogs --enable-fixed-layout --disable-popup-bloc
king --disable-password-generation --disable-save-password-bubble --disable-sing
le-click-autofill --disable-prompt-on-repos --disable-background-timer-throttlin
g --disable-renderer-backgrounding --disable-renderer-throttling --disable-resto
re-session-state --disable-translate --disable-new-profile-management --disable-
new-avatar-menu --allow-insecure-localhost --reduce-security-for-testing --enabl
e-automation --disable-infobars --disable-device-discovery-notifications --autop
lay-policy=no-user-gesture-required --disable-site-isolation-trials --metrics-re
cording-only --disable-prompt-on-repost --disable-hang-monitor --disable-sync --
disable-web-resources --safebrowsing-disable-auto-update --safebrowsing-disable-
download-protection --disable-client-side-phishing-detection --disable-component
-update --disable-default-apps --use-fake-ui-for-media-stream --use-fake-device-
for-media-stream --proxy-server=http://localhost:49478 --proxy-bypass-list=<-loo
pback> --load-extension=C:\Users\abcdef\AppData\Roaming\Cypress\cy\production\bro
wsers\chrome\interactive\CypressExtension,C:\Users\abcdef\Documents\cypress\resou
rces\app\packages\extension\theme --user-data-dir=C:\Users\abcdef\AppData\Roaming
\Cypress\cy\production\browsers\chrome\interactive --disk-cache-dir=C:\Users\cka
ku\AppData\Roaming\Cypress\cy\production\browsers\chrome\interactive\CypressCach
e
2019-07-17T15:37:57.564Z cypress:server:browsers browser opened
2019-07-17T15:37:58.361Z cypress:server:events got request for event: get:projec
t:status, { path: 'C:\\Users\\abcdef\\Documents\\cypress\\resources\\app\\package
s\\example' }
2019-07-17T15:37:58.367Z cypress:server:project get project status for undefined
 C:\Users\abcdef\Documents\cypress\resources\app\packages\example
2019-07-17T15:37:58.373Z cypress:server:project no project id
2019-07-17T15:37:58.378Z cypress:server:events sending ipc data { type: 'get:pro
ject:status', data: { id: 0.7535993345185117, data: { path: 'C:\\Users\\abcdef\\D
ocuments\\cypress\\resources\\app\\packages\\example', state: 'VALID' } } }
2019-07-17T15:37:58.566Z cypress:server:events sending ipc data { type: 'launch:
browser', data: { id: 0.538287740447811, data: { browserOpened: true } } }
2019-07-17T15:37:59.190Z cypress:server:routes Serving Cypress front-end by requ
ested URL: /__/
2019-07-17T15:37:59.206Z cypress:server:server Getting remote state: { auth: und
efined, props: null, origin: 'http://localhost:49478', strategy: 'file', visitin
g: undefined, domainName: 'localhost', fileServer: 'http://localhost:49479' }
2019-07-17T15:37:59.211Z cypress:server:runner serving runner index.html with co
nfig { version: '3.4.0', platform: 'win32', arch: 'x64', projectName: 'example'
}
2019-07-17T15:37:59.275Z cypress:server:server Got CONNECT request from clientse
rvices.googleapis.com:443
2019-07-17T15:37:59.277Z cypress:https-proxy Writing browserSocket connection he
aders { url: 'clientservices.googleapis.com:443', headLength: 0, headers: { host
: 'clientservices.googleapis.com:443', 'proxy-connection': 'keep-alive', 'user-a
gent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like
 Gecko) Chrome/72.0.3626.121 Safari/537.36' } }
2019-07-17T15:37:59.336Z cypress:https-proxy Got first head bytes { url: 'client
services.googleapis.com:443', head: '\u0016\u0003\u0001\u0002\u0000\u0001\u0000\
u0001∩┐╜\u0003\u0003V\u000e∩┐╜0hL∩┐╜∩┐╜∩┐╜\u0001\f∩┐╜∩┐╜7F┘Å\b⌂\t∩┐╜∩┐╜|∩┐╜╩á\u0
01fd�� \u0003j��NW\u001b�)\u00174�+�\u000f~��Cg���\u001d
' }
2019-07-17T15:37:59.338Z cypress:server:server HTTPS request does not match URL:
 https://clientservices.googleapis.com:443 with props: null
2019-07-17T15:37:59.339Z cypress:https-proxy Making connection to clientservices
.googleapis.com:443
2019-07-17T15:37:59.340Z cypress:https-proxy getting proxy URL { port: 443, serv
erPort: 49478, sniPort: 49480, url: 'https://clientservices.googleapis.com:443'
}
2019-07-17T15:37:59.343Z cypress:server:server Got CONNECT request from accounts
.google.com:443
2019-07-17T15:37:59.346Z cypress:https-proxy Writing browserSocket connection he
aders { url: 'accounts.google.com:443', headLength: 0, headers: { host: 'account
s.google.com:443', 'proxy-connection': 'keep-alive', 'user-agent': 'Mozilla/5.0
(Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.
3626.121 Safari/537.36' } }
←[0mGET /__/ ←[32m200 ←[0m122.682 ms - -←[0m
2019-07-17T15:37:59.360Z cypress:https-proxy Got first head bytes { url: 'accoun
ts.google.com:443', head: '\u0016\u0003\u0001\u0002\u0000\u0001\u0000\u0001�\u
0003\u0003X#]�AS<�$v�u� \u0015]\r���5���t�\u0016�CU�$
{?Z�.AoX���d^������' }
2019-07-17T15:37:59.360Z cypress:server:server HTTPS request does not match URL:
 https://accounts.google.com:443 with props: null
2019-07-17T15:37:59.360Z cypress:https-proxy Making connection to accounts.googl
e.com:443
2019-07-17T15:37:59.361Z cypress:https-proxy getting proxy URL { port: 443, serv
erPort: 49478, sniPort: 49480, url: 'https://accounts.google.com:443' }
2019-07-17T15:37:59.427Z cypress:network:connect successfully connected { opts:
{ port: '443', host: 'clientservices.googleapis.com', getDelayMsForRetry: [Funct
ion: getDelayForRetry] }, iteration: 0 }
2019-07-17T15:37:59.431Z cypress:https-proxy received upstreamSocket callback fo
r request { port: '443', hostname: 'clientservices.googleapis.com', err: undefin
ed }
2019-07-17T15:37:59.442Z cypress:network:connect successfully connected { opts:
{ port: '443', host: 'accounts.google.com', getDelayMsForRetry: [Function: getDe
layForRetry] }, iteration: 0 }
2019-07-17T15:37:59.443Z cypress:https-proxy received upstreamSocket callback fo
r request { port: '443', hostname: 'accounts.google.com', err: undefined }
←[0mGET /__cypress/runner/cypress_runner.css ←[32m200 ←[0m47.626 ms - -←[0m
←[0mGET /__cypress/runner/cypress_runner.js ←[32m200 ←[0m5.365 ms - -←[0m
←[0mGET /__cypress/static/favicon.ico ←[32m200 ←[0m1.739 ms - -←[0m
2019-07-17T15:38:00.693Z cypress:server:server Got CONNECT request from localhos
t:49478
2019-07-17T15:38:00.694Z cypress:https-proxy Writing browserSocket connection he
aders { url: 'localhost:49478', headLength: 0, headers: { host: 'localhost:49478
', 'proxy-connection': 'keep-alive', 'user-agent': 'Mozilla/5.0 (Windows NT 6.1;
 Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/
537.36' } }
2019-07-17T15:38:00.696Z cypress:https-proxy Got first head bytes { url: 'localh
ost:49478', head: 'GET /__socket.io/?EIO=3&transport=websocket HTTP/1.1\r\nHost:
 loca' }
2019-07-17T15:38:00.696Z cypress:server:server HTTPS request does not match URL:
 https://localhost:49478 with props: null
2019-07-17T15:38:00.696Z cypress:https-proxy Making connection to localhost:4947
8
2019-07-17T15:38:00.697Z cypress:https-proxy getting proxy URL { port: 49478, se
rverPort: 49478, sniPort: 49480, url: 'https://localhost:49478' }
2019-07-17T15:38:00.698Z cypress:network:connect successfully connected { opts:
{ port: '49478', host: 'localhost', getDelayMsForRetry: [Function: getDelayForRe
try] }, iteration: 0 }
2019-07-17T15:38:00.699Z cypress:https-proxy received upstreamSocket callback fo
r request { port: '49478', hostname: 'localhost', err: undefined }
2019-07-17T15:38:00.700Z cypress:server:server Got UPGRADE request from /__socke
t.io/?EIO=3&transport=websocket
2019-07-17T15:38:00.711Z cypress:server:socket socket connected
←[0mGET /__cypress/runner/fonts/fontawesome-webfont.woff2?v=4.7.0 ←[32m200 ←[0m1
.845 ms - 77160←[0m
2019-07-17T15:38:02.049Z cypress:server:events got request for event: close:brow
ser, undefined
2019-07-17T15:38:02.049Z cypress:server:browsers killing browser process
2019-07-17T15:38:02.094Z cypress:server:events sending ipc data { type: 'launch:
browser', data: { id: 0.538287740447811, data: { browserClosed: true } } }
2019-07-17T15:38:02.102Z cypress:server:browsers browser process killed
2019-07-17T15:38:02.105Z cypress:server:events sending ipc data { type: 'close:b
rowser', data: { id: 0.8687377968984005, data: null } }
2019-07-17T15:38:08.361Z cypress:server:events got request for event: get:projec
t:status, { path: 'C:\\Users\\abcdef\\Documents\\cypress\\resources\\app\\package
s\\example' }
2019-07-17T15:38:08.369Z cypress:server:project get project status for undefined
 C:\Users\abcdef\Documents\cypress\resources\app\packages\example
2019-07-17T15:38:08.372Z cypress:server:project no project id
2019-07-17T15:38:08.377Z cypress:server:events sending ipc data { type: 'get:pro
ject:status', data: { id: 0.1901979354181671, data: { path: 'C:\\Users\\abcdef\\D
ocuments\\cypress\\resources\\app\\packages\\example', state: 'VALID' } } }
2019-07-17T15:38:18.362Z cypress:server:events got request for event: get:projec
t:status, { path: 'C:\\Users\\abcdef\\Documents\\cypress\\resources\\app\\package
s\\example' }
2019-07-17T15:38:18.369Z cypress:server:project get project status for undefined
 C:\Users\abcdef\Documents\cypress\resources\app\packages\example
2019-07-17T15:38:18.372Z cypress:server:project no project id
2019-07-17T15:38:18.375Z cypress:server:events sending ipc data { type: 'get:pro
ject:status', data: { id: 0.11333642136317579, data: { path: 'C:\\Users\\abcdef\\
Documents\\cypress\\resources\\app\\packages\\example', state: 'VALID' } } }
2019-07-17T15:38:28.362Z cypress:server:events got request for event: get:projec
t:status, { path: 'C:\\Users\\abcdef\\Documents\\cypress\\resources\\app\\package
s\\example' }
2019-07-17T15:38:28.367Z cypress:server:project get project status for undefined
 C:\Users\abcdef\Documents\cypress\resources\app\packages\example
2019-07-17T15:38:28.372Z cypress:server:project no project id
2019-07-17T15:38:28.375Z cypress:server:events sending ipc data { type: 'get:pro
ject:status', data: { id: 0.6337090478925431, data: { path: 'C:\\Users\\abcdef\\D
ocuments\\cypress\\resources\\app\\packages\\example', state: 'VALID' } } }
2019-07-17T15:38:38.363Z cypress:server:events got request for event: get:projec
t:status, { path: 'C:\\Users\\abcdef\\Documents\\cypress\\resources\\app\\package
s\\example' }
2019-07-17T15:38:45.094Z cypress:server:project get project status for undefined
 C:\Users\abcdef\Documents\cypress\resources\app\packages\example
2019-07-17T15:38:45.100Z cypress:server:project no project id
2019-07-17T15:38:45.104Z cypress:server:events sending ipc data { type: 'get:pro
ject:status', data: { id: 0.11085827183667396, data: { path: 'C:\\Users\\abcdef\\
Documents\\cypress\\resources\\app\\packages\\example', state: 'VALID' } } }

@flotwig flotwig deleted the issue-1239-unique-extension-key branch January 24, 2022 18:17
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.

Give Cypress's extension a static extension ID Browser not launched through Cypress problem
6 participants