mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-06 00:22:42 -05:00
[GH-ISSUE #1376] Deleting organization works through web UI but not through API on self hosted #6678
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @QuuR32 on GitHub (Aug 28, 2025).
Original GitHub issue: https://github.com/fosrl/pangolin/issues/1376
Hello there,
First, thank you so much for the work done. The project is amazing and makes me want to use it and explore everything possible.
I've setup a self hosted application following this documentation, and everything for the API to work as explained here.
Everything works fine for the moment with the API, expect the DELETE /org/{orgId} endpoint. It's responding with a 500 status code and this content:
Using the web UI, it works fine. It looks like the call made to https://my.panglin.webui.url/api/v1/org/{orgId} works but not to the internal API.
Any clue on that would help me a lot (I am building a terraform provider for pangolin).
Thanks
@Pallavikumarimdb commented on GitHub (Aug 28, 2025):
Hi @QuuR32 , From your description, it looks like the DELETE /api/v1/org/{orgId} request is hitting the internal API (internal server port) on your self-hosted instance. This server mounts internal.ts, which does not have a deleteOrg route, so Express returns a 500 error.
The reason the web UI works is that it calls the external API server (external port), which uses external.ts and has the correct deleteOrg route.
To fix this for API access:
If you need internal-only API deletion, a route can be added to internal.ts to support it. I’ll add this route in a future update.
@QuuR32 commented on GitHub (Aug 29, 2025):
Hi @Pallavikumarimdb , thanks for your quick reply.
Just to be sure, are you talking about this route ?
Cause it's the only route for now that is not working for me. All the other routes work fine.
Also when I look at the logs in pangolin container, I can see those lines when calling the /org/{orgId} API route:
Even though I'm using an API key with full access:
Thanks
@Pallavikumarimdb commented on GitHub (Aug 29, 2025):
Hi @QuuR32 , Now I can see what's causing this issue:
The
deleteOrgfunction always callscheckUserActionPermission(), which expectsreq.user.userId. API key authentication doesn’t populatereq.userthe same way as web UI authentication./org/{orgId}API endpoint expects a logged-in user.checkUserActionPermission.For now, organizations need to be deleted via the web UI.
Fix Needed:
deleteOrgshould either:checkUserActionPermissionwhen using API key auth (permissions are already verified byverifyApiKeyIsRoot+verifyApiKeyHasAction), orreq.userproperly.Hi @oschwartz10612 , it seems this function assumes session-based auth, while the API route uses API key auth. Should
deleteOrgskip the user permission check whenreq.apiKeyexists?@oschwartz10612 commented on GitHub (Aug 31, 2025):
Thanks for identifying the issue @Pallavikumarimdb!
I fixed this in
f37eda4739I believe. Letme know if you agree. I think it was simplest to just move it to the
external.ts file like the others. This might have been an old thing.