Repository navigation
feat: send the SHA-1 hash to the Appwrite Pwned service - #13805
Merged
Merged
Conversation
Appwrite Pwned 0.4.0 takes the SHA-1 hash of the password on POST /v1/detection instead of the password itself, as a `hash` parameter of 40 hexadecimal characters. The adapter now hashes the password and sends only the hash, so the password never leaves the server. The cache key is derived from the hash rather than the password; it is still an HMAC keyed with the shared secret, so the cache holds nothing crackable. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Contributor
|
Rector's dry-run over tests/ flags the mixed-typed body the fetch adapter records, since assertStringNotContainsString takes a string. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
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.
What does this PR do?
Updates the
appwrite://password-pwned adapter to the interface Appwrite Pwned 0.4.0 ships.POST /v1/detectionno longer takes the password. It takes ahashparameter — the SHA-1 of the password as 40 hexadecimal characters (appwrite-labs/pwned#11). The adapter now hashes the password and sends only the hash, so the password itself never leaves the server, and the request body is no longer something that has to be kept out of a log.Auth\Validator\PasswordPwned\Appwriteposts{"hash": "<40 hex chars>"}instead of{"password": "..."}._APP_PWNED_PASSWORDS_DSNdescription inapp/config/variables.phpsay what now travels. The warning to keep the service on a network you control or behind TLS stays — a bare SHA-1 is unsalted, so an observer can still match a common password by its hash.No behaviour changes for the other adapters:
hibp://already sent a hash prefix, andnone://andmock://never leave the process. No API surface, model, or migration change.This requires Appwrite Pwned 0.4.0 or newer. A server pointed at 0.3.x with an
appwrite://DSN gets a400for the unknown parameter, which the adapter surfaces asgeneral_pwned_passwords_unavailable— passwords are never silently accepted. Operators usingappwrite://upgrade the service alongside this.Test Plan
tests/unit/Auth/Validator/PasswordPwned/AppwriteTest.phpupdated for the new wire format:testTheHashIsSentWithTheSharedSecretAsBearerTokenasserts the body is exactly{"hash": strtoupper(sha1(password))}and that the plaintext password appears nowhere in it.400fixture intestServiceErrorsAreReportedcarries 0.4.0's error object for a rejectedhash.61 tests, 204 assertions, green.
composer lintclean on the three changed files.tests/e2e/Services/Project/PoliciesPasswordPwnedIntegrationTest.phpruns againstmock://localhostand is untouched by this.Related PRs and Issues
Checklist
_APP_PWNED_PASSWORDS_DSNenvironment variable.🤖 Generated with Claude Code