Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
samuel-loupen opened this issue Jan 21, 2021 · 1 comment
Open

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

samuel-loupen opened this issue Jan 21, 2021 · 1 comment

Comments

@samuel-loupen
Copy link

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?

@samuel-loupen samuel-loupen changed the title Setting .strictSSL(false) does not works for .attach() Setting .strictSSL(false) does not work for .attach() Jan 21, 2021
@mghstehr
Copy link

Does a workaround exist for this ?

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

No branches or pull requests

2 participants