mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 09:32:48 -05:00
[AC-1654] idor allow the attacker to disable any one scim provising (#3325)
* [AC-1654] Added IOrganizationConnectionRepository.GetByIdOrganizationIdAsync and modified OrganizationConnectionsController to use it to get a connection matching both Id and OrganizationId * [AC-1654] Fixed unit tests
This commit is contained in:
@ -14,6 +14,23 @@ public class OrganizationConnectionRepository : Repository<OrganizationConnectio
|
||||
: base(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
|
||||
{ }
|
||||
|
||||
public async Task<OrganizationConnection> GetByIdOrganizationIdAsync(Guid id, Guid organizationId)
|
||||
{
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.QueryAsync<OrganizationConnection>(
|
||||
$"[{Schema}].[OrganizationConnection_ReadByIdOrganizationId]",
|
||||
new
|
||||
{
|
||||
Id = id,
|
||||
OrganizationId = organizationId
|
||||
},
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
return results.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<OrganizationConnection>> GetByOrganizationIdTypeAsync(Guid organizationId, OrganizationConnectionType type)
|
||||
{
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
|
Reference in New Issue
Block a user