Skip to content

[BUG] Devices which had been onboarded via CMP cannot be deleted #739

Description

@Aircoookie

Please give a concise description of the bug
Attempting to delete a device in the UI fails after it has been onboarded via CMP due to protected device foreign key on CmpTransactionModel (django.db.models.deletion.ProtectedError: ("Cannot delete some instances of model 'DeviceModel' because they are referenced through protected foreign keys: 'CmpTransactionModel.device'.")

What are the steps to reproduce the issue?
Onboard a device via CMP (e.g. with signature based protection, AOKI)

What behavior did you expect?
All associated credentials are revoked and the device is deleted

Which version does the issue occur in?
0.6.0dev / latest main

Optional notes and context
Do we need to keep a CmpTransactionModel indefinitely? Only until finalized? What if an onboarding fails in the middle of a CMP transaction and we want to clean up the associated device model.
Proposal: Cascade deletion of the CmpTransactionModel if associated device is deleted (check for side effects first!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug Report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions