Repository navigation
AIML-343: Fix get_scan_project returning empty data - #59
Merged
Merged
Conversation
ChrisEdwards
marked this pull request as ready for review
January 4, 2026 04:05
ChrisEdwards
requested review from
JacobMagesHaskinsContrast and
dougj-contrast
January 4, 2026 04:07
ChrisEdwards
force-pushed
the
AIML-342-test-plan-migration
branch
from
January 6, 2026 17:28
30cd642 to
678a0a2
Compare
ChrisEdwards
force-pushed
the
AIML-343-get-scan-project-empty-data
branch
from
January 6, 2026 17:30
8708c09 to
8862591
Compare
JacobMagesHaskinsContrast
approved these changes
Jan 6, 2026
dougj-contrast
approved these changes
Jan 6, 2026
ChrisEdwards
force-pushed
the
AIML-342-test-plan-migration
branch
from
January 7, 2026 00:18
678a0a2 to
e40b9c9
Compare
The SDK Project interface could not be serialized by Jackson because it
uses method-style accessors (id() not getId()) and contains non-serializable
resource navigation methods. This caused the tool to return {"data":{}}
despite finding the project.
Solution: Create ScanProject record that maps SDK fields to a Jackson-
serializable data class, following the established VulnLight pattern.
Changes:
- Add ScanProject record with from() factory method
- Update GetSastProjectTool to return ScanProject instead of raw Project
- Add ScanProjectTest with 5 tests for factory method edge cases
- Add regression test in GetSastProjectToolIT verifying all 15 fields
- Configure test.scan.project-name=WebGoat for integration tests
All 553 unit tests and 6 integration tests pass.
ChrisEdwards
force-pushed
the
AIML-343-get-scan-project-empty-data
branch
from
January 7, 2026 00:20
8862591 to
c6b3403
Compare
ChrisEdwards
changed the base branch from
AIML-342-test-plan-migration
to
main
January 7, 2026 00:20
ChrisEdwards
added a commit
that referenced
this pull request
Jan 7, 2026
Address PR #59 review feedback - integration tests don't need verbose log.info() output. Assertions provide sufficient test validation and failure information.
ChrisEdwards
added a commit
that referenced
this pull request
Jan 7, 2026
Address PR #59 review feedback - integration tests don't need verbose log.info() output. Assertions provide sufficient test validation and failure information.
ChrisEdwards
added a commit
that referenced
this pull request
Jan 7, 2026
Address PR #59 review feedback - integration tests don't need verbose log.info() output. Assertions provide sufficient test validation and failure information.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebased onto main after #58 merged.
Why
The
get_scan_projectMCP tool was completely broken - it returned{"found": true, "data": {}}instead of actual project data. AI agents couldn't access any SAST project metadata (vulnerability counts, scan history, language, etc.).Before this fix:
{ "found": true, "data": {} }After this fix:
{ "found": true, "data": { "id": "c9d93078-4ebb-49f2-b98f-75ac013a3d86", "name": "webgoat", "language": "JAVA", "critical": 0, "high": 12, "medium": 45, ... } }What
ScanProject.javaGetSastProjectTool.javaScanProjectinstead of raw SDKProjectScanProjectTest.javaGetSastProjectToolIT.javaapplication-integration-test.propertiesHow (Root Cause & Fix)
The Bug
Jackson couldn't serialize the Contrast SDK
Projectinterface because:id(),name()instead of JavaBeangetId(),getName()codeArtifacts()andscans()that return SDK resource handles, not dataProjectImplisn't annotated for JacksonThe Fix
Create a
ScanProjectrecord that:codeArtifacts(),scans())This follows the established pattern used by
VulnLight,ApplicationData, etc.Step-by-Step Walkthrough
1.
ScanProject.java(new file)Key decisions:
from()handles null namespace filters → empty lists2.
GetSastProjectTool.java(modified)Before:
After:
Only 3 lines changed in the tool itself.
3.
ScanProjectTest.java(new file)5 unit tests covering:
from_should_map_all_fields_correctlyfrom_should_handle_null_lastScanId_and_lastScanTimefrom_should_handle_null_namespace_filtersfrom_should_create_defensive_copy_of_namespace_filtersfrom_should_throw_on_null_project4.
GetSastProjectToolIT.java(modified)Added regression test
getScanProject_regression_all_fields_should_be_populated()that:Testing
Jira
Fixes AIML-343