Skip to content

feat: Add Aviator source encoding handling - #1066

Open
kireetivar wants to merge 4 commits into
fortify:dev/v3.xfrom
ankit2995:ankit/aviator-encoding-options
Open

feat: Add Aviator source encoding handling #1066
kireetivar wants to merge 4 commits into
fortify:dev/v3.xfrom
ankit2995:ankit/aviator-encoding-options

Conversation

@kireetivar

@kireetivar kireetivar commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add configurable Aviator source file encoding handling through --source-encodings, defaulting to FPR,UTF-8,CP850.
  • Use FPR source encoding metadata when decoding source files, with fallback encoding candidates for audit and remediation flows.
  • Propagate source encoding options through Aviator SSC audit, SSC/FoD apply-remediations, FPR processing, source enrichment, and gRPC calls.
  • Improve Aviator audit results by reporting skipped issue counts, skipped reasons, and remediation-generation skip metrics.
feat: `fcli aviator ssc audit`: Add `--source-encodings` option for source decoding and audit skip reporting
feat: `fcli aviator ssc apply-remediations`: Add `--source-encodings` option for source file decoding and encoding
feat: `fcli fod aviator apply-remediations`: Add `--source-encodings` option for source file decoding and encoding

- Introduced SourceEncodingOptions to manage source encoding candidates for decoding and encoding source files.
- Updated AuditFprOptions to include default source encoding options.
- Modified AuditProcessor and RemediationProcessor to accept and utilize SourceEncodingOptions.
- Enhanced FileUtils to read files using specified source encoding options.
- Updated SourceCodeEnricher to decode source files based on encoding options.
- Adjusted AviatorGrpcClient and AviatorStreamProcessor to pass source encoding options through gRPC calls.
- Updated AviatorSSCApplyRemediationsCommand and AviatorSSCAuditCommand to accept source encoding parameters from the command line.
- Added new properties for source encoding options in internationalization files for both Aviator and FoD.
@kireetivar kireetivar changed the title aviator encoding options feat: Add Aviator source encoding handling Jul 31, 2026
@kireetivar
kireetivar marked this pull request as ready for review July 31, 2026 09:07
@kireetivar
kireetivar requested a review from rsenden July 31, 2026 09:19

@rsenden rsenden left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I haven't reviewed everything in detail, focusing on overall structure first. Instead of having custom option parsing functionality, it would be much better to use existing picocli functionality; something like the following:

  • Create ISourceDecoder interface, with single decode method matching signature of current SourceEncodingOptions::decode
  • Create implementations of this interface:
    • One implementation in which the decode method retrieves encoding from FVDL
    • One that takes a fixed Charset as constructor arg (together with a String-based constructor that calls Charset.forName)
    • Optionally a CompositeSourceDecoder that takes a List<ISourceDecoder> as constructor argument
  • Create a corresponding picocli ITypeConverter that based on input (FPR or explicit charset) returns an instance of one of the classes above, throwing a proper picocli exception like TypeConversionException to have picocli render a proper error message in case of invalid charset
  • Create picocli mixin/arggroup class (ideally in fcli-aviator-common for re-use across FoD/SSC, but not sure whether we currently have any picocli-related classes in this module) that defines --source-encodings as List<ISourceDecoder> (or directly as CompositeSourceDecoder, but not sure whether that would work with split), with proper split, converter, and defaultValue attributes
  • Pass this list of candidate decoders to the processors (either as-is, or wrapped in CompositeSourceDecoder, but for flexibility, processors would rely on ISourceDecoder interface)
  • For encoding, have a separate SourceEncoder class with static encode method, as this operates on specified Charset and doesn't (directly) rely on any of the above

@kireetivar
kireetivar requested a review from rsenden August 3, 2026 05:04
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.

3 participants