Skip to content

Commit e2e282a

Browse files
Require a verified tag collection for source claim discovery
Keep verified empty collections valid and reject projected scalar metadata before source-bound recovery selection. (cherry picked from commit ae7c333)
1 parent c47584b commit e2e282a

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎.github/actions/Publish-PSModule/src/Publish-PSModule.Helpers.psm1‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,11 @@ function Get-PSModulePublicationReader {
338338
}.GetNewClosure()
339339
GetTagReference = $readTagReference
340340
GetTagList = {
341-
(Invoke-PSModulePublicationApi -Endpoint "repos/$Repository/git/matching-refs/tags/").Value
341+
$value = (Invoke-PSModulePublicationApi -Endpoint "repos/$Repository/git/matching-refs/tags/").Value
342+
if ($value -isnot [array]) {
343+
throw 'The publication tag enumeration returned unverifiable collection metadata.'
344+
}
345+
$value
342346
}.GetNewClosure()
343347
GetVersionReference = {
344348
param($Name, $Version)

‎.github/actions/Publish-PSModule/tests/Publish-PSModule.Preflight.Tests.ps1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ Describe 'Publish-PSModule source-bound preflight' {
245245

246246
It 'rejects a scalar tag enumeration instead of projecting a discovery collection' {
247247
$script:state.ApiResponses['repos/PSModule/TestModule/git/matching-refs/tags/'] = [pscustomobject]@{
248-
ref = 'refs/tags/v1.2.4'
248+
ref = 'refs/tags/v1.2.4'
249249
object = [pscustomobject]@{ type = 'commit'; sha = $env:GITHUB_SHA }
250250
}
251251
$reader = Get-PSModulePublicationReader -Repository 'PSModule/TestModule' -ReadOnly

0 commit comments

Comments
 (0)