- 
                Notifications
    
You must be signed in to change notification settings  - Fork 110
 
Restructure CSP Configuration with Streamlined Settings (backwards incompatible) #219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d88f009    to
    77ab5f0      
    Compare
  
    | By following this migration guide, you should be able to successfully update your Django project to | ||
| use the new dict-based CSP settings format introduced in the latest version of `django-csp`. This | ||
| change aligns the package with the latest CSP specification and provides a more organized and | ||
| flexible way to configure your Content Security Policy. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👨🍳 💋
1da985f    to
    b09c116      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very much excited about this overhaul. The new configuration model is vastly more ergonomic and easier to work with. Thank you for working on this!
| 'upgrade-insecure-requests': True, | ||
| 'report-uri': "/csp-report/", | ||
| } | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I <3 this soooo much more than django-csp 3 configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(not a full review, but some comments around the backwards-incompatibility this introduces)
d2cd3e2    to
    4c12388      
    Compare
  
    | 
           Does anyone also feel like we shouldn't have a top level  I'm considering changing the import path since we're breaking backwards compatibility anyway but wanted to try to get a poll: 
  | 
    
4c12388    to
    bb97109      
    Compare
  
    bb97109    to
    93f1eb3      
    Compare
  
    | warning = ( | ||
| "You are using django-csp < 4.0 settings. Please update your settings to use the new format.\n" | ||
| "See https://django-csp.readthedocs.io/en/latest/migration-guide.html for more information.\n\n" | ||
| "We have attempted to build the new CSP config for you based on your current settings:\n\n" | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r+ with v v minor comments
Very excited about this - thank you for all the hard (and smart!) work on it 🚀
93f1eb3    to
    bbfc8bb      
    Compare
  
    This is a backwards incompatible change. Also fixes mozilla#139, mozilla#191
bbfc8bb    to
    039f699      
    Compare
  
    
This PR introduces a significant update to the django-csp project, focusing on enhancing the coherence between configuration and headers, and aligning with Django's common practices for settings. The CSP settings have been restructured, consolidating them into two primary options for enforced and report-only policies.
Key Changes:
CONTENT_SECURITY_POLICY: settings for the enforced policy.CONTENT_SECURITY_POLICY_REPORT_ONLY: settings for the report-only policy.This is a backwards-incompatible change.
While this change may require refactoring for existing users...
Feedback and Contributions
We invite our community members to test and provide feedback on the updated settings structure. Your input will help refine django-csp and ensure its compatibility with Django best practices. Documentation enhancements or suggestions are greatly appreciated.