swagger-api / swagger-api/swagger-codegen
[JAVA][ApiClient.java]: Insecure SSL: Overly Broad Certificate Trust
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
[JAVA][ApiClient.java]: Insecure SSL: Overly Broad Certificate Trust
A critical issue was discovered by Fortify in ApiClient.java generated by swagger-codegen:
An SSL/TLS connection is created using the default pre-loaded system Certificate Authorities (CAs), which may allow attackers to intercept encrypted communications by performing man-in-the-middle (MiTM) attacks using certificates signed with compromised root CAs.
Swagger-codegen version
2.3.1
Swagger declaration file content or url
TrustManager trustAll = new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {}
@Override
public X509Certificate[] getAcceptedIssuers() { return null; }
};
Command line used for generation
swagger-codegen generate
Steps to reproduce
Scan the generated code using Fortify.
Related issues/PRs
NA
Suggest a fix/enhancement
NA
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The reported output is ApiClient.java, produced by the swagger-codegen generate command; start by locating the Java template or generation entry point that emits the shown TrustManager. Use the Fortify finding as the reproduction, then verify the generated client no longer triggers the overly broad certificate-trust finding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100