@ai-ecoverse/slicc-browsers 1.18.20 → 1.18.21

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "setVersion": "1.18.20",
3
+ "setVersion": "1.18.21",
4
4
  "sources": [
5
5
  {
6
6
  "repo": "ai-ecoverse/slicc-cli",
@@ -1200,7 +1200,7 @@
1200
1200
  }
1201
1201
  },
1202
1202
  "eventsRedacted": {
1203
- "means": "protected error-page recover: every discovery event for the tab shows, decoded as often as it takes and without the characters the URL parser ignores, the failed URL's origin only, a masked or absent url, or a url off the protected host, wrappers such as blob: unwrapped, that names no other origin on that host, with a title that names the protected host, if at all, only as that bare origin, and no url or title carries the failed URL, its path, query or fragment; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1203
+ "means": "protected error-page recover: every discovery event for the tab shows, decoded as often as it takes and without the characters the URL parser ignores, the failed URL's origin only, a masked or absent url, or a url off the protected host, wrappers such as blob: unwrapped, that names no other origin on that host, with a title that names the protected host, in any spelling the URL parser maps to it, if at all, only as that bare origin, and no url or title carries the failed URL, its path, query or fragment; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1204
1204
  "requires": ["discovery"],
1205
1205
  "check": {
1206
1206
  "result": "errorPage",
@@ -1349,7 +1349,7 @@
1349
1349
  }
1350
1350
  },
1351
1351
  "eventsRedacted": {
1352
- "means": "protected error-page recover (query): every discovery event for the tab shows, decoded as often as it takes and without the characters the URL parser ignores, the failed URL's origin only, a masked or absent url, or a url off the protected host, wrappers such as blob: unwrapped, that names no other origin on that host, with a title that names the protected host, if at all, only as that bare origin, and no url or title carries the failed URL, its path, query or fragment; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1352
+ "means": "protected error-page recover (query): every discovery event for the tab shows, decoded as often as it takes and without the characters the URL parser ignores, the failed URL's origin only, a masked or absent url, or a url off the protected host, wrappers such as blob: unwrapped, that names no other origin on that host, with a title that names the protected host, in any spelling the URL parser maps to it, if at all, only as that bare origin, and no url or title carries the failed URL, its path, query or fragment; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1353
1353
  "requires": ["discovery"],
1354
1354
  "check": {
1355
1355
  "result": "errorPage",
@@ -1498,7 +1498,7 @@
1498
1498
  }
1499
1499
  },
1500
1500
  "eventsRedacted": {
1501
- "means": "protected error-page recover (fragment): every discovery event for the tab shows, decoded as often as it takes and without the characters the URL parser ignores, the failed URL's origin only, a masked or absent url, or a url off the protected host, wrappers such as blob: unwrapped, that names no other origin on that host, with a title that names the protected host, if at all, only as that bare origin, and no url or title carries the failed URL, its path, query or fragment; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1501
+ "means": "protected error-page recover (fragment): every discovery event for the tab shows, decoded as often as it takes and without the characters the URL parser ignores, the failed URL's origin only, a masked or absent url, or a url off the protected host, wrappers such as blob: unwrapped, that names no other origin on that host, with a title that names the protected host, in any spelling the URL parser maps to it, if at all, only as that bare origin, and no url or title carries the failed URL, its path, query or fragment; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1502
1502
  "requires": ["discovery"],
1503
1503
  "check": {
1504
1504
  "result": "errorPage",
@@ -1646,7 +1646,7 @@
1646
1646
  }
1647
1647
  },
1648
1648
  "eventsRedacted": {
1649
- "means": "protected error-page restore: every discovery event for the tab shows, decoded as often as it takes and without the characters the URL parser ignores, the failed URL's origin only, a masked or absent url, or a url off the protected host, wrappers such as blob: unwrapped, that names no other origin on that host, with a title that names the protected host, if at all, only as that bare origin, and no url or title carries the failed URL, its path, query or fragment; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1649
+ "means": "protected error-page restore: every discovery event for the tab shows, decoded as often as it takes and without the characters the URL parser ignores, the failed URL's origin only, a masked or absent url, or a url off the protected host, wrappers such as blob: unwrapped, that names no other origin on that host, with a title that names the protected host, in any spelling the URL parser maps to it, if at all, only as that bare origin, and no url or title carries the failed URL, its path, query or fragment; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1650
1650
  "requires": ["discovery"],
1651
1651
  "check": {
1652
1652
  "result": "errorPage",
@@ -1827,7 +1827,7 @@
1827
1827
  }
1828
1828
  },
