MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / checkBoot

Method checkBoot

kms/auth-simple/index.ts:89–118  ·  view source on GitHub ↗
(bootInfo: BootInfo, isKms: boolean)

Source from the content-addressed store, hash-verified

87 }
88
89 async checkBoot(bootInfo: BootInfo, isKms: boolean): Promise<BootResponse> {
90 const config = this.loadConfig();
91 const osImageHash = normalizeHex(bootInfo.osImageHash);
92 const deviceId = normalizeHex(bootInfo.deviceId);
93
94 // check TCB status
95 if (bootInfo.tcbStatus !== 'UpToDate') {
96 return {
97 isAllowed: false,
98 reason: 'TCB status is not up to date',
99 gatewayAppId: config.gatewayAppId
100 };
101 }
102
103 // check OS image
104 const allowedOsImages = config.osImages.map(normalizeHex);
105 if (!allowedOsImages.includes(osImageHash)) {
106 return {
107 isAllowed: false,
108 reason: 'OS image is not allowed',
109 gatewayAppId: config.gatewayAppId
110 };
111 }
112
113 if (isKms) {
114 return this.checkKmsBoot(bootInfo, config, deviceId);
115 } else {
116 return this.checkAppBoot(bootInfo, config, deviceId);
117 }
118 }
119
120 private checkKmsBoot(bootInfo: BootInfo, config: AuthConfig, deviceId: string): BootResponse {
121 const mrAggregated = normalizeHex(bootInfo.mrAggregated);

Callers 1

index.tsFile · 0.45

Calls 4

loadConfigMethod · 0.95
checkKmsBootMethod · 0.95
checkAppBootMethod · 0.95
normalizeHexFunction · 0.85

Tested by

no test coverage detected