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

feat(CORS): set allow private network header #2383

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

zodecky
Copy link

@zodecky zodecky commented Oct 21, 2024

Summary of Changes

Allow private networks as an option in CORS

Related Issues

#2381

Pull Request Checklist

This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once; it will save you a few review cycles!

If an item doesn't apply to your pull request, check it anyway to make it apparent that there's nothing to do.

  • Applied changes to both WSGI and ASGI code paths and interfaces (where applicable).
  • Added tests for changed code.
  • Prefixed code comments with GitHub nick and an appropriate prefix.
  • Coding style is consistent with the rest of the framework.
  • Updated documentation for changed code.
    • Added docstrings for any new classes, functions, or modules.
    • Updated docstrings for any modifications to existing code.
    • Updated both WSGI and ASGI docs (where applicable).
    • Added references to new classes, functions, or modules to the relevant RST file under docs/.
    • Updated all relevant supporting documentation files under docs/.
    • A copyright notice is included at the top of any new modules (using your own name or the name of your organization).
    • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
  • Changes (and possible deprecations) have towncrier news fragments under docs/_newsfragments/, with the file name format {issue_number}.{fragment_type}.rst. (Run towncrier --draft to ensure it renders correctly.)

If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!

PR template inspired by the attrs project.

@vytas7 vytas7 changed the title Allow private networks feat(CORS): allow private network Oct 22, 2024
@vytas7 vytas7 changed the title feat(CORS): allow private network feat(CORS): set allow private network header Oct 22, 2024
Copy link

codecov bot commented Oct 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (ab2ce4c) to head (dac0d17).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2383   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           64        64           
  Lines         7726      7726           
  Branches      1071      1071           
=========================================
  Hits          7726      7726           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@vytas7 vytas7 left a comment

Choose a reason for hiding this comment

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

Something looks wrong... 😕
Have you changed line endings, or why does the whole file look as changed? Aha, you added middleware.py as a top-level file... Please make changes to falcon/middleware.py instead.

Moreover, before merging, we'll need to add tests covering the new code, and a Towncrier newsfragment.

@vytas7 vytas7 marked this pull request as draft October 22, 2024 05:55
@zodecky
Copy link
Author

zodecky commented Oct 31, 2024

Ok! Thank you! I Will change that!

@zodecky
Copy link
Author

zodecky commented Nov 6, 2024

i am adding the tests, and changed the file placement

@zodecky
Copy link
Author

zodecky commented Nov 6, 2024

I added a test in TestCustomCorsMiddleware, but I am not sure if it was supposed to be in the TestCorsMiddleware
I put it in custom because it's an optional value and not default. Also I didnt change any of the existing tests, should I also add like
assert 'Access-Control-Allow-Private-Network'.lower() not in h in the existing tests?

@vytas7
Copy link
Member

vytas7 commented Nov 10, 2024

It seems that our tests fail with the newly released websockets 14.0, this is not caused by your changes. We'll try to address this separately.

@zodecky
Copy link
Author

zodecky commented Nov 10, 2024

okk

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.

2 participants