wordpress-mobile / wordpress-mobile/WordPress-Android
Jetpack Section: Scan - Threat Details Diff Viewer
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 3.2k
- Forks
- 1.4k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 69
Description
Goal
Goal of this issue is to implement a diff viewer in the app to view file changes for a core file modification type threat (found in a site’s scan results).
Details
For a site with a core file modification type threat, API https://public-api.wordpress.com/wpcom/v2/sites/<site_id>/scan returns core file modifications as a diff string in a Unified Format.
Calypso implementation relies on jsdiff to parse the output (the patch) and produce the data structure used to display files, hunks (sections of change in the files), and the actual lines of change and context.
Sample Input
--- /tmp/wordpress/5.5.3-en_US/wordpress/wp-admin/index.php\t2020-11-01 00:12:27.097473760 +0000\n+++ /tmp/4955714993/core-file-21107UtNwEVre9TgV\t2021-02-07 08:41:40.387958956 +0000\n@@ -183,3 +183,4 @@\n
wp_print_community_events_templates();\n\nrequire_once ABSPATH .'wp-admin/admin-footer.php';\n+if ( true === false ) exit();\n\\ No newline at end of file\n
Sample Output

Currently this output is shown as plain text in the app:

Implement a diff viewer in the app for viewing this diff string in the API response.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the scan API response and the existing plain-text presentation of the diff string; compare the Calypso diff-viewer implementation and jsdiff reference linked in the issue. Confirm how the Android app represents scan threats, then implement file, hunk, and changed-line rendering for unified diffs and verify the sample output matches the intended viewer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100