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

fix(node-18): ATS URL Parsing #1302

Merged
merged 1 commit into from
Apr 12, 2023
Merged

fix(node-18): ATS URL Parsing #1302

merged 1 commit into from
Apr 12, 2023

Conversation

dpogue
Copy link
Member

@dpogue dpogue commented Apr 9, 2023

Platforms affected

iOS, with node18

Motivation and Context

Fixes #1290: currently parsing of access, allow-navigation, and allow-intent directives in config.xml for Application Transport Security is broken when using node 18 due to changes to how node handles URLs.

Description

Move URL parsing to the (non-deprecated) WHATWG URL API in node, and workaround the issues that cause URL parsing to fail or return unexpected results with that API.

Testing

All unit tests pass, but I would feel more confident if people tried throwing some weirder corner cases at this to ensure it's actually behaving consistently with previous versions.

Checklist

  • I've run the tests to see all new and existing tests pass
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)

@codecov-commenter
Copy link

codecov-commenter commented Apr 9, 2023

Codecov Report

Merging #1302 (b1e2ea8) into master (e1e21cf) will increase coverage by 78.25%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           master    #1302       +/-   ##
===========================================
+ Coverage        0   78.25%   +78.25%     
===========================================
  Files           0       15       +15     
  Lines           0     1761     +1761     
===========================================
+ Hits            0     1378     +1378     
- Misses          0      383      +383     
Impacted Files Coverage Δ
lib/prepare.js 85.02% <100.00%> (ø)

... and 14 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@erisu erisu changed the title Fix URL parsing for ATS in node 18 fix(node-18): ATS URL Parsing Apr 9, 2023
Copy link
Member

@NiklasMerz NiklasMerz left a comment

Choose a reason for hiding this comment

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

Logic looks good to me. Cannot test it right now.

@NiklasMerz NiklasMerz added this to the 6.2.1 milestone Apr 11, 2023
@NiklasMerz NiklasMerz merged commit ad60924 into apache:master Apr 12, 2023
NiklasMerz pushed a commit that referenced this pull request Apr 13, 2023
@quyenvsp
Copy link

Just note for people who has problem Invalid url

    <allow-navigation href="*youtube*" />

should change to

    <allow-navigation href="http:*youtube*" />
    <allow-navigation href="https:*youtube*" />

@dpogue dpogue deleted the node18-fix branch March 8, 2024 18:11
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.

access domains not handled properly on NodeJS 18
5 participants