{"id":15892034,"url":"https://github.com/semoal/should_send_same_site_none","last_synced_at":"2025-06-14T07:11:47.139Z","repository":{"id":56895426,"uuid":"297949990","full_name":"semoal/should_send_same_site_none","owner":"semoal","description":"A simple utility to detect incompatible user agents for `SameSite=None` cookie attribute","archived":false,"fork":false,"pushed_at":"2023-12-15T08:23:04.000Z","size":17,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-07T07:42:41.249Z","etag":null,"topics":["chrome","cookies","hacktoberfest","rails","ruby","samesite","user-agent"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/should_send_same_site_none/versions/0.1.0","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/semoal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-23T11:37:47.000Z","updated_at":"2023-03-07T15:06:28.000Z","dependencies_parsed_at":"2022-08-20T17:10:26.879Z","dependency_job_id":null,"html_url":"https://github.com/semoal/should_send_same_site_none","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semoal%2Fshould_send_same_site_none","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semoal%2Fshould_send_same_site_none/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semoal%2Fshould_send_same_site_none/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semoal%2Fshould_send_same_site_none/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semoal","download_url":"https://codeload.github.com/semoal/should_send_same_site_none/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221761187,"owners_count":16876551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chrome","cookies","hacktoberfest","rails","ruby","samesite","user-agent"],"created_at":"2024-10-06T07:42:46.538Z","updated_at":"2024-10-28T01:41:32.434Z","avatar_url":"https://github.com/semoal.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Ruby Gem CI](https://github.com/semoal/should_send_same_site_none/workflows/Ruby%20Gem%20CI/badge.svg?branch=master)\n# ShouldSendSameSiteNone\n\nWith this gem you can check a user-agent is compatible with `SameSite:none` cookie.\n\n## Background\n\nWith Chrome 80 in February 2020, Chrome will treat cookies that have no declared SameSite value as `SameSite=Lax` cookies. Other browser vendors are expected to follow Google’s lead. (See this [Blog Post](https://blog.chromium.org/2019/10/developers-get-ready-for-new.html)).\n\nIf you manage cross-site cookies, you will need to apply the SameSite=None; Secure setting to those cookies. However, some browsers, including some versions of Chrome, Safari and UC Browser, might handle the None value in unintended ways, requiring developers to code exceptions for those clients.\n\n`isSameSiteNoneCompatible` utility function detects incompatible user agents based on a [list of known incompatible clients](https://www.chromium.org/updates/same-site/incompatible-clients) and returns `true` if the given user-agent string is compatible with `SameSite=None` cookie attribute.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'should_send_same_site_none'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install should_send_same_site_none\n\n## Usage\n\nThis gem was originally created to check on Ruby on Rails redis session store, if we can pass same_site or not for ex:\n\nLook code at: https://github.com/semoal/redis-actionpack\n```ruby\n# redis-action-pack gem\ndef set_cookie(env, _session_id, cookie)\n    request = wrap_in_request(env)\n    if (request.user_agent.present? \u0026\u0026 ShouldSendSameSiteNone.is_same_site_compatible(value))\n        if (cookie[:same_site].present? \u0026\u0026 cookie[:same_site] == :none)\n            cookie.delete(:same_site)\n        end\n        cookie_jar(request)[key] = cookie.merge(cookie_options)\n    else\n        cookie_jar(request)[key] = cookie.merge(cookie_options)\n    end\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/should_send_same_site_none. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/should_send_same_site_none/blob/master/CODE_OF_CONDUCT.md).\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the ShouldSendSameSiteNone project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/should_send_same_site_none/blob/master/CODE_OF_CONDUCT.md).\n\n## Intersting links\n\n- [JS Package](https://github.com/linsight/should-send-same-site-none)\n- [Ruby on Rails Session Store with this logic, for avoiding problems on rails app](https://github.com/semoal/redis-actionpack)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemoal%2Fshould_send_same_site_none","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemoal%2Fshould_send_same_site_none","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemoal%2Fshould_send_same_site_none/lists"}