govuk-prototype-kit icon indicating copy to clipboard operation
govuk-prototype-kit copied to clipboard

Can we make authentication check more robust?

Open joelanman opened this issue 3 years ago • 7 comments

We recently saw a prototype without authentication. It's possible this is down to the check here requiring "production" - which is set on Heroku but may not be set on other hosts. Is there a more bulletproof check to ensure authentication is on when deployed to any server?

joelanman avatar Dec 15 '21 15:12 joelanman

What we'd like to do in response to this finding:

  • Identify why it didn't work in this case, try to include this use case to help other users - recognising there's another environment to support and supporting it
  • Allow the user to set a FORCE_AUTH parameter so the user can override what we detect - recognising we won't always know about all environments so gibing the user more control
  • Switch the logic to detect a dev environment making production the default (note: do we need a different start script e.g. npm run dev)

nataliecarey avatar Feb 22 '22 11:02 nataliecarey

this has come up again - Azure has no default NODE_ENV so authentication is not activated

joelanman avatar Apr 07 '22 15:04 joelanman

I was thinking the other day (for an unrelated issue about dev dependencies and Glitch) that really we should have two npm scripts, dev and serve, that run the appropriate script (and possibly set the appropriate NODE_ENV at the same time). That would act as a small bit of documentation for users as to what to use where, as well as making a Procfile / app config easier.

lfdebrux avatar May 16 '22 11:05 lfdebrux

this is higher priority now we're even less sure where people are hosting, though we have added NODE_ENV=production to the publish docs

joelanman avatar Sep 30 '22 10:09 joelanman

We've agreed for v13 to make the common default npm command, npm start, run the kit in 'production' mode. This is a breaking change, but makes it much less likely that users will end up with unsecured prototypes in production.

lfdebrux avatar Sep 30 '22 12:09 lfdebrux

@joelanman to provide outcome conversation he had with Natalie. Documentation will need an update as well.

Izabela-16 avatar Oct 05 '22 08:10 Izabela-16

Okay, v13 will now use the npm run dev command for local development, solving this issue.

lfdebrux avatar Oct 05 '22 15:10 lfdebrux