Skip to content

Conversation

@svrooij
Copy link
Contributor

@svrooij svrooij commented Jan 26, 2025

Fixes #201

Add error handling for 'https://' and 'http://' prefixes in allowed host values.

  • Modify AllowedHostsValidator class in packages/abstractions/kiota_abstractions/authentication/allowed_hosts_validator.py to throw a ValueError if any allowed host contains 'https://' or 'http://' prefix.
  • Add a check in the __init__ method and set_allowed_hosts method to throw a ValueError if any allowed host contains 'https://' or 'http://' prefix.
  • Add tests in packages/abstractions/tests/authentication/test_api_key_authentication_provider.py to verify that a ValueError is thrown when 'https://' or 'http://' prefix is present in allowed host value.

For more details, open the Copilot Workspace session.

…host value

Fixes microsoft#201

Add error handling for 'https://' and 'http://' prefixes in allowed host values.

* Modify `AllowedHostsValidator` class in `packages/abstractions/kiota_abstractions/authentication/allowed_hosts_validator.py` to throw a `ValueError` if any allowed host contains 'https://' or 'http://' prefix.
* Add a check in the `__init__` method and `set_allowed_hosts` method to throw a `ValueError` if any allowed host contains 'https://' or 'http://' prefix.
* Add tests in `packages/abstractions/tests/authentication/test_api_key_authentication_provider.py` to verify that a `ValueError` is thrown when 'https://' or 'http://' prefix is present in allowed host value.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/microsoft/kiota-python/issues/201?shareId=XXXX-XXXX-XXXX-XXXX).
@svrooij svrooij requested a review from a team as a code owner January 26, 2025 13:53
baywet
baywet previously approved these changes Jan 26, 2025
Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

@baywet baywet enabled auto-merge (squash) January 28, 2025 14:14
@sonarqubecloud
Copy link

@baywet baywet merged commit d259efa into microsoft:main Jan 28, 2025
53 checks passed
@baywet baywet added the release-please:force-run used to force releases with RP label Jan 28, 2025
@release-please release-please bot removed the release-please:force-run used to force releases with RP label Jan 28, 2025
@baywet baywet mentioned this pull request Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Throw error on https:// and http:// prefix if present in allowed host value

3 participants