[PR #5677] [MERGED] Fix how SECRET_KEY is generated #13048

Closed
opened 2025-12-29 22:25:07 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/5677
Author: @Alef-Burzmali
Created: 1/24/2021
Status: Merged
Merged: 1/25/2021
Merged by: @jeremystretch

Base: developHead: develop


📝 Commits (1)

  • b6e532f Fix how SECRET_KEY is generated

📊 Changes

1 file changed (+2 additions, -3 deletions)

View changed files

📝 netbox/generate_secret_key.py (+2 -3)

📄 Description

Fixes: #5676

Use secrets.choice instead of random.sample to generate the secret key.
random.sample selects without replacement and limits the possible space for the key, which could be bruteforced.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/5677 **Author:** [@Alef-Burzmali](https://github.com/Alef-Burzmali) **Created:** 1/24/2021 **Status:** ✅ Merged **Merged:** 1/25/2021 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `develop` --- ### 📝 Commits (1) - [`b6e532f`](https://github.com/netbox-community/netbox/commit/b6e532f01d852738f40eb8bedc89f5c056b2f62c) Fix how SECRET_KEY is generated ### 📊 Changes **1 file changed** (+2 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `netbox/generate_secret_key.py` (+2 -3) </details> ### 📄 Description <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be opened for approval prior to filing a pull request. This helps avoid wasting time and effort on something that we might not be able to accept. Please indicate the relevant feature request or bug report below. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ACCEPTED BUG REPORT OR FEATURE REQUEST, IT WILL BE MARKED AS INVALID AND CLOSED. --> ### Fixes: #5676 <!-- Please include a summary of the proposed changes below. --> Use secrets.choice instead of random.sample to generate the secret key. random.sample selects without replacement and limits the possible space for the key, which could be bruteforced. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 22:25:07 +01:00
adam closed this issue 2025-12-29 22:25:08 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13048