Skip to content

url.parse() is deemed insecure and has been deprecated.#662

Open
oelderinkX wants to merge 3 commits into
microsoft:masterfrom
oelderinkX:feature/urlparseInsecure
Open

url.parse() is deemed insecure and has been deprecated.#662
oelderinkX wants to merge 3 commits into
microsoft:masterfrom
oelderinkX:feature/urlparseInsecure

Conversation

@oelderinkX

Copy link
Copy Markdown

url.parse() calls have been replaced with new URL
@oelderinkX oelderinkX requested a review from a team as a code owner March 9, 2026 07:12
@oelderinkX

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@oelderinkX

Copy link
Copy Markdown
Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 662 in repo microsoft/azure-devops-node-api

@oelderinkX

Copy link
Copy Markdown
Author

/azp run

I'm wondering if the pipeline isn't running because my branch name possibly ?

@microsoft microsoft deleted a comment from azure-pipelines Bot Mar 11, 2026
@microsoft microsoft deleted a comment from azure-pipelines Bot Mar 11, 2026
@tarunramsinghani

Copy link
Copy Markdown
Contributor

/azp run

@oelderinkX

Copy link
Copy Markdown
Author

/azp run

let me know if I need to fix anything on my side

Comment thread api/TaskAgentApi.ts
@oelderinkX

Copy link
Copy Markdown
Author

/azp run

@oelderinkX

Copy link
Copy Markdown
Author

do I need to convert my pull request to Draft for it to be review ?

@oelderinkX

Copy link
Copy Markdown
Author

@tarunramsinghani would you have time to review ? I have made the changes you suggested

@oelderinkX

Copy link
Copy Markdown
Author

@tarunramsinghani @adeolemon @peterblazejewicz @nguerrera is anyone available for a review and pull request approval ? I'm new at pull requests for other peoples repos, so apologies in advance

@tarunramsinghani

Copy link
Copy Markdown
Contributor

/azp run

@tarunramsinghani

Copy link
Copy Markdown
Contributor

@oelderinkX I am bit pressed for time, so could not spend time to review...

I wanted to make sure this does not have any implications specially with the behaviour change i.e. url.parse returned null in case of invalid url but URL() throws exception so validating those will need some additional test cases or handling in the code.

@oelderinkX

oelderinkX commented Apr 10, 2026

Copy link
Copy Markdown
Author

@oelderinkX I am bit pressed for time, so could not spend time to review...

I wanted to make sure this does not have any implications specially with the behaviour change i.e. url.parse returned null in case of invalid url but URL() throws exception so validating those will need some additional test cases or handling in the code.

Thanks @tarunramsinghani for your comment. url.parse does not return null for invalid urls, but URL.parse does.

if you:

const pathname1 = url.parse('!').pathname; // pathname1 === '!'
const pathname2 = url.parse('www.example.com').pathname; // pathname2 === 'www.example.com'

and you'll be hitting an error somewhere else in the code. If you wanted to switch to URL.parse (you might need to update your typescript + settings) you'd need to do something like:

const pathname = URL.parse('invalid')?.pathname || '';

and you'd still be hitting an error somewhere else.

I'm happy with the Fast-Fail approach here, but are you?. If someone tries setting an invalid Url it will throw a TypeError with a message like:

TypeError: Invalid URL
  at new URL (node:internal/url:797:36)
  at new VsoClient (_build\VsoClient.js:32:25)
  at Context.<anonymous> (test\units\tests.js:51:21)
  at process.processImmediate (node:internal/timers:478:21)

I don't believe a unit test is needed for this change at the moment

@oelderinkX

Copy link
Copy Markdown
Author

anything left to do ?

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