SecurityOWASP ASVS and NIST SP 800-63B

OWASP ASVS and NIST SP 800-63B

On this page

Introduction

Keyring for Go stands where the PHP package does against OWASP ASVS 5.0.0, NIST SP 800-63B-4 and the OWASP authentication cheat sheets, since it makes the same guarantees and passes the same contract suite. The PHP page goes requirement by requirement, with the same status column. This page says where the Go port's standing, or the setup to reach it, differs. Where a requirement isn't named here, the PHP page's row holds.

What a Default Install Gives You

There's no installer to accept defaults from. keyring:install with nothing named prints the PHP installer's features and the password alone, but writes nothing, and adds no risk signals. An application that adds keyring.New[models.User]() with nothing else gets:

  • the password, authenticator apps, recovery codes and passkeys as sign-in methods, where the PHP installer's default is the password alone,
  • every feature off but the security log, where the PHP installer turns on registration, resets, email verification and password changes, since each runs code of yours,
  • eight of the eleven security emails the PHP page lists: second factor failed, recovery code used and account locked aren't sent yet (see Differences From PHP),
  • no risk signals, where the PHP installer adds three,
  • the same rate limits, timebox, session registry and session limits as the PHP package.

So to match the PHP page's default install, turn on the four features with their actions, and add keyring.SessionFingerprintChanged{}, keyring.RepeatedFactorFailures{} and keyring.SuccessAfterFailures{} with Keyring.RiskSignals (see Choosing Signals):

Go
k := keyring.New[models.User](func(cfg *keyring.Config) {    cfg.Features.Registration = true    cfg.Features.EmailVerification = true    cfg.Features.ResetPasswords = true    cfg.Features.UpdatePasswords = true}).    CreateUsersWith(actions.CreateNewUser{}).    ResetPasswordsWith(actions.ResetUserPassword{}).    UpdatePasswordsWith(actions.UpdateUserPassword{}).    RiskSignals(        keyring.SessionFingerprintChanged{},        keyring.RepeatedFactorFailures{},        keyring.SuccessAfterFailures{},    )

The actions are yours, as in the contract app. Users can't add a second factor until Features.ManageAuthenticators is on.

Level 1

As the PHP page says, with these in Go terms:

  1. Keep a server-side session driver. Keyring ends an old copy of a session through its registry either way.
  2. Keep the default cache store in a store that holds its keys, supports locks and is shared by every server, not Laravel Go's memory store. Everything the PHP page puts in cache.limiter is there.
  3. Mask password fields, and let paste and password managers work.
  4. Give users a form that posts to PUT /user/password, with Features.UpdatePasswords on.
  5. When your app disables an account, have Keyring.AllowSignInWhen answer false for it (7.4.2). Keyring then refuses every sign in, and signs out every session of the user's, ending their records, on the next request any of them makes. There's no call to end them all from your own code at the moment you set the flag.
  6. Put a sign-out button on every signed-in page.

Call Keyring.GuardChanges from your user model's Updating hook, since Laravel Go has no model events Keyring can listen to.

Level 2

As the PHP page says. The second factor is required of everyone with RequireEnrollment in the web group, which keyring:install --factor=... prints, and Config.EnrollmentURL set to your page for adding one:

Go
laravel.Options{    Packages: []laravel.Package{k},    Middleware: func(m *laravel.Middleware, _ *config.Config) {        m.Web.Append(keyring.RequireEnrollment[models.User]{})    },}

The starter kit sets this up, unless REQUIRE_SECOND_FACTOR=false.

Level 3

Not reachable yet. Level 3 needs attested security keys, and Keyring for Go doesn't check attestation other than none, so no key is attested and nothing meets AAL3. See Differences From PHP.

Requirement by Requirement

V6 Authentication

The rows are the PHP page's, with these differences:

Requirement In the Go Port
6.2.8 The password is verified exactly as received Deviates, as in the PHP package: every password is put in NFC form before it's hashed or checked. Your actions get the form's passwords already normalised.
6.3.3 Multi-factor authentication is required Needs setup: RequireEnrollment, as above.
6.3.5 Users are notified of suspicious authentication attempts Partly: the emails for a failed second factor, a recovery code used and a locked account aren't sent yet. The log entries are written, and "was this you?" alerts show at the next sign in.
6.5.5 Code lifetimes Deviates, as in the PHP package: set Factors.TotpWindow to 0 to meet it exactly.

V7 Session Management

The rows are the PHP page's, with these differences:

Requirement In the Go Port
7.4.1 A terminated session can't be used again Met for Keyring's record and the browser's next request. The ended session's data stays in the store until it expires, as Laravel Go can't destroy another browser's session.
7.4.2 Sessions end when an account is disabled or deleted Partly: a disabled account is your app's flag, read by AllowSignInWhen, as above. A deleted user's sessions are signed out on their next request. Either way each session ends on its next request, not at once.
7.4.3 The option to end other sessions after a factor changes Met: a password change always ends every other session, as sign_out_others: false can't keep them.
7.5.1 Re-authentication before changing sign-in details Met by default: Config.ChangesMiddleware starts as RequireFreshVerification within 15 minutes. Don't set it to nil.

The Other Chapters

As the PHP page says. The cryptography the Go port uses is in Cryptography. RS256 for passkeys stays off by default, as in the PHP package.

NIST SP 800-63B-4

What Keyring's Levels Mean

The levels are the PHP package's, worked out the same way. See the PHP page. AAL3 can't be reached yet, as no key is attested.

Section by Section

As the PHP page says, with one difference: Sec. 3.1.1.2's advice to rehash passwords isn't followed on sign in, as Laravel Go's guard would sign out every other session of the user.

The OWASP Cheat Sheets

As the PHP page says. Keyring's cookie names don't name the software, as the Session Management Cheat Sheet recommends.

What Is Left to Your App

As the PHP page lists, plus:

  • Your user model and actions. Registration, password changes, resets and email changes run your code, which saves users through a model whose Updating hook calls Keyring.GuardChanges, and checks passwords with Keyring.PasswordRules.
  • Trusted proxies in Laravel Go's Middleware.Proxies.
  • A queue worker, or the sync queue, for the security emails. Laravel Go uses the database queue whenever DATABASE_URL is set.