Pin Copy URL extension id

This commit is contained in:
David Heinemeier Hansson
2026-06-26 19:52:17 -04:00
parent 91ee7f20fc
commit 6565a4032f
2 changed files with 31 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
source "$(dirname "${BASH_SOURCE[0]}")/base-test.sh"
export PATH="$ROOT/bin:$PATH"
require_command jq
require_command node
copy_url_id=$(node - <<'JS' "$ROOT/default/chromium/extensions/copy-url/manifest.json"
const crypto = require('crypto')
const fs = require('fs')
const manifest = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'))
const hash = crypto.createHash('sha256').update(Buffer.from(manifest.key, 'base64')).digest()
const alphabet = 'abcdefghijklmnop'
let id = ''
for (const byte of hash.subarray(0, 16)) {
id += alphabet[byte >> 4]
id += alphabet[byte & 0x0f]
}
process.stdout.write(id)
JS
)
[[ $copy_url_id == "bgpiichlckmfanooecilcjemknkcpngb" ]] ||
fail "copy-url extension manifest has the stable id" "$copy_url_id"
pass "copy-url extension manifest has the stable id"