Skip to content

fix: normalize platform keys and repository prefix in hook config#1194

Open
John-David Dalton (jdalton) wants to merge 1 commit intomainfrom
fix/normalize-platform-keys
Open

fix: normalize platform keys and repository prefix in hook config#1194
John-David Dalton (jdalton) wants to merge 1 commit intomainfrom
fix/normalize-platform-keys

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

@jdalton John-David Dalton (jdalton) commented Apr 12, 2026

Use win- instead of win32- for Windows platform keys. Add github: prefix to repository fields.


Note

Low Risk
Low risk config/compatibility change that only affects how the hook resolves download URLs and platform lookups for Windows binaries.

Overview
Normalizes the hook’s external tool metadata to use github:-prefixed repository values and changes Windows platform keys from win32-x64 to win-x64 in external-tools.json.

Updates the setup script (index.mts) to compute platformKey as win-<arch> on Windows so Zizmor and Socket Firewall downloads resolve the correct assets/checksums.

Reviewed by Cursor Bugbot for commit b239a7b. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Repository github: prefix breaks all download URLs
    • Added stripRepoPrefix() helper to both index.mts and update.mts that strips the 'github:' prefix from repository values before they are interpolated into GitHub URLs and API calls.

Create PR

Or push these changes by commenting:

@cursor push 92f82ebc0e
Preview (92f82ebc0e)
diff --git a/.claude/hooks/setup-security-tools/index.mts b/.claude/hooks/setup-security-tools/index.mts
--- a/.claude/hooks/setup-security-tools/index.mts
+++ b/.claude/hooks/setup-security-tools/index.mts
@@ -53,6 +53,10 @@
 
 // ── Shared helpers ──
 
+function stripRepoPrefix(repo: string): string {
+  return repo.replace(/^github:/, '')
+}
+
 function findApiKey(): string | undefined {
   const envKey = process.env['SOCKET_API_KEY']
   if (envKey) return envKey
@@ -126,7 +130,7 @@
   if (!asset) throw new Error(`Unsupported platform: ${platformKey}`)
   const expectedSha = ZIZMOR.checksums?.[asset]
   if (!expectedSha) throw new Error(`No checksum for: ${asset}`)
-  const url = `https://github.com/${ZIZMOR.repository}/releases/download/v${ZIZMOR.version}/${asset}`
+  const url = `https://github.com/${stripRepoPrefix(ZIZMOR.repository!)}/releases/download/v${ZIZMOR.version}/${asset}`
 
   logger.log(`Downloading zizmor v${ZIZMOR.version} (${asset})...`)
   const { binaryPath: archivePath, downloaded } = await downloadBinary({
@@ -184,7 +188,7 @@
   const prefix = isEnterprise ? 'sfw' : 'sfw-free'
   const suffix = sfwPlatform.startsWith('windows') ? '.exe' : ''
   const asset = `${prefix}-${sfwPlatform}${suffix}`
-  const url = `https://github.com/${sfwConfig.repository}/releases/download/${sfwConfig.version}/${asset}`
+  const url = `https://github.com/${stripRepoPrefix(sfwConfig.repository!)}/releases/download/${sfwConfig.version}/${asset}`
   const binaryName = isEnterprise ? 'sfw' : 'sfw-free'
 
   // Download (with cache + checksum).

diff --git a/.claude/hooks/setup-security-tools/update.mts b/.claude/hooks/setup-security-tools/update.mts
--- a/.claude/hooks/setup-security-tools/update.mts
+++ b/.claude/hooks/setup-security-tools/update.mts
@@ -82,6 +82,10 @@
   return Date.now() - published >= COOLDOWN_MS
 }
 
+function stripRepoPrefix(repo: string): string {
+  return repo.replace(/^github:/, '')
+}
+
 function versionFromTag(tag: string): string {
   return tag.replace(/^v/, '')
 }
@@ -146,7 +150,7 @@
     return { tool, skipped: true, updated: false, reason: 'not in config' }
   }
 
-  const repo = toolConfig.repository ?? 'zizmorcore/zizmor'
+  const repo = stripRepoPrefix(toolConfig.repository ?? 'zizmorcore/zizmor')
 
   let release: GhRelease
   try {
@@ -265,10 +269,11 @@
     return { tool: toolName, skipped: true, updated: false, reason: 'not in config' }
   }
 
-  const repo = toolConfig.repository
-  if (!repo) {
+  const rawRepo = toolConfig.repository
+  if (!rawRepo) {
     return { tool: toolName, skipped: true, updated: false, reason: 'no repository' }
   }
+  const repo = stripRepoPrefix(rawRepo)
 
   let release: GhRelease
   try {

You can send follow-ups to the cloud agent here.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b239a7b. Configure here.

…tory

- Normalize hook checksums to platform-keyed `{ asset, sha256 }` format
- Use `win-` platform prefix in hook config for Windows keys
- Strip any `<host>:` prefix from repository values (not just `github:`)
  using `/^[^:]+:/` for generic host prefix handling
- Fix missing prefix stripping in update.mts and build scripts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant