Yet more git syntax I keep forgetting. To branch and create a new line of development from a specific commit, do the following:
git branch newbranchname a9c146a09505837ec03b
-b switch to immediately checkout after branching.
Since the commit will likley be behind, use
--force when pushing to tell git to ignore future commits from the original branch and start a new fork.
Web development frameworks such as Symfony these days bake-in a number of security features, CSRF protection being a fairly common one. I recently made the mistake of not scrutinizing Symfony’s CSRF protection defaults, which led to occasional confusing CSRF errors after a web app had been deployed.
CSRF protection embeds a code into both the generated form and some client-side storage mechanism (cookies, though I suppose this could work with an HTML5 client-side database or whatnot). On submit, if the value embedded into the form and the cookie value match, then we know the form is submitted by the user who originally requested it.
In Symfony, the CSRF cookie lifetime can be configured, defaulting to null, which falls back to
session.cookie_lifetime value from
php.ini. I had originally set this to be one hour, probably based on configuration examples from a year or so back..
Anyway, app users lately have been leaving forms open for more than an hour. This is a good thing: It means they are treating our web app more like a client side app, which indeed it is meant to replace. Took some sleuthing, however, to figure out why I was seeing the occasional CSRF error when everything else seemed hunky dory. I’ve now set this to
which will retain the cookie for the length of the browser session.
Lesson learned. Know your timeouts. And for that matter, plan some time to review old assumptions.