Skip to content

feat(resource-server-utils)!: flip context default; chore: drop dead lib bundles#352

Merged
bjagg merged 4 commits into
uPortal-Project:masterfrom
bjagg:chore/resource-server-consolidation
May 9, 2026
Merged

feat(resource-server-utils)!: flip context default; chore: drop dead lib bundles#352
bjagg merged 4 commits into
uPortal-Project:masterfrom
bjagg:chore/resource-server-consolidation

Conversation

@bjagg
Copy link
Copy Markdown
Member

@bjagg bjagg commented May 7, 2026

Summary

  • feat! flip ResourcesElementsProvider.DEFAULT_RESOURCE_CONTEXT from /ResourceServingWebapp to /resource-server. BREAKING CHANGE — should ship as resource-server-utils 2.0 (or at minimum 1.6). With the standard uPortal-start dual-overlay deployment + crossContext="true", every consumer's <rs:resourceURL> / <rs:aggregatedResources> / resource="true" skin entries instantly start emitting /resource-server/... URLs without any per-webapp <context-param> change. Deployers still on the legacy 1.0.48 WAR can pin via resourceContextPath=/ResourceServingWebapp per-webapp.
  • chore delete eight consumer-free legacy library directories from resource-server-content/src/main/webapp/rs/: bootstrap (BS3), bootstrap-namespaced, ckeditor (3.x + 4.3.2), datatables (1.9.4), fetch, promise-polyfill, lesscss, lodash (4.17.4). 7,330 files / 818,604 lines deleted; WAR shrinks ~115 MB → ~84 MB.
  • Closes scanner findings for known XSS CVEs in BS3, CKEditor 3.x/4.3.2, jQuery 1.x bundled DataTables, and lodash 4.17.4 prototype-pollution CVEs.

Test plan

  • mvn -B clean install from the parent — all six modules build green
  • mvn -B testresource-server-utils test suite green (all 17 tests; the one literal in ResourcesElementsProviderImplTest was updated to match the new default)
  • Drop the new resource-server-webapp:1.5.4-SNAPSHOT into uPortal-start (resourceServerWebjarVersion=1.5.4-SNAPSHOT) and confirm:
    • Visiting /resource-server/rs/lodash/4.17.4/lodash.min.js, /resource-server/rs/ckeditor/4.3.2/ckeditor.js, /resource-server/rs/bootstrap/3.3.5/css/bootstrap.min.css, /resource-server/rs/datatables/1.9.4/media/js/jquery.dataTables.js returns 404
    • Kept paths still resolve: /resource-server/rs/modernizr/2.6.2/..., /resource-server/rs/normalize/2.1.2/..., /resource-server/rs/fontawesome/4.7.0/..., /resource-server/rs/famfamfam/silk/1.3/..., /resource-server/rs/tango/0.8.90/..., /resource-server/rs/canvg/r144/..., /resource-server/rs/template/1.0.0/...
    • Webjar paths still resolve: /resource-server/webjars/jquery/dist/jquery.min.js, etc.
  • uPortal-start full Playwright suite green (visual smoke + portlet specs)

Notes

This PR pairs with consolidation PRs across the fleet (uPortal core, uPortal-start, and several portlet repos) that move every literal /ResourceServingWebapp/ path to /resource-server/ and drop or replace the libraries the deleted bundle directories provided. The full migration story and per-deployer guidance live in notes/resource-server-consolidation-deployer-guide.md in the workspace tracking docs.

bjagg added 2 commits May 6, 2026 07:55
…rce-server

Problem: ResourcesElementsProvider.DEFAULT_RESOURCE_CONTEXT defaulted
to /ResourceServingWebapp — the legacy resource-server context path.
That meant <rs:resourceURL>, <rs:aggregatedResources>, and every
resource="true" entry in skin descriptors resolved to the legacy
overlay by default, forcing every consumer that wanted to migrate to
the modern resource-server-webapp 1.5.x overlay to set an explicit
<context-param>resourceContextPath=/resource-server</context-param>
in their web.xml. None of the 13 consumer webapps in the upstream
uPortal-start fleet bother to set that override, so the legacy WAR
remains load-bearing even after consumers visually migrate their
literal paths.

Goal: flip the library default so the modern overlay is the
out-of-the-box resolution target. Consumers who deliberately want
the legacy context can still pin it via the existing
resourceContextPath context-param (no API change). Combined with
the standard uPortal-start dual-overlay deployment + Tomcat
crossContext=true, this lets the legacy overlay be retired without
touching every consumer webapp's web.xml.

Goal: BREAKING CHANGE — default behavior shifts from emitting
/ResourceServingWebapp/... to /resource-server/... URLs. Should be
released as resource-server-utils 2.0 (or at minimum 1.6).

Changes:
- resource-server-utils/src/main/java/org/jasig/resourceserver/utils/aggr/ResourcesElementsProvider.java:
  change the DEFAULT_RESOURCE_CONTEXT constant from
  "/ResourceServingWebapp" to "/resource-server".
- resource-server-utils/src/test/java/org/jasig/resourceserver/utils/aggr/ResourcesElementsProviderImplTest.java:
  update the one expected-output literal that hardcoded the old prefix
  (testHtmlFragmentWithoutServer's local-fallback expectation is
  unchanged; only the cross-context case had the literal). The other
  callsites reference DEFAULT_RESOURCE_CONTEXT as a constant and
  auto-track the new value.

