feat(metrics): tag cryptify uploads with X-Cryptify-Source: website#228
Merged
Conversation
Sets X-Cryptify-Source on the PostGuard SDK so cryptify (≥0.1.27+, encryption4all/cryptify#102) classifies uploads from this site deterministically rather than via the Origin-host fallback. Origin-based detection collided with the Outlook add-in, which is served from addin.*.postguard.eu — that host matches cryptify's `contains("postguard.")` rule and shadows the User-Agent "outlook" check. With the explicit header, the website always reports `channel="website"` regardless of the deploy host.
3 tasks
Contributor
Author
|
/dobby review |
Contributor
|
This agent sees the request, sir! Reviewing the PR now — though this agent notes it appears already merged, so will post findings as a post-merge review. |
Contributor
There was a problem hiding this comment.
Review (post-merge)
The PR was already merged by the time this agent picked up the request, but here is the verdict for the record.
Verdict: LGTM ✅
The diff is exactly what the description promises: one headers: { 'X-Cryptify-Source': 'website' } entry on the shared PostGuard client in src/lib/postguard.ts. The inline comment captures the why (Origin-header collision with the Outlook add-in on *.postguard.eu).
What this agent checked
- Diff matches the PR description; no other files touched.
- All CI green at merge time (Build amd64/arm64, Lint, Svelte Check, Conventional Commit).
pgis the single shared client instance, so every cryptify upload path (SendButton.svelteand any future caller) inherits the header — no per-call sprinkling needed.- Placement before the conditional
uploadChunkSizespread is fine; key ordering is irrelevant here and the explicit literal is easy to grep for.
Nits (non-blocking, only if you ever touch this again)
- The header value
'website'is a free-form magic string shared withcryptify'sdetect_channel. If the set of channels grows, exporting it as a constant from a sharedpg-js/cryptifytype would prevent drift. Not worth a follow-up for one literal. - Unchecked test-plan box: the "Cockpit Grafana
cryptify_uploads_total{channel="website"}increments by 1" verification still needs doing on the live deploy. Worth running through once after the next release cuts.
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.
Summary
Sets
X-Cryptify-Source: websiteon the PostGuard SDK so cryptify's per-channel upload metrics (encryption4all/cryptify#102) classify this site deterministically rather than via the Origin-host fallback.Why
Cryptify's
detect_channelchecks theOriginheader before falling back to User-Agent substring matching. The Outlook add-in is served fromaddin.*.postguard.eu, which matches cryptify'scontains("postguard.")rule and shadows theUser-Agent"outlook" check — so without explicitX-Cryptify-Sourceheaders, Outlook traffic would be miscounted aswebsite(and dev Outlook traffic asstaging-website). Setting the header explicitly on each client side removes the ambiguity, and dropping reliance on Origin lets us mergestaging-websiteintowebsiteif we ever want to.Test plan
npx tsc --noEmit).cryptify_uploads_total{channel="website"}— value should increment by 1.