8000 API: Add HTTP 200 Return in case we have an OPTIONS request by SchoolGuy · Pull Request #2594 · cobbler/cobbler · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

API: Add HTTP 200 Return in case we have an OPTIONS request #2594

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 15, 2021

Conversation

SchoolGuy
Copy link
Member
@SchoolGuy SchoolGuy commented Mar 12, 2021

While working on the new Angular Frontend for Cobbler I noticed that browsers send an OPTIONS request for pre CORS checks. Since our application didn't implement those yet, we were never successfully able to being set up in an environment where this is of concern. We now add this with this commit.

@SchoolGuy SchoolGuy added this to the v3.3.0 milestone Mar 12, 2021
@SchoolGuy SchoolGuy self-assigned this Mar 12, 2021
@codecov
Copy link
codecov bot commented Mar 12, 2021

Codecov Report

Merging #2594 (a6e8081) into master (b936c28) will increase coverage by 0.01%.
The diff coverage is 40.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2594      +/-   ##
==========================================
+ Coverage   27.42%   27.43%   +0.01%     
==========================================
  Files          85       85              
  Lines       11774    11783       +9     
==========================================
+ Hits         3229     3233       +4     
- Misses       8545     8550       +5     
Impacted Files Coverage Δ
cobbler/remote.py 19.40% <40.00%> (+0.18%) ⬆️

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 b936c28...a6e8081. Read the comment docs.

Copy link
Contributor
@hbokh hbokh left a comment

Choose a reason for hiding this comment

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

Seems legit. LGTM.

Copy link
Member
@nodeg nodeg left a comment

Choose a reason for hiding this comment

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

After skipping through CORS and xmlrpc.server the PR seems fine. My only question left is, why you separated the header requests and did not put them all together in the do_OPTIONS() method like this:

class RequestHandler(SimpleXMLRPCRequestHandler):
    def do_OPTIONS(self):
        self.send_response(200)
        self.send_header("Access-Control-Allow-Headers",
                         "Origin, X-Requested-With, Content-Type, Accept")
        self.send_header("Access-Control-Allow-Origin", "*")
        SimpleXMLRPCRequestHandler.end_headers(self)

The methond itself implements the CORS pre-flighted access for resources and I thought only this is what we need. Furthermore I am not sure if we acutally need all of the allowed Access-Control-Allow-Headers but I don't know how to test this with the new Angular web interface. @SchoolGuy Could you provide some steps how to reproduce the issue you ran into?
As long as it works, it's fine. But we should definitly check those settings regarding security before shipping the new web interface.

@SchoolGuy
Copy link
Member Author

@nodeg I will merge this PR then and I would like that you create an issue with all things we should consider before releasing the next version. Would that be okay with you?

@nodeg
Copy link
Member
nodeg commented Mar 15, 2021

Of course. The comment was only about things I wondered about 😄

@SchoolGuy SchoolGuy merged commit f7482f6 into master Mar 15, 2021
@SchoolGuy SchoolGuy deleted the feature/add_options_handler branch March 15, 2021 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0