docker / app

Make your Docker Compose applications reusable, and share them on Docker Hub
Apache License 2.0
1.57k stars 177 forks source link

Add a seed for better randomness #741

Closed rumpl closed 4 years ago

rumpl commented 4 years ago

- What I did

Added a call to rand.Seed

Without the seed the rand.Intn will always start from the same place and return the same application name

- How to verify it

Without this change run:

$ docker app run APP1
$ docker app run APP2

The second one would fail with a message: Installation "gallant_poitras" already exists, use 'docker app update' instead

- A picture of a cute animal (not mandatory) image

justincormack commented 4 years ago

Please do not use math/rand in any code, just use crypto/rand

rumpl commented 4 years ago

Please do not use math/rand in any code, just use crypto/rand

The call to rand.Intn is in moby

rumpl commented 4 years ago

This is for random name generation

justincormack commented 4 years ago

Hmm, I thought I had fixed that one too, ok will change it there.

codecov[bot] commented 4 years ago

Codecov Report

Merging #741 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #741   +/-   ##
=======================================
  Coverage   68.98%   68.98%           
=======================================
  Files          64       64           
  Lines        3437     3437           
=======================================
  Hits         2371     2371           
  Misses        748      748           
  Partials      318      318

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 61e61a8...2aacb5d. Read the comment docs.

justincormack commented 4 years ago

Its ok to merge this though, before I change the implementation.