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

[Improvement] Add cors filter for Jetty server #42

Closed
jerryshao opened this issue Jun 1, 2023 · 2 comments · Fixed by #1238
Closed

[Improvement] Add cors filter for Jetty server #42

jerryshao opened this issue Jun 1, 2023 · 2 comments · Fixed by #1238
Assignees
Labels
good first issue Good for newcomers improvement Improvements on everything

Comments

@jerryshao
Copy link
Contributor

What would you like to be improved?

To improve the security and avoid attacks to our embedded server, we should add cors filter support for our Jetty server.

How should we improve?

Implement a cors filter and register into Jetty should be enough.

@jerryshao jerryshao added the improvement Improvements on everything label Jun 1, 2023
@jerryshao jerryshao added the good first issue Good for newcomers label Jun 16, 2023
@jerryshao
Copy link
Contributor Author

@qqqttt123 assigned this to you.

@qqqttt123
Copy link
Contributor

@qqqttt123 assigned this to you.

Ok, I got it.

@jerryshao jerryshao added this to the Gravitino 0.4.0 milestone Dec 14, 2023
qqqttt123 added a commit that referenced this issue Dec 22, 2023
### What changes were proposed in this pull request?
I wrap the cors filter of Jetty as our system internal filter. Most
default values respect the default values of the cors filter of Jetty. I
only change the default value of `AllowMethods`.The origin default value
is `PUT,GET,POST,HEAD`. Because we usually use `DELETE` method, too. I
change it to `PUT,GET,POST,HEAD,DELETE`.

### Why are the changes needed?

Fix: #42 

### Does this PR introduce _any_ user-facing change?
yes, I have added the document.

### How was this patch tested?
UT + manual test
```
var http = new XMLHttpRequest();
var url = 'http://localhost:8090/api/version';
http.onreadystatechange = (e) => {
    console.log(http.responseText)
}
http.open("GET", url);
http.send();
```

---------

Co-authored-by: Heng Qin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers improvement Improvements on everything
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants