Skip to content

PE-6102 | Show session info in extension popup#9

Open
mihoward21 wants to merge 9 commits into
mainfrom
pe-6102-extension-popup
Open

PE-6102 | Show session info in extension popup#9
mihoward21 wants to merge 9 commits into
mainfrom
pe-6102-extension-popup

Conversation

@mihoward21

@mihoward21 mihoward21 commented Jun 11, 2026

Copy link
Copy Markdown

Summary

Clicking the extension's toolbar icon now opens a popup (PE-6102).

  • Always: a welcome message explaining that nothing needs to be done in the extension.
  • When signed in: a "Signed in as" card below the message with the user's avatar (initial fallback), name, and email.

How session data gets to the extension

The extension is a stateless bridge — it has no session of its own. The Splits Teams app posts session info to its own window whenever its auth state resolves (on every page load, and null when signed out). The content script — attached only on the Teams origin — relays it to the background over internal messaging. The background re-checks the sender origin and sanitizes the payload (string trimming/length caps, http(s)-only avatar URL) before persisting to browser.storage.local. The popup reads it on open and re-renders live via storage.onChanged.

Companion PR: 0xSplits/splits-teams#1497 syncs the message from AppContainer whenever the auth query resolves.

Security

  • Spoofing accepted by design: any script on the Teams origin (third-party JS, other extensions' content scripts) can post this message and repaint the popup's display strings. Impact is limited to that — the payload is sanitized in the background and the popup renders via textContent only (the welcome message is static HTML; the user card is a <template>; no innerHTML), so there's no injection path into the privileged page. Documented on SessionInfoBridge.
  • Stored snapshots expire after 7 days: Teams re-pushes on every load, so the only snapshots that age out are from sessions that ended while no Teams tab was open (expiry, remote logout, cleared cookies). Previously those would have displayed user details indefinitely — relevant on shared machines.

Notes

  • No new permissions; storage was already granted.
  • Verified with pnpm compile and pnpm build; visually checked signed-out, fresh-session
Screenshot 2026-06-12 at 11 53 04 AM Screenshot 2026-06-12 at 11 52 15 AM

🤖 Generated with Claude Code

mihoward21 and others added 6 commits June 11, 2026 10:59
Clicking the toolbar icon now opens a popup. When session info is
available it shows the user's name, avatar, and email plus the
currently selected organization and smart account; otherwise it shows
a welcome message explaining that no action is needed in the extension.

Session info reaches the extension via a new externally-connectable
message (splits-connect:setSessionInfo) that the Splits Teams app can
send after sign-in, org/account changes, and sign-out. The payload is
origin-checked and sanitized before being stored in
browser.storage.local, and the popup re-renders live on storage
changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…_connectable

The Teams app has no way to know the extension ID at connect time (it
only appears in large-RPC placeholders), so the page cannot use
chrome.runtime.sendMessage. Instead the app posts the session info to
its own window and the content script — attached only on the Teams
origin — relays it to the background over internal messaging. The
background still origin-checks the sender and sanitizes the payload
before storing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Org/account is per-dapp state (a user can be connected to two apps with
different orgs/accounts at once), so a single global popup cannot
display it honestly — drop it and show only the user, which is genuinely
global. Popup markup now lives in <template> elements in the HTML; the
script only clones and fills text.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Teams re-pushes on every load, so the only snapshots that age out are
from sessions that ended while no Teams tab was open (expiry, remote
logout, cleared cookies) — previously those displayed user details
indefinitely. Also document the accepted spoofing surface on the
session bridge and capture the avatar fallback by selector instead of
sibling position.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Someone confused at a new app should see the reassurance copy first,
whether or not they are signed in. The message is now static HTML and
only the 'Signed in as' card is rendered dynamically.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
return senderOrigin === allowedOrigin;
}

function getSenderOrigin(sender: MessageSender) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

mostly just reshuffling existing code here

// and the popup renders text only, so there is no injection path and nothing
// privileged to reach — and anything running on that origin can already read
// the real session from the page.
namespace SessionInfoBridge {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

here is the net new stuff

@mihoward21 mihoward21 requested a review from r0ohafza June 12, 2026 19:14
@mihoward21 mihoward21 marked this pull request as ready for review June 12, 2026 19:14
mihoward21 and others added 3 commits June 12, 2026 12:18
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants