cordova-ios icon indicating copy to clipboard operation
cordova-ios copied to clipboard

one question about CDVAllowList

Open Tang0401 opened this issue 2 years ago • 1 comments

Bug Report

Problem

What is expected to happen?

What does actually happen?

NSRegularExpression* parts = [NSRegularExpression regularExpressionWithPattern:@"^((\|[A-Za-z-]+):/?/?)?(((\\.)?[^/:]+)|\)?(:(\d+))?(/.)?" options:0 error:nil]; Some schemes cannot be adding into allowlist, for example, com.12306, openapp.jdmobile. Is thie regularExpression for scheme ((\|[A-Za-z-]+)) universial?

Information

Command or Code

Environment, Platform, Device

Version information

Checklist

  • [ ] I searched for existing GitHub issues
  • [ ] I updated all Cordova tooling to most recent version
  • [ ] I included all the necessary information above

Tang0401 avatar Feb 27 '23 15:02 Tang0401

IMO, the regular expression is not universal. It is more strict on what is allowed as a scheme.

Looking at O'Reilly - Extracting the Scheme from a URL, they suggest to use the following regular expression for matching URL parts.

^([a-z][a-z0-9+\-.]*):

Using the above regular expression with following test data:

http://cordova.apache.org
https://cordova.apache.org
org.apache://cordova.foobar

It would identfy that http, https and org.apache are schemes.

In regards to Cordova, I am not sure why a stricter expression was applied.

erisu avatar Mar 08 '24 13:03 erisu