Bug 1253927

Summary: Node default module crypto doesn't work properly
Product: OpenShift Online Reporter: se98100
Component: ContainersAssignee: Miciah Dashiel Butler Masters <mmasters>
Status: CLOSED WONTFIX QA Contact: Meng Bo <bmeng>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.xCC: abhgupta, jokerman, libra-bugs, mmccomas, se98100
Target Milestone: ---Keywords: UpcomingRelease
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-05-31 18:22:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
The error none

Description se98100 2015-08-15 18:13:01 UTC
Created attachment 1063300 [details]
The error

Since the last maintenance on nodejs my app doesn't work properly. it gives me this error: 
var cryptedSessionKey = crypto.publicEncrypt(publicKey, sessionKey);
TypeError: Object #<Object> has no method 'publicEncrypt'

crypto is initialized in this way: var crypto = require('crypto'); and crypto is a default module that doesn't require npm installation (but i've also tried this) indeed the app still works in local on my pc and worked on openshift until yesterday.

Comment 1 Miciah Dashiel Butler Masters 2015-08-19 17:30:18 UTC
The publicEncrypt method was added to Node.js's crypto core module in the v0.11.14 release (per `git tag --contains=42bda05af8d628db90f3ee64fa2dd89973cb1e03`).  The crypto core module was introduced in Node.js in the v0.1.92 release (per `git tag --contains=80174392bbcec0cec1c79628fb09af351a6488aa`).  According to the Node.js documentation,

    "Core modules are always preferentially loaded if their identifier is passed to require(). For instance, require('http') will always return the built in HTTP module, even if there is a file by that name."

https://nodejs.org/api/modules.html#modules_core_modules

The version of Node.js we provide in OpenShift has thus far always been strictly between v0.1.92 and v0.11.14.  Therefore crypto.publicEncrypt() should never have worked in OpenShift when using the core library with var crypto = require('crypto');.

Is it possible you were using a custom cartridge with a newer version of Node.js (and thus a newer version of the crypto core module) when the application worked on OpenShift earlier, or that you were initialising (or re-initialising) crypto using a different library?

Comment 2 Miciah Dashiel Butler Masters 2016-01-11 21:10:27 UTC
Hi, have you been able to look into this issue yet to answer the question in comment 1?

Comment 3 Eric Paris 2017-05-31 18:22:11 UTC
We apologize, however, we do not plan to address this report at this time. The majority of our active development is for the v3 version of OpenShift. If you would like for Red Hat to reconsider this decision, please reach out to your support representative. We are very sorry for any inconvenience this may cause.