[PR #2432] [MERGED] feat(integration): add domain CRUD endpoints to integration API #13820

Closed
opened 2026-05-13 19:07:24 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fosrl/pangolin/pull/2432
Author: @ChanningHe
Created: 2/8/2026
Status: Merged
Merged: 3/1/2026
Merged by: @oschwartz10612

Base: devHead: feat-integration-api-domain-crud


📝 Commits (1)

  • 52f2639 feat(integration): add domain CRUD endpoints to integration API

📊 Changes

5 files changed (+159 additions, -2 deletions)

View changed files

📝 messages/en-US.json (+6 -0)
📝 server/middlewares/integration/index.ts (+1 -0)
server/middlewares/integration/verifyApiKeyDomainAccess.ts (+90 -0)
📝 server/routers/integration.ts (+52 -1)
📝 src/components/PermissionsSelectBox.tsx (+10 -1)

📄 Description

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

  • Add 6 domain CRUD endpoints to integration API (get, create, update, delete, dns-records, restart)
  • Create verifyApiKeyDomainAccess middleware for domain-org ownership validation
  • Enable API key holders to fully manage domains programmatically

How to test?

API_KEY="xxxxxx"
ORG_ID="test-org"
BASE_URL="http://localhost:3003/v1"

# --- 1. Create a domain (PUT) ---
curl -s -X PUT "$BASE_URL/org/$ORG_ID/domain" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type": "wildcard", "baseDomain": "test.example.com"}'
# Expected: 201 Created, response includes domainId

# --- 2. Get a domain (GET) ---
DOMAIN_ID="<domainId from step 1>"
curl -s "$BASE_URL/org/$ORG_ID/domain/$DOMAIN_ID" \
  -H "Authorization: Bearer $API_KEY"
# Expected: 200 OK, returns domain details

# --- 3. Get DNS records (GET) ---
curl -s "$BASE_URL/org/$ORG_ID/domain/$DOMAIN_ID/dns-records" \
  -H "Authorization: Bearer $API_KEY"
# Expected: 200 OK, returns array of DNS records

# --- 4. Update a domain (PATCH) ---
curl -s -X PATCH "$BASE_URL/org/$ORG_ID/domain/$DOMAIN_ID" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"preferWildcardCert": true}'
# Expected: 200 OK, returns updated domain

# --- 5. Restart a domain (POST) ---
curl -s -X POST "$BASE_URL/org/$ORG_ID/domain/$DOMAIN_ID/restart" \
  -H "Authorization: Bearer $API_KEY"
# Expected: 200 OK

# --- 6. Delete a domain (DELETE) ---
curl -s -X DELETE "$BASE_URL/org/$ORG_ID/domain/$DOMAIN_ID" \
  -H "Authorization: Bearer $API_KEY"
# Expected: 200 OK

# --- 7. Verify deletion (GET should return 404) ---
curl -s "$BASE_URL/org/$ORG_ID/domain/$DOMAIN_ID" \
  -H "Authorization: Bearer $API_KEY"
# Expected: 404 Not Found

# --- Security tests ---

# No auth → 401
curl -s "$BASE_URL/org/$ORG_ID/domain/$DOMAIN_ID"
# Expected: 401 Unauthorized

# Wrong org → 403
curl -s "$BASE_URL/org/wrong-org/domain/$DOMAIN_ID" \
  -H "Authorization: Bearer $API_KEY"
# Expected: 403 Forbidden

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fosrl/pangolin/pull/2432 **Author:** [@ChanningHe](https://github.com/ChanningHe) **Created:** 2/8/2026 **Status:** ✅ Merged **Merged:** 3/1/2026 **Merged by:** [@oschwartz10612](https://github.com/oschwartz10612) **Base:** `dev` ← **Head:** `feat-integration-api-domain-crud` --- ### 📝 Commits (1) - [`52f2639`](https://github.com/fosrl/pangolin/commit/52f26396ac81a169cfb2cb93e816c8ff2fe9461f) feat(integration): add domain CRUD endpoints to integration API ### 📊 Changes **5 files changed** (+159 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `messages/en-US.json` (+6 -0) 📝 `server/middlewares/integration/index.ts` (+1 -0) ➕ `server/middlewares/integration/verifyApiKeyDomainAccess.ts` (+90 -0) 📝 `server/routers/integration.ts` (+52 -1) 📝 `src/components/PermissionsSelectBox.tsx` (+10 -1) </details> ### 📄 Description ## Community Contribution License Agreement By creating this pull request, I grant the project maintainers an unlimited, perpetual license to use, modify, and redistribute these contributions under any terms they choose, including both the AGPLv3 and the Fossorial Commercial license terms. I represent that I have the right to grant this license for all contributed content. ## Description - Add 6 domain CRUD endpoints to integration API (get, create, update, delete, dns-records, restart) - Create `verifyApiKeyDomainAccess` middleware for domain-org ownership validation - Enable API key holders to fully manage domains programmatically ## How to test? ``` API_KEY="xxxxxx" ORG_ID="test-org" BASE_URL="http://localhost:3003/v1" # --- 1. Create a domain (PUT) --- curl -s -X PUT "$BASE_URL/org/$ORG_ID/domain" \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "wildcard", "baseDomain": "test.example.com"}' # Expected: 201 Created, response includes domainId # --- 2. Get a domain (GET) --- DOMAIN_ID="<domainId from step 1>" curl -s "$BASE_URL/org/$ORG_ID/domain/$DOMAIN_ID" \ -H "Authorization: Bearer $API_KEY" # Expected: 200 OK, returns domain details # --- 3. Get DNS records (GET) --- curl -s "$BASE_URL/org/$ORG_ID/domain/$DOMAIN_ID/dns-records" \ -H "Authorization: Bearer $API_KEY" # Expected: 200 OK, returns array of DNS records # --- 4. Update a domain (PATCH) --- curl -s -X PATCH "$BASE_URL/org/$ORG_ID/domain/$DOMAIN_ID" \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{"preferWildcardCert": true}' # Expected: 200 OK, returns updated domain # --- 5. Restart a domain (POST) --- curl -s -X POST "$BASE_URL/org/$ORG_ID/domain/$DOMAIN_ID/restart" \ -H "Authorization: Bearer $API_KEY" # Expected: 200 OK # --- 6. Delete a domain (DELETE) --- curl -s -X DELETE "$BASE_URL/org/$ORG_ID/domain/$DOMAIN_ID" \ -H "Authorization: Bearer $API_KEY" # Expected: 200 OK # --- 7. Verify deletion (GET should return 404) --- curl -s "$BASE_URL/org/$ORG_ID/domain/$DOMAIN_ID" \ -H "Authorization: Bearer $API_KEY" # Expected: 404 Not Found # --- Security tests --- # No auth → 401 curl -s "$BASE_URL/org/$ORG_ID/domain/$DOMAIN_ID" # Expected: 401 Unauthorized # Wrong org → 403 curl -s "$BASE_URL/org/wrong-org/domain/$DOMAIN_ID" \ -H "Authorization: Bearer $API_KEY" # Expected: 403 Forbidden ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-13 19:07:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#13820