Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-13014] - Add CanToggleStatus property to PolicyRepsonseModel based on Policy Validators #4940

Merged
merged 12 commits into from
Nov 11, 2024

Conversation

jrmccannon
Copy link
Contributor

@jrmccannon jrmccannon commented Oct 24, 2024

🎟️ Tracking

PM-13014

📔 Objective

This will add a CanToggleStatus flag to the PolicyResponseModel to inform clients on whether or not they will be allowed to change the status of the policy (enable/disable). This is using the new PolicyValidator#ValidateAsync methods to determine if it can be changed. This is limited to Single Org Policy for now.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@jrmccannon jrmccannon requested review from eliykat and r-tome October 24, 2024 19:33
Copy link
Contributor

github-actions bot commented Oct 24, 2024

Logo
Checkmarx One – Scan Summary & Detailsb3008eeb-d8ad-4180-bbaa-5c7555aaea4d

New Issues

Severity Issue Source File / Package Checkmarx Insight
LOW Log_Forging /src/Api/Billing/Controllers/ProviderClientsController.cs: 29 Attack Vector
LOW Log_Forging /src/Api/Billing/Controllers/ProviderClientsController.cs: 29 Attack Vector

Fixed Issues

Severity Issue Source File / Package
MEDIUM CSRF /src/Api/AdminConsole/Controllers/PoliciesController.cs: 59
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 106
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 238
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 678
MEDIUM CSRF /src/Api/AdminConsole/Controllers/PoliciesController.cs: 145
MEDIUM CSRF /src/Api/AdminConsole/Controllers/PoliciesController.cs: 75
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 362
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 345
MEDIUM CSRF /src/Api/Controllers/DevicesController.cs: 73
MEDIUM CSRF /src/Api/Controllers/DevicesController.cs: 60
MEDIUM CSRF /src/Api/AdminConsole/Public/Controllers/PoliciesController.cs: 62
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 264
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 469
MEDIUM CSRF /src/Api/AdminConsole/Public/Controllers/PoliciesController.cs: 42
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 832
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 534
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 705
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 723
MEDIUM CSRF /src/Api/Controllers/DevicesController.cs: 81
LOW Log_Forging /src/Api/AdminConsole/Controllers/ProvidersController.cs: 72
LOW Log_Forging /src/Api/AdminConsole/Controllers/ProvidersController.cs: 72
LOW Log_Forging /src/Api/AdminConsole/Controllers/ProvidersController.cs: 72
LOW Log_Forging /src/Api/Auth/Controllers/EmergencyAccessController.cs: 102

@jrmccannon jrmccannon marked this pull request as ready for review October 24, 2024 20:24
@jrmccannon jrmccannon requested a review from a team as a code owner October 24, 2024 20:24
Copy link

codecov bot commented Oct 24, 2024

Codecov Report

Attention: Patch coverage is 77.27273% with 10 lines in your changes missing coverage. Please review.

Project coverage is 42.60%. Comparing base (edd31bc) to head (841ac47).
Report is 41 commits behind head on main.

Files with missing lines Patch % Lines
...Api/AdminConsole/Controllers/PoliciesController.cs 63.63% 3 Missing and 1 partial ⚠️
...inConsole/Public/Controllers/PoliciesController.cs 0.00% 3 Missing ⚠️
...icies/PolicyValidators/SingleOrgPolicyValidator.cs 78.57% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4940      +/-   ##
==========================================
+ Coverage   42.57%   42.60%   +0.02%     
==========================================
  Files        1387     1389       +2     
  Lines       64653    64678      +25     
  Branches     5933     5937       +4     
==========================================
+ Hits        27528    27553      +25     
+ Misses      35903    35901       -2     
- Partials     1222     1224       +2     

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

@jrmccannon jrmccannon requested a review from eliykat October 30, 2024 16:01
@jrmccannon jrmccannon requested review from a team as code owners November 1, 2024 15:34
@rr-bw rr-bw requested review from ike-kottlowski and removed request for rr-bw November 4, 2024 20:01
@jrmccannon jrmccannon merged commit 1dec51b into main Nov 11, 2024
52 checks passed
@jrmccannon jrmccannon deleted the ac/pm-13014-add-toggle-property-to-policy branch November 11, 2024 15:52
cyprain-okeke pushed a commit that referenced this pull request Nov 12, 2024
…d on Policy Validators (#4940)

* Adding CanToggleState to PoliciesControllers (api/public) endpoints. Added mappings wrapped in feature flag.

* Updated logic for determining CanToggle. Removed setting of toggle from List endpoint. Added new details model for single policy response. Validator now returns after first error.
vgrassia pushed a commit to vgrassia/server that referenced this pull request Nov 21, 2024
…d on Policy Validators (bitwarden#4940)

* Adding CanToggleState to PoliciesControllers (api/public) endpoints. Added mappings wrapped in feature flag.

* Updated logic for determining CanToggle. Removed setting of toggle from List endpoint. Added new details model for single policy response. Validator now returns after first error.
vgrassia pushed a commit to vgrassia/server that referenced this pull request Nov 21, 2024
…d on Policy Validators (bitwarden#4940)

* Adding CanToggleState to PoliciesControllers (api/public) endpoints. Added mappings wrapped in feature flag.

* Updated logic for determining CanToggle. Removed setting of toggle from List endpoint. Added new details model for single policy response. Validator now returns after first error.
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.

5 participants