Skip to content
This repository was archived by the owner on Aug 7, 2026. It is now read-only.

fix: yivi-dialog uses pg4ol client-id and live package version in PKG/Cryptify header - #105

Merged
rubenhensen merged 2 commits into
masterfrom
fix/yivi-dialog-client-headers
Jun 3, 2026
Merged

fix: yivi-dialog uses pg4ol client-id and live package version in PKG/Cryptify header#105
rubenhensen merged 2 commits into
masterfrom
fix/yivi-dialog-client-headers

Conversation

@dobby-coder

@dobby-coder dobby-coder Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Two related defects in the X-PostGuard-Client-Version header that the launchevent's Yivi dialog sends to PKG and Cryptify:

  1. src/yivi-dialog/yivi-dialog.ts:135 built the header inline as Outlook,1.0,pg4outlook,${ADDIN_VERSION}. The PR fix: use pg4ol metric client id to match PKG convention #11 fix for the taskpane is reapplied here — the dialog now calls clientHeaders(ADDIN_VERSION) from src/lib/pkg-client.ts, which produces Outlook,1.0,pg4ol,<version> and also stamps X-Cryptify-Source: outlook (cryptify's detect_channel was misclassifying dialog-flow uploads without it).
  2. The three local const ADDIN_VERSION = "0.1.0" declarations (yivi-dialog, compose-view, read-view) never matched package.json (0.4.0 today, 0.5.0 in chore(master): release 0.5.0 #95). ADDIN_VERSION is now exported from src/lib/pkg-client.ts, sourced via process.env.ADDIN_VERSION which webpack's DefinePlugin populates from package.json at build time — same mechanism already used for PKG_URL, CRYPTIFY_URL, ADDIN_PUBLIC_URL. No release-please config change needed; package.json is the source of truth and release-please already bumps it.

Out of scope

POSTGUARD_VERSION = "0.1.0" in launchevent.ts:41 and compose-view.ts:61 is the value of the x-postguard interop marker header (independent signal that the message went through PostGuard), not the metrics header. Left alone — its lifecycle is different and the issue does not call for it.

Verification

  • npm run build — green (pre-existing taskpane/yivi-dialog size warnings only).
  • npm run lint — green.
  • npx tsc --noEmit — green.
  • npm run validate — manifest valid.
  • grep -rn "pg4outlook\|pg4ol" src → only pg4ol (in pkg-client.ts). No pg4outlook left.
  • grep -ao "pg4ol,[0-9.]*" dist/yivi-dialog.jspg4ol,0.4.0.
  • grep -ao 'X-Cryptify-Source[^,]*outlook' dist/yivi-dialog.js dist/taskpane.js → both bundles emit X-Cryptify-Source":"outlook.

Manual smoke test (Encrypt-on-send dialog flow) is left to the maintainer — I don't have an Outlook host in this workspace.

Closes #103

The yivi-dialog runtime built the X-PostGuard-Client-Version header
inline as `Outlook,1.0,pg4outlook,0.1.0`, missing both the PR #11 fix
that switched the client-id token to `pg4ol` and the X-Cryptify-Source
header that pkg-client's clientHeaders() adds. Three files also held a
local `const ADDIN_VERSION = "0.1.0"` that has never matched
package.json, so PKG / Cryptify dashboards could not distinguish
releases.

Wire process.env.ADDIN_VERSION through webpack DefinePlugin from
package.json (same mechanism already used for PKG_URL / CRYPTIFY_URL
/ ADDIN_PUBLIC_URL), export a single ADDIN_VERSION from
src/lib/pkg-client.ts, drop the three stale local constants, and route
the dialog through clientHeaders() like the taskpane already does.

Closes #103
@dobby-coder
dobby-coder Bot requested a review from rubenhensen June 2, 2026 23:39
@rubenhensen

Copy link
Copy Markdown
Contributor

/dobby resolve conflicts

@dobby-coder

dobby-coder Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Dobby has received the request! Routing to the right specialist now...

Resolve conflicts in src/taskpane/compose-view.ts and
src/taskpane/read-view.ts. Master (#107) extracted HEADER_* constants
and byId/guessContentType into shared libs; this branch (#105) wires
ADDIN_VERSION through pkg-client from package.json. Combine: keep the
ADDIN_VERSION import on pkg-client, take the new pg-headers / dom /
mime imports from master, drop the legacy local ADDIN_VERSION and
HEADER_* declarations.
@dobby-coder

dobby-coder Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Conflicts resolved against master (PR #107 landed pg-headers.ts + lib/dom.ts extractions while this branch was open).

Resolution in src/taskpane/compose-view.ts:

  • Combined the pkg-client import to keep ADDIN_VERSION (this PR) alongside the rest.
  • Took the new byId (lib/dom), guessContentType (lib/mime), and pg-headers (ENCRYPTION_STATUS_NOTIFICATION_KEY, HEADER_*, POSTGUARD_VERSION, keyForEmails) imports from master.
  • Dropped the legacy inline HEADER_* / POSTGUARD_VERSION declarations (now in pg-headers.ts) and the stale local const ADDIN_VERSION = "0.1.0" (now imported from pkg-client).

Resolution in src/taskpane/read-view.ts:

  • Same shape: keep ADDIN_VERSION on the pkg-client import; add byId from lib/dom.

Verification:

  • npx tsc --noEmit — green.
  • npm run lint — green.
  • npm run build — green (pre-existing bundle-size warnings only).
  • npm run validate — manifest valid.
  • grep -ao "pg4ol[^\"]*" dist/yivi-dialog.js dist/taskpane.jspg4ol,0.4.0 and pg4ol,${A} (taskpane interpolates the template literal under minification; both emit the right header at runtime).
  • grep -ao 'X-Cryptify-Source[\":]*outlook' dist/yivi-dialog.js dist/taskpane.js → both bundles stamp it.

@rubenhensen
rubenhensen merged commit 5300dc4 into master Jun 3, 2026
2 checks passed
@dobby-coder
dobby-coder Bot deleted the fix/yivi-dialog-client-headers branch July 27, 2026 20:12
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.

bug: yivi-dialog sends pg4outlook (was pg4ol) and stale ADDIN_VERSION="0.1.0" in client-version header

1 participant