Skip to content

Add Cache Headers as permitted headers for CORS preflight: Fix issue #5354 #5396

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

Merged
merged 1 commit into from
Mar 12, 2019

Conversation

fatbattk
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Feb 26, 2019

Codecov Report

Merging #5396 into master will decrease coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5396      +/-   ##
==========================================
- Coverage      94%   93.93%   -0.07%     
==========================================
  Files         127      127              
  Lines        9091     9091              
==========================================
- Hits         8546     8540       -6     
- Misses        545      551       +6
Impacted Files Coverage Δ
src/middlewares.js 98.2% <ø> (ø) ⬆️
src/Adapters/Auth/httpsRequest.js 95.23% <0%> (-4.77%) ⬇️
src/Adapters/Storage/Mongo/MongoStorageAdapter.js 91.5% <0%> (-0.73%) ⬇️
src/RestWrite.js 93.27% <0%> (-0.36%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e0db6eb...0bf551f. Read the comment docs.

acinader
acinader previously approved these changes Feb 27, 2019
Copy link
Contributor

@acinader acinader left a comment

Choose a reason for hiding this comment

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

This looks good to me.

Copy link
Contributor

@acinader acinader left a comment

Choose a reason for hiding this comment

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

see my notes on the issue: #5354

@acinader acinader dismissed their stale review February 27, 2019 03:03

further consideration

@acinader acinader changed the title Fix issue #5354 Add Cache Headers as permitted headers for CORS preflight: Fix issue #5354 Mar 2, 2019
@acinader
Copy link
Contributor

acinader commented Mar 2, 2019

I think that the proposed change is likely fine, but in thinking about this, I am now concerned about

export function allowCrossDomain(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.header(
'Access-Control-Allow-Headers',
'X-Parse-Master-Key, X-Parse-REST-API-Key, X-Parse-Javascript-Key, X-Parse-Application-Id, X-Parse-Client-Version, X-Parse-Session-Token, X-Requested-With, X-Parse-Revocable-Session, Content-Type, Pragma, Cache-Control'
);
res.header(
'Access-Control-Expose-Headers',
'X-Parse-Job-Status-Id, X-Parse-Push-Status-Id'
);
// intercept OPTIONS method
if ('OPTIONS' == req.method) {
res.sendStatus(200);
} else {
next();
}
}

which allows * host to send authentication headers like master key and session id.

the fetch discussion I've been reading for context on this pr suggests that * for allowed hosts should not be permitted with authentication. Next step for me is to try and set up some tests to help me wrap my head around how this particular cors function would operate in real life. Any help would be greatly appreciated.

@acinader
Copy link
Contributor

acinader commented Mar 9, 2019

I'd like to get this merged in.

I have a concern around the * in the Access-Control-Allow-Origin given the authentication headers that are allowed; however, this change does not make that worse.

I'd like to get this merged in and would appreciate another set of eyes from the community to take a look at it and think it through.

@acinader acinader merged commit bcda96b into parse-community:master Mar 12, 2019
UnderratedDev pushed a commit to UnderratedDev/parse-server that referenced this pull request Mar 21, 2020
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.

3 participants