# GHSA-r68h-jhhj-9jvm: Validator.isValidSafeHTML is being deprecated and will be deleted from org.owasp.esapi:esapi in 1 year


- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Fix available:** Yes
- **Published:** 27 Nov 2023

## What is GHSA-r68h-jhhj-9jvm?

GHSA-r68h-jhhj-9jvm is a vulnerability in org.owasp.esapi:esapi, published on 27 Nov 2023. 

### Official description

### Impact
The `Validator.isValidSafeHTML` method can result in false negatives where it reports some input as safe (i.e., returns true), but really isn't, and using that same input as-is can in certain circumstances result in XSS vulnerabilities. Because this method cannot be fixed, it is being deprecated and will be removed in one years time from when this advisory is published. Full details may be found in [ESAPI Security Bulletin #12](https://github.com/ESAPI/esapi-java-legacy/blob/develop/documentation/ESAPI-security-bulletin12.pdf).

Note that all versions of ESAPI, that have this method (which dates back to at least the ESAPI 1.3 release more than 15 years ago) have this issue and it will continue to exist until we remove these two methods in a future ESAPI release.

### Patches
There is no patch. We do not believe that it is possible to patch this pretentiously named method other then perhaps renaming it to something like Validator.mightThisBeValidSafeHTML to dissuade developers from using it.

### Workarounds
Stop using this method. Note that `Validator.getValidSafeHTML` is believed to be safe to use with the default **antisamy-esapi.xml** AntiSamy policy file.

### Why is no CVE being filed?
We outline the reasons in the section "Why no CVE for this issue?" in [ESAPI Security Bulletin #12](https://github.com/ESAPI/esapi-java-legacy/blob/develop/documentation/ESAPI-security-bulletin12.pdf). If after reading that, if _you_ still want to file a CVE or this, knock yourself out.

### References
[CWE-79](https://cwe.mitre.org/data/definitions/79.html)
[CWE-80](https://cwe.mitre.org/data/definitions/80.html)
[ESAPI Security Bulletin #12](https://github.com/ESAPI/esapi-java-legacy/blob/develop/documentation/ESAPI-security-bulletin12.pdf)

### Final resolution
This GitHub Security Advisory should now be considered remediated in [ESAPI versions 2.6.0.0](https://github.com/ESAPI/esapi-java-legacy/releases/tag/esapi-2.6.0.0) and later as the deprecated methods have been removed from the ESAPI jar.

## Which versions are affected by GHSA-r68h-jhhj-9jvm?

2 open source packages ship an affected version, including org.owasp.esapi:esapi.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.owasp.esapi:esapi` | Maven | All versions | 2.6.0.0 |
| `org.owasp.esapi:esapi` | Maven | All versions | 2.6.0.0 |

## How do I fix GHSA-r68h-jhhj-9jvm?

Upgrade org.owasp.esapi:esapi to 2.6.0.0 or later.

## Is GHSA-r68h-jhhj-9jvm being exploited?

There is no known exploitation of GHSA-r68h-jhhj-9jvm in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-r68h-jhhj-9jvm and fix it if it is affected.

What it is: GHSA-r68h-jhhj-9jvm is a vulnerability in org.owasp.esapi:esapi, published on 27 Nov 2023. 
Exploitation: There is no known exploitation of GHSA-r68h-jhhj-9jvm in the wild and no public exploit code.

Affected packages and fixed versions:
- org.owasp.esapi:esapi (Maven): affected all versions; fixed in 2.6.0.0
- org.owasp.esapi:esapi (Maven): affected all versions; fixed in 2.6.0.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-r68h-jhhj-9jvm/ (Markdown: https://insights.sbomify.com/GHSA-r68h-jhhj-9jvm/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-r68h-jhhj-9jvm

---
From sbomify Insights: https://insights.sbomify.com/GHSA-r68h-jhhj-9jvm/
Summaries are generated and may contain mistakes; the official description above is the record.
