Digest wants 'sha256:' prefix that the upload step doesn't add for some reason (#667)

This commit is contained in:
Max Goedjen 2025-09-03 22:01:44 -07:00 committed by GitHub
parent 416a7d5f40
commit 412687467b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 13 deletions

View File

@ -55,4 +55,4 @@ jobs:
uses: actions/attest-build-provenance@v2
with:
subject-name: "Secretive.zip"
subject-digest: ${{ steps.upload.outputs.artifact-digest }}
subject-digest: sha256:${{ steps.upload.outputs.artifact-digest }}

View File

@ -30,7 +30,7 @@ extension SecureEnclave {
SecItemCopyMatching(privateAttributes, &privateUntyped)
guard let privateTyped = privateUntyped as? [[CFString: Any]] else { return }
let migratedPublicKeys = Set(store.secrets.map(\.publicKey))
var migrated = false
var migratedAny = false
for key in privateTyped {
let name = key[kSecAttrLabel] as? String ?? String(localized: .unnamedSecret)
let id = key[kSecAttrApplicationLabel] as! Data
@ -45,6 +45,7 @@ extension SecureEnclave {
// Best guess.
let auth: AuthenticationRequirement = String(describing: accessControl)
.contains("DeviceOwnerAuthentication") ? .presenceRequired : .unknown
do {
let parsed = try CryptoKit.SecureEnclave.P256.Signing.PrivateKey(dataRepresentation: tokenObjectID)
let secret = Secret(id: UUID().uuidString, name: name, publicKey: parsed.publicKey.x963Representation, attributes: Attributes(keyType: .init(algorithm: .ecdsa, size: 256), authentication: auth))
guard !migratedPublicKeys.contains(parsed.publicKey.x963Representation) else {
@ -56,9 +57,12 @@ extension SecureEnclave {
try store.saveKey(tokenObjectID, name: name, attributes: secret.attributes)
logger.log("Migrated \(name).")
try markMigrated(secret: secret, oldID: id)
migrated = true
migratedAny = true
} catch {
logger.error("Failed to migrate \(name): \(error).")
}
if migrated {
}
if migratedAny {
store.reloadSecrets()
}
}