@@ -11433,7 +11433,7 @@ exports.SignedCertificateTimestamp = SignedCertificateTimestamp;
"use strict" ;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
exports . HEADER _OCI _SUBJECT = exports . HEADER _LOCATION = exports . HEADER _IF _MATCH = exports . HEADER _ETAG = exports . HEADER _DIGEST = exports . HEADER _CONTENT _TYPE = exports . HEADER _CONTENT _LENGTH = exports . HEADER _AUTHORIZATION = exports . HEADER _AUTHENTICATE = exports . HEADER _API _VERSION = exports . HEADER _ACCEPT = exports . CONTENT _TYPE _EMPTY _DESCRIPTOR = exports . CONTENT _TYPE _OCTET _STREAM = exports . CONTENT _TYPE _OCI _MANIFEST = exports . CONTENT _TYPE _OCI _INDEX = void 0 ;
exports . HEADER _OCI _SUBJECT = exports . HEADER _LOCATION = exports . HEADER _IF _MATCH = exports . HEADER _ETAG = exports . HEADER _DIGEST = exports . HEADER _CONTENT _TYPE = exports . HEADER _CONTENT _LENGTH = exports . HEADER _AUTHORIZATION = exports . HEADER _AUTHENTICATE = exports . HEADER _API _VERSION = exports . HEADER _ACCEPT = exports . CONTENT _TYPE _EMPTY _DESCRIPTOR = exports . CONTENT _TYPE _OCTET _STREAM = exports . CONTENT _TYPE _DOCKER _MANIFEST _LIST = exports . CONTENT _TYPE _DOCKER _MANIFEST = exports . CONTENT _TYPE _ OCI _MANIFEST = exports . CONTENT _TYPE _OCI _INDEX = void 0 ;
/ *
Copyright 2023 The Sigstore Authors .
@@ -11451,6 +11451,8 @@ limitations under the License.
* /
exports . CONTENT _TYPE _OCI _INDEX = 'application/vnd.oci.image.index.v1+json' ;
exports . CONTENT _TYPE _OCI _MANIFEST = 'application/vnd.oci.image.manifest.v1+json' ;
exports . CONTENT _TYPE _DOCKER _MANIFEST = 'application/vnd.docker.distribution.manifest.v2+json' ;
exports . CONTENT _TYPE _DOCKER _MANIFEST _LIST = 'application/vnd.docker.distribution.manifest.list.v2+json' ;
exports . CONTENT _TYPE _OCTET _STREAM = 'application/octet-stream' ;
exports . CONTENT _TYPE _EMPTY _DESCRIPTOR = 'application/vnd.oci.empty.v1+json' ;
exports . HEADER _ACCEPT = 'Accept' ;
@@ -11575,6 +11577,96 @@ class OCIError extends Error {
exports . OCIError = OCIError ;
/***/ } ) ,
/***/ 437 :
/***/ ( function ( _ _unused _webpack _module , exports , _ _nccwpck _require _ _ ) {
"use strict" ;
var _ _importDefault = ( this && this . _ _importDefault ) || function ( mod ) {
return ( mod && mod . _ _esModule ) ? mod : { "default" : mod } ;
} ;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
/ *
Copyright 2024 The Sigstore Authors .
Licensed under the Apache License , Version 2.0 ( the "License" ) ;
you may not use this file except in compliance with the License .
You may obtain a copy of the License at
http : //www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing , software
distributed under the License is distributed on an "AS IS" BASIS ,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
See the License for the specific language governing permissions and
limitations under the License .
* /
const http2 _1 = _ _nccwpck _require _ _ ( 85158 ) ;
const make _fetch _happen _1 = _ _importDefault ( _ _nccwpck _require _ _ ( 9525 ) ) ;
const proc _log _1 = _ _nccwpck _require _ _ ( 56528 ) ;
const promise _retry _1 = _ _importDefault ( _ _nccwpck _require _ _ ( 54742 ) ) ;
const { HTTP _STATUS _INTERNAL _SERVER _ERROR , HTTP _STATUS _TOO _MANY _REQUESTS , HTTP _STATUS _REQUEST _TIMEOUT , } = http2 _1 . constants ;
const fetchWithRetry = async ( url , options = { } ) => {
return ( 0 , promise _retry _1 . default ) ( async ( retry , attemptNum ) => {
/* eslint-disable @typescript-eslint/no-explicit-any */
const logRetry = ( reason ) => {
proc _log _1 . log . http ( 'fetch' , ` ${ options . method } ${ url } attempt ${ attemptNum } failed with ${ reason } ` ) ;
} ;
const response = await ( 0 , make _fetch _happen _1 . default ) ( url , {
... options ,
retry : false , // We're handling retries ourselves
} ) . catch ( ( reason ) => {
logRetry ( reason ) ;
return retry ( reason ) ;
} ) ;
if ( retryable ( response . status ) ) {
logRetry ( response . status ) ;
return retry ( response ) ;
}
return response ;
} , retryOpts ( options . retry ) ) . catch ( ( err ) => {
// If we got an actual error, throw it
if ( err instanceof Error ) {
throw err ;
}
// Otherwise, return the response (this is simply a retry-able response for
// which we exceeded the retry limit)
return err ;
} ) ;
} ;
// Returns a wrapped fetch function with default options
fetchWithRetry . defaults = ( defaultOptions = { } , wrappedFetch = fetchWithRetry ) => {
const defaultedFetch = ( url , options = { } ) => {
const finalOptions = {
... defaultOptions ,
... options ,
headers : { ... defaultOptions . headers , ... options . headers } ,
} ;
return wrappedFetch ( url , finalOptions ) ;
} ;
defaultedFetch . defaults = ( newDefaults = { } ) => fetchWithRetry . defaults ( newDefaults , defaultedFetch ) ;
return defaultedFetch ;
} ;
// Determine if a status code is retryable. This includes 5xx errors, 408, and
// 429.
const retryable = ( status ) => [ HTTP _STATUS _REQUEST _TIMEOUT , HTTP _STATUS _TOO _MANY _REQUESTS ] . includes ( status ) || status >= HTTP _STATUS _INTERNAL _SERVER _ERROR ;
// Normalize the retry options to the format expected by promise-retry
const retryOpts = ( retry ) => {
if ( typeof retry === 'boolean' ) {
return { retries : retry ? 1 : 0 } ;
}
else if ( typeof retry === 'number' ) {
return { retries : retry } ;
}
else {
return { retries : 0 , ... retry } ;
}
} ;
exports [ "default" ] = fetchWithRetry ;
/***/ } ) ,
/***/ 79539 :
@@ -11614,13 +11706,14 @@ limitations under the License.
const constants _1 = _ _nccwpck _require _ _ ( 61319 ) ;
const error _1 = _ _nccwpck _require _ _ ( 60064 ) ;
const registry _1 = _ _nccwpck _require _ _ ( 27464 ) ;
const DOCKER _DEFAULT _REGISTRY = 'registry-1.docker.io' ;
const EMPTY _BLOB = Buffer . from ( '{}' ) ;
class OCIImage {
constructor ( image , creds , opts ) {
_OCIImage _instances . add ( this ) ;
_OCIImage _client . set ( this , void 0 ) ;
_OCIImage _credentials . set ( this , void 0 ) ;
_ _classPrivateFieldSet ( this , _OCIImage _client , new registry _1 . RegistryClient ( image . registry , image . path , opts ) , "f" ) ;
_ _classPrivateFieldSet ( this , _OCIImage _client , new registry _1 . RegistryClient ( canonicalizeRegistryName ( image. registry ) , image . path , opts ) , "f" ) ;
_ _classPrivateFieldSet ( this , _OCIImage _credentials , creds , "f" ) ;
}
async addArtifact ( opts ) {
@@ -11750,6 +11843,13 @@ const newIndex = () => ({
const digestToTag = ( digest ) => {
return digest . replace ( ':' , '-' ) ;
} ;
// Canonicalize the registry name to match the format used by the registry
// client. This is used primarily to handle the special case of the Docker Hub
// registry.
// https://github.com/moby/moby/blob/v24.0.2/registry/config.go#L25-L48
const canonicalizeRegistryName = ( registry ) => {
return registry . endsWith ( 'docker.io' ) ? DOCKER _DEFAULT _REGISTRY : registry ;
} ;
/***/ } ) ,
@@ -11869,11 +11969,17 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License .
* /
const make _fetch _happen _1 = _ _importDefault ( _ _nccwpck _require _ _ ( 9525 ) ) ;
const node _crypto _1 = _ _importDefault ( _ _nccwpck _require _ _ ( 6005 ) ) ;
const constants _1 = _ _nccwpck _require _ _ ( 61319 ) ;
const credentials _1 = _ _nccwpck _require _ _ ( 95475 ) ;
const error _1 = _ _nccwpck _require _ _ ( 60064 ) ;
const fetch _1 = _ _importDefault ( _ _nccwpck _require _ _ ( 437 ) ) ;
const ALL _MANIFEST _MEDIA _TYPES = [
constants _1 . CONTENT _TYPE _OCI _INDEX ,
constants _1 . CONTENT _TYPE _OCI _MANIFEST ,
constants _1 . CONTENT _TYPE _DOCKER _MANIFEST ,
constants _1 . CONTENT _TYPE _DOCKER _MANIFEST _LIST ,
] . join ( ',' ) ;
class RegistryClient {
constructor ( registry , repository , opts ) {
_RegistryClient _instances . add ( this ) ;
@@ -11881,7 +11987,7 @@ class RegistryClient {
_RegistryClient _repository . set ( this , void 0 ) ;
_RegistryClient _fetch . set ( this , void 0 ) ;
_ _classPrivateFieldSet ( this , _RegistryClient _repository , repository , "f" ) ;
_ _classPrivateFieldSet ( this , _RegistryClient _fetch , make _fetch _happen _1 . default . defaults ( opts ) , "f" ) ;
_ _classPrivateFieldSet ( this , _RegistryClient _fetch , fetch _1 . default . defaults ( opts ) , "f" ) ;
// Use http for localhost registries, https otherwise
const hostname = new URL ( ` http:// ${ registry } ` ) . hostname ;
/* istanbul ignore next */
@@ -11968,9 +12074,7 @@ class RegistryClient {
async checkManifest ( reference ) {
const response = await _ _classPrivateFieldGet ( this , _RegistryClient _fetch , "f" ) . call ( this , ` ${ _ _classPrivateFieldGet ( this , _RegistryClient _baseURL , "f" ) } /v2/ ${ _ _classPrivateFieldGet ( this , _RegistryClient _repository , "f" ) } /manifests/ ${ reference } ` , {
method : 'HEAD' ,
headers : {
[ constants _1 . HEADER _ACCEPT ] : ` ${ constants _1 . CONTENT _TYPE _OCI _MANIFEST } , ${ constants _1 . CONTENT _TYPE _OCI _INDEX } ` ,
} ,
headers : { [ constants _1 . HEADER _ACCEPT ] : ALL _MANIFEST _MEDIA _TYPES } ,
} ) . then ( ( 0 , error _1 . ensureStatus ) ( 200 ) ) ;
const mediaType = response . headers . get ( constants _1 . HEADER _CONTENT _TYPE ) ||
/* istanbul ignore next */ '' ;
@@ -11982,9 +12086,7 @@ class RegistryClient {
// Retrieves a manifest by reference
async getManifest ( reference ) {
const response = await _ _classPrivateFieldGet ( this , _RegistryClient _fetch , "f" ) . call ( this , ` ${ _ _classPrivateFieldGet ( this , _RegistryClient _baseURL , "f" ) } /v2/ ${ _ _classPrivateFieldGet ( this , _RegistryClient _repository , "f" ) } /manifests/ ${ reference } ` , {
headers : {
[ constants _1 . HEADER _ACCEPT ] : ` ${ constants _1 . CONTENT _TYPE _OCI _MANIFEST } , ${ constants _1 . CONTENT _TYPE _OCI _INDEX } ` ,
} ,
headers : { [ constants _1 . HEADER _ACCEPT ] : ALL _MANIFEST _MEDIA _TYPES } ,
} ) . then ( ( 0 , error _1 . ensureStatus ) ( 200 ) ) ;
const body = await response . json ( ) ;
const mediaType = response . headers . get ( constants _1 . HEADER _CONTENT _TYPE ) ||
@@ -13923,8 +14025,23 @@ exports.internalError = internalError;
"use strict" ;
/ *
Copyright 2023 The Sigstore Authors .
Licensed under the Apache License , Version 2.0 ( the "License" ) ;
you may not use this file except in compliance with the License .
You may obtain a copy of the License at
http : //www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing , software
distributed under the License is distributed on an "AS IS" BASIS ,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
See the License for the specific language governing permissions and
limitations under the License .
* /
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
exports . checkStatus = exports . HTTPError = void 0 ;
exports . HTTPError = void 0 ;
class HTTPError extends Error {
constructor ( { status , message , location , } ) {
super ( ` ( ${ status } ) ${ message } ` ) ;
@@ -13933,38 +14050,11 @@ class HTTPError extends Error {
}
}
exports . HTTPError = HTTPError ;
const checkStatus = async ( response ) => {
if ( response . ok ) {
return response ;
}
else {
let message = response . statusText ;
const location = response . headers ? . get ( 'Location' ) || undefined ;
const contentType = response . headers ? . get ( 'Content-Type' ) ;
// If response type is JSON, try to parse the body for a message
if ( contentType ? . includes ( 'application/json' ) ) {
try {
await response . json ( ) . then ( ( body ) => {
message = body . message ;
} ) ;
}
catch ( e ) {
// ignore
}
}
throw new HTTPError ( {
status : response . status ,
message : message ,
location : location ,
} ) ;
}
} ;
exports . checkStatus = checkStatus ;
/***/ } ) ,
/***/ 62960 :
/***/ 78509 :
/***/ ( function ( _ _unused _webpack _module , exports , _ _nccwpck _require _ _ ) {
"use strict" ;
@@ -13972,6 +14062,110 @@ exports.checkStatus = checkStatus;
var _ _importDefault = ( this && this . _ _importDefault ) || function ( mod ) {
return ( mod && mod . _ _esModule ) ? mod : { "default" : mod } ;
} ;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
exports . fetchWithRetry = void 0 ;
/ *
Copyright 2023 The Sigstore Authors .
Licensed under the Apache License , Version 2.0 ( the "License" ) ;
you may not use this file except in compliance with the License .
You may obtain a copy of the License at
http : //www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing , software
distributed under the License is distributed on an "AS IS" BASIS ,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
See the License for the specific language governing permissions and
limitations under the License .
* /
const http2 _1 = _ _nccwpck _require _ _ ( 85158 ) ;
const make _fetch _happen _1 = _ _importDefault ( _ _nccwpck _require _ _ ( 9525 ) ) ;
const proc _log _1 = _ _nccwpck _require _ _ ( 56528 ) ;
const promise _retry _1 = _ _importDefault ( _ _nccwpck _require _ _ ( 54742 ) ) ;
const util _1 = _ _nccwpck _require _ _ ( 90724 ) ;
const error _1 = _ _nccwpck _require _ _ ( 11294 ) ;
const { HTTP2 _HEADER _LOCATION , HTTP2 _HEADER _CONTENT _TYPE , HTTP2 _HEADER _USER _AGENT , HTTP _STATUS _INTERNAL _SERVER _ERROR , HTTP _STATUS _TOO _MANY _REQUESTS , HTTP _STATUS _REQUEST _TIMEOUT , } = http2 _1 . constants ;
async function fetchWithRetry ( url , options ) {
return ( 0 , promise _retry _1 . default ) ( async ( retry , attemptNum ) => {
const method = options . method || 'POST' ;
const headers = {
[ HTTP2 _HEADER _USER _AGENT ] : util _1 . ua . getUserAgent ( ) ,
... options . headers ,
} ;
const response = await ( 0 , make _fetch _happen _1 . default ) ( url , {
method ,
headers ,
body : options . body ,
timeout : options . timeout ,
retry : false , // We're handling retries ourselves
} ) . catch ( ( reason ) => {
proc _log _1 . log . http ( 'fetch' , ` ${ method } ${ url } attempt ${ attemptNum } failed with ${ reason } ` ) ;
return retry ( reason ) ;
} ) ;
if ( response . ok ) {
return response ;
}
else {
const error = await errorFromResponse ( response ) ;
proc _log _1 . log . http ( 'fetch' , ` ${ method } ${ url } attempt ${ attemptNum } failed with ${ response . status } ` ) ;
if ( retryable ( response . status ) ) {
return retry ( error ) ;
}
else {
throw error ;
}
}
} , retryOpts ( options . retry ) ) ;
}
exports . fetchWithRetry = fetchWithRetry ;
// Translate a Response into an HTTPError instance. This will attempt to parse
// the response body for a message, but will default to the statusText if none
// is found.
const errorFromResponse = async ( response ) => {
let message = response . statusText ;
const location = response . headers ? . get ( HTTP2 _HEADER _LOCATION ) || undefined ;
const contentType = response . headers ? . get ( HTTP2 _HEADER _CONTENT _TYPE ) ;
// If response type is JSON, try to parse the body for a message
if ( contentType ? . includes ( 'application/json' ) ) {
try {
const body = await response . json ( ) ;
message = body . message || message ;
}
catch ( e ) {
// ignore
}
}
return new error _1 . HTTPError ( {
status : response . status ,
message : message ,
location : location ,
} ) ;
} ;
// Determine if a status code is retryable. This includes 5xx errors, 408, and
// 429.
const retryable = ( status ) => [ HTTP _STATUS _REQUEST _TIMEOUT , HTTP _STATUS _TOO _MANY _REQUESTS ] . includes ( status ) || status >= HTTP _STATUS _INTERNAL _SERVER _ERROR ;
// Normalize the retry options to the format expected by promise-retry
const retryOpts = ( retry ) => {
if ( typeof retry === 'boolean' ) {
return { retries : retry ? 1 : 0 } ;
}
else if ( typeof retry === 'number' ) {
return { retries : retry } ;
}
else {
return { retries : 0 , ... retry } ;
}
} ;
/***/ } ) ,
/***/ 62960 :
/***/ ( ( _ _unused _webpack _module , exports , _ _nccwpck _require _ _ ) => {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
exports . Fulcio = void 0 ;
/ *
@@ -13989,33 +14183,26 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License .
* /
const make _ fetch_happen _ 1 = _ _importDefault ( _ _ nccwpck _require _ _ ( 9525 ) ) ;
const util _1 = _ _nccwpck _require _ _ ( 90724 ) ;
const error _1 = _ _nccwpck _require _ _ ( 11294 ) ;
const fetch _1 = _ _nccwpck _require _ _ ( 78509 ) ;
/ * *
* Fulcio API client .
* /
class Fulcio {
constructor ( options ) {
this . fetch = make _fetch _happen _1 . default . defaults ( {
retry : options . retry ,
timeout : options . timeout ,
headers : {
'Content-Type' : 'application/json' ,
'User-Agent' : util _1 . ua . getUserAgent ( ) ,
} ,
} ) ;
this . baseUrl = options . baseURL ;
this . options = options ;
}
async createSigningCertificate ( request ) {
const url = ` ${ this . baseUrl } /api/v2/signingCert ` ;
const response = await this . fetch ( url , {
m ethod : 'POST' ,
const { baseURL , retry , timeout } = this . options ;
const url = ` ${ baseURL } /api/v2/signingCert ` ;
const response = await ( 0 , f etch _1 . fetchWithRetry ) ( url , {
headers : {
'Content-Type' : 'application/json' ,
} ,
body : JSON . stringify ( request ) ,
timeout ,
retry ,
} ) ;
await ( 0 , error _1 . checkStatus ) ( response ) ;
const data = await response . json ( ) ;
return data ;
return response . json ( ) ;
}
}
exports . Fulcio = Fulcio ;
@@ -14024,13 +14211,10 @@ exports.Fulcio = Fulcio;
/***/ } ) ,
/***/ 56205 :
/***/ ( function ( _ _unused _webpack _module , exports , _ _nccwpck _require _ _ ) {
/***/ ( ( _ _unused _webpack _module , exports , _ _nccwpck _require _ _ ) => {
"use strict" ;
var _ _importDefault = ( this && this . _ _importDefault ) || function ( mod ) {
return ( mod && mod . _ _esModule ) ? mod : { "default" : mod } ;
} ;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
exports . Rekor = void 0 ;
/ *
@@ -14048,23 +14232,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License .
* /
const make _ fetch_happen _ 1 = _ _importDefault ( _ _ nccwpck _require _ _ ( 9525 ) ) ;
const util _1 = _ _nccwpck _require _ _ ( 90724 ) ;
const error _1 = _ _nccwpck _require _ _ ( 11294 ) ;
const fetch _1 = _ _nccwpck _require _ _ ( 78509 ) ;
/ * *
* Rekor API client .
* /
class Rekor {
constructor ( options ) {
this . fetch = make _fetch _happen _1 . default . defaults ( {
retry : options . retry ,
timeout : options . timeout ,
headers : {
Accept : 'application/json' ,
'User-Agent' : util _1 . ua . getUserAgent ( ) ,
} ,
} ) ;
this . baseUrl = options . baseURL ;
this . options = options ;
}
/ * *
* Create a new entry in the Rekor log .
@@ -14072,13 +14246,17 @@ class Rekor {
* @ returns { Promise < Entry > } The created entry
* /
async createEntry ( propsedEntry ) {
const url = ` ${ this . baseUrl } /api/v1/log/entries ` ;
const response = await this . fetch ( url , {
m ethod : 'POST' ,
headers : { 'Content-Type' : 'application/json' } ,
const { baseURL , timeout , retry } = this . options ;
const url = ` ${ baseURL } /api/v1/log/entries ` ;
const response = await ( 0 , f etch _1 . fetchWithRetry ) ( url , {
headers : {
'Content-Type' : 'application/json' ,
Accept : 'application/json' ,
} ,
body : JSON . stringify ( propsedEntry ) ,
timeout ,
retry ,
} ) ;
await ( 0 , error _1 . checkStatus ) ( response ) ;
const data = await response . json ( ) ;
return entryFromResponse ( data ) ;
}
@@ -14088,45 +14266,19 @@ class Rekor {
* @ returns { Promise < Entry > } The retrieved entry
* /
async getEntry ( uuid ) {
const url = ` ${ this . baseUrl } /api/v1/log/entries/ ${ uuid } ` ;
const response = await this . fetch ( url ) ;
await ( 0 , error _1 . checkStatus ) ( response ) ;
const { baseURL , timeout , retry } = this . options ;
const url = ` ${ baseURL } /api/v1/log/entries/ ${ uuid } ` ;
const response = await ( 0 , fetch _1 . fetchWithRetry ) ( url , {
method : 'GET' ,
headers : {
Accept : 'application/json' ,
} ,
timeout ,
retry ,
} ) ;
const data = await response . json ( ) ;
return entryFromResponse ( data ) ;
}
/ * *
* Search the Rekor log index for entries matching the given query .
* @ param opts { SearchIndex } Options to search the Rekor log
* @ returns { Promise < string [ ] > } UUIDs of matching entries
* /
async searchIndex ( opts ) {
const url = ` ${ this . baseUrl } /api/v1/index/retrieve ` ;
const response = await this . fetch ( url , {
method : 'POST' ,
body : JSON . stringify ( opts ) ,
headers : { 'Content-Type' : 'application/json' } ,
} ) ;
await ( 0 , error _1 . checkStatus ) ( response ) ;
const data = await response . json ( ) ;
return data ;
}
/ * *
* Search the Rekor logs for matching the given query .
* @ param opts { SearchLogQuery } Query to search the Rekor log
* @ returns { Promise < Entry [ ] > } List of matching entries
* /
async searchLog ( opts ) {
const url = ` ${ this . baseUrl } /api/v1/log/entries/retrieve ` ;
const response = await this . fetch ( url , {
method : 'POST' ,
body : JSON . stringify ( opts ) ,
headers : { 'Content-Type' : 'application/json' } ,
} ) ;
await ( 0 , error _1 . checkStatus ) ( response ) ;
const rawData = await response . json ( ) ;
const data = rawData . map ( ( d ) => entryFromResponse ( d ) ) ;
return data ;
}
}
exports . Rekor = Rekor ;
// Unpack the response from the Rekor API into a more convenient format.
@@ -14147,13 +14299,10 @@ function entryFromResponse(data) {
/***/ } ) ,
/***/ 82759 :
/***/ ( function ( _ _unused _webpack _module , exports , _ _nccwpck _require _ _ ) {
/***/ ( ( _ _unused _webpack _module , exports , _ _nccwpck _require _ _ ) => {
"use strict" ;
var _ _importDefault = ( this && this . _ _importDefault ) || function ( mod ) {
return ( mod && mod . _ _esModule ) ? mod : { "default" : mod } ;
} ;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
exports . TimestampAuthority = void 0 ;
/ *
@@ -14171,28 +14320,22 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License .
* /
const make _ fetch_happen _ 1 = _ _importDefault ( _ _ nccwpck _require _ _ ( 9525 ) ) ;
const util _1 = _ _nccwpck _require _ _ ( 90724 ) ;
const error _1 = _ _nccwpck _require _ _ ( 11294 ) ;
const fetch _1 = _ _nccwpck _require _ _ ( 78509 ) ;
class TimestampAuthority {
constructor ( options ) {
this . fetch = make _fetch _happen _1 . default . defaults ( {
retry : options . retry ,
timeout : options . timeout ,
headers : {
'Content-Type' : 'application/json' ,
'User-Agent' : util _1 . ua . getUserAgent ( ) ,
} ,
} ) ;
this . baseUrl = options . baseURL ;
this . options = options ;
}
async createTimestamp ( request ) {
const url = ` ${ this . baseUrl } /api/v1/timestamp ` ;
const response = await this . fetch ( url , {
m ethod : 'POST' ,
const { baseURL , timeout , retry } = this . options ;
const url = ` ${ baseURL } /api/v1/timestamp ` ;
const response = await ( 0 , f etch _1 . fetchWithRetry ) ( url , {
headers : {
'Content-Type' : 'application/json' ,
} ,
body : JSON . stringify ( request ) ,
timeout ,
retry ,
} ) ;
await ( 0 , error _1 . checkStatus ) ( response ) ;
return response . buffer ( ) ;
}
}
@@ -40919,6 +41062,8 @@ class CacheEntry {
const cacheWritePromise = new Promise ( ( resolve , reject ) => {
cacheWriteResolve = resolve
cacheWriteReject = reject
} ) . catch ( ( err ) => {
body . emit ( 'error' , err )
} )
body = new CachingMinipassPipeline ( { events : [ 'integrity' , 'size' ] } , new MinipassFlush ( {
@@ -41673,6 +41818,7 @@ const { Minipass } = __nccwpck_require__(14968)
const fetch = _ _nccwpck _require _ _ ( 68998 )
const promiseRetry = _ _nccwpck _require _ _ ( 54742 )
const ssri = _ _nccwpck _require _ _ ( 4406 )
const { log } = _ _nccwpck _require _ _ ( 56528 )
const CachingMinipassPipeline = _ _nccwpck _require _ _ ( 61064 )
const { getAgent } = _ _nccwpck _require _ _ ( 79907 )
@@ -41760,6 +41906,8 @@ const remoteFetch = (request, options) => {
options . onRetry ( res )
}
/* eslint-disable-next-line max-len */
log . http ( 'fetch' , ` ${ req . method } ${ req . url } attempt ${ attemptNum } failed with ${ res . status } ` )
return retryHandler ( res )
}
@@ -41783,6 +41931,7 @@ const remoteFetch = (request, options) => {
options . onRetry ( err )
}
log . http ( 'fetch' , ` ${ req . method } ${ req . url } attempt ${ attemptNum } failed with ${ err . code } ` )
return retryHandler ( err )
}
} , options . retry ) . catch ( ( err ) => {
@@ -49022,6 +49171,166 @@ module.exports = async (
} ;
/***/ } ) ,
/***/ 56528 :
/***/ ( ( module ) => {
const META = Symbol ( 'proc-log.meta' )
module . exports = {
META : META ,
output : {
LEVELS : [
'standard' ,
'error' ,
'buffer' ,
'flush' ,
] ,
KEYS : {
standard : 'standard' ,
error : 'error' ,
buffer : 'buffer' ,
flush : 'flush' ,
} ,
standard : function ( ... args ) {
return process . emit ( 'output' , 'standard' , ... args )
} ,
error : function ( ... args ) {
return process . emit ( 'output' , 'error' , ... args )
} ,
buffer : function ( ... args ) {
return process . emit ( 'output' , 'buffer' , ... args )
} ,
flush : function ( ... args ) {
return process . emit ( 'output' , 'flush' , ... args )
} ,
} ,
log : {
LEVELS : [
'notice' ,
'error' ,
'warn' ,
'info' ,
'verbose' ,
'http' ,
'silly' ,
'timing' ,
'pause' ,
'resume' ,
] ,
KEYS : {
notice : 'notice' ,
error : 'error' ,
warn : 'warn' ,
info : 'info' ,
verbose : 'verbose' ,
http : 'http' ,
silly : 'silly' ,
timing : 'timing' ,
pause : 'pause' ,
resume : 'resume' ,
} ,
error : function ( ... args ) {
return process . emit ( 'log' , 'error' , ... args )
} ,
notice : function ( ... args ) {
return process . emit ( 'log' , 'notice' , ... args )
} ,
warn : function ( ... args ) {
return process . emit ( 'log' , 'warn' , ... args )
} ,
info : function ( ... args ) {
return process . emit ( 'log' , 'info' , ... args )
} ,
verbose : function ( ... args ) {
return process . emit ( 'log' , 'verbose' , ... args )
} ,
http : function ( ... args ) {
return process . emit ( 'log' , 'http' , ... args )
} ,
silly : function ( ... args ) {
return process . emit ( 'log' , 'silly' , ... args )
} ,
timing : function ( ... args ) {
return process . emit ( 'log' , 'timing' , ... args )
} ,
pause : function ( ) {
return process . emit ( 'log' , 'pause' )
} ,
resume : function ( ) {
return process . emit ( 'log' , 'resume' )
} ,
} ,
time : {
LEVELS : [
'start' ,
'end' ,
] ,
KEYS : {
start : 'start' ,
end : 'end' ,
} ,
start : function ( name , fn ) {
process . emit ( 'time' , 'start' , name )
function end ( ) {
return process . emit ( 'time' , 'end' , name )
}
if ( typeof fn === 'function' ) {
const res = fn ( )
if ( res && res . finally ) {
return res . finally ( end )
}
end ( )
return res
}
return end
} ,
end : function ( name ) {
return process . emit ( 'time' , 'end' , name )
} ,
} ,
input : {
LEVELS : [
'start' ,
'end' ,
'read' ,
] ,
KEYS : {
start : 'start' ,
end : 'end' ,
read : 'read' ,
} ,
start : function ( fn ) {
process . emit ( 'input' , 'start' )
function end ( ) {
return process . emit ( 'input' , 'end' )
}
if ( typeof fn === 'function' ) {
const res = fn ( )
if ( res && res . finally ) {
return res . finally ( end )
}
end ( )
return res
}
return end
} ,
end : function ( ) {
return process . emit ( 'input' , 'end' )
} ,
read : function ( ... args ) {
let resolve , reject
const promise = new Promise ( ( _resolve , _reject ) => {
resolve = _resolve
reject = _reject
} )
process . emit ( 'input' , 'read' , resolve , reject , ... args )
return promise
} ,
} ,
}
/***/ } ) ,
/***/ 54742 :
@@ -79642,14 +79951,25 @@ const endpoints_1 = __nccwpck_require__(69112);
const predicate _1 = _ _nccwpck _require _ _ ( 72103 ) ;
const subject _1 = _ _nccwpck _require _ _ ( 95206 ) ;
const COLOR _CYAN = '\x1B[36m' ;
const COLOR _GRAY = '\x1B[38;5;244m' ;
const COLOR _DEFAULT = '\x1B[39m' ;
const ATTESTATION _FILE _NAME = 'attestation.jsonl' ;
const MAX _SUBJECT _COUNT = 64 ;
const OCI _TIMEOUT = 2000 ;
const OCI _RETRY = 3 ;
/* istanbul ignore next */
const logHandler = ( level , ... args ) => {
// Send any HTTP-related log events to the GitHub Actions debug log
if ( level === 'http' ) {
core . debug ( args . join ( ' ' ) ) ;
}
} ;
/ * *
* The main function for the action .
* @ returns { Promise < void > } Resolves when the action is complete .
* /
async function run ( ) {
process . on ( 'log' , logHandler ) ;
// Provenance visibility will be public ONLY if we can confirm that the
// repository is public AND the undocumented "private-signing" arg is NOT set.
// Otherwise, it will be private.
@@ -79694,13 +80014,17 @@ async function run() {
}
catch ( err ) {
// Fail the workflow run if an error occurs
core . setFailed ( err instanceof Error ? err . message : /* istanbul ignore next */ ` ${ err } ` ) ;
core . setFailed ( err instanceof Error ? err : /* istanbul ignore next */ ` ${ err } ` ) ;
// Log the cause of the error if one is available
/* istanbul ignore if */
if ( err instanceof Error && 'cause' in err ) {
const innerErr = err . cause ;
core . debug ( innerErr instanceof Error ? innerErr . message : ` ${ innerErr } } ` ) ;
core . info ( mute ( innerErr instanceof Error ? innerErr . toString ( ) : ` ${ innerErr } ` ) ) ;
}
}
finally {
process . removeListener ( 'log' , logHandler ) ;
}
}
exports . run = run ;
const createAttestation = async ( subject , predicate , sigstoreInstance ) => {
@@ -79737,14 +80061,19 @@ const createAttestation = async (subject, predicate, sigstoreInstance) => {
annotations : {
'dev.sigstore.bundle.content' : 'dsse-envelope' ,
'dev.sigstore.bundle.predicateType' : core . getInput ( 'predicate-type' )
}
} ,
fetchOpts : { timeout : OCI _TIMEOUT , retry : OCI _RETRY }
} ) ;
core . info ( highlight ( 'Attestation uploaded to registry' ) ) ;
core . info ( ` ${ subject . name } @ ${ artifact . digest } ` ) ;
}
return attestation ;
} ;
// Emphasis string using ANSI color codes
const highlight = ( str ) => ` ${ COLOR _CYAN } ${ str } ${ COLOR _DEFAULT } ` ;
// De-emphasize string using ANSI color codes
/* istanbul ignore next */
const mute = ( str ) => ` ${ COLOR _GRAY } ${ str } ${ COLOR _DEFAULT } ` ;
const tempDir = ( ) => {
const basePath = process . env [ 'RUNNER_TEMP' ] ;
/* istanbul ignore if */
@@ -79869,6 +80198,9 @@ const subjectFromInputs = async () => {
const subjectPath = core . getInput ( 'subject-path' , { required : false } ) ;
const subjectDigest = core . getInput ( 'subject-digest' , { required : false } ) ;
const subjectName = core . getInput ( 'subject-name' , { required : false } ) ;
const pushToRegistry = core . getBooleanInput ( 'push-to-registry' , {
required : false
} ) ;
if ( ! subjectPath && ! subjectDigest ) {
throw new Error ( 'One of subject-path or subject-digest must be provided' ) ;
}
@@ -79878,11 +80210,14 @@ const subjectFromInputs = async () => {
if ( subjectDigest && ! subjectName ) {
throw new Error ( 'subject-name must be provided when using subject-digest' ) ;
}
// If push-to-registry is enabled, ensure the subject name is lowercase
// to conform to OCI image naming conventions
const name = pushToRegistry ? subjectName . toLowerCase ( ) : subjectName ;
if ( subjectPath ) {
return await getSubjectFromPath ( subjectPath , subjectN ame) ;
return await getSubjectFromPath ( subjectPath , n ame) ;
}
else {
return [ getSubjectFromDigest ( subjectDigest , subjectN ame) ] ;
return [ getSubjectFromDigest ( subjectDigest , n ame) ] ;
}
} ;
exports . subjectFromInputs = subjectFromInputs ;
@@ -83326,7 +83661,7 @@ exports.LRUCache = LRUCache;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
exports . Glob = void 0 ;
const minimatch _1 = _ _nccwpck _require _ _ ( 7111 ) ;
const path _scurry _1 = _ _nccwpck _require _ _ ( 69569 ) ;
const path _scurry _1 = _ _nccwpck _require _ _ ( 51081 ) ;
const url _1 = _ _nccwpck _require _ _ ( 57310 ) ;
const pattern _js _1 = _ _nccwpck _require _ _ ( 92895 ) ;
const walker _js _1 = _ _nccwpck _require _ _ ( 45548 ) ;
@@ -89034,7 +89369,7 @@ exports.Minipass = Minipass;
/***/ } ) ,
/***/ 69569 :
/***/ 51081 :
/***/ ( function ( _ _unused _webpack _module , exports , _ _nccwpck _require _ _ ) {
"use strict" ;
@@ -89115,21 +89450,21 @@ const IFMT = 0b1111;
// mask to unset low 4 bits
const IFMT _UNKNOWN = ~ IFMT ;
// set after successfully calling readdir() and getting entries.
const READDIR _CALLED = 16 ;
const READDIR _CALLED = 0b0000 _0001 _0000 ;
// set after a successful lstat()
const LSTAT _CALLED = 32 ;
const LSTAT _CALLED = 0b0000 _0010 _0000 ;
// set if an entry (or one of its parents) is definitely not a dir
const ENOTDIR = 64 ;
const ENOTDIR = 0b0000 _0100 _0000 ;
// set if an entry (or one of its parents) does not exist
// (can also be set on lstat errors like EACCES or ENAMETOOLONG)
const ENOENT = 128 ;
const ENOENT = 0b0000 _1000 _0000 ;
// cannot have child entries -- also verify &IFMT is either IFDIR or IFLNK
// set if we fail to readlink
const ENOREADLINK = 256 ;
const ENOREADLINK = 0b0001 _0000 _0000 ;
// set if we know realpath() will fail
const ENOREALPATH = 512 ;
const ENOREALPATH = 0b0010 _0000 _0000 ;
const ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH ;
const TYPEMASK = 1023 ;
const TYPEMASK = 0b0011 _1111 _1111 ;
const entToType = ( s ) => s . isFile ( )
? IFREG
: s . isDirectory ( )
@@ -89743,7 +90078,7 @@ class PathBase {
/* c8 ignore stop */
try {
const read = await this . # fs . promises . readlink ( this . fullpath ( ) ) ;
const linkTarget = this . parent . resolve ( read ) ;
const linkTarget = ( await this . parent . realpath ( ) ) ? . resolve( read ) ;
if ( linkTarget ) {
return ( this . # linkTarget = linkTarget ) ;
}
@@ -89772,7 +90107,7 @@ class PathBase {
/* c8 ignore stop */
try {
const read = this . # fs . readlinkSync ( this . fullpath ( ) ) ;
const linkTarget = this . parent . resolve ( read ) ;
const linkTarget = ( this . parent . realpathSync ( ) ) ? . resolve( read ) ;
if ( linkTarget ) {
return ( this . # linkTarget = linkTarget ) ;
}
@@ -89787,7 +90122,9 @@ class PathBase {
this . # type |= READDIR _CALLED ;
// mark all remaining provisional children as ENOENT
for ( let p = children . provisional ; p < children . length ; p ++ ) {
children [ p ] . # markENOENT ( ) ;
const c = children [ p ] ;
if ( c )
c . # markENOENT ( ) ;
}
}
# markENOENT ( ) {
@@ -93860,7 +94197,7 @@ exports.parse = parse;
/***/ ( ( module ) => {
"use strict" ;
module . exports = { "i8" : "2.3.0 " } ;
module . exports = { "i8" : "2.3.1 " } ;
/***/ } ) ,
@@ -93940,7 +94277,7 @@ module.exports = JSON.parse('[["0","\\u0000",128],["a1","。",62],["8140","
/***/ ( ( module ) => {
"use strict" ;
module . exports = JSON . parse ( '{"name":"make-fetch-happen","version":"13.0.0 ","description":"Opinionated, caching, retrying fetch client","main":"lib/index.js","files":["bin/","lib/"],"scripts":{"test":"tap","posttest":"npm run lint","eslint":"eslint","lint":"eslint \\"**/*.js\\"","lintfix":"npm run lint -- --fix","postlint":"template-oss-check","snap":"tap","template-oss-apply":"template-oss-apply --force"},"repository":{"type":"git","url":"https://github.com/npm/make-fetch-happen.git"},"keywords":["http","request","fetch","mean girls","caching","cache","subresource integrity"],"author":"GitHub Inc.","license":"ISC","dependencies":{"@npmcli/agent":"^2.0.0","cacache":"^18.0.0","http-cache-semantics":"^4.1.1","is-lambda":"^1.0.1","minipass":"^7.0.2","minipass-fetch":"^3.0.0","minipass-flush":"^1.0.5","minipass-pipeline":"^1.2.4","negotiator":"^0.6.3","promise-retry":"^2.0.1","ssri":"^10.0.0"},"devDependencies":{"@npmcli/eslint-config":"^4.0.0","@npmcli/template-oss":"4.18.0 ","nock":"^13.2.4","safe-buffer":"^5.2.1","standard-version":"^9.3.2","tap":"^16.0.0"},"engines":{"node":"^16.14.0 || >=18.0.0"},"tap":{"color":1,"files":"test/*.js","check-coverage":true,"timeout":60,"nyc-arg":["--exclude","tap-snapshots/**"]},"templateOSS":{"//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten.","ciV ersions ":["16.14.0","16.x","18.0.0","18.x"],"version":"4.18.0 ","publish":"true"}}' ) ;
module . exports = JSON . parse ( '{"name":"make-fetch-happen","version":"13.0.1 ","description":"Opinionated, caching, retrying fetch client","main":"lib/index.js","files":["bin/","lib/"],"scripts":{"test":"tap","posttest":"npm run lint","eslint":"eslint","lint":"eslint \\"**/*.{ js,cjs,ts,mjs,jsx,tsx} \\"","lintfix":"npm run lint -- --fix","postlint":"template-oss-check","snap":"tap","template-oss-apply":"template-oss-apply --force"},"repository":{"type":"git","url":"https://github.com/npm/make-fetch-happen.git"},"keywords":["http","request","fetch","mean girls","caching","cache","subresource integrity"],"author":"GitHub Inc.","license":"ISC","dependencies":{"@npmcli/agent":"^2.0.0","cacache":"^18.0.0","http-cache-semantics":"^4.1.1","is-lambda":"^1.0.1","minipass":"^7.0.2","minipass-fetch":"^3.0.0","minipass-flush":"^1.0.5","minipass-pipeline":"^1.2.4","negotiator":"^0.6.3","proc-log":"^4.2.0"," promise-retry":"^2.0.1","ssri":"^10.0.0"},"devDependencies":{"@npmcli/eslint-config":"^4.0.0","@npmcli/template-oss":"4.21.4 ","nock":"^13.2.4","safe-buffer":"^5.2.1","standard-version":"^9.3.2","tap":"^16.0.0"},"engines":{"node":"^16.14.0 || >=18.0.0"},"tap":{"color":1,"files":"test/*.js","check-coverage":true,"timeout":60,"nyc-arg":["--exclude","tap-snapshots/**"]},"templateOSS":{"//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten.","v ersion":"4.21.4 ","publish":"true"}}' ) ;
/***/ } ) ,