Skip to content

[APS-18945, APS-18946] fix: bump org.json and testng to patch security vulnerabilities#4

Open
karanshah-browserstack wants to merge 2 commits intomainfrom
fix/APS-18945-18946-dependency-security-patches
Open

[APS-18945, APS-18946] fix: bump org.json and testng to patch security vulnerabilities#4
karanshah-browserstack wants to merge 2 commits intomainfrom
fix/APS-18945-18946-dependency-security-patches

Conversation

@karanshah-browserstack
Copy link
Copy Markdown
Collaborator

@karanshah-browserstack karanshah-browserstack commented May 5, 2026

Security Fix: APS-18945 + APS-18946

Issues Fixed

Ticket Package Vulnerability CVSS
APS-18945 `org.json:json` Stack overflow / DoS via crafted JSON/XML (GHSA-3vqj-43w4-2q58) 7.5
APS-18946 `org.testng:testng` Path traversal in XML File Parser (GHSA-rc2q-x9mf-w3vf) 7.8

Root Cause

Both dependencies were pinned to old, vulnerable versions in `pom.xml`:

  • `org.json:json` at `20210307` — vulnerable to stack overflow DoS when parsing deeply nested XML/JSON
  • `org.testng:testng` at `7.4.0` — vulnerable to path traversal via the `testngXmlExistsInJar` function

Fix Applied

Single `pom.xml` change bumping both version properties:

```
<testng.version>7.4.0</testng.version> → <testng.version>7.5.1</testng.version>
<json.version>20210307</json.version> → <json.version>20231013</json.version>
```

  • `org.testng:testng` → `7.5.1` (backport of the Zip Slip / path traversal fix from the 7.7.0 patch)
  • `org.json:json` → `20231013` (includes the stack overflow nesting depth limit fix from 20230227 and later)

Testing

Dependency Resolution (fix branch):

  • `mvn dependency:resolve` → `BUILD SUCCESS`
  • `org.testng:testng:jar:7.5.1:test` ✅ resolved
  • `org.json:json:jar:20231013:test` ✅ resolved

Compilation (fix branch):

  • `mvn compile` → `BUILD SUCCESS` ✅

BrowserStack E2E Session Run (karanshah14's account):

Session Browser OS Status
Verify Google Homepage Title playwright-webkit 26.0 OS X Ventura ✅ passed — view session
Verify Google Homepage Title chrome 147.0 OS X Sonoma ✅ passed — view session

Note: Two pre-existing issues (unrelated to the security patches) were also fixed: (1) `URLEncoder.encode` used the `Charset` overload (Java 10+ only) — changed to pass `"UTF-8"` as a String for Java 8 compat; (2) Tests require Java 11+ to run — the BrowserStack Java SDK javaagent fails on Java 8 due to bytecode instrumentation incompatibility with Playwright 1.55.0.

Note: Dependabot PRs #2 and #3 cover these same fixes individually. This PR supersedes both with a single combined fix. Once this PR is merged, PRs #2 and #3 can be closed.

Jira Tickets

  • APS-18945 — org.json:json stack overflow vulnerability
  • APS-18946 — TestNG path traversal vulnerability

Checklist

…S [APS-18945, APS-18946]

- Bump org.json:json from 20210307 to 20231013 (fixes CVE stack overflow / DoS — APS-18945)
- Bump org.testng:testng from 7.4.0 to 7.5.1 (fixes path traversal vulnerability — APS-18946)

Resolves: APS-18945, APS-18946
…18945] [APS-18946]

- Replace StandardCharsets.UTF_8 (Charset) with "UTF-8" (String) in
  URLEncoder.encode calls — the Charset overload requires Java 10+
- Add throws Exception to @before setUp methods to satisfy the
  checked UnsupportedEncodingException declaration
- Pre-existing compilation failure on main branch; unrelated to the
  dependency version bumps in 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.

1 participant