Skip to content

fix: upgrade scify/laravel-cookie-guard to 5.1.0 - #402

Merged
PavlosIsaris merged 1 commit into
masterfrom
chore/cookie-guard-5.1.0
Sep 21, 2026
Merged

PavlosIsaris merged 1 commit into
masterfrom
chore/cookie-guard-5.1.0

Conversation

@PavlosIsaris

@PavlosIsaris PavlosIsaris commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Version 4.x stored the consent cookie for 30 days, although the
configuration sets 365. It posted to /guard-settings/save outside the web
middleware group, so the CSRF token was never checked. It hid the banner
before the server confirmed the save. It did not erase the cookies of a
rejected category. It also spells the plural interval as [2,Inf], which
Laravel 12.48 and newer print literally in the banner.

  • Require scify/laravel-cookie-guard ^5.1.0.
  • Re-publish the cookies-consent-public assets. The fix is in that
    JavaScript.
  • Publish those assets on every composer update, through post-update-cmd.
  • Remove the enabled config key. Version 5 removed the option.

The consent cookie keeps its name, so visitors are not asked again. Consent
cookies written by 4.x hold 30 days and expire on their own schedule. New
consents last the configured 365 days.

Summary by CodeRabbit

  • New Features

    • Added support for opening cookie consent settings on page load and through URL links or hash changes.
    • Consent selections now reflect configured categories, preserve required cookies, and can be stored for a configurable period.
    • Improved cookie security and cleanup across domains, including Secure and SameSite protections.
  • Bug Fixes

    • Improved restoration and parsing of previously saved consent choices.
  • Style

    • Refreshed cookie banner, accordion, and responsive styling.

Version 4.x stored the consent cookie for 30 days, although the
configuration sets 365. It posted to /guard-settings/save outside the web
middleware group, so the CSRF token was never checked. It hid the banner
before the server confirmed the save. It did not erase the cookies of a
rejected category. It also spells the plural interval as [2,Inf], which
Laravel 12.48 and newer print literally in the banner.

- Require scify/laravel-cookie-guard ^5.1.0.
- Re-publish the cookies-consent-public assets. The fix is in that
  JavaScript.
- Publish those assets on every composer update, through post-update-cmd.
- Remove the enabled config key. Version 5 removed the option.
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 6c17c7a4-7972-4fee-bc6b-b753a7f07cca

📥 Commits

Reviewing files that changed from the base of the PR and between 2bdb599 and 2bbc30d.

⛔ Files ignored due to path filters (2)
  • composer.lock is excluded by !**/*.lock
  • public/vendor/scify/laravel-cookie-guard/scripts.js.map is excluded by !**/*.map
📒 Files selected for processing (5)
  • composer.json
  • config/cookies_consent.php
  • public/vendor/scify/laravel-cookie-guard/_variables.css
  • public/vendor/scify/laravel-cookie-guard/scripts.js
  • public/vendor/scify/laravel-cookie-guard/styles.css
💤 Files with no reviewable changes (1)
  • config/cookies_consent.php

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The pull request upgrades the cookie guard package, adds automatic asset publication, removes the enabled-category override, updates consent handling, and regenerates the published CSS and JavaScript assets.

Changes

Cookie consent update

Layer / File(s) Summary
Package and consent configuration
composer.json, config/cookies_consent.php
The cookie guard dependency uses ^5.1.0. Composer force-publishes consent assets after dependency updates. The enabled configuration key is removed, while strictly_necessary remains required.
Consent flow and persistence
public/vendor/scify/laravel-cookie-guard/scripts.js
The script handles consent-settings links and hash changes, derives category selections, sends CSRF-protected submissions, validates responses, stores returned consent data, removes declined cookies across domains, and applies secure cookie attributes.
Published consent assets
public/vendor/scify/laravel-cookie-guard/_variables.css, public/vendor/scify/laravel-cookie-guard/styles.css, public/vendor/scify/laravel-cookie-guard/scripts.js
The published CSS is regenerated and reformatted. Media queries and consent banner rules are updated. A source-map reference is added to the script.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant CookieConsentUI
  participant scripts.js
  participant ConsentServer
  participant BrowserCookies
  CookieConsentUI->>scripts.js: Submit selected consent categories
  scripts.js->>ConsentServer: Send consent with XSRF or CSRF header
  ConsentServer-->>scripts.js: Return consent data
  scripts.js->>BrowserCookies: Store returned consent and remove declined cookies
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 1 files. (3 skipped: 3… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the primary change: upgrading scify/laravel-cookie-guard to version 5.1.0. It is concise and specific.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 1 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.17%. Comparing base (2bdb599) to head (2bbc30d).

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #402   +/-   ##
=========================================
  Coverage     50.17%   50.17%           
  Complexity     1394     1394           
=========================================
  Files           195      195           
  Lines          4759     4759           
=========================================
  Hits           2388     2388           
  Misses         2371     2371           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PavlosIsaris
PavlosIsaris merged commit 29eb6a7 into master Sep 21, 2026
10 checks passed
@PavlosIsaris
PavlosIsaris deleted the chore/cookie-guard-5.1.0 branch September 21, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants