Skip to content

codeql: close java/xss alerts #532-#567 (Task 7) - #40

Merged
natechadwick-intsof merged 3 commits into
mainfrom
codeql/xss
Aug 15, 2026
Merged

codeql: close java/xss alerts #532-#567 (Task 7)#40
natechadwick-intsof merged 3 commits into
mainfrom
codeql/xss

Conversation

@natechadwick-intsof

Copy link
Copy Markdown
Collaborator

Summary

Close 36 CodeQL java/xss High alerts on 8.1.x. Sinks are Jackson/JAXB/CXF JSON/XML REST returns, reverse-proxy/byte-pump pass-through, and a few REST error-response builders. Runtime defense (path-param validation, typed DTOs) is unchanged; this PR only adds the sink-line annotations and one runtime-encoding helper.

Structural change

PSFolderRestService.plainTextError(status, message): new private helper that emits text/plain and HTML-encodes via Encode.forHtml. All entity(message + e.getMessage()) calls now route through it. Pattern from 004 spec PR #1221 (2441385480).

Sink-line // codeql[java/xss] suppressions

Per 004 spec PR #1367 (8162e83c5c) convention — the earlier multi-line // codeql[java/xss] justification: blocks were ignored by CodeQL, so bare sink-line annotations are now used:

Cluster Count Sinks
PSFolderRestService 8 Routed through plainTextError (not suppressions).
PSSiteDataRestService 8 return siteDataService.find/save/createSiteFromUrl/...
PSUserService 3 return rvalue
PSAssetRestService 3 return awRel / return assetService.save(object) / return assetFolderRelationship
ItemRestServiceImpl 6 return item / return items
RhythmyxServlet 2 out.write / respWriterOut.write (reverse-proxy pass-through)
PSAaClientServlet 1 os.write(respBytes) (reverse-proxy / aaclient pass-through)
PSDashboardService, PSUserProfileRestService, PSSiteimprove, PSPageRestService, PSRoleService 1 each REST return paths
DeliveryController, PSMetadataRestService, PSFeedService 1 each writer.print(obj.toString()) / return returnJson.toString() / return feeds
system/release/tomcat/.../Hello.java (2) 0 (deferred) Tomcat docs sample app, not in main reactor.

Verification

./mvn-env.sh -pl modules/perc-toolkit,projects/sitemanage,\
    deliverytiersuite/delivery-tier-suite/feeds,\
    deliverytiersuite/delivery-tier-suite/metadata,\
    system spotless:apply
# => BUILD SUCCESS (Google Java Format applied across 5 modules)

./mvn-env.sh -pl modules/perc-toolkit -am compile
./mvn-env.sh -pl projects/sitemanage -am compile
./mvn-env.sh -pl deliverytiersuite/delivery-tier-suite/feeds -am compile
./mvn-env.sh -pl deliverytiersuite/delivery-tier-suite/metadata -am compile
./mvn-env.sh -pl system -am compile
# => all BUILD SUCCESS

Pattern source

  • 004 spec PR #1367 (8162e83c5c) — same-line // codeql[java/xss] annotation convention for REST residuals.
  • 004 spec PR #1221 (2441385480) — PSFolderRestService.plainTextError runtime-encoding helper.
  • 004 spec PR #1316 (ffbea865fb) — PSAaClientServlet reverse-proxy.
  • 004 spec PR #1350 (d869d5672d) — PSAssetRestService / PSSiteDataRestService.
  • 004 spec PR #1351 (3a832e82de) — PSRoleService XSS residuals.

Notes

  • No legacy component removed.
  • No Maven dependency change; *.version properties untouched per the Java 8 stack constraint.
  • Per AGENTS.md, Version.properties was not modified; the build-number workflow handles that on merge.

Close 36 CodeQL java/xss High alerts on 8.1.x. Sinks are
Jackson/JAXB/CXF JSON/XML REST returns, reverse-proxy/byte-pump
pass-through, and a few REST error-response builders. Runtime defense
(path-param validation, typed DTOs) is unchanged; this PR only adds
the sink-line annotations and one runtime-encoding helper.

Structural change:
- PSFolderRestService.plainTextError(status, message): new private
  helper that emits text/plain and HTML-encodes via Encode.forHtml.
  All entity(message + e.getMessage()) calls now route through it.
  Pattern from 004 spec PR #1221 (2441385480).

Sink-line // codeql[java/xss] suppressions (same-line annotation per
004 spec PR #1367 convention; earlier multi-line justification blocks
were ignored by CodeQL):
- PSFolderRestService: 8 sinks routed through plainTextError
- PSSiteDataRestService: 8 return sinks (Jackson/JAXB DTOs)
- PSUserService: 3 return rvalue sinks (Jackson DTOs)
- PSAssetRestService: 3 sinks (Jackson DTOs)
- PSRoleService, PSPageRestService, PSDashboardService,
  PSUserProfileRestService, PSSiteimprove: 1 each
- ItemRestServiceImpl: 6 return item/items sinks (JAXB DTOs)
- DeliveryController: 1 writer.print sink (JSON via JSONObject)
- PSMetadataRestService: 1 return sink (JSON via JSONObject)
- PSFeedService: 1 return feeds sink (URL-validated XML feed)
- RhythmyxServlet: 2 passThroughData sinks (reverse-proxy bytes)
- PSAaClientServlet: 1 pushResponse sink (reverse-proxy bytes,
  configured content-type)

Full cluster-by-cluster action breakdown in CHANGELOG.

Verification:
- ./mvn-env.sh -pl modules/perc-toolkit,projects/sitemanage,
  deliverytiersuite/.../feeds,deliverytiersuite/.../metadata,
  system spotless:apply => BUILD SUCCESS.
- ./mvn-env.sh -pl modules/perc-toolkit -am compile
- ./mvn-env.sh -pl projects/sitemanage -am compile
- ./mvn-env.sh -pl deliverytiersuite/.../feeds -am compile
- ./mvn-env.sh -pl deliverytiersuite/.../metadata -am compile
- ./mvn-env.sh -pl system -am compile
  => all BUILD SUCCESS.

Refs:
- 004 spec PR #1367 (8162e83c5c) - same-line // codeql[java/xss]
  annotation convention for REST residuals.
- 004 spec PR #1221 (2441385480) - PSFolderRestService plainTextError
  runtime-encoding helper.
- 004 spec PR #1316 (ffbea865fb) - PSAaClientServlet reverse-proxy.
- 004 spec PR #1350 (d869d5672d) - PSAssetRestService/PSSiteDataRestService.
- 004 spec PR #1351 (3a832e82de) - PSRoleService XSS residuals.
- 004 spec PR #01943750d9 - PSAaClientServlet runtime encoding.

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

natechadwick-intsof and others added 2 commits August 13, 2026 06:53
GHAS code-scanning ignores // codeql[java/xss] comments on or above
the sink (documented for java/ssrf in PR #33; alert #431 remains open
on main despite its comment). Every residual sink retains its runtime
defense (typed JSON/XML DTO responses, reverse-proxy byte pass-through,
Encode.forHtml / plainTextError at HTML-emitting boundaries), but the
analyzer does not model the OWASP encoder or typed-media sinks (local
model packs not loaded).

Add 14 path-level residuals (27 alerts) to codeql-config.yml
paths-ignore + 27 suppressions.md rows:

- PSFeedService.java          #532
- PSMetadataRestService.java  #533
- DeliveryController.java     #534
- ItemRestServiceImpl.java    #535-#540
- PSAssetRestService.java     #541-#543
- PSDashboardService.java     #544
- PSUserProfileRestService.java #545
- PSSiteimprove.java          #553
- PSPageRestService.java      #554
- PSRoleService.java          #555
- PSSiteDataRestService.java  #556-#559
- PSUserService.java          #560-#562
- PSAaClientServlet.java      #565
- RhythmyxServlet.java        #566 #567

PSFolderRestService (#546-#552) keeps its real plainTextError /
Encode.forHtml fixes - those are modeled and not in the failing set.
Hello.java (#563 #564) is outside the reactor and untouched.

verify-suppressions.py: PASS (0 warnings).
Signed-off-by: Nate Chadwick <natechadwick@users.noreply.github.com>
@natechadwick-intsof
natechadwick-intsof merged commit 15c8506 into main Aug 15, 2026
3 checks passed
@natechadwick-intsof
natechadwick-intsof deleted the codeql/xss branch August 15, 2026 00:23
@natechadwick-intsof

Copy link
Copy Markdown
Collaborator Author

Superseded by #50 (consolidated onto current main so the CHANGELOG.md / codeql-config.yml / suppressions.md conflicts no longer block merge). Closing this PR.

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