Skip to content

Commit af5e32f

Browse files
committed
fix(hooks): strip any host prefix from repository, not just github:
Repository values use a `<host>:` prefix convention (e.g. github:, gitlab:, etc). Use `/^[^:]+:/` to strip any prefix rather than hardcoding `github:`.
1 parent d91ba58 commit af5e32f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

.claude/hooks/setup-security-tools/index.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ async function setupZizmor(): Promise<boolean> {
127127
throw new Error(`Unsupported platform: ${platformKey}`)
128128
}
129129
const { asset, sha256: expectedSha } = platformEntry
130-
const repo = ZIZMOR.repository?.replace(/^github:/, '') ?? ''
130+
const repo = ZIZMOR.repository?.replace(/^[^:]+:/, '') ?? ''
131131
const url = `https://github.com/${repo}/releases/download/v${ZIZMOR.version}/${asset}`
132132

133133
logger.log(`Downloading zizmor v${ZIZMOR.version} (${asset})...`)
@@ -184,7 +184,7 @@ async function setupSfw(apiKey: string | undefined): Promise<boolean> {
184184

185185
// Checksum + asset.
186186
const { asset, sha256 } = platformEntry
187-
const repo = sfwConfig.repository?.replace(/^github:/, '') ?? ''
187+
const repo = sfwConfig.repository?.replace(/^[^:]+:/, '') ?? ''
188188
const url = `https://github.com/${repo}/releases/download/${sfwConfig.version}/${asset}`
189189
const binaryName = isEnterprise ? 'sfw' : 'sfw-free'
190190

.claude/hooks/setup-security-tools/update.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ async function updateZizmor(config: Config): Promise<UpdateResult> {
146146
return { tool, skipped: true, updated: false, reason: 'not in config' }
147147
}
148148

149-
const repo = toolConfig.repository?.replace(/^github:/, '') ?? 'zizmorcore/zizmor'
149+
const repo = toolConfig.repository?.replace(/^[^:]+:/, '') ?? 'zizmorcore/zizmor'
150150

151151
let release: GhRelease
152152
try {
@@ -265,7 +265,7 @@ async function updateSfwTool(
265265
return { tool: toolName, skipped: true, updated: false, reason: 'not in config' }
266266
}
267267

268-
const repo = toolConfig.repository?.replace(/^github:/, '')
268+
const repo = toolConfig.repository?.replace(/^[^:]+:/, '')
269269
if (!repo) {
270270
return { tool: toolName, skipped: true, updated: false, reason: 'no repository' }
271271
}

0 commit comments

Comments
 (0)