Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: throw error for malformed URLs missing '//' #7315#7316

Open
sapla1125 wants to merge 1 commit intoaxios:v1.xfrom
sapla1125:fix-url-normalization-7315
Open

fix: throw error for malformed URLs missing '//' #7315#7316
sapla1125 wants to merge 1 commit intoaxios:v1.xfrom
sapla1125:fix-url-normalization-7315

Conversation

@sapla1125
Copy link

This pull request fixes URL normalization in Axios by throwing an explicit error when a URL protocol is missing // instead of silently normalizing it.

Changes included:

Added validation in parseProtocol to detect malformed URLs.

Updated tests to cover invalid URLs like http:/example.com and https:/127.0.0.1/ to ensure they throw an error.

Updated documentation to mention that malformed URLs now throw explicitly.

Issue Reference:
Fixes #7315

import parseProtocol from '../../../lib/helpers/parseProtocol.js';

// Minimal expect helper for browser testing
function expect(actual) {

Choose a reason for hiding this comment

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

Suggested change
function expect(actual) {
function expect(actual) {

@jasonsaayman
Copy link
Member

@cubic-dev-ai

@cubic-dev-ai
Copy link
Contributor

cubic-dev-ai bot commented Feb 23, 2026

@cubic-dev-ai

@jasonsaayman I have started the AI code review. It will take a few minutes to complete.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

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.

Normalization of url cause an ssrf security bypass

4 participants