Skip to content

Conversation

@eyalk007
Copy link
Collaborator

@eyalk007 eyalk007 commented Dec 28, 2025

  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • This pull request is on the dev branch.
  • I used gofmt for formatting the code before submitting the pull request.
  • Update documentation about new features / new supported technologies

- Update MavenPackageUpdater to handle multiple Components
- Loop through all Components and update each pom.xml file
- Extracts file paths from Component.Location.File
- Handles same vulnerability in multiple modules (e.g., backend + frontend)
- All changes go into ONE PR (same vuln, same fix)
- Update all tests to populate Components array with Location
- Backward compatible: falls back to 'pom.xml' if no Components
- Remove backward compatibility fallback that masked bugs
- If Components array is empty or missing Location data, fail explicitly
- Better error message explains the issue is with scan results
- Forces engine to always populate Components with Location
- Prevents silent failures in multi-module projects
- Add constants for magic strings (separator, property prefix/suffix)
- Extract parseMavenCoordinate() and toMavenCoordinate() helpers
- Extract extractPropertyName() for property placeholder parsing
- Remove all comments (code is self-documenting)
- Simplify debug logs (no fmt.Sprintf)
- DRY: no repetition anywhere
- All tests still pass
- Better naming: matches ImpactedDependencyName field
- parseDependencyName() / toDependencyName()
- More accurate: we parse dependency names (groupId:artifactId), not coordinates (which include version)
- Replace encoding/xml with github.com/beevik/etree
- Use DOM-based XML manipulation instead of unmarshal/marshal
- Should preserve formatting, namespaces, and all XML attributes
- All tests still pass
- Need to test on real repo to verify formatting preservation
- Parse XML to understand structure (encoding/xml)
- Use regex to replace ONLY the version text
- Preserves ALL formatting, namespaces, blank lines, comments
- Minimal diffs - only version numbers change
- All tests pass
- Ready for real-world testing
- Document all 5 test cases (simple, property, parent, depMgmt, multi-module)
- Document engine limitations (parent POM resolution, non-standard pom names)
- Document text-based replacement approach
- Document multi-module support
- Recommendations for engine team
- Testing checklist
@eyalk007 eyalk007 self-assigned this Dec 28, 2025
@eyalk007 eyalk007 added the improvement Automatically generated release notes label Dec 28, 2025
Comment on lines -150 to +153
if !repository.Params.FrogbotConfig.CreateAutoFixPr {
log.Info(fmt.Sprintf("This command is running in detection mode only. To enable automatic fixing of issues, set the '%s' flag under the repository's coniguration settings in Jfrog platform", createAutoFixPrConfigNameInProfile))
return totalFindings, nil
}
//if !repository.Params.FrogbotConfig.CreateAutoFixPr {
// log.Info(fmt.Sprintf("This command is running in detection mode only. To enable automatic fixing of issues, set the '%s' flag under the repository's coniguration settings in Jfrog platform", createAutoFixPrConfigNameInProfile))
// return totalFindings, nil
//}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will revert back

Comment on lines +83 to +91
func (mpu *MavenPackageUpdater) getPomPaths(vulnDetails *utils.VulnerabilityDetails) []string {
var pomPaths []string
for _, component := range vulnDetails.Components {
if component.Location != nil && component.Location.File != "" {
pomPaths = append(pomPaths, component.Location.File)
}
}
return pomPaths
}
Copy link
Collaborator Author

@eyalk007 eyalk007 Dec 28, 2025

Choose a reason for hiding this comment

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

this gets all occurrences of a vulnerability (the exact package and version)
can be moved to a utils because multiple package updaters will use this logic

)

const (
mavenCoordinateSeparator = ":"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

can rename to package instead of coordinate

updated := false
newContent := content

if updated, newContent = mpu.updateInParent(&project, groupId, artifactId, fixedVersion, newContent); updated {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

currently not working because of the engine

return fmt.Errorf("dependency %s not found in %s", toDependencyName(groupId, artifactId), pomPath)
}

func (mpu *MavenPackageUpdater) SetCommonParams(serverDetails *config.ServerDetails, depsRepo string) {}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will remove once common package handler is deprecated ( can add todo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Automatically generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant