Skip to content

Comments

feat(SafeShield): Malicious adresses in Shield threat review#6776

Merged
vmosharova merged 21 commits intodevfrom
feat/malicious-adresses-in-threat-review
Dec 11, 2025
Merged

feat(SafeShield): Malicious adresses in Shield threat review#6776
vmosharova merged 21 commits intodevfrom
feat/malicious-adresses-in-threat-review

Conversation

@vmosharova
Copy link
Collaborator

@vmosharova vmosharova commented Dec 3, 2025

What it solves

Displays malicious addresses from threat analysis issues in the UI. When the backend returns threat analysis results with issues containing addresses (e.g., {description: "Malicious contract interaction", address: "0x1234..."}), these addresses were not shown in the UI.

Resolves: COR-937

The changes are implemented to reflect the API schema change in the BE (2824 and 2829

How this PR fixes it

  1. Type definitions updated:

    • Added ThreatIssue type with {description: string, address?: string} structure
    • Updated MaliciousOrModerateThreatAnalysisResult to use ThreatIssue[] instead of string[] for issues
    • Updated auto-generated types to match the backend DTO format
  2. Transformation logic created:

    • Added transformThreatAnalysisResponse utility that extracts addresses from ThreatIssue objects in the issues property
    • Extracted addresses are added to the addresses array of each threat result
    • Prevents duplicate addresses and preserves existing addresses
  3. Hook integration:

    • Updated useThreatAnalysis to use transformThreatAnalysisResponse to process threat data before returning it
    • Ensures addresses from issues are available to UI components
  4. Web + Mobile update:
    The components + UI are updated both for Web and Mobile.

  5. Test coverage:

    • Added tests covering address extraction, duplicate prevention, UI changes, and edge cases

Screenshots

image

How to test it

  1. Manual testing:
    • Create a transaction that triggers a threat analysis with issues containing addresses
    • Verify that the threat analysis section shows:
      • Addresses are clickable and show explorer links

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊 - No analytics changes
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻 - Added tests for transformThreatAnalysisResponse

CLA signature

With the submission of this Pull Request, I confirm that I have read and agree to the terms of the Contributor License Agreement.


Note

Displays addresses from threat analysis issues across web and mobile by transforming API responses and updating UI to show/copy/open addresses with conditional address lists.

  • Utils/Types:
    • Add ThreatIssue ({ description, address? }) and update threat issues typing.
    • Introduce transformThreatAnalysisResponse to extract issue addresses into result.addresses; integrate in useThreatAnalysis.
    • Update builders to include sample addresses in malicious/moderate presets.
  • Mobile UI (SafeShield):
    • AnalysisDisplay: render AnalysisIssuesDisplay when issues exist; otherwise show ShowAllAddress.
    • New AnalysisPaper wrapper and useAnalysisAddress hook (copy-to-clipboard, explorer open).
    • Refactor AddressListItem and ShowAllAddress to use new hook and wrapper; minor key fixes in AnalysisGroup.
  • Web UI (SafeShield):
    • AnalysisGroupCardItem: only show ShowAllAddress when no issues; always render AnalysisIssuesDisplay and address changes as applicable.
    • AnalysisIssuesDisplay: show issue address (copy + optional explorer link) with description; ignore empty issues.
  • Tests:
    • Add comprehensive tests for transformer, web and mobile issue/address rendering, and conditional address list behavior.

Written by Cursor Bugbot for commit e0b44f3. This will update automatically on new commits. Configure here.

@vmosharova vmosharova requested a review from LucieFaire December 3, 2025 15:02
@vmosharova vmosharova changed the title Feat: Malicious adresses in Shield threat review feat(web): Malicious adresses in Shield threat review Dec 4, 2025
@vmosharova
Copy link
Collaborator Author

@codex review this draft

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

@vmosharova vmosharova changed the title feat(web): Malicious adresses in Shield threat review feat(SafeShield): Malicious adresses in Shield threat review Dec 8, 2025
@vmosharova vmosharova marked this pull request as ready for review December 8, 2025 11:59
@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

📦 Next.js Bundle Analysis for @safe-global/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 1.38 MB (🟡 +1 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Thirteen Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/apps/open 89.93 KB (-1 B) 1.47 MB
/bridge 2.58 KB (🟢 -1 B) 1.38 MB
/earn 630 B (🟢 -1 B) 1.38 MB
/home 59.88 KB (🟡 +1 B) 1.44 MB
/settings/security 20.82 KB (🟡 +1 B) 1.4 MB
/stake 633 B (🟢 -1 B) 1.38 MB
/swap 852 B (🟢 -3 B) 1.38 MB
/transactions 137.87 KB (-3 B) 1.52 MB
/transactions/history 137.83 KB (-2 B) 1.52 MB
/transactions/messages 96.72 KB (-1 B) 1.48 MB
/transactions/msg 93.18 KB (-2 B) 1.47 MB
/transactions/queue 85.37 KB (-2 B) 1.47 MB
/transactions/tx 84.73 KB (-2 B) 1.47 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

Coverage report for apps/web

St.
Category Percentage Covered / Total
🟡 Statements
76.77% (-0.05% 🔻)
17331/22576
🔴 Branches
54.21% (+0% 🔼)
4671/8616
🟡 Functions
61.44% (-0.01% 🔻)
2468/4017
🟡 Lines
78.14% (-0.09% 🔻)
15756/20164
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🔴
... / withGuardCheck.tsx
16.67% (-83.33% 🔻)
0% (-100% 🔻)
0% (-100% 🔻)
16.67% (-83.33% 🔻)
🔴
... / withOwnerCheck.tsx
16.67% (-83.33% 🔻)
0% (-100% 🔻)
0% (-100% 🔻)
16.67% (-83.33% 🔻)
🔴
... / index.tsx
50% (-50% 🔻)
0% (-100% 🔻)
50% (-50% 🔻)
50% (-50% 🔻)
🔴
... / index.tsx
57.14% (-42.86% 🔻)
0% (-100% 🔻)
66.67% (-33.33% 🔻)
57.14% (-42.86% 🔻)
🟢
... / AnalysisIssuesDisplay.tsx
93.94% (-6.06% 🔻)
83.33% (-16.67% 🔻)
85.71% (-14.29% 🔻)
96.67% (-3.33% 🔻)

Test suite run success

2554 tests passing in 306 suites.

Report generated by 🧪jest coverage report action from 92dc220

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

📸 Page Screenshots

Found 1 screenshot(s) for pages affected by changes in this PR.

Preview Site: https://feat_malicious_adresses_in_threat_review--walletweb.review.5afe.dev/home?safe=eth:0xA77DE01e157f9f57C7c4A326eeE9C4874D0598b6

Balances

Balances


Screenshots are automatically captured from pages affected by changed files.

@vmosharova
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Copy link
Member

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! It would be good to break down mobile/web parts into separate PRs next time.

@LucieFaire
Copy link
Contributor

love the new design! 💟

@vmosharova vmosharova merged commit c0061d2 into dev Dec 11, 2025
24 checks passed
@vmosharova vmosharova deleted the feat/malicious-adresses-in-threat-review branch December 11, 2025 12:46
Fbartoli pushed a commit that referenced this pull request Dec 11, 2025
* feat: show malicious addresses in the Shield UI

* feat: (packages) show malicious addresses in the Shield UI

* chore: linting; fix tests

* fix: handle edge cases with undefined issues and empty arrays; fix tests

* fix: preserve all metadata fields (request_id, etc.) in the response destructuring

* feat(mobile): Add address property in the malicious threat builders and storybook

* feat(mobile): change the underlying layout of the AnalysisIssueDisplay component to support the new address type

* feat(mobile): extract reusable analysis address logic to useAnalysisAddress hook

* feat(mobile): move AddressItem wrapper to AnalysisPaper component in order to reuse it in the IssueDisplay component

* fix(mobile): do not render 'Show All' component if there are 'issues' prop in the analysis results

* fix(mobile): unit tests

* fix(mobile): prettier

* fix(mobile): Fixed the index collision in the mobile issues analysis to avoid resetting for every severity group

* refactor: remove obsolete description check as it is always present in the objects in ThreatIssues[]

* fix: new styles for the Threat description

* fix(mobile): check result.issues truthiness and fix explorer link for undefined addresses

---------

Co-authored-by: Clovis da Silva Neto <clovisdasilvaneto@gmail.com>
@Safe-infra Safe-infra mentioned this pull request Dec 12, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants