npq 3.23.1 → 3.23.3

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.
@@ -15,6 +15,19 @@ const dns = new Resolver()
15
15
  dns.setServers(['1.1.1.1', '8.8.8.8'])
16
16
  const MARSHALL_NAME = 'maintainers_expired_emails'
17
17
 
18
+ function stripTerminalControlCharacters(value) {
19
+ if (typeof value !== 'string') {
20
+ return ''
21
+ }
22
+
23
+ return [...value]
24
+ .filter((character) => {
25
+ const codePoint = character.codePointAt(0)
26
+ return codePoint >= 0x20 && (codePoint < 0x7f || codePoint > 0x9f)
27
+ })
28
+ .join('')
29
+ }
30
+
18
31
  class Marshall extends BaseMarshall {
19
32
  constructor(options) {
20
33
  super(options)
@@ -44,6 +57,7 @@ class Marshall extends BaseMarshall {
44
57
  }
45
58
 
46
59
  const emailDomains = new Map()
60
+ const maintainersByDomain = new Map()
47
61
  let invalidMaintainers = 0
48
62
  for (const maintainerInfo of maintainersAccounts) {
49
63
  const emailDomain = normalizeMaintainerDomain(maintainerInfo && maintainerInfo.email)
@@ -54,6 +68,9 @@ class Marshall extends BaseMarshall {
54
68
  }
55
69
 
56
70
  emailDomains.set(emailDomain, (emailDomains.get(emailDomain) || 0) + 1)
71
+ const domainMaintainers = maintainersByDomain.get(emailDomain) || []
72
+ domainMaintainers.push(maintainerInfo)
73
+ maintainersByDomain.set(emailDomain, domainMaintainers)
57
74
  }
58
75
 
59
76
  if (emailDomains.size === 0) {
@@ -142,10 +159,26 @@ class Marshall extends BaseMarshall {
142
159
  const domainNoun = corroboratedDomains.length === 1 ? 'domain' : 'domains'
143
160
  const resolveVerb = corroboratedDomains.length === 1 ? 'does' : 'do'
144
161
  let message = `Maintainer ${domainNoun} ${corroboratedDomains.join(', ')} ${resolveVerb} not resolve in public DNS, and RDAP found no active registration; account takeover may be possible.`
162
+ const affectedMaintainers = corroboratedDomains
163
+ .map((domain) => {
164
+ const identities = maintainersByDomain
165
+ .get(domain)
166
+ .map((maintainer) => {
167
+ const name = stripTerminalControlCharacters(maintainer.name).trim()
168
+ const email = stripTerminalControlCharacters(maintainer.email)
169
+ return name.length > 0 ? `${name} <${email}>` : email
170
+ })
171
+ .join(', ')
172
+
173
+ return `- ${domain}: ${identities}`
174
+ })
175
+ .join('\n')
176
+
177
+ message += `\n\nAffected maintainers:\n${affectedMaintainers}`
145
178
 
146
179
  if (incompleteCount > 0) {
147
180
  const recordNoun = incompleteCount === 1 ? 'record' : 'records'
148
- message += ` ${incompleteCount} other maintainer ${recordNoun} could not be evaluated.`
181
+ message += `\n\n${incompleteCount} other maintainer ${recordNoun} could not be evaluated.`
149
182
  }
150
183
 
151
184
  throw new Warning(message)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npq",
3
- "version": "3.23.1",
3
+ "version": "3.23.3",
4
4
  "description": "marshall your npm/npm package installs with high quality and class 🎖",
5
5
  "bin": {
6
6
  "npq": "./bin/npq.js",