1829
1829
  "eventsRedacted": {
1830
- "means": "protected error-page sticky: every discovery event for the tab shows, decoded as often as it takes and without the characters the URL parser ignores, the failed URL's origin only, a masked or absent url, or a url off the protected host, wrappers such as blob: unwrapped, that names no other origin on that host, with a title that names the protected host, if at all, only as that bare origin, and no url or title carries the failed URL, its path, query or fragment; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1830
+ "means": "protected error-page sticky: every discovery event for the tab shows, decoded as often as it takes and without the characters the URL parser ignores, the failed URL's origin only, a masked or absent url, or a url off the protected host, wrappers such as blob: unwrapped, that names no other origin on that host, with a title that names the protected host, in any spelling the URL parser maps to it, if at all, only as that bare origin, and no url or title carries the failed URL, its path, query or fragment; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1831
1831
  "requires": ["discovery"],
1832
1832
  "check": {
1833
1833
  "result": "errorPage",
@@ -2020,7 +2020,7 @@
2020
2020
  }
2021
2021
  },
2022
2022
  "eventsRedacted": {
2023
- "means": "protected error-page sticky (query): every discovery event for the tab shows, decoded as often as it takes and without the characters the URL parser ignores, the failed URL's origin only, a masked or absent url, or a url off the protected host, wrappers such as blob: unwrapped, that names no other origin on that host, with a title that names the protected host, if at all, only as that bare origin, and no url or title carries the failed URL, its path, query or fragment; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
2023
+ "means": "protected error-page sticky (query): every discovery event for the tab shows, decoded as often as it takes and without the characters the URL parser ignores, the failed URL's origin only, a masked or absent url, or a url off the protected host, wrappers such as blob: unwrapped, that names no other origin on that host, with a title that names the protected host, in any spelling the URL parser maps to it, if at all, only as that bare origin, and no url or title carries the failed URL, its path, query or fragment; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
2024
2024
  "requires": ["discovery"],
2025
2025
  "check": {
2026
2026
  "result": "errorPage",
@@ -2213,7 +2213,7 @@
2213
2213
  }
2214
2214
  },
2215
2215
  "eventsRedacted": {
2216
- "means": "protected error-page sticky (fragment): every discovery event for the tab shows, decoded as often as it takes and without the characters the URL parser ignores, the failed URL's origin only, a masked or absent url, or a url off the protected host, wrappers such as blob: unwrapped, that names no other origin on that host, with a title that names the protected host, if at all, only as that bare origin, and no url or title carries the failed URL, its path, query or fragment; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
2216
+ "means": "protected error-page sticky (fragment): every discovery event for the tab shows, decoded as often as it takes and without the characters the URL parser ignores, the failed URL's origin only, a masked or absent url, or a url off the protected host, wrappers such as blob: unwrapped, that names no other origin on that host, with a title that names the protected host, in any spelling the URL parser maps to it, if at all, only as that bare origin, and no url or title carries the failed URL, its path, query or fragment; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
2217
2217
  "requires": ["discovery"],
2218
2218
  "check": {
2219
2219
  "result": "errorPage",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-browsers",
3
- "version": "1.18.20",
3
+ "version": "1.18.21",
4
4
  "description": "SLICC's shared browser catalog, JSON schemas and discovery conformance corpus",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -80,6 +80,19 @@ const readings = (value) =>
80
80
  return out;
81
81
  });
82
82
  const layers = (value) => readings(value).flat();
