Skip to content
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
6 changes: 0 additions & 6 deletions src/Areas/Identity/Pages/Account/LogOut.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
AuditEventType.Success,
AuditObjectType.User,
userId,
userId,
username,
HttpContextAccessor.HttpContext.GetClientIpAddress(),
new { Username = username });
}

Expand All @@ -42,9 +39,6 @@
AuditEventType.Success,
AuditObjectType.User,
userId,
userId,
username,
HttpContextAccessor.HttpContext.GetClientIpAddress(),
new { Username = username });
}

Expand Down
9 changes: 0 additions & 9 deletions src/Areas/Identity/Pages/Account/Login.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ await _auditService.LogAsync(
AuditEventType.Success,
AuditObjectType.User,
user?.Id,
user?.Id,
Input.Username,
HttpContext.GetClientIpAddress(),
new { Username = Input.Username });
return LocalRedirect(returnUrl);
}
Expand All @@ -158,9 +155,6 @@ await _auditService.LogAsync(
AuditEventType.Failure,
AuditObjectType.User,
null,
null,
Input.Username,
HttpContext.GetClientIpAddress(),
new { Username = Input.Username, Reason = "Account locked out" });
return RedirectToPage("./Lockout");
}
Expand All @@ -171,9 +165,6 @@ await _auditService.LogAsync(
AuditEventType.Failure,
AuditObjectType.User,
null,
null,
Input.Username,
HttpContext.GetClientIpAddress(),
new { Username = Input.Username, Reason = "Invalid credentials" });
ModelState.AddModelError(string.Empty, "Invalid login attempt.");
return Page();
Expand Down
16 changes: 3 additions & 13 deletions src/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Identity;
using NodeGuard.Services;
using NodeGuard.Helpers;

namespace NodeGuard.Areas.Identity.Pages.Account
{
Expand Down Expand Up @@ -118,10 +117,7 @@ await _auditService.LogAsync(
AuditActionType.TwoFactorLogin,
AuditEventType.Success,
AuditObjectType.User,
userId,
userId,
user.UserName,
HttpContext.GetClientIpAddress(),
objectId: userId,
new { Username = user.UserName });
return LocalRedirect(returnUrl);
}
Expand All @@ -132,10 +128,7 @@ await _auditService.LogAsync(
AuditActionType.TwoFactorLogin,
AuditEventType.Failure,
AuditObjectType.User,
userId,
userId,
user.UserName,
HttpContext.GetClientIpAddress(),
objectId: userId,
new { Username = user.UserName, Reason = "Account locked out" });
return RedirectToPage("./Lockout");
}
Expand All @@ -146,10 +139,7 @@ await _auditService.LogAsync(
AuditActionType.TwoFactorLogin,
AuditEventType.Failure,
AuditObjectType.User,
userId,
userId,
user.UserName,
HttpContext.GetClientIpAddress(),
objectId: userId,
new { Username = user.UserName, Reason = "Invalid authenticator code" });
ModelState.AddModelError(string.Empty, "Invalid authenticator code.");
return Page();
Expand Down
30 changes: 0 additions & 30 deletions src/Pages/ChannelRequests.razor
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@
TemplatePsbtString="@_templatePSBTString"
SignedPSBT="@_psbt"/>

<CancelOrRejectPopup

Check warning on line 417 in src/Pages/ChannelRequests.razor

View workflow job for this annotation

GitHub Actions / build-and-test

Component 'CancelOrRejectPopup' expects a value for the parameter 'Reason', but a value may not have been provided.
@ref=@_rejectCancelModalRef
Title='@(_selectedStatusActionString + " operation: " + _selectedRequest?.Id)'
Validator="@RejectReasonValidator"
Expand Down Expand Up @@ -724,9 +724,6 @@
AuditEventType.Success,
AuditObjectType.ChannelOperationRequest,
request.Id.ToString(),
LoggedUser.Id,
LoggedUser.UserName,
HttpContextAccessor.HttpContext?.GetClientIpAddress(),
new { Amount = amount, SourceNodeId = _selectedSourceNodeId, DestNodeId = _selectedDestNode?.Id, Description = $"Channel open request created. Amount: {amount} BTC, SourceNodeId: {_selectedSourceNodeId}, DestNodeId: {_selectedDestNode?.Id}" });

if (_selectedUTXOs.Count > 0)
Expand All @@ -742,9 +739,6 @@
AuditEventType.Failure,
AuditObjectType.ChannelOperationRequest,
null,
LoggedUser.Id,
LoggedUser.UserName,
HttpContextAccessor.HttpContext?.GetClientIpAddress(),
new { Error = createChannelResult.Item2, Description = $"Failed to create channel open request. Error: {createChannelResult.Item2}" });
}
_utxoSelectorModalRef.ClearModal();
Expand Down Expand Up @@ -803,9 +797,6 @@
AuditEventType.Failure,
AuditObjectType.ChannelOperationRequest,
_selectedRequest.Id.ToString(),
LoggedUser.Id,
LoggedUser.UserName,
HttpContextAccessor.HttpContext?.GetClientIpAddress(),
new { RequestId = _selectedRequest.Id, Status = _selectedStatus, Description = $"Failed to {_selectedStatus.ToString().ToLower()} channel operation request" });
}
else
Expand All @@ -817,9 +808,6 @@
AuditEventType.Success,
AuditObjectType.ChannelOperationRequest,
_selectedRequest.Id.ToString(),
LoggedUser.Id,
LoggedUser.UserName,
HttpContextAccessor.HttpContext?.GetClientIpAddress(),
new { RequestId = _selectedRequest.Id, Status = _selectedStatus, Reason = _selectedRequest.ClosingReason, Description = $"Channel operation request {_selectedStatus.ToString().ToLower()}" });
await FetchRequests();
}
Expand Down Expand Up @@ -892,9 +880,6 @@
AuditEventType.Success,
AuditObjectType.ChannelOperationRequest,
_selectedRequest.Id.ToString(),
LoggedUser.Id,
LoggedUser.UserName,
HttpContextAccessor.HttpContext?.GetClientIpAddress(),
new { RequestId = _selectedRequest.Id, Description = "PSBT signature collected for channel operation request" });

_selectedRequest = await ChannelOperationRequestRepository.GetById(_selectedRequest.Id);
Expand All @@ -913,9 +898,6 @@
AuditEventType.Failure,
AuditObjectType.ChannelOperationRequest,
_selectedRequest.Id.ToString(),
LoggedUser.Id,
LoggedUser.UserName,
HttpContextAccessor.HttpContext?.GetClientIpAddress(),
new { RequestId = _selectedRequest.Id, Description = "Failed to save PSBT signature for channel operation request" });
}

Expand Down Expand Up @@ -955,9 +937,6 @@
AuditEventType.Success,
AuditObjectType.ChannelOperationRequest,
_selectedRequest.Id.ToString(),
LoggedUser.Id,
LoggedUser.UserName,
HttpContextAccessor.HttpContext?.GetClientIpAddress(),
new { Amount = new Money(_selectedRequest.SatsAmount).ToUnit(MoneyUnit.BTC), SourceNodeId = _selectedRequest.SourceNodeId, DestNodeId = _selectedRequest.DestNodeId, IsHotWallet = true, Description = "Hot wallet channel open request created" });
}
else
Expand All @@ -968,9 +947,6 @@
AuditEventType.Failure,
AuditObjectType.ChannelOperationRequest,
null,
LoggedUser.Id,
LoggedUser.UserName,
HttpContextAccessor.HttpContext?.GetClientIpAddress(),
new { Error = createChannelResult.Item2, IsHotWallet = true, Description = "Failed to create hot wallet channel open request" });
_utxoSelectorModalRef.ClearModal();
await _approveOperationConfirmationModal.CloseModal();
Expand Down Expand Up @@ -1070,9 +1046,6 @@
AuditEventType.Success,
AuditObjectType.ChannelOperationRequest,
request.Id.ToString(),
LoggedUser.Id,
LoggedUser.UserName,
HttpContextAccessor.HttpContext?.GetClientIpAddress(),
new { RequestId = request.Id, NewStatus = ChannelOperationRequestStatus.Failed, Description = "Channel operation request marked as failed" });
}
catch (Exception? e)
Expand All @@ -1083,9 +1056,6 @@
AuditEventType.Failure,
AuditObjectType.ChannelOperationRequest,
_selectedRequestForMarkingAsFailed?.Id.ToString(),
LoggedUser?.Id,
LoggedUser?.UserName,
HttpContextAccessor.HttpContext?.GetClientIpAddress(),
new { RequestId = _selectedRequestForMarkingAsFailed?.Id, Description = "Failed to mark channel operation request as failed" });
}
finally
Expand Down
24 changes: 12 additions & 12 deletions src/Pages/Channels.razor
Original file line number Diff line number Diff line change
Expand Up @@ -505,14 +505,14 @@
{
ToastService.ShowError("Something went wrong");
await AuditService.LogAsync(actionType, AuditEventType.Failure, AuditObjectType.Channel,
channel.Id.ToString(), LoggedUser?.Id, LoggedUser?.UserName, null,
channel.Id.ToString(),
$"Failed to {(forceClose ? "force " : "")}close channel. ChanId: {channel.ChanId}");
}
else
{
ToastService.ShowSuccess("Channel closed successfully");
await AuditService.LogAsync(actionType, AuditEventType.Success, AuditObjectType.Channel,
channel.Id.ToString(), LoggedUser?.Id, LoggedUser?.UserName, null,
channel.Id.ToString(),
$"Channel {(forceClose ? "force " : "")}closed. ChanId: {channel.ChanId}");
await FetchData();
}
Expand Down Expand Up @@ -615,14 +615,14 @@
{
ToastService.ShowError("Something went wrong");
await AuditService.LogAsync(AuditActionType.Update, AuditEventType.Failure, AuditObjectType.Channel,
_selectedChannel.Id.ToString(), LoggedUser?.Id, LoggedUser?.UserName, null,
_selectedChannel.Id.ToString(),
$"Failed to update channel. ChanId: {_selectedChannel.ChanId}");
}
else
{
ToastService.ShowSuccess("Channel updated successfully");
await AuditService.LogAsync(AuditActionType.Update, AuditEventType.Success, AuditObjectType.Channel,
_selectedChannel.Id.ToString(), LoggedUser?.Id, LoggedUser?.UserName, null,
_selectedChannel.Id.ToString(),
$"Channel updated. ChanId: {_selectedChannel.ChanId}");
}
}
Expand All @@ -637,14 +637,14 @@
{
ToastService.ShowError("Something went wrong");
await AuditService.LogAsync(AuditActionType.Create, AuditEventType.Failure, AuditObjectType.LiquidityRule,
_currentLiquidityRule.ChannelId.ToString(), LoggedUser?.Id, LoggedUser?.UserName, null,
_currentLiquidityRule.ChannelId.ToString(),
$"Failed to add liquidity rule for channel. ChannelId: {_currentLiquidityRule.ChannelId}");
}
else
{
ToastService.ShowSuccess("Liquidity rule added successfully");
await AuditService.LogAsync(AuditActionType.Create, AuditEventType.Success, AuditObjectType.LiquidityRule,
_currentLiquidityRule.Id.ToString(), LoggedUser?.Id, LoggedUser?.UserName, null,
_currentLiquidityRule.Id.ToString(),
$"Liquidity rule created. ChannelId: {_currentLiquidityRule.ChannelId}, MinLocal: {_currentLiquidityRule.MinimumLocalBalance}%, MinRemote: {_currentLiquidityRule.MinimumRemoteBalance}%, Target: {_currentLiquidityRule.RebalanceTarget}%");
}
}
Expand All @@ -655,14 +655,14 @@
{
ToastService.ShowError("Something went wrong");
await AuditService.LogAsync(AuditActionType.Update, AuditEventType.Failure, AuditObjectType.LiquidityRule,
_currentLiquidityRule.Id.ToString(), LoggedUser?.Id, LoggedUser?.UserName, null,
_currentLiquidityRule.Id.ToString(),
$"Failed to update liquidity rule. RuleId: {_currentLiquidityRule.Id}");
}
else
{
ToastService.ShowSuccess("Liquidity rule updated successfully");
await AuditService.LogAsync(AuditActionType.Update, AuditEventType.Success, AuditObjectType.LiquidityRule,
_currentLiquidityRule.Id.ToString(), LoggedUser?.Id, LoggedUser?.UserName, null,
_currentLiquidityRule.Id.ToString(),
$"Liquidity rule updated. ChannelId: {_currentLiquidityRule.ChannelId}, MinLocal: {_currentLiquidityRule.MinimumLocalBalance}%, MinRemote: {_currentLiquidityRule.MinimumRemoteBalance}%, Target: {_currentLiquidityRule.RebalanceTarget}%");
}
}
Expand Down Expand Up @@ -735,14 +735,14 @@
{
ToastService.ShowError("Something went wrong");
await AuditService.LogAsync(actionType, AuditEventType.Failure, AuditObjectType.Channel,
_selectedChannel.Id.ToString(), LoggedUser?.Id, LoggedUser?.UserName, null,
_selectedChannel.Id.ToString(),
$"Failed to {(enabledLiquidityMngmt ? "enable" : "disable")} liquidity management. ChanId: {_selectedChannel.ChanId}");
}
else
{
ToastService.ShowSuccess("Channel updated successfully");
await AuditService.LogAsync(actionType, AuditEventType.Success, AuditObjectType.Channel,
_selectedChannel.Id.ToString(), LoggedUser?.Id, LoggedUser?.UserName, null,
_selectedChannel.Id.ToString(),
$"Liquidity management {(enabledLiquidityMngmt ? "enabled" : "disabled")}. ChanId: {_selectedChannel.ChanId}");
}
}
Expand Down Expand Up @@ -908,14 +908,14 @@
{
ToastService.ShowSuccess("Channel marked as closed");
await AuditService.LogAsync(AuditActionType.MarkAsClosed, AuditEventType.Success, AuditObjectType.Channel,
contextItem.Id.ToString(), LoggedUser?.Id, LoggedUser?.UserName, null,
contextItem.Id.ToString(),
$"Channel marked as closed. ChanId: {contextItem.ChanId}");
}
else
{
ToastService.ShowError("Something went wrong: " + result.Item2);
await AuditService.LogAsync(AuditActionType.MarkAsClosed, AuditEventType.Failure, AuditObjectType.Channel,
contextItem.Id.ToString(), LoggedUser?.Id, LoggedUser?.UserName, null,
contextItem.Id.ToString(),
$"Failed to mark channel as closed. ChanId: {contextItem.ChanId}. Error: {result.Item2}");
}

Expand Down
15 changes: 0 additions & 15 deletions src/Pages/Nodes.razor
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,6 @@
AuditEventType.Success,
AuditObjectType.Node,
arg.Item.Id.ToString(),
LoggedUser?.Id,
LoggedUser?.UserName,
null,
new { Name = arg.Item.Name, PubKey = arg.Item.PubKey });
}
else
Expand All @@ -629,9 +626,6 @@
AuditEventType.Failure,
AuditObjectType.Node,
null,
LoggedUser?.Id,
LoggedUser?.UserName,
null,
new { Name = arg.Item.Name, PubKey = arg.Item.PubKey, Error = addResult.Item2 });
}
}
Expand All @@ -656,9 +650,6 @@
AuditEventType.Success,
AuditObjectType.Node,
arg.Item.Id.ToString(),
LoggedUser?.Id,
LoggedUser?.UserName,
null,
new { Name = arg.Item.Name, PubKey = arg.Item.PubKey });
}
else
Expand All @@ -669,9 +660,6 @@
AuditEventType.Failure,
AuditObjectType.Node,
arg.Item.Id.ToString(),
LoggedUser?.Id,
LoggedUser?.UserName,
null,
new { Name = arg.Item.Name, PubKey = arg.Item.PubKey, Error = updateResult.Item2 });
}
}
Expand Down Expand Up @@ -722,9 +710,6 @@
AuditEventType.Success,
AuditObjectType.Node,
node.Id.ToString(),
LoggedUser?.Id,
LoggedUser?.UserName,
null,
new { NodeName = node.Name, PubKey = node.PubKey });
_nodes = await NodeRepository.GetAll();

Expand Down
Loading
Loading