@envseal/prompters 0.1.2 → 0.1.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.
Files changed (2) hide show
  1. package/dist/loopback.js +18 -6
  2. package/package.json +2 -2
package/dist/loopback.js CHANGED
@@ -44,17 +44,29 @@ function respondText(res, status, body, headers) {
44
44
  function renderKeySection(key) {
45
45
  const sectionId = `field-${key.key}`;
46
46
  const revealId = `reveal-${key.key}`;
47
+ // Audit follow-up: these links are manifest/model-controlled. Rendering a
48
+ // polished "Get your key" button with no destination shown turned the
49
+ // consent page itself into a phishing referral inside trusted envseal
50
+ // chrome. The hostname is now part of the visible link text, so wherever
51
+ // the user would land is on screen before they click.
52
+ const externalLink = (cls, url, label) => {
53
+ let host;
54
+ try {
55
+ host = new URL(url).hostname;
56
+ }
57
+ catch {
58
+ return ''; // unreachable when isHttpUrl gates the call; fail closed anyway
59
+ }
60
+ return (` <p class="${cls}"><a href="${escapeHtml(url)}" ` +
61
+ `rel="noreferrer noopener" target="_blank">${escapeHtml(label)} \u2192 ${escapeHtml(host)}</a></p>\n`);
62
+ };
47
63
  let signup = '';
48
64
  if (isHttpUrl(key.signupUrl ?? '')) {
49
- signup =
50
- ` <p class="signup"><a href="${escapeHtml(key.signupUrl ?? '')}" ` +
51
- `rel="noreferrer noopener" target="_blank">Get your key</a></p>\n`;
65
+ signup = externalLink('signup', key.signupUrl ?? '', 'Get your key');
52
66
  }
53
67
  let docs = '';
54
68
  if (isHttpUrl(key.docsUrl ?? '')) {
55
- docs =
56
- ` <p class="docs"><a href="${escapeHtml(key.docsUrl ?? '')}" ` +
57
- `rel="noreferrer noopener" target="_blank">Documentation</a></p>\n`;
69
+ docs = externalLink('docs', key.docsUrl ?? '', 'Documentation');
58
70
  }
59
71
  let hint = '';
60
72
  if (key.formatHint) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envseal/prompters",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -20,7 +20,7 @@
20
20
  "provenance": true
21
21
  },
22
22
  "dependencies": {
23
- "@envseal/protocol": "0.1.2"
23
+ "@envseal/protocol": "0.1.3"
24
24
  },
25
25
  "devDependencies": {
26
26
  "undici": "^7.2.0"