Skip to content

Feat: custom ID for API keys#11277

Merged
Meldiron merged 4 commits into1.8.xfrom
feat-api-key-custom-id
Feb 10, 2026
Merged

Feat: custom ID for API keys#11277
Meldiron merged 4 commits into1.8.xfrom
feat-api-key-custom-id

Conversation

@Meldiron
Copy link
Copy Markdown
Contributor

@Meldiron Meldiron commented Feb 9, 2026

What does this PR do?

Allows custom IDs for API keys

Test Plan

New tests

Related PRs and Issues

x

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 9, 2026

📝 Walkthrough

Walkthrough

Adds a keyId parameter to the projects API create-key endpoint, registers the CustomId validator, and updates the action signature. The controller now treats the literal unique() as a generator trigger (using ID::unique()) or accepts a provided keyId, assigning it to the key document $id instead of always generating one. Public key creation flow was updated to use the same keyId logic. End-to-end and console client tests were updated to include and validate custom, magic-string, and omitted keyId scenarios.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Feat: custom ID for API keys' clearly and concisely summarizes the main change in the changeset, which adds support for custom IDs when creating API keys.
Description check ✅ Passed The pull request description explains the feature (allowing custom IDs for API keys), mentions test coverage, and includes a completed contributor checklist confirming API specs and docs were updated.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-api-key-custom-id

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 9, 2026

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
libcrypto3 3.5.4-r0 CVE-2025-15467 CRITICAL
libcrypto3 3.5.4-r0 CVE-2025-69419 HIGH
libcrypto3 3.5.4-r0 CVE-2025-69421 HIGH
libpng 1.6.51-r0 CVE-2025-66293 HIGH
libpng 1.6.51-r0 CVE-2026-22695 HIGH
libpng 1.6.51-r0 CVE-2026-22801 HIGH
libpng-dev 1.6.51-r0 CVE-2025-66293 HIGH
libpng-dev 1.6.51-r0 CVE-2026-22695 HIGH
libpng-dev 1.6.51-r0 CVE-2026-22801 HIGH
libssl3 3.5.4-r0 CVE-2025-15467 CRITICAL
libssl3 3.5.4-r0 CVE-2025-69419 HIGH
libssl3 3.5.4-r0 CVE-2025-69421 HIGH
libxml2 2.13.8-r0 CVE-2025-49794 CRITICAL
libxml2 2.13.8-r0 CVE-2025-49796 CRITICAL
libxml2 2.13.8-r0 CVE-2025-49795 HIGH
libxml2 2.13.8-r0 CVE-2025-6021 HIGH
openssl 3.5.4-r0 CVE-2025-15467 CRITICAL
openssl 3.5.4-r0 CVE-2025-69419 HIGH
openssl 3.5.4-r0 CVE-2025-69421 HIGH
openssl-dev 3.5.4-r0 CVE-2025-15467 CRITICAL
openssl-dev 3.5.4-r0 CVE-2025-69419 HIGH
openssl-dev 3.5.4-r0 CVE-2025-69421 HIGH
py3-urllib3 1.26.20-r0 CVE-2026-21441 HIGH
py3-urllib3-pyc 1.26.20-r0 CVE-2026-21441 HIGH
github.com/containerd/containerd/v2 v2.0.2 CVE-2024-25621 HIGH
golang.org/x/crypto v0.31.0 CVE-2025-22869 HIGH
golang.org/x/oauth2 v0.24.0 CVE-2025-22868 HIGH
stdlib 1.22.10 CVE-2025-47907 HIGH
stdlib 1.22.10 CVE-2025-58183 HIGH
stdlib 1.22.10 CVE-2025-61726 HIGH
stdlib 1.22.10 CVE-2025-61728 HIGH
stdlib 1.22.10 CVE-2025-61729 HIGH
stdlib 1.22.10 CVE-2025-61730 HIGH
stdlib 1.22.10 CVE-2025-68121 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 9, 2026

✨ Benchmark results

  • Requests per second: 2,253
  • Requests with 200 status code: 405,653
  • P99 latency: 0.067842653

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 2,253 1,165
200 405,653 209,747
P99 0.067842653 0.176329595

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for specifying custom IDs when creating project API keys, and updates the E2E test suite to exercise both auto-generated and custom key IDs.

Changes:

  • Add a keyId request parameter to the “Create key” Projects API endpoint using a CustomId validator.
  • Use the provided keyId as the key document $id during creation.
  • Expand/update E2E tests to include custom ID creation and adjust expectations accordingly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
app/controllers/api/projects.php Adds keyId param and uses it as the created key’s $id.
tests/e2e/Services/Projects/ProjectsConsoleClientTest.php Updates key-creation calls and adds coverage for creating keys with/without keyId.
tests/e2e/Scopes/ProjectCustom.php Updates helper key creation calls to include keyId.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/e2e/Services/Projects/ProjectsConsoleClientTest.php (1)

3215-3223: ⚠️ Potential issue | 🟠 Major

Project key total should be 4 after four successful creations.
The test creates four keys (unique ID, no ID, custom ID, magic string). Expecting 3 will fail once the custom-ID path succeeds.

🔧 Suggested fix
-        $this->assertEquals(3, $response['body']['total']);
+        $this->assertEquals(4, $response['body']['total']);
🤖 Fix all issues with AI agents
In `@tests/e2e/Services/Projects/ProjectsConsoleClientTest.php`:
- Around line 3143-3184: The POST tests that create keys need explicit
assertions for the custom ID and magic-string cases: after the call that uses
$customKeyId (variable customKeyId) assert the response status is 201 and that
response['body']['$id'] === $customKeyId; for the call that passes 'unique()'
assert status 201, assert response['body']['$id'] is not equal to the literal
string 'unique()', and assert it is a non-empty/generated id (e.g., matches the
same non-empty pattern you use elsewhere or simply is not 'unique()' and is not
empty) so the magic-string behavior is validated.

@Meldiron Meldiron requested a review from Copilot February 9, 2026 16:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Meldiron Meldiron requested a review from Copilot February 9, 2026 16:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Meldiron Meldiron merged commit 226e36d into 1.8.x Feb 10, 2026
47 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants