Skip to content

Feat: Support trusted console projects#11248

Merged
Meldiron merged 3 commits into1.8.xfrom
feat-trusted-console-projects
Feb 4, 2026
Merged

Feat: Support trusted console projects#11248
Meldiron merged 3 commits into1.8.xfrom
feat-trusted-console-projects

Conversation

@Meldiron
Copy link
Copy Markdown
Contributor

@Meldiron Meldiron commented Feb 4, 2026

What does this PR do?

Allows to trust specific projects so all it's rules is allowed to talk to all projects including Console.

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 4, 2026

📝 Walkthrough

Walkthrough

Adds _APP_CONSOLE_TRUSTED_PROJECTS to .env and two services in docker-compose.yml; updates app/init/resources.php to permit console access when a rule's projectId is listed in that environment variable (as a fallback to the previous projectInternalId equality check) and includes comments marking this as temporary/experimental; and adds a new end-to-end test testConsoleCorsWithTrustedProject in tests/e2e/Services/Projects/ProjectsConsoleClientTest.php (appears duplicated in the diff) that verifies CORS exposure for trusted vs. untrusted projects.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Feat: Support trusted console projects' is clear and directly summarizes the main change: introducing support for marking specific projects as trusted.
Description check ✅ Passed The PR description explains the motivation ('Allows to trust specific projects so all its rules is allowed to talk to all projects including Console') and mentions testing approach (new tests).

✏️ 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-trusted-console-projects

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 4, 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

Source Code Scan Results

🎉 No vulnerabilities found!

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: 4

🤖 Fix all issues with AI agents
In @.env:
- Line 28: Move the _APP_CONSOLE_TRUSTED_PROJECTS key so it appears with the
other console-related environment variables to satisfy dotenv ordering rules;
locate the line containing
_APP_CONSOLE_TRUSTED_PROJECTS=trusted-project,another-trusted-project and
cut/paste it into the block where other console keys (e.g., keys prefixed with
_APP_CONSOLE_ or nearby console-related entries) are defined, preserving its
value and formatting.

In `@app/init/resources.php`:
- Around line 259-270: The trusted-projects parsing silently fails on entries
with whitespace; update the block that builds $trustedProjects (currently
looping over explode(',', System::getEnv('_APP_CONSOLE_TRUSTED_PROJECTS', '')))
to trim each exploded value and remove empty strings before matching against
$rule->getAttribute('projectId', ''), e.g. use array_map('trim', ...) and
array_filter(...) to produce $trustedProjects and then use in_array to set
$permitsCurrentProject; keep the existing condition that checks
!$permitsCurrentProject and !$rule->isEmpty() and the final in_array check.

In `@tests/e2e/Services/Projects/ProjectsConsoleClientTest.php`:
- Around line 5176-5181: The test testConsoleCorsWithTrustedProject currently
hard-codes $trustedProjectIds; instead, read the runtime env variable
_APP_CONSOLE_TRUSTED_PROJECTS, split it on commas, trim and filter empty values
into $trustedProjectIds, and then merge with the untrusted ID as before (use the
existing $projectIds = array_merge($trustedProjectIds,
['untrusted-project-id'])); ensure the parsing handles empty or missing env
gracefully (fall back to an empty array).
- Around line 5182-5234: The finally block unconditionally attempts to delete
the project and asserts a 204, which can mask a prior failure in setupProject;
add a guard variable (e.g., $created = false) before calling setupProject(), set
$created = true only after setupProject() succeeds (or after receiving a
successful creation response), and in the finally block only call the delete via
$this->client->call(... '/projects/' . $projectId ...) and assert the 204 when
$created is true; reference setupProject, the foreach over $projectIds, and the
delete call to locate where to add the flag and conditional cleanup.

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

Adds support for “trusted” projects whose custom-domain rules can be used to allow CORS access to Console APIs (and potentially other projects), driven by a new _APP_CONSOLE_TRUSTED_PROJECTS env var.

Changes:

  • Introduces _APP_CONSOLE_TRUSTED_PROJECTS to control which project IDs are treated as trusted.
  • Updates rule resolution to allow trusted projects’ rules to be accepted even when the rule’s owning project doesn’t match the current project.
  • Adds an E2E test covering Console CORS behavior for trusted vs untrusted projects.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
app/init/resources.php Adds trusted-project bypass logic when resolving the request origin “rule”.
tests/e2e/Services/Projects/ProjectsConsoleClientTest.php Adds an E2E test to validate Console CORS behavior for trusted/untrusted projects.
docker-compose.yml Plumbs _APP_CONSOLE_TRUSTED_PROJECTS into relevant containers.
.env Adds a default value for _APP_CONSOLE_TRUSTED_PROJECTS.

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 4, 2026

✨ Benchmark results

  • Requests per second: 2,477
  • Requests with 200 status code: 445,853
  • P99 latency: 0.062119042

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 2,477 1,176
200 445,853 211,691
P99 0.062119042 0.173277396

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 4 out of 4 changed files in this pull request and generated 4 comments.


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

@Meldiron Meldiron merged commit f7f6b51 into 1.8.x Feb 4, 2026
78 of 79 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