summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-05-17 20:27:30 +0000
committerGerrit Code Review <review@openstack.org>2018-05-17 20:27:30 +0000
commit8b104e1f9116ac349fd9b5628e49430b5de8f931 (patch)
treeea4ccc1259ba8e7bfbbc08a43cc3b2db8b8b5210
parent472c7106c5fa2a855f894cf50925bcc693eae820 (diff)
parentde568e036cf310338aeced0b9a34377f8a6280e4 (diff)
downloadheat-8b104e1f9116ac349fd9b5628e49430b5de8f931.tar.gz
Merge "Replace random with SystemRandom for RandomString" into stable/ocata
-rw-r--r--heat/engine/resources/openstack/heat/random_string.py6
-rw-r--r--releasenotes/notes/system-random-string-38a14ae2cb6f4a24.yaml6
2 files changed, 11 insertions, 1 deletions
diff --git a/heat/engine/resources/openstack/heat/random_string.py b/heat/engine/resources/openstack/heat/random_string.py
index d4758531e..9052b5062 100644
--- a/heat/engine/resources/openstack/heat/random_string.py
+++ b/heat/engine/resources/openstack/heat/random_string.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import random
+import random as random_module
import string
import six
@@ -25,6 +25,10 @@ from heat.engine import resource
from heat.engine import support
from heat.engine import translation
+# NOTE(pas-ha) Heat officially supports only POSIX::Linux platform
+# where os.urandom() and random.SystemRandom() are available
+random = random_module.SystemRandom()
+
class RandomString(resource.Resource):
"""A resource which generates a random string.
diff --git a/releasenotes/notes/system-random-string-38a14ae2cb6f4a24.yaml b/releasenotes/notes/system-random-string-38a14ae2cb6f4a24.yaml
new file mode 100644
index 000000000..713317c8f
--- /dev/null
+++ b/releasenotes/notes/system-random-string-38a14ae2cb6f4a24.yaml
@@ -0,0 +1,6 @@
+---
+security:
+ - |
+ Heat no longer uses standard Python RNG when generating values for
+ OS::Heat::RandomString resource, and instead relies on system's RNG
+ for that.