Repository navigation
feat(aviator): 2493049 extract FPR parsing into fcli-common-fpr module - #1151
Conversation
Move the SAST/DAST FPR parsing code out of fcli-aviator-common into a new Aviator-independent module fcli-core/fcli-common-fpr so it can be reused by other teams. - New package com.fortify.cli.common.fpr.* (model, filter, processor, dast, util, utils, config) with its own tests and resources - Aviator-specific behavior (Aviator status/expected-outcome tags, filter template tag injection) is injected via AuditTagConfig and FilterTemplateCustomizer; AviatorSastFprParser wraps the generic parser - Generic audit.xml reading extracted to AuditXmlReader - Moved code throws Fcli exceptions; Aviator catch sites updated - Proto files, remediation, AuditProcessor and SourceCodeEnricher stay in fcli-aviator-common Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0e2bdb1 to
78983f5
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The assessment reflects a ~95-file cross-module refactor whose behavior preservation and native-image/functional builds depend on CI verification that a human must confirm.
No open issues 🎉
What changed in this PR
This PR extracts the SAST/DAST FPR parsing code out of fcli-aviator-common into a new, Aviator-independent fcli-common-fpr module (com.fortify.cli.common.fpr.*), so the parsing library can be reused by other OpenText teams ahead of the Aviator 27.1 release. It is intended to be a behavior-preserving move: Aviator-specific concerns (status/expected-outcome tag IDs and filter-template tag injection) are now injected into the generic parser via AuditTagConfig and FilterTemplateCustomizer rather than hard-coded.
Changes:
- New module
fcli-common-fprwith model/filter/processor/dast/util/config code and resources (extensions_config.yaml,languages_comment_config.yaml,webinspect.xsd); exceptions switched toFcli*Exceptionsupertypes. - Product-specific behavior injected: generic
SastFprParser/SastFprData+AuditXmlReader; Aviator wraps them viaAviatorSastFprParserandAviatorFilterTemplateCustomizer, preserving priorFPRProcessortag logic. - Wiring updated:
gradle.properties,fcli-apprefs,fcli-aviator-commonapi(project(...)), native-image reflect-config FQNs, and module list in copilot-instructions; tests moved with their classes.
I verified there are no dangling references to any moved class (in .java, action .yaml, or native-image .json), that fcli-common-fpr has zero com.fortify.cli.aviator.* references, that the new AuditXmlReader/AuditProcessor/AuditTagConfig wiring is consistent and behavior-preserving, and that moved resources still resolve on the unified runtime classpath. No high-confidence code defects were found; the main residual risk is that native-image and functional-test builds are left to CI.
| File | Description |
|---|---|
fcli-core/fcli-common-fpr/** (model, filter, processor, dast, util, utils, config) |
New module; package renamed to com.fortify.cli.common.fpr.*, Aviator exceptions replaced by Fcli*Exception. |
fcli-common-fpr/.../FPRProcessor.java |
Replaces hard-coded Aviator tag IDs with injected AuditTagConfig + FilterTemplateCustomizer; adds 2-arg (DEFAULT) constructor. |
fcli-common-fpr/.../AuditTagConfig.java, FilterTemplateCustomizer.java, SastFprParser.java, SastFprData.java, FprConstants.java, FprYamlResourceLoader.java |
New product-neutral abstractions / shared constants / classpath YAML loader. |
fcli-common-fpr/.../FilterTemplateParser.java |
Tag-injection logic removed; now delegates to injected customizer. |
fcli-common-fpr/.../util/LanguageCommentMapperUtil.java, FileTypeLanguageMapperUtil.java |
Lazy-load bundled YAML instead of requiring Aviator init (volatile + idempotent). |
fcli-aviator-common/.../audit/AviatorSastFprParser.java, audit/processor/AviatorFilterTemplateCustomizer.java |
Aviator adapters that supply tag config / filter-template DOM injection and rewrap into ParsedFprData. |
fcli-aviator-common/** (imports, Constants.java, AuditProcessor, ParsedFprData, processors, grpc, remediation) |
Updated to consume the new module; catch sites widened to Fcli*Exception; Constants delegates shared values to FprConstants. |
fcli-aviator/** (commands, helpers, tests) |
Import updates to new package names; correlate parser uses AviatorSastFprParser. |
gradle.properties, fcli-app/build.gradle.kts, fcli-aviator-common/build.gradle.kts, fcli-common-fpr/build.gradle.kts |
Wire the new module (fcliCommonFprRef, api(project(...)), snakeyaml dep). |
native-image reflect-config.json (yaml, grpc) |
Updated FQNs for moved ExtensionsConfig/LanguagesCommentConfig. |
.github/copilot-instructions.md |
Documents the new module and its Aviator-independence rule. |
| Test files across both modules | Package/import/assertion updates mirroring the move; new AviatorSastFprParserTest / AviatorFilterTemplateCustomizerTest. |
Review effort: Balanced
- Rename model.Entry to FvdlExternalEntry and drop fully qualified names - Make FprHandle validation messages generic (no scan-type-specific checks) - Load default audit.xml from classpath resource; extract getAuditDoc - Remove duplicate ExtensionsConfig entry from grpc/reflect-config.json Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The target branch now contains fortify#1146 itself (back-merged from dev/v3.x), along with fortify#1145 (StreamInitializationTimeout) and fortify#1151 (FPR classes moved to com.fortify.cli.common.fpr). Conflicts were resolved by taking the target's version of each conflicted file and replaying only this branch's changes made after the fortify#1146 backport (server flow control, keepalive/lock-lost robustness, review fixes). Correlation now creates its StreamInitializationTimeout per stream attempt, as DAST audit already does, so a stream re-opened after SERVER_BUSY gets its own countdown instead of inheriting the first attempt's. Both processors close the refused attempt's timer before a busy-start retry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ion streams (backport of #1146 to 27.1) Cherry-pick of 43607ce onto feat/v3.x/aviator/27.1. Conflict resolution: keep 27.1's FPR model packages (com.fortify.cli.aviator.fpr/dast; the fcli-common-fpr module from #1151 is dev-only) and drop the StreamInitializationTimeout field/test changes that depend on dev-only #1145.
Story
ValueEdge/Octane 2493049 – Extract FPR parsing from
fcli-aviator-commoninto a reusablefcli-common-fprmodule (needed before the Aviator 27.1 release).Targets
dev/v3.x.Why
SAST + DAST FPR parsing should be a standalone, Aviator-independent library that other OpenText teams can reuse.
What changed
fcli-core/fcli-common-fpr(com.fortify.cli.common.fpr.*): model, filter, processor, dast, util/utils, config + resources (extensions_config.yaml,languages_comment_config.yaml,webinspect.xsd). Nocom.fortify.cli.aviatorimports.AuditTagConfig(Aviator status / expected-outcome tag ids) andFilterTemplateCustomizer(Aviator tag-definition injection).AviatorSastFprParser(in aviator-common) wraps the genericSastFprParserand returns the unchangedParsedFprData.AuditXmlReader;AuditProcessordelegates to it.FcliSimpleException/FcliTechnicalException/FcliBugException(the Aviator exceptions extend these). Catch sites inRemediationsApplyHelper,RemediationProcessorandAviatorStreamProcessornow catch the Fcli supertypes so behavior is preserved.gradle.properties(fcliCommonFprRef),fcli-app/build.gradle.kts,fcli-aviator-commonapi(project(...)); native-image reflect-config FQNs updated;.github/copilot-instructions.mdmodule list.Behavior
No functional change intended. The Aviator tag config reproduces the previous
FPRProcessortag logic;LanguageCommentMapperUtilnow lazy-loads its YAML if not initialized (previously returned "Unknown").Tests
./gradlew build(incl. unit tests,NativeReflectConfigTest) compiles and passes locally on adev/v3.xbase, except 3StreamInitializationTimeoutTesttests infcli-aviator-commonthat already fail ondev/v3.xwithout this change (missingFcliExecutionContextin the test). Only its imports were updated here for the moved classes.Decisions / out of scope
fcli-aviator-common.filterpackage moved too (deliberate deviation from the story wording):FPRInfo,NodeandStreamingFVDLProcessordepend onFilterTemplate.fpr.remediation,ParsedFprData,AuditResponse,TagMappingConfigstay in Aviator.Known limitations / follow-ups (for reviewers)
fcli-common-fprstill depends onfcli-common-core(FcliSimpleException,FcliTechnicalException,FcliBugException,SecureXmlParserFactory). It has no Aviator dependency. Removing thefcli-common-coredependency, e.g. by introducing module-local exceptions, is a candidate for a later phase if the library is to be consumed outside fcli.FilterTemplateCustomizeras an out-channel:AviatorFilterTemplateCustomizercaptures the filter-template DOM in a field thatAviatorSastFprParserreads back after parsing (contract documented in Javadoc). A cleaner follow-up is to expose the DOM onSastFprDataand make the customizer stateless. Not done here to keep this PR a behavior-preserving move.util/utilspackages: both exist incommon.fprbecause the original Aviator code already had both. Merging them is deferred to avoid extra churn and rebase conflicts.Related / conflicts
fcli fprmodule) touchesAuditIssue,AuditProcessor,XmlUtils- may need rebasing onto new package names if merged after this.dev/v3.x): editsFprHandle, which this PR moves tofcli-common-fpr. Whichever merges second needs a rename-aware merge of that one hunk.feat/v3.x/aviator/27.1; it touchesutil/Constants.java,AviatorGrpcClientandGrpcUtil, so a trivial overlap is possible when 27.1 content is merged intodev/v3.x.