Skip to content

Commit

Permalink
feat: + 1142 rule (#21)
Browse files Browse the repository at this point in the history
* feat: + 1142 rule

* 1.1.21

* feat: remove nft approve trust value rule

* 1.1.22
  • Loading branch information
vvvvvv1vvvvvv committed May 29, 2024
1 parent 4be0274 commit 16e61c1
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 69 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rabby-wallet/rabby-security-engine",
"version": "1.1.20",
"version": "1.1.22",
"description": "",
"main": "dist/index.js",
"scripts": {
Expand Down
68 changes: 34 additions & 34 deletions src/rules/collectionApprove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,40 @@ const rules: RuleConfig[] = [
return isEOA;
},
},
{
id: "1054",
enable: true,
valueDescription: "Trust value",
valueTooltip:
"Trust value refers to the top NFT approved and exposed to this contract. A low trust value indicates either risk or inactivity for 180 days.",
valueDefine: {
type: "int",
min: 0,
minIncluded: true,
max: null,
maxIncluded: false,
},
defaultThreshold: {
danger: {
min: 0,
minIncluded: true,
max: 10000,
maxIncluded: true,
},
warning: {
min: 10000,
minIncluded: false,
max: 100000,
maxIncluded: true,
},
},
customThreshold: {},
requires: ["collectionApprove"],
async getValue(ctx) {
const data = ctx.collectionApprove!;
return data.riskExposure;
},
},
// {
// id: "1054",
// enable: true,
// valueDescription: "Trust value",
// valueTooltip:
// "Trust value refers to the top NFT approved and exposed to this contract. A low trust value indicates either risk or inactivity for 180 days.",
// valueDefine: {
// type: "int",
// min: 0,
// minIncluded: true,
// max: null,
// maxIncluded: false,
// },
// defaultThreshold: {
// danger: {
// min: 0,
// minIncluded: true,
// max: 10000,
// maxIncluded: true,
// },
// warning: {
// min: 10000,
// minIncluded: false,
// max: 100000,
// maxIncluded: true,
// },
// },
// customThreshold: {},
// requires: ["collectionApprove"],
// async getValue(ctx) {
// const data = ctx.collectionApprove!;
// return data.riskExposure;
// },
// },
{
id: "1055",
enable: true,
Expand Down
4 changes: 4 additions & 0 deletions src/rules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export interface ContextActionData {
isTokenContract: boolean;
usedChainList: string[];
onTransferWhitelist: boolean;
hasReceiverMnemonicInWallet: boolean;
hasReceiverPrivateKeyInWallet: boolean;
};
permit?: {
spender: string;
Expand Down Expand Up @@ -128,6 +130,8 @@ export interface ContextActionData {
} | null;
usedChainList: string[];
onTransferWhitelist: boolean;
hasReceiverMnemonicInWallet: boolean;
hasReceiverPrivateKeyInWallet: boolean;
};
nftApprove?: {
chainId: string;
Expand Down
68 changes: 34 additions & 34 deletions src/rules/nftApprove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,40 @@ const rules: RuleConfig[] = [
return isEOA;
},
},
{
id: "1044",
enable: true,
valueDescription: "Trust value",
valueTooltip:
"Trust value refers to the top NFT approved and exposed to this contract. A low trust value indicates either risk or inactivity for 180 days.",
valueDefine: {
type: "int",
min: 0,
minIncluded: true,
max: null,
maxIncluded: false,
},
defaultThreshold: {
danger: {
min: 0,
minIncluded: true,
max: 10000,
maxIncluded: true,
},
warning: {
min: 10000,
minIncluded: false,
max: 100000,
maxIncluded: true,
},
},
customThreshold: {},
requires: ["nftApprove"],
async getValue(ctx) {
const data = ctx.nftApprove!;
return data.riskExposure;
},
},
// {
// id: "1044",
// enable: true,
// valueDescription: "Trust value",
// valueTooltip:
// "Trust value refers to the top NFT approved and exposed to this contract. A low trust value indicates either risk or inactivity for 180 days.",
// valueDefine: {
// type: "int",
// min: 0,
// minIncluded: true,
// max: null,
// maxIncluded: false,
// },
// defaultThreshold: {
// danger: {
// min: 0,
// minIncluded: true,
// max: 10000,
// maxIncluded: true,
// },
// warning: {
// min: 10000,
// minIncluded: false,
// max: 100000,
// maxIncluded: true,
// },
// },
// customThreshold: {},
// requires: ["nftApprove"],
// async getValue(ctx) {
// const data = ctx.nftApprove!;
// return data.riskExposure;
// },
// },
{
id: "1045",
enable: true,
Expand Down
18 changes: 18 additions & 0 deletions src/rules/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,24 @@ const rules: RuleConfig[] = [
return onTransferWhitelist;
},
},
{
id: "1142",
enable: true,
valueDescription: "The recipient address is from your seed phrase",
valueDefine: {
type: "boolean",
},
defaultThreshold: {
safe: true,
},
customThreshold: {},
requires: ["send", "sendNFT"],
async getValue(ctx) {
const { hasReceiverMnemonicInWallet, hasReceiverPrivateKeyInWallet } =
ctx.send!;
return hasReceiverMnemonicInWallet || hasReceiverPrivateKeyInWallet
},
},
];

export default rules;

0 comments on commit 16e61c1

Please sign in to comment.