Rocket icon indicating copy to clipboard operation
Rocket copied to clipboard

Use invalid secret_key in documentation

Open snyball opened this issue 2 years ago • 2 comments

Existing Functionality

Currently the documentation contains examples like this:

## NOTE: Don't (!) use this key! Generate your own!
secret_key = "hPRYyVRiMyxpw5sBB1XeCMN1kFsDCqKvBi2QJxBVHQk="

This warning is insufficient for someone quickly copy-pasting and not reading very thoroughly.

Suggested Changes

Make the secret_key subtly invalid base64 [1], and provide an example for how to generate a secure code.

## NOTE: Don't (!) use this key! Generate your own! (e.g on Linux `head -c64 /dev/urandom | base64 -w0`)
secret_key = "hPRYyVRiMyµ5sBB1π+CMN1kFsqKvBi2QJxBVHQk="

[1] https://util.unicode.org/UnicodeJsps/confusables.jsp

Alternatives Considered

  • Making sure people have time to read documentation thoroughly
    • I've talked with upstream and they've marked this as wontfix
  • Refusing to use the key hPRYyVRiMyxpw5sBB1XeCMN1kFsDCqKvBi2QJxBVHQk= specifically (the key used in the docs)

Additional Context

Obviously developers should read documentation carefully, but I think this is a nice way to catch people before they make a mistake.

snyball avatar Aug 02 '22 16:08 snyball

This a great idea. Maybe we can both 1) change the key in the docs to be invalid, and 2) refuse to use the known docs key, perhaps as a warning in 0.5.0 and then as an error in 0.6.0.

SergioBenitez avatar Sep 04 '22 23:09 SergioBenitez

@SergioBenitez Sounds like a good idea to just do both, I'll submit a PR.

snyball avatar Sep 19 '22 22:09 snyball

This was fixed via #2356. Thank you again!

SergioBenitez avatar Mar 24 '23 01:03 SergioBenitez