-
-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bandit] Use the secrets module for activation keys
Issue: [B311:blacklist] Standard pseudo-random generators are not suitable for security/cryptographic purposes. Fix: instead of using random.random() use secrets.token_hex() and avoid using hashing the salt then hashing salt+username! NEW DB MIGRATION: - increases activation_key field size to 64 chars!
- Loading branch information
Showing
3 changed files
with
35 additions
and
27 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
tcms/core/contrib/auth/migrations/0002_increase_activation_key_size.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 2.0.4 on 2018-04-12 11:56 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('tcms.core.contrib.auth', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='useractivatekey', | ||
name='activation_key', | ||
field=models.CharField(blank=True, max_length=64, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters