Skip to content

[PM-40514] Add UseRiskInsights Org ability check in all Access Intelligence v1 endpoints - #8258

Open
lastbestdev wants to merge 6 commits into
mainfrom
PM-40514/dirt/check-use-risk-insights-ai-v1
Open

[PM-40514] Add UseRiskInsights Org ability check in all Access Intelligence v1 endpoints #8258
lastbestdev wants to merge 6 commits into
mainfrom
PM-40514/dirt/check-use-risk-insights-ai-v1

Conversation

@lastbestdev

@lastbestdev lastbestdev commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-40514

📔 Objective

The request Organization must have the UseRiskInsights ability set to true in order to use Access Intelligence features. Some of the v1 endpoints were not checking this ability properly, and are patched in these changes.

One of the old v1 endpoints is removed, as it is not called anywhere by the clients codebase.

📸 Screenshots

N/A

@lastbestdev
lastbestdev requested a review from a team as a code owner August 25, 2026 23:50
@lastbestdev
lastbestdev requested a review from AlexRubik August 25, 2026 23:50
@github-actions

Copy link
Copy Markdown
Contributor

Claude Code is reviewing this pull request...

If this comment does not update with results, check the Actions log.

return Ok(response);
}

private async Task AuthorizeAsync(Guid organizationId)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note: all the same logic here, just moved private methods to the bottom of file to improve order

@lastbestdev lastbestdev added the t:bugfix Change Type - Bugfix label Aug 25, 2026
Comment on lines -136 to -159
/// <summary>
/// Adds a new record into PasswordHealthReportApplication
/// </summary>
/// <param name="request">A single instance of PasswordHealthReportApplication Model</param>
/// <returns>A single instance of PasswordHealthReportApplication</returns>
/// <exception cref="BadRequestException">If the organization Id is not valid</exception>
/// <exception cref="NotFoundException">If the user lacks access</exception>
[HttpPost("password-health-report-application")]
public async Task<PasswordHealthReportApplication> AddPasswordHealthReportApplication(
[FromBody] PasswordHealthReportApplicationModel request)
{
if (!await _currentContext.AccessReports(request.OrganizationId))
{
throw new NotFoundException();
}

var commandRequest = new AddPasswordHealthReportApplicationRequest
{
OrganizationId = request.OrganizationId,
Url = request.Url
};

return await _addPwdHealthReportAppCommand.AddPasswordHealthReportApplicationAsync(commandRequest);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note: this endpoint is removed as it is never called in the clients codebase. Only the endpoint for adding multiple critical applications at once is in use

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.38%. Comparing base (bc4ddd5) to head (842ee69).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../Dirt/Controllers/OrganizationReportsController.cs 83.33% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8258      +/-   ##
==========================================
+ Coverage   63.35%   63.38%   +0.03%     
==========================================
  Files        2429     2429              
  Lines      104830   104825       -5     
  Branches     9505     9504       -1     
==========================================
+ Hits        66416    66447      +31     
+ Misses      36137    36102      -35     
+ Partials     2277     2276       -1     

☔ 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

Labels

needs-qa t:bugfix Change Type - Bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants