[PR #20262] [MERGED] Closes #20222: Enable HttpOnly flag for the CSRF cookie #15862

Closed
opened 2025-12-30 00:24:28 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20262
Author: @jetomit
Created: 9/5/2025
Status: Merged
Merged: 9/6/2025
Merged by: @arthanson

Base: mainHead: close-20222


📝 Commits (1)

  • 6a2f2a5 Closes #20222: Enable HttpOnly flag for the CSRF cookie

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 netbox/netbox/settings.py (+1 -0)

📄 Description

Fixes: #20222

This prevents JS code from reading the CSRF token from the cookie store. If needed, the window.CSRF_TOKEN property can be used instead (see also commit cdea302).

Actual security benefit of this change is minimal, but it is sometimes requested by auditors.


🔄 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/20262 **Author:** [@jetomit](https://github.com/jetomit) **Created:** 9/5/2025 **Status:** ✅ Merged **Merged:** 9/6/2025 **Merged by:** [@arthanson](https://github.com/arthanson) **Base:** `main` ← **Head:** `close-20222` --- ### 📝 Commits (1) - [`6a2f2a5`](https://github.com/netbox-community/netbox/commit/6a2f2a50b61613ec12cbb9e924d704d708935a07) Closes #20222: Enable HttpOnly flag for the CSRF cookie ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `netbox/netbox/settings.py` (+1 -0) </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 approved and assigned prior to opening a pull request. This helps avoid waste time and effort on a proposed change that we might not be able to accept. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED TO YOU, IT WILL BE CLOSED AUTOMATICALLY. Please specify your assigned issue number on the line below. --> ### Fixes: #20222 <!-- Please include a summary of the proposed changes below. --> This prevents JS code from reading the CSRF token from the cookie store. If needed, the `window.CSRF_TOKEN` property can be used instead (see also commit cdea302). Actual security benefit of this change is minimal, but it is sometimes requested by auditors. --- <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-30 00:24:28 +01:00
adam closed this issue 2025-12-30 00:24:28 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15862