Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,14 @@ struct PlatformWalletDashConnectStateTransitionParser: DashConnectStateTransitio
return .keyRegistration(
DashConnectKeyRegistrationTransition(
identityId: parsed.identityId,
addPublicKeys: parsed.addPublicKeys.map { key in
addPublicKeys: try parsed.addPublicKeys.map { key in
DashConnectKeyRegistrationKey(
keyId: key.keyId,
keyType: key.keyType,
purpose: key.purpose,
securityLevel: key.securityLevel,
publicKeyData: key.pubkeyBytes,
contractBounds: key.contractBounds.map {
contractBounds: try key.contractBounds.map {
switch $0 {
case .singleContract(let id):
return .singleContract(id: id)
Expand All @@ -251,6 +251,18 @@ struct PlatformWalletDashConnectStateTransitionParser: DashConnectStateTransitio
id: id,
documentTypeName: documentTypeName
)
case .contractGroup:
// The wallet layer reports a contract-group bound since the
// SDK's #4800, and the DPP-layer `ContractBounds` this maps
// into has no case for it (dashpay/platform#4853). Dropping
// the bound is not an option here: the value decides which
// approved app a key registration belongs to, and it is also
// rebuilt into the `IdentityPubkey` handed back to
// `updateIdentity(...)`, so a silently weakened bound would
// mean signing a transition the dApp did not ask for. A key
// bound to a contract group is never one of the login keys
// this flow derives, so refuse the transition instead.
throw DashConnectPlatformError.keyRegistrationUnexpectedMutation
}
Comment on lines +254 to 266

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: Add a regression test for whole-transition contract-group refusal

The new .contractGroup refusal branch has no regression coverage: the existing parser tests cover supported identity updates and token purchases, while this PR's fixture changes only supply the new optional key-limit fields. Use the existing injected parseTransition closure to return an identity update containing a supported key followed by a contract-group-bound key, then assert that parse throws DashConnectPlatformError.keyRegistrationUnexpectedMutation. This directly protects the security-relevant guarantee that the entire registration is rejected rather than returning a partial key list or silently weakening a bound, without requiring a live dApp.

source: muse-spark-1.3-contributor (phase1-reviewer: general, ffi-engineer, security-auditor); gpt-6-astra (phase2-reviewer: general, ffi-engineer, security-auditor)

}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,11 @@ final class PlatformDashConnectDataSourceTests: XCTestCase {
keyType: keyType,
readOnly: false,
disabledAt: disabledAt.map { Int64(bitPattern: $0) },
data: data
data: data,
// Protocol 14 key limits (platform#4798). These fixtures describe
// the keys the QR login flow derives, which carry neither.
totalBudget: nil,
expiresAt: nil
)
}

Expand Down
Loading