Repository navigation
feat(links): Require a canView access check on every link type - #3376
Merged
Merged
Conversation
Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/docs/src/content/docs/extend/build-a-plugin.md # packages/junior/src/api/objects/resolve.ts
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Found 2 test failures on Blacksmith runners: Failures
|
Contributor
|
12 screenshot changes — 12 changed · 0 added · 0 removed Review screenshots in Frameshift |
BYK
approved these changes
Nov 13, 2026
This was referenced Nov 13, 2026
23 tasks done
BYK
added a commit
that referenced
this pull request
Nov 13, 2026
…en them (#3367) Sentry issue links in a Conversation show as bare URLs, so people must open Sentry to see what an issue is. They now show as a chip and a hover card, for viewers who can open the issue in Sentry. **Links:** `sentry.io/organizations/<org>/issues/<id>/` and `<org>.sentry.io/issues/<id>/`, by numeric id or short id (`JUNIOR-3ZK`), plus `/events/<id|latest|recommended|oldest>/` under an issue (shows the issue card). Other Sentry pages get no card. **Access:** the link type's `canView` (#3376) asks Sentry, with the viewer's own OAuth token on the org's region host, whether the viewer can open the issue. Core calls it before each card read and again on Attach. Then Junior's org read token reads the card, cached per issue for 60 seconds. A viewer who has not connected Sentry, or whom Sentry denies, gets no card and no fields. **Core:** `ObjectLinkContext.viewerEgress`, available to `canView` and `resolve`. It is egress with the viewer as the credential subject and `userOAuthOnly`: it uses only that viewer's stored OAuth token. It skips plugin grants, never falls back to an environment token, and never asks the viewer to connect. No new OAuth scopes, credential stores, or migrations. If this path breaks, the exposure is one viewer's own Sentry token used for a read that the same viewer can already make. **Card:** reuses Ticket (`task`) with display type "Sentry issue": title, culprit, state, assignee, priority, project, level and substatus labels, event and user counts. No event data, tags, or stack frames. | | Dark | Light | |---|---|---| | Before |  |  | | After |  |  | <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Ab784a61e6351b98fecdafda6e0e72301 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Ab784a61e6351b98fecdafda6e0e72301) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Ab784a61e6351b98fecdafda6e0e72301/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]>
BYK
added a commit
that referenced
this pull request
Nov 13, 2026
## Problem
Google link cards match only `docs.google.com`. A `drive.google.com`
link gets no card. Drive has no oEmbed provider, and Drive serves a
sign-in page to anonymous fetches, so the `web_page` card cannot preview
it either.
## Fix
- The Google `document` link type now also matches `drive.google.com`
`/file/d/<id>`, `/file/u/<n>/d/<id>`, `/open?id=<id>`,
`/drive/folders/<id>`, and `/drive/u/<n>/...`. These filters have a
host, so they win over the `web_page` catch-all.
- A Drive link to a Doc, Sheet, or Slides file gets the same card as its
`docs.google.com` link. It uses the shared `FILE_TYPES` map and file
card.
- Other files and folders use the existing `document` object type, with
a type label from the MIME type ("PDF", "Image", "Google Drive folder").
They show the name, owner, and modified time. I did not add a new object
type: the card has the same fields as a Doc card, and only the label
changes.
- File thumbnails go through the image proxy. The Google plugin adds an
`images` source that does the same viewer check as the card on each
read, through `ImageSourceContext.egress` (#3370), then fetches
`thumbnailLink` with Junior's Google token. It sends the token only to
`*.googleusercontent.com`. Facts hold only a signed `/api/images/...`
path, never `thumbnailLink`.
- Access uses the same viewer rule as Doc cards (`viewerCanOpen`). For
cards, the rule runs in `canView` (#3376), which shares one cached Drive
read with `resolve`. Thumbnails run it again on each image read, with no
cache (`readViewerFile`). Group-only shares, trashed files, and
shortcuts get no card and no thumbnail.
- Plugin API changes:
- `ObjectLinkContext.imagePath(ref, version?)` makes a signed image path
for a card.
- `readTool` is now a function of the resolved object, because a Drive
URL does not show its type before the lookup. Docs, Sheets, and Slides
from Drive name `readGoogleFile`. Other files name no tool.
- The `document` and `web_page` facts share one `thumbnailUrl` schema.
- No new OAuth scopes and no migration. `drive.readonly` is already
granted.
| | Dark | Light |
| --- | --- | --- |
| Before: Drive links stay plain links |

|

|
| After: PDF chip and hover card |

|

|
| After: folder chip and hover card |

|

|
The before shots use the same mock thread with the Drive results removed
from `/api/objects`, which is what main returns for them.
<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->
<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3Ab4ab1661aa9222ed540303a34bce2d99 -->
--
[View
Session](https://junior-prod.sentry.dev/conversations/agent%3Ab4ab1661aa9222ed540303a34bce2d99)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Ab4ab1661aa9222ed540303a34bce2d99/?project=4510944073809921)
<!-- junior-session-footer:end -->
---------
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <[email protected]>
This branch was successfully deployed
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.
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
Problem
Each link type checks the viewer inside
resolve. Nothing makes a new plugin do that check, so a plugin that forgets it shows cards to viewers who cannot open the object. See the review on #3349.Fix
PluginObjectLinkDefinitionnow requirescanView(ctx, url): Promise<boolean>. Plugin registration rejects a link type without it.canViewbeforeresolve, for each card read and again on each Attach.resolveruns only whencanViewreturns true.canViewConversationLinkreads the viewer's Conversation access.mailto:: true, because every signed-in viewer sees the People pages.web_page: true, because Junior fetches the page without credentials.junior-githubaccount links: true, because a GitHub profile is public.junior-google:canViewruns the existing viewer rule. Drive and Calendar metadata are read throughctx.cachefor 10 seconds, socanViewandresolveshare one read. The Drive access queries checktrashed = falseagain, so a trashed file never shows.canViewcan take the separateviewerCanSeeIssuecheck from #3367. On #3367's head2aec5973f, that check needs the region origin and is not exported, so the Sentry link type adds this hook in its own module, as Stella posted in #3367:The PR that merges second adds it.
Tests
object-attach.test.ts: the test link types check access only incanView, andresolvealways returns data. A participant without access gets no card from/api/objectsand a 404 on Attach. This fails when core does not callcanView.junior-googlelink tests: every case goes throughcanViewand thenresolve. A Doc and a Calendar event each make one metadata read for both calls.via @BYK.
--
View Session [Sentry]