kratos icon indicating copy to clipboard operation
kratos copied to clipboard

feat: webhooks support setting client cookies

Open brahmlower opened this issue 1 year ago • 2 comments

Related issue(s)

None- I've added this without any prior discussion.

Checklist

  • [x] I have read the contributing guidelines.
  • [ ] I have referenced an issue containing the design document if my change introduces a new feature.
  • [x] I am following the contributing code guidelines.
  • [x] I have read the security policy.
  • [x] I confirm that this pull request does not address a security vulnerability. If this pull request addresses a security vulnerability, I confirm that I got the approval (please contact [email protected]) from the maintainers to push the changes.
  • [ ] I have added tests that prove my fix is effective or that my feature works.
  • [ ] I have added or changed the documentation.

Further Comments

Hey folks, it's been a while 👋 Hope you all had a good winter break!

My team realized it would be helpful if we could set an additional cookie via the post-login webhook for some of our users, and so I went ahead and added support for doing just that 😁 This PR is a functional proof of concept.

A webhook response with the following would set a cookie named "foo" with the value "bar":

{
  "cookies": [
    {
      "name": "foo",
      "value": "bar"
    }
  ]
}

As I see it, the only remaining work this branch needs is:

  • [ ] tests
  • [ ] docs
  • [ ] any security checks/guards that you guys think would be appropriate

Before working on that though, I wanted to check in with you guys first to see if this is a feature you'd be interested in merging.

brahmlower avatar Jan 26 '24 07:01 brahmlower

Codecov Report

Attention: Patch coverage is 46.15385% with 28 lines in your changes are missing coverage. Please review.

Project coverage is 77.93%. Comparing base (d01b670) to head (5242e84). Report is 1 commits behind head on master.

Files Patch % Lines
selfservice/hook/web_hook.go 46.15% 27 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3716      +/-   ##
==========================================
- Coverage   77.98%   77.93%   -0.06%     
==========================================
  Files         359      359              
  Lines       25190    25213      +23     
==========================================
+ Hits        19644    19649       +5     
- Misses       4039     4056      +17     
- Partials     1507     1508       +1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 26 '24 08:01 codecov[bot]