You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
The function DoorLockServer::modifyCredentialForUser() does not check the credential type when searching for the existing credential in the list of user credentials. This can lead to credentials being easily overwritten in the user's list depending on the order they were added to the user.
Reproduction steps
Description
The function DoorLockServer::modifyCredentialForUser() does not check the credential type when searching for the existing credential in the list of user credentials. This can lead to credentials being easily overwritten in the user's list depending on the order they were added to the user.
Reproduction steps
./chip-tool doorlock set-user 0 1 "test" 123 1 0 0 <destination-id> <endpoint-id> --timedInteractionTimeoutMs <ms_value>
./chip-tool doorlock set-credential 0 '{ "credentialType": 2, "credentialIndex": 1 }' <CredentialData> 1 null null <destination-id> <endpoint-id> --timedInteractionTimeoutMs <ms_value>
./chip-tool doorlock set-credential 0 '{ "credentialType": 1, "credentialIndex": 1 }' "1234" 1 null null <destination-id> <endpoint-id> --timedInteractionTimeoutMs <ms_value>
./chip-tool doorlock get-user 1 <destination-id> <endpoint-id>
./chip-tool doorlock set-credential 2 '{ "credentialType": 1, "credentialIndex": 1 }' "5678" 1 null null <destination-id> <endpoint-id> --timedInteractionTimeoutMs <ms_value>
./chip-tool doorlock get-user 1 <destination-id> <endpoint-id>
Output of Get User at Step 4
GetUserResponse: {
userIndex: 1
userName: test
userUniqueID: 123
userStatus: 1
userType: 0
credentialRule: 0
credentials: 1 entries
[1]: {
CredentialType: 2
CredentialIndex: 1
}
[2]: {
CredentialType: 1
CredentialIndex: 1
}
}
creatorFabricIndex: 1
lastModifiedFabricIndex: 1
nextUserIndex: null
}
Output of Get User at Step 6
GetUserResponse: {
userIndex: 1
userName: test
userUniqueID: 123
userStatus: 1
userType: 0
credentialRule: 0
credentials: 1 entries
[1]: {
CredentialType: 1
CredentialIndex: 1
}
[2]: {
CredentialType: 1
CredentialIndex: 1
}
}
creatorFabricIndex: 1
lastModifiedFabricIndex: 1
nextUserIndex: null
}
Potential Fix
Add a check for the credential type to DoorLockServer::modifyCredentialForUser() alongside the credential index check.
Bug prevalence
100% reproducible
GitHub hash of the SDK that was being used
main
Platform
core
Platform Version(s)
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: