Skip to content

[Bug]: TextReportFormatter vulnerable to String.format injection via filenames #202

@Splatcrafter

Description

@Splatcrafter

AI REVIEWED

Module: cli
File: cli/report/TextReportFormatter.java (~line 85)
Severity: Medium

Summary

String.format() is used with user-supplied file names and type strings. If a filename contains % characters (e.g., file%d.json), String.format() throws MissingFormatArgumentException.

return String.format("Migration: %s [%s] v%d -> v%d (%dms)",
    fileName, type, fromVersion, toVersion, duration.toMillis());

Suggested Fix

Use string concatenation instead of format:

return "Migration: " + fileName + " [" + type + "] v" + fromVersion
    + " -> v" + toVersion + " (" + duration.toMillis() + "ms)";

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions