@@ -13,8 +13,9 @@ import { basename, dirname, isAbsolute, normalize, resolve } from 'node:path';
1313
1414import { readHostedAdmissionExactRecord as readExactRecord } from './hostedAdmissionExactRecord' ;
1515import {
16+ assertSameHostedAdmissionSocketIdentity ,
17+ hostedAdmissionSocketIdentityForPath ,
1618 parseHostedAdmissionSocketIdentity ,
17- sameHostedAdmissionSocketIdentity ,
1819} from './hostedAdmissionSocketIdentity' ;
1920import {
2021 type HostedApprovalAdmissionPin ,
@@ -224,20 +225,32 @@ export function admitHostedLifecycleProductionOwner(
224225 expectedUid,
225226 expectedGid,
226227 } ) ;
227- assertSameSocketIdentity (
228+ assertSameHostedAdmissionSocketIdentity (
228229 parsed . expectedOwnerBinding . socketIdentity ,
229- socketIdentityForPath ( admittedSocketPaths , admittedSocketIdentities , socketPath )
230+ hostedAdmissionSocketIdentityForPath (
231+ admittedSocketPaths ,
232+ admittedSocketIdentities ,
233+ socketPath
234+ )
230235 ) ;
231236 for ( const route of parsed . approvalRoutes ) {
232- assertSameSocketIdentity (
237+ assertSameHostedAdmissionSocketIdentity (
233238 route . socketIdentity ,
234- socketIdentityForPath ( admittedSocketPaths , admittedSocketIdentities , route . socketPath )
239+ hostedAdmissionSocketIdentityForPath (
240+ admittedSocketPaths ,
241+ admittedSocketIdentities ,
242+ route . socketPath
243+ )
235244 ) ;
236245 }
237246 for ( const admittedSocketPath of admittedSocketPaths ) {
238247 assertSocketStillCurrent (
239248 admittedSocketPath ,
240- socketIdentityForPath ( admittedSocketPaths , admittedSocketIdentities , admittedSocketPath )
249+ hostedAdmissionSocketIdentityForPath (
250+ admittedSocketPaths ,
251+ admittedSocketIdentities ,
252+ admittedSocketPath
253+ )
241254 ) ;
242255 }
243256 assertBootstrapBinding (
@@ -257,9 +270,9 @@ export function admitHostedLifecycleProductionOwner(
257270 expectedGid,
258271 } ) ;
259272 for ( const [ index , identity ] of admittedSocketIdentities . entries ( ) ) {
260- assertSameSocketIdentity (
273+ assertSameHostedAdmissionSocketIdentity (
261274 identity ,
262- socketIdentityForPath (
275+ hostedAdmissionSocketIdentityForPath (
263276 admittedSocketPaths ,
264277 revalidatedSocketIdentities ,
265278 admittedSocketPaths [ index ]
@@ -443,19 +456,6 @@ function assertOwnerRunDirectoryLayout(input: {
443456 ) ;
444457}
445458
446- function socketIdentityForPath (
447- socketPaths : readonly string [ ] ,
448- socketIdentities : readonly OrchestratorSocketIdentity [ ] ,
449- socketPath : string | undefined
450- ) : OrchestratorSocketIdentity {
451- const index = socketPath === undefined ? - 1 : socketPaths . indexOf ( socketPath ) ;
452- const identity = index < 0 ? undefined : socketIdentities [ index ] ;
453- if ( identity === undefined ) {
454- throw new TypeError ( 'hosted-lifecycle-owner-admission-layout-invalid' ) ;
455- }
456- return identity ;
457- }
458-
459459function assertLifecycleTrustDirectoryLayout ( input : {
460460 readonly trustAnchorPath : string ;
461461 readonly releasePinPath : string ;
@@ -520,7 +520,10 @@ function readSocketIdentity(
520520}
521521
522522function assertSocketStillCurrent ( path : string , expected : OrchestratorSocketIdentity ) : void {
523- assertSameSocketIdentity ( expected , readSocketIdentity ( path , expected . uid , expected . gid ) ) ;
523+ assertSameHostedAdmissionSocketIdentity (
524+ expected ,
525+ readSocketIdentity ( path , expected . uid , expected . gid )
526+ ) ;
524527}
525528
526529function parseAdmissionPayload (
@@ -796,12 +799,3 @@ function sameReleasePin(
796799 candidate . protocolVersion === artifact . protocolVersion
797800 ) ;
798801}
799-
800- function assertSameSocketIdentity (
801- left : OrchestratorSocketIdentity ,
802- right : OrchestratorSocketIdentity
803- ) : void {
804- if ( ! sameHostedAdmissionSocketIdentity ( left , right ) ) {
805- throw new TypeError ( 'hosted-lifecycle-owner-admission-socket-substituted' ) ;
806- }
807- }
0 commit comments