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

fix: Chrome browser console warning about unsafe header access-control-expose-headers when calling Cloud Function #2095

Merged
merged 10 commits into from
Apr 22, 2024

Conversation

mortenmo
Copy link
Contributor

@mortenmo mortenmo commented Mar 17, 2024

Pull Request

Issue

#2059

Closes: #2059

Approach

Based on https://trackjs.com/blog/refused-unsafe-header/

Chrome shows a console error when accessing a non-existant header. Checking if header is available before calling that method.

Copy link

parse-github-assistant bot commented Mar 17, 2024

Thanks for opening this pull request!

@mortenmo mortenmo changed the title Fix: check if header is available before calling xhr.getResponseHeader to avoid Chrome console warning fix: check if header is available before calling xhr.getResponseHeader to avoid Chrome console warning Mar 17, 2024
Copy link

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant bot changed the title fix: check if header is available before calling xhr.getResponseHeader to avoid Chrome console warning fix: Check if header is available before calling xhr.getResponseHeader to avoid Chrome console warning Mar 17, 2024
@mtrezza mtrezza changed the title fix: Check if header is available before calling xhr.getResponseHeader to avoid Chrome console warning fix: Chrome console warning Refused to get unsafe header "access-control-expose-headers" when calling Cloud Function Mar 17, 2024
Copy link

codecov bot commented Mar 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (72bc9ac) to head (ac3e1dd).
Report is 11 commits behind head on alpha.

Additional details and impacted files
@@             Coverage Diff             @@
##            alpha     #2095      +/-   ##
===========================================
+ Coverage   99.98%   100.00%   +0.01%     
===========================================
  Files          61        64       +3     
  Lines        6185      6198      +13     
  Branches     1499      1503       +4     
===========================================
+ Hits         6184      6198      +14     
+ Misses          1         0       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/RESTController.js Outdated Show resolved Hide resolved
@onpix
Copy link

onpix commented Apr 4, 2024

Looking forward to seeing this error fixed!

@lortonx
Copy link

lortonx commented Apr 4, 2024

bump

@dplewis
Copy link
Member

dplewis commented Apr 11, 2024

@mortenmo any updates?

@mortenmo
Copy link
Contributor Author

Thanks for the reminder it fell off my mind. Should be updated with your suggestions.

@mortenmo mortenmo requested review from mtrezza and dplewis April 14, 2024 01:48
src/RESTController.js Outdated Show resolved Hide resolved
mtrezza and others added 2 commits April 15, 2024 19:14
Co-authored-by: Diamond Lewis <findlewis@gmail.com>
Signed-off-by: Manuel <5673677+mtrezza@users.noreply.github.com>
@REPTILEHAUS
Copy link

Really looking forward to this being merged

Copy link
Member

@mtrezza mtrezza left a comment

Choose a reason for hiding this comment

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

Is it possible to add a test for this change?

@mortenmo
Copy link
Contributor Author

I wrote some tests. One mimicking the Chrome issue causing the log error. It fails if you revert RESTController and succeeds in this branch.

@mortenmo mortenmo requested a review from mtrezza April 18, 2024 14:09
src/__tests__/RESTController-test.js Outdated Show resolved Hide resolved
src/__tests__/RESTController-test.js Outdated Show resolved Hide resolved
mtrezza added 2 commits April 18, 2024 16:36
Signed-off-by: Manuel <5673677+mtrezza@users.noreply.github.com>
Signed-off-by: Manuel <5673677+mtrezza@users.noreply.github.com>
src/__tests__/RESTController-test.js Outdated Show resolved Hide resolved
Signed-off-by: Manuel <5673677+mtrezza@users.noreply.github.com>
@mtrezza mtrezza changed the title fix: Chrome console warning Refused to get unsafe header "access-control-expose-headers" when calling Cloud Function fix: Chrome console warning about unsafe header access-control-expose-headers when calling Cloud Function Apr 18, 2024
Copy link
Member

@mtrezza mtrezza left a comment

Choose a reason for hiding this comment

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

Looks good, waiting for CI to pass...

@mtrezza mtrezza changed the title fix: Chrome console warning about unsafe header access-control-expose-headers when calling Cloud Function fix: Chrome browser console warning about unsafe header access-control-expose-headers when calling Cloud Function Apr 18, 2024
@mtrezza
Copy link
Member

mtrezza commented Apr 18, 2024

Could you just fix the lint errors?

@mtrezza
Copy link
Member

mtrezza commented Apr 19, 2024

There are still 2 open conversations, could you please reply there to see whether they can be closed?

@mortenmo
Copy link
Contributor Author

There are still 2 open conversations, could you please reply there to see whether they can be closed?

