Skip to content

Fix CORS configuration in API config#8496

Merged
davidjiglesias merged 1 commit into4.2from
fix/8485-cors-api-config
May 10, 2021
Merged

Fix CORS configuration in API config#8496
davidjiglesias merged 1 commit into4.2from
fix/8485-cors-api-config

Conversation

@Selutario
Copy link
Contributor

Related issue
Closes #8485

Description

Hi team!

This PR fixes the CORS configuration so lists can be added to expose_headers and allow_headers fields again. This was the allowed configuration until a JSONschema validator was added in this PR: #7803

Now, both strings:

 cors:
  enabled: yes
  source_route: "*"
  expose_headers: "*"
  allow_headers: "*"
  allow_credentials: no

and lists:

cors:
  enabled: yes
  source_route: "https://test_url.com"
  expose_headers:
    - "Test-expose"
    - "another-expose"
  allow_headers:
    - "Content-type"
  allow_credentials: true

can be used as before.

QA test output

The CORS is passing now (there is 1 xfailed not related with this changes):

pytest /wazuh-qa/tests/integration/test_api/test_config/test_cors/ --disable-warnings
/var/ossec/framework/python/lib/python3.9/site-packages/_testinfra_renamed.py:5: DeprecationWarning: testinfra package has been renamed to pytest-testinfra. Please `pip install pytest-testinfra` and `pip uninstall testinfra` and update your package requirements to avoid this message
  warnings.warn((
====================================================================================== test session starts ======================================================================================
platform linux -- Python 3.9.2, pytest-6.2.3, py-1.10.0, pluggy-0.13.1
rootdir: /wazuh-qa/tests/integration, configfile: pytest.ini
plugins: html-3.1.1, testinfra-6.3.0, testinfra-6.0.0, metadata-1.11.0
collected 2 items                                                                                                                                                                               

wazuh-qa/tests/integration/test_api/test_config/test_cors/test_cors.py x.                                                                                                                 [100%]

=========================================================================== 1 passed, 1 xfailed, 2 warnings in 20.56s ===========================================================================

Regards,
Selu.

@Selutario Selutario self-assigned this May 4, 2021
@Selutario Selutario changed the base branch from master to 4.2 May 4, 2021 08:18
@Selutario Selutario changed the title Fix/8485 cors api config Fix CORS configuration in API config May 4, 2021
@davidjiglesias davidjiglesias merged commit 9fa8543 into 4.2 May 10, 2021
@davidjiglesias davidjiglesias deleted the fix/8485-cors-api-config branch May 10, 2021 08:16
Selutario added a commit that referenced this pull request May 10, 2021
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.

API configuration validator does not accept lists in CORS

2 participants