coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: Deleting a GitHub app from sources breaks resources that used the associated private key

Open rigwild opened this issue 1 year ago • 1 comments

Description

Hi,

I migrated from private repository via GitHub app to private repository via deploy keys because I have private submodules that I could not get to deploy when using GitHub app.

When doing so, I reused the private key created when creating the GitHub app that is associated with it. I did not realize that they were linked. What happened is after doing my configs migrations is that I deleted the GitHub app source, which also deleted the associated private key.

This results in a 500 error when entering resources that use this deleted private key.

This is an edge case but that broke my setup as I was not aware the private key would be deleted as well. I had to restore a backup.

I believe you need to add a check when deleting a GitHub app that verifies that there are no resources that use the associated deleted private key.

Minimal Reproduction (if possible, example repository)

  1. Create GitHub app source
  2. Create a private Github resource with deploy key that uses the private key created with the GitHub app
  3. Delete the GitHub app -> this will automatically delete the associated private key
  4. Private Github resource with deploy key is broken HTTP 500

Exception or Error

Error 500

Attempt to read property "name ", ....

Version

v4.0.0-beta.266

rigwild avatar Apr 24 '24 22:04 rigwild

Here is a repro video that shows the full steps that got me into breaking the setup.

https://github.com/coollabsio/coolify/assets/26366184/22ce2b28-6642-4b0b-9cc5-d694fe6193db

rigwild avatar Apr 24 '24 22:04 rigwild

Oh, thanks for catching that!

In the next version, you will only be able to delete a GitHub App if you have deleted all associated resources + fix for that http 500.

andrasbacsai avatar Apr 25 '24 09:04 andrasbacsai