Commit Graph

156 Commits

Author SHA1 Message Date
Chris Breiding
2c8337a913 chore: upgrade @cypress/request-promise to 5.0.0 (#27655) 2023-08-24 11:14:18 -04:00
Chris Breiding
7f45375439 breaking: Upgrade @cypress/request to 3.0.0 (#27495) 2023-08-23 15:16:27 -04:00
Ryan Manuel
43821bf53d feat: handle empty response bodies by communicating them to the protocol from the proxy (#27606) 2023-08-21 19:31:40 -05:00
Bill Glesias
f1b3741a40 Merge pull request #27537 from cypress-io/chore/merge_develop_into_release_13
chore: merge develop into release 13
2023-08-15 17:13:59 -04:00
Ryan Manuel
462ee04df9 feat: enable the protocol to retrieve response bodies from the network proxy (#27462)
Co-authored-by: Matt Schile <mschile@cypress.io>
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Cacie Prins <cacie@cypress.io>
Co-authored-by: Cacie Prins <cacieprins@users.noreply.github.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
fix: do not correlate cached requests in the proxy (#27525)
2023-08-15 13:41:36 -05:00
Jordan
1061f858a8 chore: update tough cookie (#27515)
* chore: update tough-cookie from 4.0.0 to 4.1.3. requires v8 snapshot update

* fix: tough-cookie as of 4.1 doesn't default sameSite undefined to none any longer. However, we want to set sameSite === undefined to lax as the default as this is the case in every standard browser, except firefox. We did this previously and this is behavior we want to continue to preserve, even for security reasons

* chore: update v8 snapshots

* fix issue with global toString

* chore: run ci

* chore: update @cypress/request to 2.88.22 and @cypress/request-promise to 4.2.7 [run ci]

* remove jsdom and start-server-and-test

* revert @cypress/request back to 2.88.12

* update changelog entry

* remove uneeded deps

---------

Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
2023-08-11 13:42:36 -04:00
Adam Stone-Lord
28189fb577 chore: remove check-ts from Gulp (#27492)
* chore: update build-npm-modules script

* chore: update build-npm-modules script

* chore: update build-npm-modules script

* chore: update build-npm-modules script

* [run ci]

* we can't clean without building after

* update commands

* add config for data-context build step

* fix output configurations for npm packages, add gitignores

* revert changes to config and data-context build steps

* run with cache

* fix outputs for cli

* actually fix outputs

* test with cache

* chore: remove check-ts from Gulp and use Nx

* try limiting concurrency

* try concurrency 1

* add check-ts to packages where it is missing

---------

Co-authored-by: jordanpowell88 <jordan@jpdesigning.com>
2023-08-10 16:04:25 -04:00
Bill Glesias
68f8f99a9d chore: update node types from v14 to v16 latest to be current (no 16.16.0 types exist). Fixes types issues with webpack upgrade. (#27425)
chore: bump the Typescript minimum version in the CLI from 3.4 to 3.9
2023-08-01 09:16:49 -04:00
Bill Glesias
2e092add12 perf: no longer pause every single request through CDP and only pause requests needed for AUT document [run ci] (#26623) 2023-07-21 13:38:35 -04:00
Jennifer Shehane
9ce54e36c4 dependency: bump cypress-request packages, loosen semver rules to ^ (#27005)
Co-authored-by: Matt Schile <mschile@cypress.io>
2023-07-07 11:28:44 -04:00
Bill Glesias
ca1b42c2ae chore: reorganize middleware and add telemetry to OmitProblematicHeaders (#27139)
* move omitProblematicHeaders above set injection level (1:1 change).
Addresses https://github.com/cypress-io/cypress/pull/26483/files#r1203011105

* chore: add telemetry to omitProblematicHeaders
2023-06-26 16:35:52 -04:00
Preston Goforth
71c5b864ea feat: Selective CSP header stripping from HTTPResponse (#26483)
* feat: Selective CSP header directive stripping from HTTPResponse
- uses `stripCspDirectives` config option

* feat: Selective CSP header directive permission from HTTPResponse
- uses `experimentalCspAllowList` config option

* Address Review Comments:
- Add i18n for `experimentalCspAllowList`
- Remove PR link in changelog
- Fix docs link in changelog
- Remove extra typedef additions
- Update validation error message and snapshot
- Fix middleware negated conditional

* chore: refactor driver test into system tests to get better test
coverage on experimentalCspAllowList options

* Address Review Comments:
- Remove legacyOption for `experimentalCspAllowList`
- Update App desc for `experimentalCspAllowList` to include "Content-Security-Policy-Report-Only"
- Modify CHANGELOG wording
- Specify “never” overrideLevel
- Remove unused validator (+2 squashed commits)
- Add "Addresses" note in CHANGELOG to satisfy automation
- Set `canUpdateDuringTestTime` to `false` to prevent confusion

* chore: Add `frame-src` and `child-src` to conditional CSP directives

* chore: Rename `isSubsetOf` to `isArrayIncludingAny`

* chore: fix CLI linting types

* chore: fix server unit tests

* chore: fix system tests within firefox and webkit

* chore: add form-action test

* chore: update system test snapshots

* chore: skip tests in webkit due to form-action flakiness

* chore: Move 'sandbox' and 'navigate-to' into `unsupportedCSPDirectives`
- Add additional system tests
- Update snapshots and unit test

* chore: update system test snapshots

* chore: fix system tests

* chore: do not run csp tests within firefox or webkit due to flake issues in CI

* chore: attempt to increase intercept delay to avoid race condition

* chore: update new snapshots with video defaults work

* chore: update changelog

---------

Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: Matt Schile <mschile@cypress.io>
2023-06-14 14:54:52 -05:00
Matt Henkes
dc80641d02 chore: telemetry pr cleanup (#26776) 2023-05-17 10:51:02 -05:00
Matt Henkes
50ffd5ee1d chore: add telemetry to the proxy (#26695)
* chore: set up instrumentation and instrument middleware

* chore: set up console exporter

* chore: add parent span option to telemetry package

* chore: set up telemetry verbose mode

* chore: instrument the network proxy - part 1

* chore: make sure to terminate spans when request is aborted

* fix telemetry, create/end the request middle prior to sending the outbound request

* avoid telemetry ts build step, create entrypoint into packages/telemetry using TS conventions

* allow env vars to be "true" or "1"

* when creating child span, inherit their attributes directly from the parent

* create custom honeycomb exporter and span processor to log traces

* remove duplicate code that's already called in this.setRootContext

* cleanup

* more clean up

* update honeycomb network:proxy attributes, update console.log message

* yarn lock

* chore: remove performance API in middleware

* chore: end response on correct event

* recursively gather parent attributes on close

* added key and some clean up

* github action detector, move verbose into index, verbose log commands

* some tests

* clean up honeycomb exporter

* some renaming

* testing console trace link exporter

* Don't lose the top span when running in verbose.

* link to the right place for prod/dev

* changes to verbose to make sure it is read in the browser

* Apply suggestions from code review

* pass parent attributes between telemetry instances

* default to false

* 'fix' build issues

* src not dist

* add back on start span

* once more with feeling

* Fix some tests

* try this i guess

* revert auto build

* Apply suggestions from code review

Co-authored-by: Bill Glesias <bglesias@gmail.com>

* support failed commands

* Address PR comments

* Address PR Comments

* error handling

* handle all the errors

---------

Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: Brian Mann <brian.mann86@gmail.com>
2023-05-17 08:32:10 -05:00
Emily Rohrbough
f49e25322c chore: list rimraf dev-dependency once in repo (#26257) 2023-03-28 20:49:09 -05:00
Zach Bloomquist
039ebad220 feat(intercept): add { log: false } to StaticResponse (#25547)
* begin setting log with the backend

* revert backend changes

* update interface now that we are only doing static log

* change existing logging logic to run in proxy layer instead

* add tests, fix small bugs

run ci

* fix tests

* add changelog

* run ci

* run ci

* fix cl

run ci

* Update cli/CHANGELOG.md

---------

Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
2023-03-14 08:54:46 -05:00
Bill Glesias
59c1175065 chore: improve types for server automation cookie client (#25836)
* chore: improve types for automation cookies

* [run ci]
2023-02-20 14:52:38 -05:00
Mike Plummer
efc195896a fix: Improve error handling around calls to this.next in middleware (#25702) 2023-02-08 10:17:28 -06:00
renovate[bot]
bcb945d6ce dependency(deps): update dependency debug to ^4.3.4 🌟 (#25699)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Stokes Player <stokes.player@gmail.com>
2023-02-06 15:35:34 -05:00
Bill Glesias
478407ec38 fix: revert CSP header and script-src addition (#25445)
* Revert "feat: Do not strip CSP headers from HTTPResponse (#24760)"

This reverts commit 0472bb9cdb.

* run ci
2023-01-13 10:59:00 -05:00
Preston Goforth
0472bb9cdb feat: Do not strip CSP headers from HTTPResponse (#24760)
Co-authored-by: Zach Bloomquist <git@chary.us>
Closes https://github.com/cypress-io/cypress/issues/1030
2023-01-11 17:37:45 +00:00
Bill Glesias
d470f59ea2 feat: experimental skip domain injection (#25307)
* feat: set up experimentalUseDefaultDocumentDomain to disallow document.domain overwritting

* use default domain around experimentalUseDefaultDocumentDomain in main iframe and spec bridge iframes. Also adapt CORS policy to use same-origin if experimental flag is set

* run ci

* fix: add insertion of experimental flag where is was needed/missing

* chore: add system test to exercise experimental flag for expected behavior

* fix: fix issues with template updates to conform to squirrelly v7

* fix: update config tests to include new experimental flag

* run ci

* fix: trailing whitespace [run ci]

* chore: update snapshot

* run ci

* fix: update proxy unit tests to account for experimentalUseDefaultDocumentDomain

* run ci

* fix: Allow component tests with special characters in filepath (#25299)

feat: cut over experimental flag to take list of known problematic domains via string/glob pattern

run ci

chore: update system test and fix broken config

* fix: fix server unit and integration tests. integration tests should no longer use google to test against injection as we do not inject document.domain on google domains

* run ci

* run ci

* fix: server integration tests where google documents are expected to receive document.domain injection. Kept test same by changing URL

* run ci

* fix: update server test with mssing unupdated assertions

* run ci

* fix: turn off experimental flag by default while recommending sane defaults to users to configure

* run ci

* chore: fix typings [run ci]

* run ci

* chore: make experiment an e2e option only

* run ci

* chore: address comments in code review

* chore: rename experimentalUseDefaultDocumentDomain to experimentalSkipDomainInjection

* fix regression in shouldInjectionDocumentDomain utility function and add unit tests

* run ci

* chore: rename documentSuperDomainIfExists to superDomain [run ci]

* chore: address comments from code review

* chore: just pass opts through to policyForDomain

* run ci

Co-authored-by: Mike Plummer <mike-plummer@users.noreply.github.com>
2023-01-09 10:00:05 -05:00
renovate[bot]
1047796cae chore(deps): update dependency express to v4.17.3 [security] (#25015)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
2022-12-27 11:36:52 -06:00
Lachlan Miller
1682a3ffd9 fix: change network request sweep interval from 1s -> 10s (#25209)
* fix: change sweep interval from 1s -> 10s

* binaries

* update variable name

* use DI to make PreRequest class more testable

* revert code [skip ci]

* try tweaking test

Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
2022-12-21 14:37:13 +10:00
Zach Bloomquist
e02f6bf905 feat: add resourceType support to cy.intercept() on req/routeMatcher (#25075)
Co-authored-by: Bill Glesias <bglesias@gmail.com>
2022-12-14 17:40:53 +00:00
Bill Glesias
ca01e29ab8 fix: re include document domain injections for spec-bridge and injection and disable origin-agent-cluster (#25013)
* Revert "chore: remove document.domain usage for cross-origin testing (#24945)"

This reverts commit a3d3074e70.

* fix: set origin-agent-cluster=?0 for the spec bridge iframe

* re apply comment that was reverted in 1fa1246b5c

* Update packages/server/lib/routes-e2e.ts

Co-authored-by: Matt Schile <mschile@cypress.io>

* chore: update document.domain immutable target from chrome 106 -> chrome 109

Co-authored-by: Matt Schile <mschile@cypress.io>
2022-12-06 17:52:48 -05:00
Chris Breiding
a3d3074e70 chore: remove document.domain usage for cross-origin testing (#24945) 2022-12-02 12:08:12 -05:00
Blue F
8ff38cdb01 feat: Create public Cypress.ensure API for use with custom queries (#24697)
* fix: Improve TypeScript support for custom queries

* Typo fix

* Fix TS more

* Move 'ensures' off of cy and onto Cypress

* Type fixes

* One missed replacement

* Test fixes

* Properly pass in  to ensureRunnable

* Add .eslintignores to quiet down warnings

* Review feedback

* Update cli/types/cypress.d.ts

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
2022-11-29 09:34:34 -06:00
mjhenkes
200656b1d2 Merge branch 'develop' into matth/merge-in-develop 2022-11-25 09:06:20 -06:00
Matt Henkes
b04f9a1143 fix: Canceled Intercepted calls will now end a waited on alias (#24709)
* fix: on a canceled request, end waiting on an intercepted alias

* Add tests, fix ts

* skip firefox

* add doc

* try to fix flake

* delay?

* Use http proxy instead of cdp.

* 'fix' safari

* test updates

* PR updates

* test updates
2022-11-25 08:53:40 -06:00
Emily Rohrbough
5f56670051 chore(12): merge in develop (#24783)
Co-authored-by: Ben M <benm@cypress.io>
Co-authored-by: Dariusz Czajkowski <darek@darek.dev>
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Adam Stone <adams@cypress.io>
2022-11-23 07:55:29 -06:00
Adam Stone
2166ba0d94 fix: fix windows-lint CI job (#24758) 2022-11-22 14:35:28 -05:00
Emily Rohrbough
79ea453764 chore(v12): merge develop into release/12.0.0 (#24705)
Co-authored-by: amehta265 <65267668+amehta265@users.noreply.github.com>
Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: mattvCypress <mattv@cypress.io>
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Jordan <jordan@jpdesigning.com>
Co-authored-by: Adam Stone <adams@cypress.io>
2022-11-18 16:02:31 -06:00
Jordan
ed90b14d4f refactor: move linting to each lib to enable caching (#24424) 2022-11-17 17:31:19 +10:00
Chris Breiding
e4be9697bd Merge branch 'develop' into merge-develop-v12-2022-11-14-take-2 2022-11-14 13:57:38 -05:00
Matt Henkes
23299acc88 fix: Disallow same-superdomain-origin cy.origin blocks (#24569)
* fix: throw error if the cy.origin origin is in the same superDomainOrigin as top.

* testing test tweaks

* 'fix' cypress in cypress tests

* Inject cross origin in google subdomains when not same-origin

* style tweaks

* Ensure strict same-origin check works for google.

* test fixes

* we don't need the location object when we just want the href.

* what is in a name?

* Address PR Comments
2022-11-09 08:29:27 -06:00
Bill Glesias
6055af37b0 Merge branch 'develop' of github.com:cypress-io/cypress into release/12.0.0 2022-11-02 10:27:39 -04:00
Bill Glesias
26e5f31b15 chore: only inject when html is going to be rendered (#24414)
* chore: only inject when html is going to be rendered AND if a
content-type exists, make sure it contains html (which is valid for
xhtml and other mime types)

* rename isHTML is isNotJavascript to be a bit more accurate

* chore: remove isNotJavascript function for restContentTypeIsJavascript for experimental ast rewriter
2022-11-01 14:01:59 -04:00
Ryan Manuel
b0c0eaa508 feat: introduce v8 snapshots to improve startup performance (#24295)
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Zach Bloomquist <git@chary.us>
Co-authored-by: Tyler Biethman <tbiethman@users.noreply.github.com>
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
Co-authored-by: Matt Schile <mschile@cypress.io>
Co-authored-by: Mark Noonan <mark@cypress.io>
Co-authored-by: Zachary Williams <ZachJW34@gmail.com>
Co-authored-by: Ben M <benm@cypress.io>
Co-authored-by: Zachary Williams <zachjw34@gmail.com>
Co-authored-by: astone123 <adams@cypress.io>
Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: Emily Rohrbough <emilyrohrbough@yahoo.com>
Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: Adam Stone <adams@cypress.io>
Co-authored-by: Blue F <blue@cypress.io>
Co-authored-by: GitStart <1501599+gitstart@users.noreply.github.com>
Co-authored-by: Mike Plummer <mike-plummer@users.noreply.github.com>
Co-authored-by: Jordan <jordan@jpdesigning.com>
Co-authored-by: Sam Goodger <turbo@tailz.dev>
Co-authored-by: Colum Ferry <cferry09@gmail.com>
Co-authored-by: Stokes Player <stokes@cypress.io>
Co-authored-by: Vilhelm Melkstam <vilhelm.melkstam@gmail.com>
Co-authored-by: amehta265 <65267668+amehta265@users.noreply.github.com>
2022-10-31 20:20:27 -05:00
Matt Schile
69873ae988 chore: remove experimentalSessionAndOrigin flag (#24340)
BREAKING CHANGE: removed experimentalSessionAndOrigin flag. testIsolation defaults to strict
2022-10-24 08:49:13 -06:00
Chris Breiding
f9272bbd22 fix: Improve document.cookie patch (#23643) 2022-10-18 17:38:56 -04:00
Bill Glesias
695dd275bc feat: same origin spec bridges (#23885)
* chore: enforce strict origin spec bridges

chore: refactor spec bridges to strictly enforce same origin

fix: wrap fullCrossOrigin injection around feature flag inside buffered response

* fix: do NOT set the initial cypress cookie inside the spec bridge as it is sending unecessary cookies

* chore: simplify the finding cypress in the injection code

* chore: change order in which callback fn is declared

* chore: add spec bridge performance issue to validation tests
2022-10-04 18:26:04 -04:00
Bill Glesias
a41b104880 chore: simulated cookie fixes 1 (#24060)
* chore: add documentation to CDP,electron, and web extension for selected resource types

* chore: change nomenclature of X-Cypress-Request to X-Cypress-Is-XHR-Or-Fetch

* chore: remove no longer applicable comment for socket code

* chore: add comments to the resourceType/credential manager
2022-10-03 10:05:34 -04:00
Bill Glesias
11ed9a622b fix: misc review comments (#23971)
* chore: refactor credential manager into its own utility class and add basic unit tests

* chore: add firefox comments into the cookie jar
2022-09-27 17:11:30 -04:00
Bill Glesias
01ea821926 feat: implement simulated top req res middleware (#23888)
* test: add correct cookie_behavior assertions before work on server
(currently failing)

* chore: add types needed in the socket and middlewares

* feat: add socket code to server-base (no tests here) to be used in request/response middleware

* feat: fill out the ExtractCypressMetadataHeaders implementation

* feat: add attach cookie logic to requests based on xhr/fetch requests

* feat: add attaching cookies to response logic w/ tests

* Update packages/proxy/lib/http/request-middleware.ts

Co-authored-by: Matt Henkes <mjhenkes@gmail.com>

Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
2022-09-23 10:04:45 -04:00
Bill Glesias
56b4f894aa chore: add utility functions in proxy to be used in the near future i… (#23880)
* chore: add utility functions in proxy to be used in the near future in the request/response middleware(s)

* fix: add isAUTIframe check inside the shouldAttachAndSetCookies, move the siteContext info to the cookies package, simplify top-simulation util, and add better method documentation
2022-09-22 10:21:13 -04:00
Bill Glesias
252ae5ae67 Merge branch 'develop' of github.com:cypress-io/cypress into feature/simulated-top-cookie-handling 2022-09-21 18:29:21 -04:00
Bill Glesias
18321f80dd chore: refactor originPolicy to use superDomainOrigin nomenclat… (#23879)
* chore: refactor originPolicy to use superDomainOriginPolicy nomenclature and add sameSite/superDomainOrigin policy functions and make originMatch functions match fully same origin policy including sub domains

* chore: change doesAutMatchTopSuperOriginPolicy to doesAUTMatchTopSuperDomainOriginPolicy

* chore: rename originPolicy references to just be origin. Rename superDomainOriginPolicy to superDomainOrigin

* fix: remove duplicate origin keys and add check for remote.origin to return null

* chore: further rename variables to fit origin paradigm

* chore: remove latestActiveSuperDomainOrigin as it is no longer used

* fix: key order in consoleProps yielded test

* remove isAnticipatingCrossOriginResponse as it is no longer available

* chore: update documentation to urlMatchesSameSiteProps to show why the strictPortMatch is an option

* chore: refactor cors package to use a single parse function and update unit tests

* chore: refactor getOrigin to use url origin

* chore: update same-site documentation to now be dependent on cookies

* chore: update same-site policy to be schemeful-same-site policy as we consider protocol mismatches to be not same-site
2022-09-21 18:27:17 -04:00
Bill Glesias
cd2fde9047 fix: misc cy origin cleanup (#23914)
* chore: remove cannot_visit_previous_origin error message as it is no longer used

* fix: wrap MaybeEndRequestWithBufferedResponse fullCrossOrigin check around feature flag
2022-09-21 16:14:19 -04:00
Bill Glesias
fd941023a2 fix: properly replace integrity tags in script resources when experimentalModifyObstructiveThirdPartyCode is true (#23820)
* test: add failing unit test for expected behavior

* fix: add regex to strip out dynamic setAttribute integrity setting when modifyObstructiveThirdPartyCode is enabled

* fix: properly replace integrity tags inside script resources when experimentalModifyObstructiveThirdPartyCode is true

* test: fix regex rewritter to handle a few other cases of rewriting
integrity. Now accurately applies to other broad strokes

* rename html integrity re to general as this replaces both html and javascript integrity tags in certain cases

* chore: rephrase comments in regex rewriter for MO third party code
2022-09-20 16:03:17 -04:00