@contentful/app-scripts 1.28.0 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/utils.js +16 -1
  2. package/package.json +2 -2
package/lib/utils.js CHANGED
@@ -27,7 +27,22 @@ const throwValidationException = (subject, message, details) => {
27
27
  };
28
28
  exports.throwValidationException = throwValidationException;
29
29
  const isValidNetwork = (address) => {
30
- const addressRegex = /^(?:localhost|(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|(\[(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}\]|(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}))(?::\d{1,5})?$/;
30
+ // Regular expression to validate network addresses
31
+ const addressRegex = new RegExp('^(?:' + // Start of the non-capturing group for the entire address
32
+ '(?:' + // Start of the non-capturing group for domain names
33
+ '(?:\\*\\.)' + // Matches wildcard domains like *.example.com
34
+ '(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)' + // Matches a single subdomain
35
+ '[a-zA-Z]{2,6}' + // Matches the top-level domain (TLD)
36
+ '|' + // OR
37
+ '(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+' + // Matches standard domains with one or more subdomains
38
+ '[a-zA-Z]{2,6}' + // Matches the top-level domain (TLD)
39
+ ')|' + // End of the non-capturing group for domain names, OR
40
+ '(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}' + // Matches the first three octets of an IPv4 address
41
+ '(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|' + // Matches the last octet of an IPv4 address
42
+ '(\\[(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}\\]' + // Matches IPv6 addresses in square brackets
43
+ '|(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4})' + // Matches IPv6 addresses without square brackets
44
+ ')(?::\\d{1,5})?$' // Matches an optional port number (1 to 5 digits)
45
+ );
31
46
  return addressRegex.test(address);
32
47
  };
33
48
  exports.isValidNetwork = isValidNetwork;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/app-scripts",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "description": "A collection of scripts for building Contentful Apps",
5
5
  "author": "Contentful GmbH",
6
6
  "license": "MIT",
@@ -60,7 +60,7 @@
60
60
  "open": "8.4.2",
61
61
  "ora": "5.4.1"
62
62
  },
63
- "gitHead": "580a3ebbe9ac4dbefaf0a7fea989ba4aab7b8dc3",
63
+ "gitHead": "2179b34098340843ad4e6eeaa09e341f34286164",
64
64
  "devDependencies": {
65
65
  "@tsconfig/node18": "18.2.4",
66
66
  "@types/adm-zip": "0.5.5",