Repository navigation
fix(web): clearer create errors, focus management, stripped password links, safe file downloads - #181
Merged
Merged
Conversation
A secret over the server's body limit failed with a bare 'unexpected status code 413' toast, and 429 looked the same. Show translated messages instead. Move focus to the success heading after creating a secret and to the heading of each recipient status card, so keyboard and screen reader users are not left on the page body.
…iles A password-protected link whose query was stripped showed the no-password flow and used up a failed attempt; the 2. key prefix already marks it. The file download used the sender-supplied content as the link target without checking it, so it could point anywhere; only data URLs are downloaded now.
Merged
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 was wrong
<body>. The same happened on the recipient's status screens.?p=true(CFYI-UX-002). When a chat app stripped the query, the reader got the no-password flow, used up a failed attempt, and saw "invalid link". The key's2.prefix already marks a password-protected secret.hrefstraight from the decrypted payload, so it could send the recipient to another site.What changed
lib/createError.ts: 413 and 429 errors from create map to new translated messages (create.errors.tooLarge,create.errors.rateLimited). Other errors keep their message, as before.<h2>and theStatusCard<h1>(tabIndex={-1}) are focused when they mount. The card that holds the credentials form opts out, because its inputs alreadyautoFocus.isPasswordProtectedLink:?por a2.-prefixed fragment key means the secret is password-protected.safeFileDownloadUrl: onlydata:URLs are downloaded. Anything else shows a translated error.en,es,de,fr,zh) and typed inTranslationKeys.@crypt.fyi/coreand@crypt.fyi/webpatch.How it was tested
pnpm build,pnpm typecheck,pnpm lint(0 errors; the existing core warning),pnpm format:check: pass.pnpm test:e2e: 7 pass, including a newe2e/focus.spec.ts. That spec checks that the success heading is focused after create and the gate heading after opening a link. It also checks that a password link with?p=trueremoved still asks for the password and unlocks. Both new e2e tests fail withmain's components.For the reviewer
BODY_LIMIT_BYTESis 100 KB. You could lowerMAX_FILE_SIZE, raise the server default, or expose the limit to the client (an API addition). Users now get a clear message, but the right limit is your call.Left out
msg, which needs a core client change to read the body. A11Y-002 (hard-coded English strings,aria-labelon<pre>), CRYPTO-007 (clearing the key from history, a UX trade-off on refresh), PRIV-002 (self-hosting the badge), HDR-001 (CSP additions, which need a CSP and e2e review) and DEBT-001: not done here.