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

Add aiohttp signal to modify HTTP response headers #9263

Merged
merged 2 commits into from
Jul 14, 2021

Conversation

vicferpoy
Copy link
Contributor

Related issue
closes #9253

Description

Hello team,

This PR adds a new API module to implement and manage aiohttp signals. In addition, we have implemented a new signal to modify HTTP response headers. Now, API responses do not have the Server header:

Successful

Content-Type: application/json; charset=utf-8
Strict-Transport-Security: max-age=63072000; includeSubdomains
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Security-Policy: none
Referrer-Policy: no-referrer, strict-origin-when-cross-origin
Pragma: no-cache
Expires: 0
Cache-control: no-cache, no-store, must-revalidate, max-age=0
Content-Length: 1313
Date: Mon, 12 Jul 2021 15:11:01 GMT

Unsuccessful

Content-Type: application/problem+json; charset=utf-8
Content-Length: 71
Date: Mon, 12 Jul 2021 15:11:14 GMT

Tests performed

Unit tests

========================================= test session starts ==========================================
platform linux -- Python 3.9.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /home/vicferpoy/Desktop/Git/wazuh/api
plugins: cov-2.12.0, asyncio-0.15.1
collected 238 items                                                                                    

models/test/test_model.py ............                                                           [  5%]
test/test_alogging.py ..........                                                                 [  9%]
test/test_authentication.py ..........                                                           [ 13%]
test/test_configuration.py ..........................................                            [ 31%]
test/test_util.py ...................................                                            [ 45%]
test/test_validator.py ......................................................................... [ 76%]
........................................................                                         [100%]

=================================== 238 passed, 15 warnings in 1.20s ===================================

Regards,
Víctor

@vicferpoy vicferpoy self-assigned this Jul 12, 2021
Copy link
Contributor

@Selutario Selutario left a comment

Choose a reason for hiding this comment

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

LGTM!

@davidjiglesias davidjiglesias merged commit ac62da2 into master Jul 14, 2021
@davidjiglesias davidjiglesias deleted the feature/9253-api-http-headers branch July 14, 2021 16:04
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.

Remove server information from API HTTP response headers
3 participants