-
Notifications
You must be signed in to change notification settings - Fork 357
feat: add strict policy option for enforcing base URL #817
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
Conversation
9618798 to
05a2540
Compare
05a2540 to
d363c37
Compare
PR SummaryAdds a
Written by Cursor Bugbot for commit 5480e78. This will update automatically on new commits. Configure here. |
d363c37 to
4dc86b7
Compare
4dc86b7 to
4f1f58d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a strict policy option to the BaseUrl middleware to address security concerns when user-controlled input determines the request URL. The strict mode ensures the base URL is always prepended, preventing potential URL redirection attacks.
Key Changes:
- Introduces
policy: :strictoption to enforce base URL prepending even when URLs contain schemes - Refactors option parsing to support both keyword list format (
:base_url+:policy) and backward-compatible string format - Adds comprehensive test coverage for strict policy behavior and validation
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
lib/tesla/middleware/base_url.ex |
Implements strict/insecure policy logic with new option parsing; updates documentation with examples and security guidance |
test/tesla/middleware/base_url_test.exs |
Adds test coverage for strict policy behavior, policy validation, backward compatibility, and edge cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
01ead85 to
c582cb5
Compare
Add an opt-in `policy: :strict` option to the BaseUrl middleware that enforces base URL prepending regardless of whether the request URL already includes a scheme. This addresses security concerns when user input controls the URL parameter, preventing potential URL redirection attacks. Fixes #816 Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
c582cb5 to
5480e78
Compare
Add an opt-in
policy: :strictoption to the BaseUrl middleware that enforcesbase URL prepending regardless of whether the request URL already includes a scheme.
This addresses security concerns when user input controls the URL parameter,
preventing potential URL redirection attacks.
Signed-off-by: Yordis Prieto yordis.prieto@gmail.com