Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2149 from IEvangelist/cleanup
Browse files Browse the repository at this point in the history
Fix security issue (warning) with Yarp package / cleanup
  • Loading branch information
jamesmontemagno authored Sep 11, 2023
2 parents b9aae67 + d87c089 commit 3c15e6a
Show file tree
Hide file tree
Showing 58 changed files with 108 additions and 154 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<IsPublishable>false</IsPublishable>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using System.Linq;
using Xunit;

namespace EventBus.Tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using System.Threading.Tasks;

namespace EventBus.Tests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using System.Threading.Tasks;

namespace EventBus.Tests
{
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@
<PackageVersion Include="System.Reflection.TypeExtensions" Version="4.7.0" />
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageVersion Include="Yarp.ReverseProxy" Version="2.0.0" />
<PackageVersion Include="Yarp.ReverseProxy" Version="2.0.1" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public OrderStartedIntegrationEventHandler(

public async Task Handle(OrderStartedIntegrationEvent @event)
{
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new("IntegrationEventContext", @event.Id) }))
{
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public ProductPriceChangedIntegrationEventHandler(

public async Task Handle(ProductPriceChangedIntegrationEvent @event)
{
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new("IntegrationEventContext", @event.Id) }))
{
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<IsPublishable>false</IsPublishable>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Services/Basket/Basket.FunctionalTests/BasketScenarios.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Basket.FunctionalTests;

public class BasketScenarios :
public class BasketScenarios :
BasketScenarioBase
{
[Fact]
Expand Down Expand Up @@ -33,7 +33,7 @@ await server.CreateClient()

var contentCheckout = new StringContent(BuildCheckout(), UTF8Encoding.UTF8, "application/json")
{
Headers = { { "x-requestid", Guid.NewGuid().ToString() } }
Headers = { { "x-requestid", Guid.NewGuid().ToString() } }
};

var response = await server.CreateClient()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
<IsPublishable>false</IsPublishable>
<IsPackable>false</IsPackable>
Expand Down
16 changes: 8 additions & 8 deletions src/Services/Basket/Basket.UnitTests/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
global using Basket.API.IntegrationEvents.Events;
global using System;
global using System.Collections.Generic;
global using System.Security.Claims;
global using System.Threading.Tasks;
global using Basket.API.IntegrationEvents.Events;
global using Basket.API.Model;
global using Microsoft.AspNetCore.Http;
global using Microsoft.AspNetCore.Mvc;
global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
global using Microsoft.eShopOnContainers.Services.Basket.API.Controllers;
global using Microsoft.eShopOnContainers.WebMVC.Controllers;
global using Microsoft.eShopOnContainers.WebMVC.Services;
global using Microsoft.eShopOnContainers.WebMVC.ViewModels;
global using Microsoft.Extensions.Logging;
global using Moq;
global using System;
global using System.Collections.Generic;
global using System.Security.Claims;
global using System.Threading.Tasks;
global using Xunit;
global using IBasketIdentityService = Microsoft.eShopOnContainers.Services.Basket.API.Services.IIdentityService;
global using Microsoft.eShopOnContainers.WebMVC.Controllers;
global using Microsoft.eShopOnContainers.WebMVC.Services;
global using Microsoft.eShopOnContainers.WebMVC.ViewModels;
global using BasketModel = Microsoft.eShopOnContainers.WebMVC.ViewModels.Basket;
4 changes: 1 addition & 3 deletions src/Services/Catalog/Catalog.API/Apis/PicApi.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Microsoft.AspNetCore.Routing;

namespace Catalog.API.Apis;
namespace Catalog.API.Apis;

public static class PicApi
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public OrderStatusChangedToAwaitingValidationIntegrationEventHandler(
{
_catalogContext = catalogContext;
_catalogIntegrationEventService = catalogIntegrationEventService;
_logger = logger ?? throw new System.ArgumentNullException(nameof(logger));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}

public async Task Handle(OrderStatusChangedToAwaitingValidationIntegrationEvent @event)
{
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new("IntegrationEventContext", @event.Id) }))
{
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ public OrderStatusChangedToPaidIntegrationEventHandler(
ILogger<OrderStatusChangedToPaidIntegrationEventHandler> logger)
{
_catalogContext = catalogContext;
_logger = logger ?? throw new System.ArgumentNullException(nameof(logger));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}

public async Task Handle(OrderStatusChangedToPaidIntegrationEvent @event)
{
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new("IntegrationEventContext", @event.Id) }))
{
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<IsPublishable>false</IsPublishable>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.AspNetCore.Mvc.Testing;

namespace Catalog.FunctionalTests;

public class CatalogScenariosBase
public class CatalogScenariosBase
{
private class CatalogApplication : WebApplicationFactory<Program>
{
Expand Down
16 changes: 4 additions & 12 deletions src/Services/Catalog/Catalog.FunctionalTests/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
global using Microsoft.AspNetCore.Hosting;
global using System.IO;
global using System.Net;
global using System.Threading.Tasks;
global using Microsoft.AspNetCore.Hosting;
global using Microsoft.AspNetCore.TestHost;
global using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
global using Microsoft.eShopOnContainers.Services.Catalog.API.Extensions;
global using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
global using Microsoft.eShopOnContainers.Services.Catalog.API;
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Hosting;
global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Options;
global using System.IO;
global using System.Net;
global using System.Reflection;
global using System.Threading.Tasks;
global using Xunit;
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
using Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.Services.Catalog.API;
using Microsoft.eShopOnContainers.Services.Catalog.API.Controllers;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
using Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents;
using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
using Microsoft.eShopOnContainers.Services.Catalog.API.ViewModel;
using Microsoft.Extensions.Options;
using Moq;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;

namespace UnitTest.Catalog.Application;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
<IsPublishable>false</IsPublishable>
<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Identity/Identity.API/SeedData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ await retryPolicy.ExecuteAsync(async () =>
});
}

private static AsyncPolicy CreateRetryPolicy(IConfiguration configuration, Microsoft.Extensions.Logging.ILogger logger)
private static AsyncPolicy CreateRetryPolicy(IConfiguration configuration, ILogger logger)
{
var retryMigrations = false;
bool.TryParse(configuration["RetryMigrations"], out retryMigrations);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ await strategy.ExecuteAsync(async () =>
Guid transactionId;
await using var transaction = await _dbContext.BeginTransactionAsync();
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("TransactionContext", transaction.TransactionId) }))
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new("TransactionContext", transaction.TransactionId) }))
{
_logger.LogInformation("Begin transaction {TransactionId} for {CommandName} ({@Command})", transaction.TransactionId, typeName, request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public GracePeriodConfirmedIntegrationEventHandler(
ILogger<GracePeriodConfirmedIntegrationEventHandler> logger)
{
_mediator = mediator;
_logger = logger ?? throw new System.ArgumentNullException(nameof(logger));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}

/// <summary>
Expand All @@ -23,7 +23,7 @@ public GracePeriodConfirmedIntegrationEventHandler(
/// <returns></returns>
public async Task Handle(GracePeriodConfirmedIntegrationEvent @event)
{
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new("IntegrationEventContext", @event.Id) }))
{
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public OrderPaymentFailedIntegrationEventHandler(

public async Task Handle(OrderPaymentFailedIntegrationEvent @event)
{
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new("IntegrationEventContext", @event.Id) }))
{
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public OrderPaymentSucceededIntegrationEventHandler(

public async Task Handle(OrderPaymentSucceededIntegrationEvent @event)
{
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new("IntegrationEventContext", @event.Id) }))
{
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public OrderStockConfirmedIntegrationEventHandler(

public async Task Handle(OrderStockConfirmedIntegrationEvent @event)
{
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new("IntegrationEventContext", @event.Id) }))
{
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ public OrderStockRejectedIntegrationEventHandler(
ILogger<OrderStockRejectedIntegrationEventHandler> logger)
{
_mediator = mediator;
_logger = logger ?? throw new System.ArgumentNullException(nameof(logger));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}

public async Task Handle(OrderStockRejectedIntegrationEvent @event)
{
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new("IntegrationEventContext", @event.Id) }))
{
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ public UserCheckoutAcceptedIntegrationEventHandler(
/// <returns></returns>
public async Task Handle(UserCheckoutAcceptedIntegrationEvent @event)
{
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new("IntegrationEventContext", @event.Id) }))
{
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);