83
+ const inner = (u) => (u && !u.host ? inner(parseURL(u.pathname)) : u);
84
+ const pattern = /(?:[a-z][a-z\d+.-]*:)+[\\/]*[^\\/?#&\s]*|[\\/]{2}[^\\/?#&\s]*/g;
85
+ const spaced = (form) => Array.from(form, (c) => (c > ' ' ? c : ' ')).join('');
86
+ const mapped = new Map();
87
+ const hostChar = (c) => {
88
+ if (!mapped.has(c)) {
89
+ const host = parseURL(`http://a${c}a/`)?.hostname;
90
+ mapped.set(c, host && !host.includes('xn--') ? host.slice(1, -1) : c);
91
+ }
92
+ return mapped.get(c);
93
+ };
94
+ const folded = (form) =>
95
+ Array.from(form, (c) => (c.charCodeAt(0) < 128 ? c : hostChar(c))).join('');
83
96
  const unschemed = (value) => value.replace(/^[a-z][a-z\d+.-]*:\/\//, '');
84
97
 
85
98
  const encoded = (url) =>
@@ -107,41 +120,40 @@ function failureRules({ failedURL, tag }) {
107
120
  .filter((part) => part && part !== '/')
108
121
  .map(plain);
109
122
  const leaks = (value) => layers(value).some((form) => parts.some((part) => form.includes(part)));
110
- const names = (value) =>
111
- layers(value).some((form) => form.includes(hostname)) || parseURL(value)?.origin === origin;
123
+ const onHost = (u) => u?.hostname.replace(/\.$/, '') === hostname;
124
+ const refs = (text) =>
125
+ Array.from(text.matchAll(pattern), ([ref]) =>
126
+ inner(parseURL(ref, /^[\\/]/.test(ref) ? origin : undefined))
127
+ );
128
+ const mentions = (form) =>
129
+ folded(form).includes(hostname) || [form, spaced(form)].some((text) => refs(text).some(onHost));
130
+ const names = (value) => layers(value).some(mentions) || parseURL(value)?.origin === origin;
112
131
  const carries = (value) => layers(value).some((form) => form.includes(plain(tag)));
113
- return { failed, leaks, names, carries };
132
+ return { failed, leaks, names, carries, mentions, onHost, refs };
114
133
  }
115
134
 
116
135
  function discoveryRules({ failedURL, tag, trigger }) {
117
- const { failed, leaks, names, carries } = failureRules({ failedURL, tag });
136
+ const { failed, leaks, names, carries, mentions, onHost, refs } = failureRules({
137
+ failedURL,
138
+ tag,
139
+ });
118
140
  const { origin, host, hostname } = failed;
119
141
  const named = [hostname, host, origin];
120
142
  const cleanTitle = ({ title, url }) =>
121
143
  !leaks(title) &&
122
144
  (!names(title) ||
123
145
  named.includes(lower(title)) ||
124
- (!layers(url).includes(origin) && referenced(title)));
146
+ (!layers(url).some((form) => onHost(inner(parseURL(form)))) && referenced(title)));
125
147
  const ownTitle = ({ url, title }) =>
126
148
  plain(title) !== '' && [plain(url), unschemed(plain(url))].includes(plain(title));
127
- const inner = (u) => (u && !u.host ? inner(parseURL(u.pathname)) : u);
128
- const onHost = (u) => u?.hostname.replace(/\.$/, '') === hostname;
129
- const pattern = /(?:[a-z][a-z\d+.-]*:)+[\\/]*[^\\/?#&\s]*|[\\/]{2}[^\\/?#&\s]*/g;
130
- const spaced = (form) => Array.from(form, (c) => (c > ' ' ? c : ' ')).join('');
131
- const resolve = (ref) => inner(parseURL(ref, /^[\\/]/.test(ref) ? origin : undefined));
132
- const fine = (text) =>
133
- Array.from(text.matchAll(pattern), ([ref]) => resolve(ref)).every(
134
- (u) => !onHost(u) || u.origin === origin
135
- );
149
+ const fine = (text) => refs(text).every((u) => !onHost(u) || u.origin === origin);
136
150
  const exact = (form) =>
137
151
  form === origin || (!onHost(inner(parseURL(form))) && fine(form) && fine(spaced(form)));
138
152
  const only = (ref, at, text) =>
139
153
  parseURL(ref, /^[\\/]/.test(ref) ? origin : undefined)?.href === `${origin}/` &&
140
154
  !/[\\/?#]/.test(text[at + ref.length] ?? '');
141
155
  const bare = (form) =>
142
- !spaced(form)
143
- .replace(pattern, (ref, at, text) => (only(ref, at, text) ? ref.replace(hostname, ' ') : ref))
144
- .includes(hostname);
156
+ !mentions(spaced(form).replace(pattern, (ref, at, text) => (only(ref, at, text) ? ' ' : ref)));
145
157
  const referenced = (title) =>
146
158
  layers(title).every(exact) && readings(title).every((read) => bare(read.at(-1)));
147
159
  const cleanURL = (url) => !leaks(url) && layers(url).every(exact);