Bug 1253927 - Node default module crypto doesn't work properly [NEEDINFO]
Node default module crypto doesn't work properly
Product: OpenShift Online
Classification: Red Hat
Component: Containers (Show other bugs)
Unspecified Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: Miciah Dashiel Butler Masters
Meng Bo
: UpcomingRelease
Depends On:
  Show dependency treegraph
Reported: 2015-08-15 14:13 EDT by se98100
Modified: 2017-05-31 14:22 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2017-05-31 14:22:11 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
mmasters: needinfo? (se98100)

Attachments (Terms of Use)
The error (79.19 KB, image/png)
2015-08-15 14:13 EDT, se98100
no flags Details

  None (edit)
Description se98100 2015-08-15 14:13:01 EDT
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 13:30:18 EDT
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."


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 16:10:27 EST
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 14:22:11 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.