var result = false;

if (@event.RequestId != Guid.Empty)
{
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IdentifiedCommandId", @event.RequestId) }))
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new("IdentifiedCommandId", @event.RequestId) }))
{
var createOrderCommand = new CreateOrderCommand(@event.Basket.Items, @event.UserId, @event.UserName, @event.City, @event.Street,
@event.State, @event.Country, @event.ZipCode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Validations;

using static Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands.CreateOrderCommand;

public class CreateOrderCommandValidator : AbstractValidator<CreateOrderCommand>
{
public CreateOrderCommandValidator(ILogger<CreateOrderCommandValidator> logger)
Expand Down
5 changes: 2 additions & 3 deletions src/Services/Ordering/Ordering.API/Grpc/OrderingService.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using GrpcOrdering;

using OrderDraftDTO = GrpcOrdering.OrderDraftDTO;
using CreateOrderDraftCommand = GrpcOrdering.CreateOrderDraftCommand;
using BasketItem = GrpcOrdering.BasketItem;
using CreateOrderDraftCommand = GrpcOrdering.CreateOrderDraftCommand;
using OrderDraftDTO = GrpcOrdering.OrderDraftDTO;
using OrderItemDTO = GrpcOrdering.OrderItemDTO;

public class OrderingService : OrderingGrpc.OrderingGrpcBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-Ordering.BackgroundTasks-9D3E1DD6-405B-447F-8AAB-1708B36D260E</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Threading;
using System.Threading.Tasks;
using System.Data.SqlClient;
using Dapper;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.Extensions.Options;
Expand Down
Loading

0 comments on commit 3c15e6a

Please sign in to comment.