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

- Security Optimization #126

Merged
merged 1 commit into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ It leverages `SignalR` for real-time monitoring and `LiteDb` a Serverless MongoD
Install via .NET CLI

```bash
dotnet add package WatchDog.NET --version 1.4.9
dotnet add package WatchDog.NET --version 1.4.10
```
Install via Package Manager

```bash
Install-Package WatchDog.NET --version 1.4.9
Install-Package WatchDog.NET --version 1.4.10
```


Expand Down
2 changes: 1 addition & 1 deletion WatchDog/WatchDog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Authors>Israel Ulelu, Kelechi Onyekwere</Authors>
<PackageId>WatchDog.NET</PackageId>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>1.4.9</Version>
<Version>1.4.10</Version>
<PackageReleaseNotes>- Security Optimization
- Query Filters Fixes and Optimizations
- Package Assembly as DB Name Fix(MongoDB)</PackageReleaseNotes>
Expand Down
5 changes: 2 additions & 3 deletions WatchDog/WatchDogExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public static class WatchDogExtension

public static IServiceCollection AddWatchDogServices(this IServiceCollection services, [Optional] Action<WatchDogSettings> configureOptions)
{
string mongoDbName = Assembly.GetCallingAssembly().GetName().Name.Replace('.', '_') + "_WatchDogDB";
var options = new WatchDogSettings();
if (configureOptions != null)
configureOptions(options);
Expand All @@ -35,7 +34,7 @@ public static IServiceCollection AddWatchDogServices(this IServiceCollection ser
AutoClearModel.ClearTimeSchedule = options.ClearTimeSchedule;
WatchDogExternalDbConfig.ConnectionString = options.SetExternalDbConnString;
WatchDogDatabaseDriverOption.DatabaseDriverOption = options.DbDriverOption;
WatchDogExternalDbConfig.MongoDbName = mongoDbName;
WatchDogExternalDbConfig.MongoDbName = Assembly.GetCallingAssembly().GetName().Name?.Replace('.', '_') + "_WatchDogDB";

if (!string.IsNullOrEmpty(WatchDogExternalDbConfig.ConnectionString) && WatchDogDatabaseDriverOption.DatabaseDriverOption == 0)
throw new WatchDogDBDriverException("Missing DB Driver Option: DbDriverOption is required at .AddWatchDogServices()");
Expand Down Expand Up @@ -64,7 +63,7 @@ public static IServiceCollection AddWatchDogServices(this IServiceCollection ser
{
if (WatchDogDatabaseDriverOption.DatabaseDriverOption == src.Enums.WatchDogDbDriverEnum.Mongo)
{
ExternalDbContext.MigrateNoSql(mongoDbName);
ExternalDbContext.MigrateNoSql();
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions WatchDog/src/Data/ExternalDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ public static void BootstrapTables()

}

public static void MigrateNoSql(string databaseName)
public static void MigrateNoSql()
{
try
{
var mongoClient = CreateMongoDBConnection();
var database = mongoClient.GetDatabase(databaseName);
var database = mongoClient.GetDatabase(WatchDogExternalDbConfig.MongoDbName);
_ = database.GetCollection<WatchLog>(Constants.WatchLogTableName);
_ = database.GetCollection<WatchExceptionLog>(Constants.WatchLogExceptionTableName);
_ = database.GetCollection<WatchLoggerModel>(Constants.LogsTableName);
Expand Down
2 changes: 1 addition & 1 deletion WatchDog/src/Models/WatchDogConfigModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class WatchDogSettings
public static class WatchDogExternalDbConfig
{
public static string ConnectionString { get; set; } = string.Empty;
public static string MongoDbName { get; set; } = string.Empty;
public static string MongoDbName { get; set; } = "WatchDogDb";
}

public static class WatchDogDatabaseDriverOption
Expand Down