From ebb63362814c88c99a23247e8cc16b6b99cd56ee Mon Sep 17 00:00:00 2001 From: Enginex0 Date: Thu, 26 Mar 2026 02:49:01 +0100 Subject: [PATCH] fix(interception): patch authorizations on import-overwrite path The retained cert chain was applied to response metadata but the authorizations array was left unpatched, allowing a detector to compare metadata patch levels against cert attestation values and spot the divergence. Refs upstream JingMatrix #164. --- .../interception/keystore/Keystore2Interceptor.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/org/matrix/TEESimulator/interception/keystore/Keystore2Interceptor.kt b/app/src/main/java/org/matrix/TEESimulator/interception/keystore/Keystore2Interceptor.kt index 1e61f24..b9c8530 100644 --- a/app/src/main/java/org/matrix/TEESimulator/interception/keystore/Keystore2Interceptor.kt +++ b/app/src/main/java/org/matrix/TEESimulator/interception/keystore/Keystore2Interceptor.kt @@ -332,6 +332,11 @@ object Keystore2Interceptor : AbstractKeystoreInterceptor() { } SystemLogger.info("[TX_ID: $txId] Imported key overwrote attested alias, serving retained chain for $keyId") CertificateHelper.updateCertificateChain(response.metadata, retainedChain).getOrThrow() + response.metadata.authorizations = + InterceptorUtils.patchAuthorizations( + response.metadata.authorizations, + callingUid, + ) return InterceptorUtils.createTypedObjectReply(response) }