Skip to content

Restrict isfeatured update to admins - #14973

Open
DaanHoogland wants to merge 2 commits into
4.20from
restrict-isfeatured-update-to-admins
Open

DaanHoogland wants to merge 2 commits into
4.20from
restrict-isfeatured-update-to-admins

Conversation

@DaanHoogland

Copy link
Copy Markdown
Contributor

Description

Registering a template/ISO, or creating a template from a volume or snapshot, forces isfeatured to false for non-admin callers. updateTemplatePermissions / updateIsoPermissions had no such check, so the owner of a template could mark it featured right after registering it. This PR rejects isfeatured=true from non-admin callers on the update path too. Setting it to false is still allowed for owners. The parameter description now says that only admins can set it to true.

Raised by @wido in the review of #14428.

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?

New unit tests in TemplateManagerImplTest:

  • updateTemplateOrIsoPermissionsTestOwnerCannotFeatureTemplate: fails without the fix.
  • updateTemplateOrIsoPermissionsTestOwnerCanUnfeatureTemplate
  • updateTemplateOrIsoPermissionsTestAdminCanFeatureTemplate

mvn -pl server test -Dtest=TemplateManagerImplTest: 40 tests, 0 failures.

Note: owners who currently feature their own templates through the API will now get an error. That is the behaviour registration already has.

🤖 Generated with Claude Code

DaanHoogland and others added 2 commits December 3, 2026 16:40
…issions

Registering a template, or creating one from a volume or snapshot, forces
isfeatured to false for non-admin callers. updateTemplatePermissions and
updateIsoPermissions did not, so an owner could mark their own template
or ISO as featured right after registering it. Reject isfeatured=true
from non-admins there as well; un-featuring is still allowed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 16.46%. Comparing base (e5dbc5f) to head (9b82cda).

Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #14973      +/-   ##
============================================
+ Coverage     16.45%   16.46%   +0.01%     
- Complexity    13710    13719       +9     
============================================
  Files          5670     5670              
  Lines        501769   501774       +5     
  Branches      60964    60964              
============================================
+ Hits          82588    82642      +54     
+ Misses       409926   409857      -69     
- Partials       9255     9275      +20     
Flag Coverage Δ
uitests 4.16% <ø> (ø)
unittests 17.33% <100.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.

@sonarqubecloud

sonarqubecloud Bot commented Dec 3, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

1 participant