Kong / Kong/unirest-nodejs

Setting .strictSSL(false) does not work for .attach()

Open
#138 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
953
Forks
164
PR merge metrics
No merged PRs in 30d

Description

I am able to authenticate and get some work item in my RTC https local server setting Request.strictSSL(false), but when I try to .attach() something, it does not works:

Code:

```
var cookies = unirest.jar();
async.waterfall([
(callback) => {
var req = unirest("POST", "https://localhost:9443/ccm/j_security_check")
.headers({
"Content-Type": "application/x-www-form-urlencoded",
})
.strictSSL(false)
.jar(cookies)
.send("j_username=samuel")
.send("j_password=samuel")
.end(function(res) {
if (res.error) throw new Error(res.error);
console.log('logged');
callback();
});
},
(callback) => {
var req = unirest("GET", "https://localhost:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/2")
.headers({
Accept: "application/json",
})
.jar(cookies)
.strictSSL(false)
.end(function(res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
callback();
});
},
(callback) => {
var req = unirest(
"POST",
"https://localhost:9443/ccm/service/com.ibm.team.workitem.service.internal.rest.IAttachmentRestService?projectId=_Jv0jwFXOEeuKc9Bmrq6cOA&multiple=true"
)
.strictSSL(false)
.jar(cookies)
.attach(
"file",
"https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/8075345095/original/nicolas_cage.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAS6FNSMY2WD6T3JNC%2F20210120%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210120T164143Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=78fd8611c6a7c530937631d0f61d0c412c9a4f0d3d0a100eca919fa495e5c775"
)
.end(function(res) {
if (res.error) {
console.error(res.error);
} else {
console.log('attach worked');
}
});
}
])
```

Output:

```
logged
{...workitem}
{ Error: self signed certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1058:34)
at TLSSocket.emit (events.js:198:13)
at TLSSocket._finishInit (_tls_wrap.js:636:8) code: 'DEPTH_ZERO_SELF_SIGNED_CERT' }
```

Am I missing something?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the .attach() entry point and trace how its request handles the strictSSL(false) option compared with the preceding requests. Reproduce the shown attachment request against the self-signed RTC server, then verify that the attachment succeeds without the certificate error when strictSSL(false) is set.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.