Skip to content

Fix path handling, calculations, and security validations#75

Open
pablo-schmeiser wants to merge 8 commits intoHaDiNet:masterfrom
pablo-schmeiser:fix/miscellaneous-fixes
Open

Fix path handling, calculations, and security validations#75
pablo-schmeiser wants to merge 8 commits intoHaDiNet:masterfrom
pablo-schmeiser:fix/miscellaneous-fixes

Conversation

@pablo-schmeiser
Copy link
Collaborator

This pull request introduces several improvements and bug fixes across the codebase, focusing on performance optimizations, security enhancements, and code correctness. The most notable changes include optimizing database queries, tightening redirect URL validation, correcting logic in recurring shift handling, and improving timezone and locale settings.

Performance and Query Optimization:

  • Optimized the calculation of a user's shift_count in User by aggregating all relevant user IDs and performing a single query, reducing database load and improving efficiency.
  • Added a cached_property for participant_count in Shift, and refactored related properties to use this cached value, minimizing redundant database queries.

Security Improvements:

  • Enhanced redirect URL validation in authentication views and base views by using url_has_allowed_host_and_scheme to prevent at least 2 Open Redirect Vulnerabilities (CWE 601), and added error handling for unsafe URLs.

Bug Fixes and Logic Corrections:

  • Fixed a bug in recurring shift creation where holiday handling logic was incorrectly referencing the weekend handling condition instead of the holiday handling condition.
  • Corrected the calculation of weeks in _matches_every_nth_weekday to use integer division, ensuring accurate recurrence logic.
  • Improved form validation for shift length to ensure both start and end times are present before performing the check.

Settings and Configuration Adjustments:

  • Updated settings to use os.path for path handling, ensuring compatibility and correctness.

Permissions Handling:

  • Refactored organization permissions collection to use more efficient queryset operations and clearer logic for aggregating permissions.

@pablo-schmeiser pablo-schmeiser added the bug Something isn't working label Mar 17, 2026
@pablo-schmeiser pablo-schmeiser removed the request for review from mfbehrens March 17, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant