Skip to content

Fix frontend finding type mismatch with backend scan response#76

Open
aditya-sharma-devs wants to merge 1 commit into
ionfwsrijan:mainfrom
aditya-sharma-devs:fix-finding-type-mismatch
Open

Fix frontend finding type mismatch with backend scan response#76
aditya-sharma-devs wants to merge 1 commit into
ionfwsrijan:mainfrom
aditya-sharma-devs:fix-finding-type-mismatch

Conversation

@aditya-sharma-devs

Copy link
Copy Markdown

Summary

This PR fixes the mismatch between the frontend BackendFinding type and the actual backend Finding model returned by the scan APIs.

Changes Made

  • Updated BackendFinding to match the backend response structure.

  • Replaced deprecated top-level fields (file, line, tool) with:

    • location.path
    • location.start_line
    • metadata.engine
  • Updated the finding mapper to correctly transform backend responses into the UI Finding model.

  • Added safe fallbacks to prevent undefined values during rendering.

Testing

  • Successfully ran npm run build after the changes.
  • Verified that findings continue to map correctly to the UI model.

Fixes #50

@ionfwsrijan

Copy link
Copy Markdown
Owner

@aditya-sharma-devs The core implementation is good but i found a couples of flaws in it.

  1. confidence is declared twice in BackendFinding
  2. reachability?: unknown and features?: unknown are typed as unknown with no structure
  3. lineNumber: f.location?.start_line ?? 0 — fallback of 0 is semantically wrong
  4. tool: (f.metadata?.engine as Finding["tool"]) ?? "semgrep" which is an unsafe cast

@ionfwsrijan

Copy link
Copy Markdown
Owner

@aditya-sharma-devs Join our dc server to connect with fellow contributors and mentors. We'll help you out.

https://discord.gg/FcXuyw2Rs

@aditya-sharma-devs

Copy link
Copy Markdown
Author

Thanks for the review! I'll work through these issues and update the PR with the suggested fixes.

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.

[Bug] Frontend BackendFinding Type Does Not Match ScanResponse Schema

2 participants