Skip to content
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
rubenhensen merged 1 commit into
masterfrom
feat/x-cryptify-source-header
May 18, 2026
Merged

feat(metrics): tag cryptify uploads with X-Cryptify-Source: outlook#96
rubenhensen merged 1 commit into
masterfrom
feat/x-cryptify-source-header

Conversation

@rubenhensen

Copy link
Copy Markdown
Contributor

Summary

Adds X-Cryptify-Source: outlook to clientHeaders() so cryptify's per-channel upload metrics (encryption4all/cryptify#102) classify this add-in deterministically.

Why

Cryptify's detect_channel falls back through three layers: explicit X-Cryptify-Source header → API auth → Origin substring → User-Agent substring. The add-in is served from addin.*.postguard.eu, which matches the Origin rule (contains("postguard.")) before the User-Agent rule (contains("outlook")) ever gets to run — so without an explicit header, Outlook uploads would be misclassified as website (or staging-website in 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

  • In a dev build, compose + send an encrypted attachment via the add-in.
  • In Cockpit Grafana Explore on the custom metrics DS: cryptify_uploads_total{channel="outlook"} should increment by 1.

Note

There is a preexisting tsc --noEmit error in src/lib/pending-upload.ts (missing resumeUpload export from @e4a/pg-js) — unrelated to this change.

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.
@rubenhensen

Copy link
Copy Markdown
Contributor Author

/dobby review

@rubenhensen
rubenhensen merged commit 5629fa5 into master May 18, 2026
2 checks passed
@rubenhensen
rubenhensen deleted the feat/x-cryptify-source-header branch May 18, 2026 17:20

@dobby-coder dobby-coder Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dobby-coder

dobby-coder Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

This agent already submitted an approving review on this PR (see above) and it has since been merged. No further action needed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant