Skip to content

Commit 1cc64c8

Browse files
authored
Fixing Issues & Security Hotspots from SonarQube (#85)
1 parent a188aea commit 1cc64c8

File tree

6 files changed

+24
-26
lines changed

6 files changed

+24
-26
lines changed

src/OneGround.ZGW.Autorisaties.Common/BusinessRules/ApplicatieBusinessRuleService.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public async Task<bool> ValidateUpdateAsync(
5656
}
5757

5858
//ac-001
59-
private async Task ValidateClientIdsUniquenessAsync(Applicatie applicatie, List<ValidationError> errors, Guid existingId = new Guid())
59+
private async Task ValidateClientIdsUniquenessAsync(Applicatie applicatie, List<ValidationError> errors, Guid existingId = default)
6060
{
6161
var uniqueClientIds = applicatie.ClientIds.Select(c => c.ClientId.ToLower()).Distinct().ToList();
6262
var duplicateClientIdApplicatie = await _context.Applicaties.FirstOrDefaultAsync(a =>
@@ -192,18 +192,19 @@ private static void ValidateBrcComponentRules(
192192
bool checkComponentUrl = true
193193
)
194194
{
195-
if (applicatieAutorisatie.Scopes.Any(s => s.StartsWith("besluiten.")))
195+
if (
196+
applicatieAutorisatie.Scopes.Any(s => s.StartsWith("besluiten."))
197+
&& checkComponentUrl
198+
&& string.IsNullOrEmpty(applicatieAutorisatie.BesluitType)
199+
)
196200
{
197-
if (checkComponentUrl && string.IsNullOrEmpty(applicatieAutorisatie.BesluitType))
198-
{
199-
validationErrors.Add(
200-
new ValidationError(
201-
$"autorisaties.{index}.besluittype",
202-
ErrorCode.Required,
203-
$"This field is required if `component` is {applicatieAutorisatie.Component}"
204-
)
205-
);
206-
}
201+
validationErrors.Add(
202+
new ValidationError(
203+
$"autorisaties.{index}.besluittype",
204+
ErrorCode.Required,
205+
$"This field is required if `component` is {applicatieAutorisatie.Component}"
206+
)
207+
);
207208
}
208209
}
209210

src/OneGround.ZGW.Besluiten.Web/Handlers/v1/CreateBesluitCommandHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public async Task<CommandResult<Besluit>> Handle(CreateBesluitCommand request, C
130130
if (!zaakBesluit.Success)
131131
{
132132
_logger.LogError(
133-
"Could not add zaak-besluit to ZRC. Zaak url={zaak}; Besluit={besluit.Url}. Status={status}. Error={detail}.",
133+
"Could not add zaak-besluit to ZRC. Zaak url={zaak}; Besluit={besluit}. Status={status}. Error={detail}.",
134134
besluit.Zaak,
135135
besluit.Url,
136136
zaakBesluit.Error.Status,

src/OneGround.ZGW.Catalogi.ServiceAgent/v1/3/CatalogiServiceAgent.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@ public Task<ServiceAgentResponse<CatalogusResponseDto>> GetCatalogusAsync(string
4949
}
5050

5151
public Task<ServiceAgentResponse<PagedResponse<CatalogusResponseDto>>> GetCatalogussenAsync(
52-
Contracts.v1.Queries.GetAllCatalogussenQueryParameters queryParameters,
52+
Contracts.v1.Queries.GetAllCatalogussenQueryParameters parameters,
5353
int page = 1
5454
)
5555
{
56-
return GetPagedResponseAsync<CatalogusResponseDto>("/catalogussen", queryParameters, page);
56+
return GetPagedResponseAsync<CatalogusResponseDto>("/catalogussen", parameters, page);
5757
}
5858

5959
public Task<ServiceAgentResponse<PagedResponse<ZaakTypeResponseDto>>> GetZaakTypenAsync(
60-
Contracts.v1.Queries.GetAllZaakTypenQueryParameters queryParameters,
60+
Contracts.v1.Queries.GetAllZaakTypenQueryParameters parameters,
6161
int page = 1
6262
)
6363
{
64-
return GetPagedResponseAsync<ZaakTypeResponseDto>("/zaaktypen", queryParameters, page);
64+
return GetPagedResponseAsync<ZaakTypeResponseDto>("/zaaktypen", parameters, page);
6565
}
6666

6767
public Task<ServiceAgentResponse<ZaakTypeResponseDto>> GetZaakTypeByUrlAsync(string zaakTypeUrl)

src/OneGround.ZGW.Catalogi.ServiceAgent/v1/CatalogiServiceAgent.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,9 @@ public async Task<ServiceAgentResponse<CatalogusResponseDto>> GetCatalogusAsync(
3333
return await GetAsync<CatalogusResponseDto>(new Uri(catalogusUrl));
3434
}
3535

36-
public Task<ServiceAgentResponse<PagedResponse<ZaakTypeResponseDto>>> GetZaakTypenAsync(
37-
GetAllZaakTypenQueryParameters queryParameters,
38-
int page = 1
39-
)
36+
public Task<ServiceAgentResponse<PagedResponse<ZaakTypeResponseDto>>> GetZaakTypenAsync(GetAllZaakTypenQueryParameters parameters, int page = 1)
4037
{
41-
return GetPagedResponseAsync<ZaakTypeResponseDto>("/zaaktypen", queryParameters, page);
38+
return GetPagedResponseAsync<ZaakTypeResponseDto>("/zaaktypen", parameters, page);
4239
}
4340

4441
public async Task<ServiceAgentResponse<ZaakTypeResponseDto>> GetZaakTypeByUrlAsync(string zaakTypeUrl)

src/OneGround.ZGW.Catalogi.Web/Handlers/v1/3/Extensions/StatusTypeExensionMethods.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public static bool CanBeUpdated(this StatusType statustype, StatusType other)
1717
&& statustype.VolgNummer == other.VolgNummer
1818
&& statustype.IsEindStatus == other.IsEindStatus
1919
&& statustype.Informeren == other.Informeren
20-
&& statustype.Doorlooptijd == statustype.Doorlooptijd
21-
&& statustype.StatusTekst == statustype.StatusTekst
22-
&& statustype.Toelichting == statustype.Toelichting;
20+
&& statustype.Doorlooptijd == other.Doorlooptijd
21+
&& statustype.StatusTekst == other.StatusTekst
22+
&& statustype.Toelichting == other.Toelichting;
2323
}
2424
}

src/OneGround.ZGW.Common.ServiceAgent/ZGWServiceAgent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ private void LogUnsuccessfulResponse(HttpResponseMessage response)
181181
{
182182
if (response.Headers.WwwAuthenticate.Count > 0)
183183
{
184-
Logger.LogError("Request unauthorized. WWW-Authenticate: {response.Headers.WwwAuthenticate}", response.Headers.WwwAuthenticate);
184+
Logger.LogError("Request unauthorized. WWW-Authenticate: {WwwAuthenticate}", response.Headers.WwwAuthenticate);
185185
}
186186
}
187187
}

0 commit comments

Comments
 (0)