SameSite Cookies Explained

The SameSite attribute of cookies controls how they are sent in cross-site (slightly different from cross-origin) requests in web browsers through which we can reduce the risk of cross-site request forgery (CSRF) attacks and hence enhance user privacy and security. Before looking at the different values we can pass to this attribute, please read this […]

Set Shared Cookies Across Subdomains on localhost

If you are running multiple apps on localhost across different subdomains (foo.localhost, bar.localhost, etc.) and want to set a cookie on one domain that is accessible from another subdomain, then you will have to watch out for a couple of things. Setting a Cookie with Domain=.localhost or Domain=localhost (since the dot notation is deprecated) will […]

Pydantic Private Fields (or Attributes)

Let’s say we have a simple Pydantic model that looks like this: When you instantiate a Pydantic model – post = Post(**data) – all the required attributes defined must be passed, i.e., id, title, body. What if you had one or more of the following requirements: This would mostly require us to have an attribute […]