Commit Graph

184 Commits

Author SHA1 Message Date
Mikhail
82601500b6 perf: optimize parseCspHeaders (#29887)
* fix: optimize parseCspHeaders

* Added changelog notes

* Fix changelog

---------

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2024-07-26 15:23:51 -04:00
Mike McCready
767ddf8584 dependency: update @cypress/request to 3.0.1 (#29864)
* dependency: update @cypress/request to 3.0.1

* move changelog entry to next version

---------

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2024-07-25 11:01:21 -04:00
BernardoSousa03
ec1d7994dd fix: HTTP response with invalid headers doesn't throw error #28865 (#29420)
* fix: HTTP response with invalid headers doesn't throw error #28865

When receiving the described HTTP response Cypress resets the headers.
This would cause the validateHeaderName method from node to be called
which would cause an error, since the headers where invalid.
Now Crypress verifies all the headers before reseting them,
discards invalid ones and sends a warning in the console
when debug module is on.

* fix: improved warning display to the command line

When cutting off invalid headers from the response the user
is informed of such headers in the command line

* fix: added undefined verification and catched missing error

Fixed a typescript error where validateHeaderValue was being called
with value possibly being undefined. Fixed catching missing error
where code is 'ERROR_INVALID_CHAR' and rethrows other errors

* Update cli/CHANGELOG.md

---------

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
Co-authored-by: Cacie Prins <cacieprins@users.noreply.github.com>
Co-authored-by: Bill Glesias <bglesias@gmail.com>
2024-06-11 13:13:34 -04:00
Bill Glesias
f3b67666a5 fix: update cypress to Typescript 5 (#29568)
* fix: update the monorepo to typescript 5

* chore: updating v8 snapshot cache

* chore: updating v8 snapshot cache

* chore: updating v8 snapshot cache

* run ci to see problems [run ci]

* update vue-tsc and typings that conflict with update

* regen snapshot

* fix typescript errors ui test as stack trace behavior has changed

* fix server unit tests

* update cy.origin() spec based on stack traces and code frames

* update spec to include source map url

* run ci

* fix check-ts

* chore: fix system tests [run ci]

* add preprocessor tests to batteries included to exercise new logic

* run ci

* refactor unit tests to be a bit more dry

* pin typescript to ~5.4 and adjust config to ignroe deprecations but keep importsNotUsedAsValues

* add changelog entry

* add fixme issue to stack trace mismatches inside evaled context

* use import type webpack as webpack as a lib isn't actually invboked in the runner webpack config

* fix system test as adding 4 lines of comments impacts the stack trace line 4 lines (duh)

---------

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>
2024-06-04 19:17:38 -04:00
Bill Glesias
6937190084 chore: update browser internal images to chrome 124 and firefox 125 (#29391)
* chore: update browser internal images to chrome 124 and firefox 125 [run ci]

* update screenshot sizes for chrome as they have changed in the chrome 124 and is ultimately out of our control since the options passed into the CLI are STILL not respected [run ci]

* fix cypress-in-cypress tests for chrome 119 and up

* remove windows app integration code added in 29198

* run windows build [run ci]

* fix some failing system tests [run ci]

* update non proxied png [run ci]

* fix system tests failing [run ci]

* fix afterEach [run ci]

* chore: update documentation in response middleware
2024-04-30 14:16:02 -04:00
Bill Glesias
f14a11aecf chore: update eslint from version 7 to version 8 (#29355)
* chore: (for eslint-plugin-dev only is breaking) update eslint-plugin dev minimum to eslint 7. Remove support for coffeescript and reconfigured required peer deps

* correctly configure eslint-plugin-json-format for the monorepo and run linting on all json files (previously was not running)

* properly support no duplicate imports
2024-04-26 14:42:33 -04:00
Matt Schile
867a973dca perf: support activated service worker that is not handling requests (#29349) 2024-04-23 11:52:40 -06:00
Bill Glesias
768afcc5ae chore: move to macstadium intel runner for circle darwinx64 [run ci] (#29300)
* chore: move to macstadium intel runner for circle darwinx64 [run ci]

* update cache and try runner machine version 3 [run ci]

* prevent stop only from failing (maybe we remove this?) [run ci]

* what happens to the dir after job [run ci]

* try this [run ci]

* retrigger x64 job mac [run ci]

* bump cache to verify functionality [run ci]

* bump cache key to trigger full dependency cache [run ci]

* rebump cache while user is not logged in [run ci]

* bump cache to check full rerun [run ci]
2024-04-16 11:52:59 -04:00
renovate[bot]
4d97a0fdb3 dependency: update dependency express to v4.19.2 [security] (#29211)
* chore(deps): update dependency express to v4.19.2 [security]

* empty commit

* dependency: add changelog item

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2024-04-01 11:47:55 -04:00
Matt Schile
cd4a23fa90 test: fix issue with electron in service-worker.cy.js (#29089) 2024-03-11 11:22:35 -04:00
Matt Schile
a29eae9260 perf: fix performance issue for service workers that don't handle requests (#28900) 2024-03-05 11:24:59 -07:00
Jennifer Shehane
a0b2d1e912 fix: Add existential operators to properties before calling split in processBrowserPreRequest (#28952)
* fix: Add existential operators to properties before calling split

* empty commit

* changelog entry

* Add note about regression

* remove duplicate dep in changelog

* Add link to issue

* Update packages/proxy/lib/http/util/service-worker-manager.ts

Co-authored-by: Ryan Manuel <ryanm@cypress.io>

* Update packages/proxy/lib/http/util/service-worker-manager.ts

Co-authored-by: Ryan Manuel <ryanm@cypress.io>

---------

Co-authored-by: Ryan Manuel <ryanm@cypress.io>
2024-02-15 13:29:40 -05:00
Ryan Manuel
9088dc232d fix: issue with service workers in test replay when they're initiated from a support file (#28748)
* fix: issue with service workers in test replay when they're initiated from a support file

* add changelog

* Update cli/CHANGELOG.md

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

* PR comment

* get prerelease

* PR comments

* Update .circleci/workflows.yml

* Update .circleci/workflows.yml

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

---------

Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: Matt Schile <mschile@cypress.io>
2024-01-23 12:22:02 -06:00
Matt Schile
c672581a71 perf: fix proxy correlation timeout issues (#28751) 2024-01-22 15:35:49 -07:00
Ryan Manuel
c6f5e9a5c9 fix: ensure that we capture service worker requests (#28517)
* fix: ensure that we capture service worker requests

* add changelog

* fix changelog

* fix tests

* PR comments

* PR comments

* PR comment

* PR comment

* update changelog

* Update cli/CHANGELOG.md

Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com>

* enable builds on all archs

* fix permission issue

* PR comments

* Update smoke.js

* Update cli/CHANGELOG.md

* attempt to fix smoke tests

* bump ci cache

* Update smoke.js

* Update smoke.js

* Update example.json

* fix multiple specs

* fix tests

* Update CHANGELOG.md

---------

Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com>
2024-01-06 15:23:30 -06:00
Matt Schile
7a9e3a4697 perf: don't reset preRequests when test isolation is off (#28642) 2024-01-05 14:52:47 -07:00
Matt Schile
c9062f145e fix: handle malformed URIs in prerequests (#28522) 2023-12-14 09:12:13 -07:00
Matt Schile
57bb0b68ee fix: decode urls in prerequest (#28427) 2023-11-29 15:09:12 -07:00
Chris Breiding
650d5cb7da fix: Ensure basic auth headers are set on extra target requests (#28387) 2023-11-27 16:28:35 -05:00
Chris Breiding
9d9bf25977 fix: Ensure response headers are set for extra target network requests (#28322) 2023-11-13 17:51:51 -05:00
Chris Breiding
a0cfed5044 fix: "bypass" proxying network requests from extra browser tabs/windows (#28188)
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Matt Schile <mschile@cypress.io>
2023-11-02 13:55:13 -04:00
Ryan Manuel
d9606868c5 fix: fix failures and correlation in proxy (#28094) 2023-10-23 16:08:05 -05:00
Ryan Manuel
ff89ffa2b2 fix: proxy issues with service workers and clean up at end of specs (#28060) 2023-10-17 19:53:49 -05:00
Ryan Manuel
ca6d30d7bf fix: force gzip when no accept encoding header is sent and use identity if gzip is not sent (#28026)
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
2023-10-17 13:52:37 -05:00
Ryan Manuel
078dc0a81e fix: support proxy correlation timeout notifications and additional proxy data (#27976) 2023-10-10 16:19:37 -05:00
Ryan Manuel
8da1e5c92f fix: correlate prerequests in order instead of reverse order (#27892) 2023-09-27 16:37:16 -05:00
Matt Schile
f8b4c59daa fix: update net stubbing to not intercept requests sent to dev server (#27788) 2023-09-12 08:22:33 -06:00
Ryan Manuel
70248ab9c0 fix: prerequest correlation for various retried and cached requests (#27771) 2023-09-10 21:41:40 -05:00
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