feat(guided remediation): add pom.xml writing #528
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.
Copying over the pom.xml patch writing functionality from osv-scanner.
It's quite complicated, so I've tried to make minimal changes.
One notable change is how the writing works with local parent POMs. It now always rewrites the local parent pom.xml files, even if there are no patches. The location of the written parent poms is now relative to the written root pom.xml. (e.g. If the original pom.xml was
foo/root/pom.xml
with parentfoo/parent/pom.xml
, writing the root tobar/root/pom.xml
will write its parent tobar/parent/pom.xml
). To facilitate this, the output is now a path to the new manifest, rather than anio.Writer
One issue is that
io/fs
is read-only. I've worked around this by reading from theFS
and writing the files to a path on the system. Maybe this should use something likego-billy
instead?We've vendored
encoding/xml
to add missing support for writing self-closing tags. I think it may be better to move this to its own fork.