Repository navigation
Conversation
# Conflicts: # CHANGELOG.md # contract/bin/run-rust # docs/laravel-rust.md # rust/contract-app/src/main.rs # rust/laravel-keyring/README.md # rust/laravel-keyring/src/config.rs # rust/laravel-keyring/src/events.rs # rust/laravel-keyring/src/http/session.rs # rust/laravel-keyring/src/lib.rs # rust/laravel-keyring/src/sessions.rs # workbench/app/Providers/ContractServiceProvider.php
…nnouncements, with prune and sweep scheduled
…sion's announcement
…ves for the sweep
…for, as the php package does
# Conflicts: # contract/bin/run-rust # docs/laravel-rust.md # rust/laravel-keyring/README.md # rust/laravel-keyring/src/config.rs # rust/laravel-keyring/src/events.rs # rust/laravel-keyring/src/login/attempts.rs # rust/laravel-keyring/src/notifications.rs # rust/laravel-keyring/tests/impersonation.rs
…nded session's announcement
…s and inertia visits
… announce what ended before a failure
…om the provider's table and fail on passkeys left behind
…ules and the import's new checks
…d, and what sign-out and import now check
# Conflicts: # CHANGELOG.md # docs/laravel-rust.md # rust/laravel-keyring/README.md
…wser refusals for pages
…inertia json lockouts
…nces at the new docs
…record belongs to
…session or changing sign-in methods
…other session_user_type
…feat/laravel-rust-support # Conflicts: # docs/laravel-rust.md
… signing them out everywhere
…sign in keeps to sessions.max
…stry other than the database
…d how long it waits
…se any unexpired stray and require a connection:table user type
…ill refuse and that a missing user table is looked for again
# Conflicts: # CHANGELOG.md # UPGRADE.md # tests/Feature/EmailCodeTest.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a Rust version of Keyring for Laravel for Rust (
laravel-rust0.1.4) and a React + Inertia starter kit built on it, alongside the PHP package. A shared HTTP contract suite keeps the PHP and Rust versions in step. This PR also fixes two security issues in the PHP package that the port's reviews turned up.What's here
contract/: a bun + TypeScript black-box suite that drives Keyring over real HTTP. It uses a cookie jar, CSRF, TOTP, a WebCrypto passkey and a fake identity provider. Its README is the spec each contract app follows, including the test-only/_keyring-test/*hooks and theX-Keyring-Test-Clockheader.workbench/: the PHP contract app, serving the real package withphp -Son localhost.rust/laravel-keyring: the crate, a port of the whole package. Tables, stored data and JSON match PHP's, so a database or a@keyringjs/keyringfrontend works with either side.rust/contract-app: the Rust contract app.rust/starter-kit: a Laravel for Rust app with Inertia, React 19, TypeScript and Tailwind v4, using the crate and@keyringjs/keyring/react. It has a page for everything Keyring renders, settings pages for the profile, password, sign-in methods and sessions, and "Was this you?" alerts. It asks for a second factor by default (REQUIRE_SECOND_FACTOR). Its README covers copying it out and going to production.docs/rust/is a full Rust doc set that mirrors the PHP docs page for page (quick start, installation, configuration, factors, sessions, SSO, step-up, testing and so on).docs/rust/differences.mdlists every known difference from PHP.docs/laravel-rust.mdis now a landing page pointing into it.contract,rustandrust-databases(Postgres, MySQL) jobs.jsjob also typechecks, builds and audits the starter kit.The crate is
publish = falsefor now, andcontract/,workbench/andrust/are export-ignored, so nothing new ships to Packagist.What the crate covers
dangerously_replace()/dangerously_remove()for the risk lock and requirement stepssign_in::attempt()andas_user(), for signing someone in from the app's own routesallow_sign_in_when(),allows_enrollment()), and username normalising/confirm,RequireFreshVerification, thekeyring:aal2middleware (RequireAssurance) for the app's own routes, andRequireEnrollment(keyring.enrolled). A confirmed enrollment hands backcontinue.PasswordRulessso.extend()), andsso::start()/complete()for its own routes. The OAuth 2.0 and OpenID Connect pieces are public (OAuth2,Oidc,OpenIdConnect, andGoogle/Microsoft/GitHub), so an app can build a driver on them the way PHP subclassesOAuth2ProviderandOidcProvider.impersonate(),stop_impersonating(),refusal())testingfeature): fakes, acting as a signed-in user, authenticator factories, virtual passkeys andKeyringConformance.keyring:prune,sweep,sign-out,import fortifyandinstall(including--require-second-factor), with the scheduled upkeep.Everything laravel-rust can support is ported, apart from a pipeline step locking an attempt out. Differences from PHP are listed in the crate README and
docs/laravel-rust.md. The main ones come from what laravel-rust 0.1.4 doesn't have:webauthn-rs-corecan't verify Ed25519.Auth::logout_current_device.protection::guard()andaddress_reserved()itself.Failed,Lockout,PasswordReset,RegisteredorVerifiedevents. Add authentication events laravel/rust-framework#411 adds the session guard's events.The README's "What laravel-rust Would Need" section lists the rest.
PHP security fixes
These affect both sides and are in the CHANGELOG's Security section and a new "From 0.4 to 0.5" section in UPGRADE.md.
established_afterhas passed, so a stolen session can't add one to lock the owner out.known_browsercookie.Rust security audit
The crate had a full security audit (recon, 23 coverage units, hunters, coverage critics and verifiers). It found no confirmed vulnerabilities and five leads that depend on how an app is set up. All five are fixed, and each fix had a code review and a security review:
step_up::proved()and the assurance checks are bound to the session record's user, so a proof can't be read off a record that belongs to someone else.sessions.maxset all take the same row lock on the user that the PHP package takes. The wait is capped at 5 seconds, and if the lock can't be taken in time, the change fails rather than going ahead without it.session_user_typeare handled:UPDATEthat fixes a leftover setting.session_user_typethat isn'tconnection:tablestops the app at boot.Coverage was measured with
cargo llvm-cov, and tests were added for the gaps it showed (throttle, registries, SSO flows, impersonation, email changes and more).Testing
All run locally with
bin/ci:contract/bin/run-phpandcontract/bin/run-rust, 292 pass each. The runners now hash at bcrypt cost 4 and give every file a 30s timeout; before that, password tests timed out on CI.cargo teston SQLite, Postgres and MySQL, 3,693 pass in total, with fmt and clippy clean. The starter kit also builds without thetestingfeature.vendor/bin/pest --parallel, 4,040 pass at 100% coverage, with Pint, PHPStan and Rector clean.Each part had a code review and a security review before it was merged.
The new
contractcheck will need adding to main's required checks by hand.