@efolusi/meridian-cli 1.23.0 → 1.25.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/package.json +1 -1
  2. package/src/registry.mjs +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@efolusi/meridian-cli",
3
- "version": "1.23.0",
3
+ "version": "1.25.0",
4
4
  "description": "Copy Meridian design system components, types and usage notes into your project from the registry.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://meridian.efolusi.com",
package/src/registry.mjs CHANGED
@@ -26,6 +26,10 @@ export async function openRegistry(location = DEFAULT_REGISTRY, { fetchImpl = gl
26
26
  if (/^https?:\/\//i.test(location)) {
27
27
  const base = new URL(location.endsWith('/') ? location : `${location}/`);
28
28
  if (base.username || base.password) throw new RegistryError('--registry URL must not carry credentials');
29
+ // Plain http lets anyone on the path swap the files that get written; allow it only on this machine.
30
+ if (base.protocol === 'http:' && !['localhost', '127.0.0.1', '[::1]'].includes(base.hostname)) {
31
+ throw new RegistryError(`--registry ${JSON.stringify(location)} uses plain http; use https (http is allowed only for localhost)`);
32
+ }
29
33
  return httpRegistry(base, fetchImpl);
30
34
  }
31
35
  // Any other scheme (file:, ftp:, data:, ...). One letter is a Windows drive.