Done

@mtrezza
Copy link
Member

mtrezza commented Apr 22, 2024

Thanks for closing the conversations.

@mtrezza mtrezza merged commit 7b73c03 into parse-community:alpha Apr 22, 2024
10 checks passed
parseplatformorg pushed a commit that referenced this pull request Apr 22, 2024
# [5.1.0-alpha.5](5.1.0-alpha.4...5.1.0-alpha.5) (2024-04-22)

### Bug Fixes

* Chrome browser console warning about unsafe header `access-control-expose-headers` when calling Cloud Function ([#2095](#2095)) ([7b73c03](7b73c03))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.1.0-alpha.5

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Apr 22, 2024
parseplatformorg pushed a commit that referenced this pull request May 16, 2024
# [5.1.0-beta.1](5.0.0...5.1.0-beta.1) (2024-05-16)

### Bug Fixes

* `Parse.GeoPoint.current` returns `undefined` ([#2127](#2127)) ([3860535](3860535))
* Chrome browser console warning about unsafe header `access-control-expose-headers` when calling Cloud Function ([#2095](#2095)) ([7b73c03](7b73c03))
* Live Query not working on Expo React Native ([#2109](#2109)) ([7a89665](7a89665))
* Local datastore throws error when `Parse.Query.notEqualTo` is set to `null` ([#2102](#2102)) ([6afd32a](6afd32a))
* Multiple object updates of nested keys overwrite each other ([#1451](#1451)) ([fa4341a](fa4341a))
* Pending updates to nested field causes `ParseObject.toJSON()` to return incorrect object ([#1453](#1453)) ([23cc573](23cc573))
* Remove circular dependencies ([#2125](#2125)) ([b415165](b415165))

### Features

* Add password validation for user with unverified email via `Parse.User.verifyPassword` using master key and option `ignoreEmailVerification: true` ([#2076](#2076)) ([b0adf7e](b0adf7e))
* Add support for setting `Parse.ACL` from json ([#2097](#2097)) ([72bc9ac](72bc9ac))
* Allow setting custom queue for handling offline operations via `Parse.EventuallyQueue` ([#2106](#2106)) ([f92e4d4](f92e4d4))
* Improve installation object `Parse.Installation.currentInstallation` to support web push notifications ([#2119](#2119)) ([4fc62ce](4fc62ce))
* Lazy load `Parse.CoreManager` controllers to add support for swappable `CryptoController`, `LocalDatastoreController`, `StorageController`, `WebSocketController`, `ParseLiveQuery` ([#2100](#2100)) ([fbd0ab1](fbd0ab1))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.1.0-beta.1

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label May 16, 2024
parseplatformorg pushed a commit that referenced this pull request May 16, 2024
# [5.1.0](5.0.0...5.1.0) (2024-05-16)

### Bug Fixes

* `Parse.GeoPoint.current` returns `undefined` ([#2127](#2127)) ([3860535](3860535))
* Chrome browser console warning about unsafe header `access-control-expose-headers` when calling Cloud Function ([#2095](#2095)) ([7b73c03](7b73c03))
* Live Query not working on Expo React Native ([#2109](#2109)) ([7a89665](7a89665))
* Local datastore throws error when `Parse.Query.notEqualTo` is set to `null` ([#2102](#2102)) ([6afd32a](6afd32a))
* Multiple object updates of nested keys overwrite each other ([#1451](#1451)) ([fa4341a](fa4341a))
* Pending updates to nested field causes `ParseObject.toJSON()` to return incorrect object ([#1453](#1453)) ([23cc573](23cc573))
* Remove circular dependencies ([#2125](#2125)) ([b415165](b415165))

### Features

* Add password validation for user with unverified email via `Parse.User.verifyPassword` using master key and option `ignoreEmailVerification: true` ([#2076](#2076)) ([b0adf7e](b0adf7e))
* Add support for setting `Parse.ACL` from json ([#2097](#2097)) ([72bc9ac](72bc9ac))
* Allow setting custom queue for handling offline operations via `Parse.EventuallyQueue` ([#2106](#2106)) ([f92e4d4](f92e4d4))
* Improve installation object `Parse.Installation.currentInstallation` to support web push notifications ([#2119](#2119)) ([4fc62ce](4fc62ce))
* Lazy load `Parse.CoreManager` controllers to add support for swappable `CryptoController`, `LocalDatastoreController`, `StorageController`, `WebSocketController`, `ParseLiveQuery` ([#2100](#2100)) ([fbd0ab1](fbd0ab1))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-alpha Released as alpha version state:released-beta Released as beta version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refused to get unsafe header "access-control-expose-headers" on Chrome
7 participants