Skip to content

Corepack breaks when integrity key is missing from metadata, from artifactory #537

@trc-mathieu

Description

@trc-mathieu

Hi, I am actually using artifactory as npm proxy and it's missing the dist/integrity neither dist/signatures keys so this line breaks corepack since integrity is null.

build[1] = Buffer.from(integrity.slice(`sha512-`.length), `base64`).toString(`hex`);

I'm using corepack@v0.29.2

Would it be possible to fallback to dist/shasum in that case?

For instance, for corepack, I only have this

{
  "dist" : {
    "tarball" : "https://artifactory.<our domain>.com/artifactory/api/npm/npm/corepack/-/corepack-0.28.2.tgz",
    "shasum" : "2270c8fd1e4bebffda46ac0978d1f8b4202739ba"
  },
}

where npm has a lot more info

"dist": {
    "shasum": "2270c8fd1e4bebffda46ac0978d1f8b4202739ba",
    "tarball": "https://registry.npmjs.org/corepack/-/corepack-0.28.2.tgz",
    "fileCount": 54,
    "integrity": "sha512-YOo8PWW/SOQs7mqDIP6dDp9KoIyFvOJaoTofrXQEOIAZ5D24OpgKQ6JeW1HhXsRCMm1t1AunC/hXyqfT9G+5GQ==",
    "signatures": [
      {
        "sig": "MEQCIBBdptqO4kmk7aUSqWxmDQZ7O9acaxXdyHrFkM7P9jQPAiAINyseohZpq6pmY/Ufsw/XBgKcJy7buhcjDx5Icm9cjQ==",
        "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
      }
    ],
    "unpackedSize": 1030119
  },

const {version, dist: {integrity, signatures}} = metadata;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions