This repository was archived by the owner on Aug 7, 2026. It is now read-only.
feat(metrics): tag cryptify uploads with X-Cryptify-Source: outlook - #96
Merged
Conversation
Adds the X-Cryptify-Source: outlook header to clientHeaders() so cryptify's per-channel upload metrics (encryption4all/cryptify#102) classify this add-in deterministically. cryptify's detect_channel checks the Origin header before falling back to User-Agent substring matching. The add-in is served from addin.*.postguard.eu, which matches cryptify's `contains("postguard.")` rule and would otherwise shadow the User-Agent "outlook" check — labeling Outlook uploads as `website` / `staging-website` instead of `outlook`. Setting the explicit header here removes the ambiguity.
3 tasks
Contributor
Author
|
/dobby review |
Contributor
There was a problem hiding this comment.
Approving: single-line header addition is correct and matches the parallel cryptify channel-detection PR.
- Change is symmetric with postguard-website / postguard-tb-addon as stated.
- The inline comment explains the non-obvious WHY (cryptify's detect_channel checks Origin before User-Agent, and addin.*.postguard.eu matches the Origin rule first). That's exactly the kind of WHY that belongs in code.
- Header is now set in clientHeaders() and flows through both compose-view.ts:466 and read-view.ts:170 — every cryptify upload path is covered.
- CI green (lint/typecheck/build + conventional-commit title).
- Preexisting tsc --noEmit error in src/lib/pending-upload.ts is unrelated, as the PR notes.
No findings.
Contributor
|
This agent already submitted an approving review on this PR (see above) and it has since been merged. No further action needed. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Adds
X-Cryptify-Source: outlooktoclientHeaders()so cryptify's per-channel upload metrics (encryption4all/cryptify#102) classify this add-in deterministically.Why
Cryptify's
detect_channelfalls back through three layers: explicitX-Cryptify-Sourceheader → API auth →Originsubstring →User-Agentsubstring. The add-in is served fromaddin.*.postguard.eu, which matches theOriginrule (contains("postguard.")) before the User-Agent rule (contains("outlook")) ever gets to run — so without an explicit header, Outlook uploads would be misclassified aswebsite(orstaging-websitein dev). Setting the header here removes the ambiguity at the source, and is symmetric with parallel PRs in postguard-website and postguard-tb-addon.Test plan
cryptify_uploads_total{channel="outlook"}should increment by 1.Note
There is a preexisting
tsc --noEmiterror insrc/lib/pending-upload.ts(missingresumeUploadexport from@e4a/pg-js) — unrelated to this change.