Notes: deployers still on the legacy 1.0.48 ResourceServingWebapp
overlay can pin per-webapp via
<context-param><param-name>resourceContextPath</param-name>
<param-value>/ResourceServingWebapp</param-value></context-param>;
documented in the workspace deployer guide. Verified end-to-end
against uPortal-start's full Playwright suite + a hand-rolled
visual smoke that asserts zero /ResourceServingWebapp/... requests
on guest/admin/student layouts.

BREAKING CHANGE: DEFAULT_RESOURCE_CONTEXT is now "/resource-server"
(was "/ResourceServingWebapp"). Consumers that depend on the legacy
default must either deploy a webapp at /ResourceServingWebapp or set
the resourceContextPath context-param explicitly.
Problem: resource-server-content's rs/** overlay shipped a kitchen-sink
of front-end libraries dating from 2008-2015 (Bootstrap 3.x, CKEditor
3.x + 4.3.2, Apache Fluid Infusion, DataTables 1.9.4, fetch and
Promise polyfills, the LESS compiler, lodash 4.17.4). uPortal core
and every bundled portlet have either migrated to webjar-based
modern equivalents or replaced the lib with a native API; a workspace
audit confirmed zero remaining consumers of these directories. The
bundle's old versions trip security scanners (BS3 < 3.4.1 and
CKEditor 4.x < 4.22 carry XSS CVEs), even though no live page
loads them.

Goal: shrink the WAR and clear those scanner findings by deleting
the consumer-free directories. The remaining rs/** content (tango,
famfamfam, modernizr, normalize, fontawesome, jquery-plugins, etc.)
still has live consumers and stays for now; future passes will
migrate or replace them in turn.

Changes:
- resource-server-content/src/main/webapp/rs/bootstrap/,
  rs/bootstrap-namespaced/: delete (Bootstrap 3.x + namespaced
  variant). uPortal core consumes Bootstrap 5 via webjar.
- resource-server-content/src/main/webapp/rs/ckeditor/: delete
  (CKEditor 3.x + 4.3.2 directories). SimpleContentPortlet now
  consumes CKEditor 4.22.1 via the org.webjars.npm:ckeditor4 webjar.
- resource-server-content/src/main/webapp/rs/datatables/: delete
  (DataTables 1.9.4). uPortal core consumes DataTables 2.3.x via
  webjar.
- resource-server-content/src/main/webapp/rs/fetch/,
  rs/promise-polyfill/: delete. Modern browsers have native
  fetch/Promise; uPortal targets BS5 baseline (no IE).
- resource-server-content/src/main/webapp/rs/lesscss/: delete.
  uPortal core moved to Sass/esbuild for skin compilation.
- resource-server-content/src/main/webapp/rs/lodash/: delete.
  Recent consumer-side commits removed lodash from
  uPortal-webapp/Search/searchRest.jsp,
  uPortal-webapp/Invoker/sitemap.jsp, and
  JasigWidgetPortlets/configLinks.jsp in favor of native ES.

Notes: ~7,330 files / 818,604 lines deleted from source. Local
resource-server-webapp 1.5.4-SNAPSHOT WAR shrinks ~115 MB → ~84 MB
(~30 MB saved). The next resource-server release ships as 1.5.4 and
deployers pick up the slimmer WAR transparently. End-to-end verified
against uPortal-start's full Playwright suite.
@Naenyn
Copy link
Copy Markdown
Contributor

Naenyn commented May 8, 2026

It looks like this PR needs org.webjars.npm:ckeditor4:4.22.1 added as a dependency, to webapp's pom:

    <dependency>
      <groupId>org.webjars.npm</groupId>
      <artifactId>ckeditor4</artifactId>
      <version>4.22.1</version>
    </dependency>

bjagg added 2 commits May 8, 2026 15:17
Problem: resource-server-webapp does not declare the ckeditor4 webjar,
so the running resource-server has no CKEditor 4 assets to serve to
consumers. SimpleContentPortlet PR #554 needs the asset path available
before its CKEditor webjar swap can be verified.

Goal: include org.webjars.npm:ckeditor4 in the webapp module so the
served context exposes CKEditor 4 from the standard webjars path.

Changes:
- add org.webjars.npm:ckeditor4:4.22.1 to resource-server-webapp/pom.xml
  webjar dependencies, alphabetical position between bootstrap and
  jquery
Brings in:
- uPortal-Project#342 update dependency foundation to v6
- uPortal-Project#349 bump parent v49 -> v50 (plexus-archiver CVE fix)

Conflict resolution: kept HEAD's deletion of
resource-server-content/src/main/webapp/rs/datatables/1.9.4/plugins/integration/foundation/index.html.
The entire rs/datatables/1.9.4/ directory is being removed in this
branch (see commit 85224df); upstream's uPortal-Project#342 modification to that
file is irrelevant since the directory itself is doomed.
@Naenyn Naenyn self-requested a review May 9, 2026 00:30
Copy link
Copy Markdown
Contributor

@Naenyn Naenyn left a comment

Choose a reason for hiding this comment

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

Looks good to me after the ckeditor addition. Deployed and tested locally.

@ChristianMurphy ChristianMurphy requested a review from Copilot May 9, 2026 00:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@bjagg bjagg merged commit 6d3d4b6 into uPortal-Project:master May 9, 2026
5 checks passed
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.

4 participants