Skip to content

CertService: Fix account id requirement by using caller account id as fallback - #13818

Open
resmo wants to merge 2 commits into
apache:mainfrom
resmo:fix/ssl-cert-unneccessary-invalid-param-ex
Open

CertService: Fix account id requirement by using caller account id as fallback#13818
resmo wants to merge 2 commits into
apache:mainfrom
resmo:fix/ssl-cert-unneccessary-invalid-param-ex

Conversation

@resmo

@resmo resmo commented Aug 6, 2026

Copy link
Copy Markdown
Member

Description

While implementing an ansible module for ssl cert (ngine-io/ansible-collection-cloudstack#178). I faced this api and experienced this issue. (As a side note: The ssl cert api is IMHO not consistent with other cloudstack apis: e.g. there are no domainId with accountName param but an accountId.)

SSL cert service requires to set the account id (if no project id or lb id), however, this is inconsistent to other cloudstack APIs where (AFAICS) the caller account name is used instead as a fallack.

This change aligns with this behaviour.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

Copilot AI lite review requested due to automatic review settings August 6, 2026 12:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Aligns CertService SSL certificate listing behavior with other CloudStack APIs by falling back to the caller’s account when no explicit accountId (and no other filter like project/LB/cert) is provided, removing an unnecessary hard requirement that caused client friction (e.g., automation modules).

Changes:

  • Update listSslCerts to use the caller account ID as the default when accountId is not provided.
  • Add a unit test ensuring the no-filter case queries certificates for the caller’s account.
  • Minor cleanup: parameterized logging and correct string comparison for key algorithm checks.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
server/src/main/java/org/apache/cloudstack/network/ssl/CertServiceImpl.java Implements caller-account fallback for listing certs; minor logging/string-compare adjustments; updates PEM reader close handling.
server/src/test/java/org/apache/cloudstack/network/ssl/CertServiceTest.java Adds a regression test validating caller-account fallback behavior for listSslCerts.

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

Comment thread server/src/main/java/org/apache/cloudstack/network/ssl/CertServiceImpl.java Outdated
Copilot AI review requested due to automatic review settings August 6, 2026 12:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Suppressed comments (1)

server/src/main/java/org/apache/cloudstack/network/ssl/CertServiceImpl.java:375

  • The comment and logic here are misleading: this block is not about "encryption for DSA"; it conditionally performs an RSA signature round-trip to validate that the keypair matches, and it skips validation for any non-RSA algorithm (not just DSA). Consider updating the comment and using a null-safe string comparison for clarity.
        // No encryption for DSA
        if (!pubKey.getAlgorithm().equals("RSA")) {
            return;
        }

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.64%. Comparing base (5a67f19) to head (a9dc8bf).

Files with missing lines Patch % Lines
...apache/cloudstack/network/ssl/CertServiceImpl.java 0.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #13818      +/-   ##
============================================
- Coverage     19.64%   19.64%   -0.01%     
+ Complexity    19790    19784       -6     
============================================
  Files          6368     6368              
  Lines        574889   574887       -2     
  Branches      70353    70353              
============================================
- Hits         112962   112957       -5     
  Misses       449656   449656              
- Partials      12271    12274       +3     
Flag Coverage Δ
uitests 3.41% <ø> (ø)
unittests 20.92% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants