From 33a15bc6f1efeaae4c463570536456996657243b Mon Sep 17 00:00:00 2001 From: Sergey White Date: Thu, 23 May 2024 14:06:20 +0300 Subject: [PATCH] fix: missed protocol field for finding object --- ethereum-steth/src/services/gate-seal/GateSeal.srv.ts | 8 ++++++++ .../src/services/steth_operation/StethOperation.srv.ts | 9 ++++++++- ethereum-steth/src/services/vault/Vault.srv.ts | 7 +++++++ .../src/services/withdrawals/Withdrawals.srv.ts | 10 ++++++++++ ethereum-steth/src/utils/errors.ts | 2 ++ 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/ethereum-steth/src/services/gate-seal/GateSeal.srv.ts b/ethereum-steth/src/services/gate-seal/GateSeal.srv.ts index 7b7116a0..ee6db1cf 100644 --- a/ethereum-steth/src/services/gate-seal/GateSeal.srv.ts +++ b/ethereum-steth/src/services/gate-seal/GateSeal.srv.ts @@ -64,6 +64,7 @@ export class GateSealSrv { f.setAlertid('GATE-SEAL-DEFAULT-EXPIRED') f.setSeverity(Finding.Severity.MEDIUM) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) this.logger.info(elapsedTime(`[${this.name}.initialize]`, start) + `on block ${currentBlock}`) @@ -91,6 +92,7 @@ export class GateSealSrv { f.setAlertid('GATE-SEAL-DEFAULT-WITHOUT-ROLE') f.setSeverity(Finding.Severity.MEDIUM) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) } @@ -134,6 +136,7 @@ export class GateSealSrv { f.setAlertid('GATE-SEAL-DEFAULT-EXPIRED') f.setSeverity(Finding.Severity.MEDIUM) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) @@ -168,6 +171,7 @@ export class GateSealSrv { f.setAlertid('GATE-SEAL-DEFAULT-EXPIRED') f.setSeverity(Finding.Severity.HIGH) f.setType(Finding.FindingType.DEGRADED) + f.setProtocol('ethereum') this.cache.setLastNoPauseRoleAlertTimestamp(currentBlockTimestamp) } @@ -202,6 +206,7 @@ export class GateSealSrv { f.setAlertid('GATE-SEAL-IS-EXPIRED') f.setSeverity(Finding.Severity.HIGH) f.setType(Finding.FindingType.DEGRADED) + f.setProtocol('ethereum') out.push(f) @@ -216,6 +221,7 @@ export class GateSealSrv { f.setAlertid('GATE-SEAL-IS-ABOUT-TO-BE-EXPIRED') f.setSeverity(Finding.Severity.MEDIUM) f.setType(Finding.FindingType.DEGRADED) + f.setProtocol('ethereum') out.push(f) this.cache.setLastExpiryGateSealAlertTimestamp(currentBlockTimestamp) @@ -263,6 +269,7 @@ export class GateSealSrv { f.setAlertid('GATE-SEAL-IS-SEALED') f.setSeverity(Finding.Severity.CRITICAL) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) } catch (e) { @@ -297,6 +304,7 @@ export class GateSealSrv { f.setAlertid('GATE-SEAL-NEW-ONE-CREATED') f.setSeverity(Finding.Severity.MEDIUM) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) this.gateSealAddress = gate_seal diff --git a/ethereum-steth/src/services/steth_operation/StethOperation.srv.ts b/ethereum-steth/src/services/steth_operation/StethOperation.srv.ts index ba00fc78..3462de0c 100644 --- a/ethereum-steth/src/services/steth_operation/StethOperation.srv.ts +++ b/ethereum-steth/src/services/steth_operation/StethOperation.srv.ts @@ -184,6 +184,7 @@ export class StethOperationSrv { f.setAlertid('LIDO-INVARIANT-ERROR') f.setSeverity(Finding.Severity.CRITICAL) f.setType(Finding.FindingType.SUSPICIOUS) + f.setProtocol('ethereum') findings.push(f) } @@ -309,6 +310,7 @@ export class StethOperationSrv { f.setAlertid('BUFFERED-ETH-DRAIN') f.setSeverity(Finding.Severity.CRITICAL) f.setType(Finding.FindingType.SUSPICIOUS) + f.setProtocol('ethereum') out.push(f) } @@ -352,7 +354,8 @@ export class StethOperationSrv { ) .setAlertid('HUGE-DEPOSITABLE-ETH') .setSeverity(Finding.Severity.HIGH) - .setType(Finding.FindingType.SUSPICIOUS), + .setType(Finding.FindingType.SUSPICIOUS) + .setProtocol('ethereum'), ) this.cache.setLastReportedDepositableEthTimestamp(blockTimestamp) @@ -374,6 +377,7 @@ export class StethOperationSrv { f.setAlertid('HIGH-DEPOSITABLE-ETH') f.setSeverity(Finding.Severity.MEDIUM) f.setType(Finding.FindingType.SUSPICIOUS) + f.setProtocol('ethereum') out.push(f) this.cache.setLastReportedDepositableEthTimestamp(blockTimestamp) @@ -411,6 +415,7 @@ export class StethOperationSrv { f.setAlertid('LOW-DEPOSIT-EXECUTOR-BALANCE') f.setSeverity(Finding.Severity.MEDIUM) f.setType(Finding.FindingType.SUSPICIOUS) + f.setProtocol('ethereum') out.push(f) } } @@ -446,6 +451,7 @@ export class StethOperationSrv { f.setAlertid('LOW-STAKING-LIMIT') f.setSeverity(Finding.Severity.MEDIUM) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) this.cache.setLastReportedStakingLimit10Timestamp(currentBlockTimestamp) @@ -463,6 +469,7 @@ export class StethOperationSrv { f.setAlertid('LOW-STAKING-LIMIT') f.setSeverity(Finding.Severity.INFO) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) this.cache.setLastReportedStakingLimit30Timestamp(currentBlockTimestamp) diff --git a/ethereum-steth/src/services/vault/Vault.srv.ts b/ethereum-steth/src/services/vault/Vault.srv.ts index 89260e0e..7b7b70e9 100644 --- a/ethereum-steth/src/services/vault/Vault.srv.ts +++ b/ethereum-steth/src/services/vault/Vault.srv.ts @@ -189,6 +189,7 @@ export class VaultSrv { f.setAlertid('WITHDRAWAL-VAULT-BALANCE-CHANGE') f.setSeverity(Finding.Severity.INFO) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) } @@ -219,6 +220,7 @@ export class VaultSrv { f.setAlertid('EL-VAULT-BALANCE-CHANGE') f.setSeverity(Finding.Severity.INFO) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) } @@ -255,6 +257,7 @@ export class VaultSrv { f.setAlertid('WITHDRAWAL-VAULT-BALANCE-DRAIN') f.setSeverity(Finding.Severity.CRITICAL) f.setType(Finding.FindingType.SUSPICIOUS) + f.setProtocol('ethereum') out.push(f) } @@ -276,6 +279,7 @@ export class VaultSrv { f.setAlertid('WITHDRAWAL-VAULT-BALANCE-DRAIN') f.setSeverity(Finding.Severity.CRITICAL) f.setType(Finding.FindingType.SUSPICIOUS) + f.setProtocol('ethereum') out.push(f) } @@ -312,6 +316,7 @@ export class VaultSrv { f.setAlertid('EL-VAULT-BALANCE-DRAIN') f.setSeverity(Finding.Severity.CRITICAL) f.setType(Finding.FindingType.SUSPICIOUS) + f.setProtocol('ethereum') out.push(f) } @@ -333,6 +338,7 @@ export class VaultSrv { f.setAlertid('EL-VAULT-BALANCE-DRAIN') f.setSeverity(Finding.Severity.CRITICAL) f.setType(Finding.FindingType.SUSPICIOUS) + f.setProtocol('ethereum') out.push(f) } @@ -361,6 +367,7 @@ export class VaultSrv { f.setAlertid('BURNER-SHARES-TRANSFER') f.setSeverity(Finding.Severity.HIGH) f.setType(Finding.FindingType.SUSPICIOUS) + f.setProtocol('ethereum') out.push(f) } diff --git a/ethereum-steth/src/services/withdrawals/Withdrawals.srv.ts b/ethereum-steth/src/services/withdrawals/Withdrawals.srv.ts index dc49760e..cce38d2f 100644 --- a/ethereum-steth/src/services/withdrawals/Withdrawals.srv.ts +++ b/ethereum-steth/src/services/withdrawals/Withdrawals.srv.ts @@ -305,6 +305,7 @@ export class WithdrawalsSrv { f.setAlertid('WITHDRAWALS-UNFINALIZED-QUEUE-AND-STAKE-LIMIT') f.setSeverity(Finding.Severity.MEDIUM) f.setType(Finding.FindingType.SUSPICIOUS) + f.setProtocol('ethereum') findings.push(f) @@ -366,6 +367,7 @@ export class WithdrawalsSrv { f.setAlertid('WITHDRAWALS-BIG-UNFINALIZED-QUEUE') f.setSeverity(Finding.Severity.MEDIUM) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) @@ -391,6 +393,7 @@ export class WithdrawalsSrv { f.setAlertid('WITHDRAWALS-LONG-UNFINALIZED-QUEUE') f.setSeverity(Finding.Severity.MEDIUM) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) @@ -494,6 +497,7 @@ export class WithdrawalsSrv { f.setAlertid('WITHDRAWALS-UNCLAIMED-REQUESTS') f.setSeverity(Finding.Severity.INFO) f.setType(Finding.FindingType.SUSPICIOUS) + f.setProtocol('ethereum') out.push(f) @@ -523,6 +527,7 @@ export class WithdrawalsSrv { f.setAlertid('WITHDRAWALS-UNCLAIMED-REQUESTS-MORE-THAN-BALANCE') f.setSeverity(Finding.Severity.CRITICAL) f.setType(Finding.FindingType.SUSPICIOUS) + f.setProtocol('ethereum') out.push(f) @@ -549,6 +554,7 @@ export class WithdrawalsSrv { f.setAlertid('WITHDRAWALS-BUNKER-ENABLED') f.setSeverity(Finding.Severity.CRITICAL) f.setType(Finding.FindingType.DEGRADED) + f.setProtocol('ethereum') out.push(f) @@ -570,6 +576,7 @@ export class WithdrawalsSrv { f.setAlertid('WITHDRAWALS-BUNKER-DISABLED') f.setSeverity(Finding.Severity.MEDIUM) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) @@ -633,6 +640,7 @@ export class WithdrawalsSrv { f.setAlertid('WITHDRAWALS-BIG-WITHDRAWAL-REQUEST-BATCH') f.setSeverity(Finding.Severity.INFO) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) } @@ -652,6 +660,7 @@ export class WithdrawalsSrv { f.setAlertid('WITHDRAWALS-BIG-WITHDRAWAL-REQUEST-AFTER-REBASE') f.setSeverity(Finding.Severity.MEDIUM) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) @@ -768,6 +777,7 @@ export class WithdrawalsSrv { f.setAlertid('WITHDRAWALS-CLAIMED-AMOUNT-MORE-THAN-REQUESTED') f.setSeverity(Finding.Severity.CRITICAL) f.setType(Finding.FindingType.INFORMATION) + f.setProtocol('ethereum') out.push(f) diff --git a/ethereum-steth/src/utils/errors.ts b/ethereum-steth/src/utils/errors.ts index fb54ff61..ed0183cb 100644 --- a/ethereum-steth/src/utils/errors.ts +++ b/ethereum-steth/src/utils/errors.ts @@ -9,6 +9,7 @@ export function networkAlert(err: Error, name: string, desc: string): Finding { f.setAlertid(NetworkErrorFinding) f.setSeverity(Finding.Severity.UNKNOWN) f.setType(Finding.FindingType.DEGRADED) + f.setProtocol('ethereum') const m = f.getMetadataMap() m.set('stack', `${err.stack}`) @@ -25,6 +26,7 @@ export function dbAlert(err: Error, name: string, desc: string): Finding { f.setAlertid('DB-ERROR') f.setSeverity(Finding.Severity.UNKNOWN) f.setType(Finding.FindingType.DEGRADED) + f.setProtocol('ethereum') const m = f.getMetadataMap() m.set('stack', `${err.stack}`)