Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

✨ Security-aware update notifications for self-hosted instances (#3334)

Luke Vella8bf2f82fff1c
diff --git a/apps/docs/self-hosting/control-panel.mdx b/apps/docs/self-hosting/control-panel.mdx
index ee50ee207..540ebbeb6 100644
--- a/apps/docs/self-hosting/control-panel.mdx
+++ b/apps/docs/self-hosting/control-panel.mdx
@@ -36,3 +36,9 @@ If you see an **Administrator access required** message when visiting `/control-
- It does not match the email address of the account you are signed in with.
Update `INITIAL_ADMIN_EMAIL` to match your account's email address, restart your instance, and visit `/control-panel` again to claim admin rights. Alternatively, an existing administrator can grant your account the admin role from the **Users** section of the Control Panel.
+
+## Update notifications
+
+The Control Panel home page shows the version your instance is running and whether a newer release is available. The check runs against `api.rallly.co` once an hour and only sends the running version and an anonymous instance identifier. On a restricted network, see [Corporate networks](/self-hosting/corporate-networks#hosts-to-allow).
+
+When a release you have not installed yet contains security fixes, every Control Panel page shows a banner linking to the release notes. If your major version has reached end of life and the fix only shipped in a newer major, the banner links to the migration guide instead. Older instances than 4.16 render the plain update notice and cannot tell you about security fixes, so keep an eye on the [releases page](https://github.com/lukevella/rallly/releases) until you have updated past that version.
diff --git a/apps/docs/self-hosting/corporate-networks.mdx b/apps/docs/self-hosting/corporate-networks.mdx
index 407bb1595..1e2611ba8 100644
--- a/apps/docs/self-hosting/corporate-networks.mdx
+++ b/apps/docs/self-hosting/corporate-networks.mdx
@@ -8,6 +8,19 @@ Corporate networks often restrict outbound traffic in two ways: all egress must
If your server can reach the internet directly and your network does not intercept TLS, none of this applies and you can skip this page.
+## Hosts to allow
+
+Rallly makes outbound requests to these hosts, all over HTTPS on port 443. If your firewall filters by destination, allow them.
+
+| Host | Purpose | When blocked |
+|:-----|:--------|:-------------|
+| `licensing.rallly.co` | License activation and refresh | Activation fails with an error in the Control Panel |
+| `api.rallly.co` | Hourly update check: sends the running version and an anonymous instance identifier, receives the latest release and any security advisories affecting your version | Fails silently. The version tile shows no status and you are not told about security updates, so watch the [releases page](https://github.com/lukevella/rallly/releases) instead |
+
+Pulling images with `./rallly.sh update` reaches Docker Hub (`registry-1.docker.io` and `auth.docker.io`), which is governed by Docker's own proxy settings rather than the variables below.
+
+Anything you configure yourself, such as your SMTP server, an identity provider, or external object storage, needs to be reachable too.
+
## Routing traffic through a proxy
Rallly honours the standard `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` environment variables for outbound requests. Set them in `.env`:
@@ -95,5 +108,5 @@ Watch the logs while triggering the failing request (for example, a license acti
|:--------------|:------|:----|
| `UNABLE_TO_VERIFY_LEAF_SIGNATURE`, `SELF_SIGNED_CERT_IN_CHAIN`, or `unable to get local issuer certificate` | TLS is intercepted and re-signed by an untrusted CA | Set [`CA_CERT_FILE`](#trusting-a-custom-root-ca) |
| `ENOTFOUND` | DNS resolution for the host is blocked | Allow DNS for the host, or route through a proxy that resolves it |
-| `ETIMEDOUT` or `ECONNREFUSED` | No direct route to the host | Configure the [proxy variables](#routing-traffic-through-a-proxy) (v4.12.3+), or request a firewall exception for `licensing.rallly.co` on port 443 |
+| `ETIMEDOUT` or `ECONNREFUSED` | No direct route to the host | Configure the [proxy variables](#routing-traffic-through-a-proxy) (v4.12.3+), or request a firewall exception for the [hosts above](#hosts-to-allow) on port 443 |
| `EAI_AGAIN` with no connection attempts | Proxy-only network with no external DNS, on a version before v4.12.3 that ignores proxy variables | [Update](/self-hosting/management#updating) to v4.12.3 or later, then configure the proxy variables |
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.json
index d9f4ec4eb..ea946e3da 100644
--- a/apps/web/public/locales/en/app.json
+++ b/apps/web/public/locales/en/app.json
@@ -44,6 +44,7 @@
"adminSetupCta": "Make me an admin",
"adminSetupDescription": "Click the button below to make yourself an admin user.",
"adminSetupTitle": "Are you the admin?",
+ "advisorySeverity": "{severity, select, critical {critical} high {high} medium {medium} low {low} other {unrated}}",
"allDay": "All day",
"allMembers": "All",
"allParticipants": "All participants",
@@ -822,6 +823,9 @@
"securityAuthentication": "Authentication",
"securityAuthenticationDescription": "Manage how you sign in to your account",
"securityDescription": "Manage your account security and password settings",
+ "securityUpdateAvailable": "Security update available",
+ "securityUpdateBannerDescription": "Rallly {version} fixes {count, plural, one {a {severity} severity vulnerability} other {# vulnerabilities, the most severe rated {severity},}} affecting the version you are running. Update as soon as possible.",
+ "securityUpdateBannerNewMajorDescription": "Rallly v{major} fixes {count, plural, one {a {severity} severity vulnerability} other {# vulnerabilities, the most severe rated {severity},}} affecting the version you are running, and the fix is not available for your major version. Migrate as soon as possible.",
"selectAtLeastOneOptionOrDecline": "Select at least one option, or decline",
"selectPlan": "Select plan:",
"selectPotentialDates": "Select potential dates or times for your event",
@@ -975,6 +979,7 @@
"verifyEmailDescription": "Enter the 6-digit code we sent to <b>{email}</b>",
"verifyEmailTitle": "Verify your email",
"versionTileNewMajorNotice": "v{major} is available. Read the migration guide.",
+ "viewAdvisory": "{count, plural, one {View advisory} other {View advisories}}",
"viewClosedPolls": "View closed polls",
"viewInvites": "View invites",
"viewResults": "View results",
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/components/control-panel-menu-item.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/components/control-panel-menu-item.tsx
index 5bce4706c..c3730b89c 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/components/control-panel-menu-item.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/components/control-panel-menu-item.tsx
@@ -6,7 +6,13 @@ import { HoverPrefetchLink } from "@/components/hover-prefetch-link";
import { useUser } from "@/features/user/client";
import { Trans } from "@/i18n/client";
-export function ControlPanelMenuItem() {
+// `children` is the slot for the update indicator: it renders as a sibling
+// of the button so SidebarMenuBadge's peer styles apply.
+export function ControlPanelMenuItem({
+ children,
+}: {
+ children?: React.ReactNode;
+}) {
const { user } = useUser();
if (user?.role !== "admin") {
@@ -19,6 +25,7 @@ export function ControlPanelMenuItem() {
<GaugeIcon />
<Trans i18nKey="controlPanel" defaults="Control Panel" />
</SidebarMenuButton>
+ {children}
</SidebarMenuItem>
);
}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx
index 962936455..30734e979 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx
@@ -12,8 +12,10 @@ import {
SidebarSeparator,
} from "@rallly/ui/sidebar";
import { SettingsIcon } from "lucide-react";
+import { Suspense } from "react";
import { HoverPrefetchLink } from "@/components/hover-prefetch-link";
import { PastDueAlert } from "@/features/billing/components/past-due-alert";
+import { UpdateIndicator } from "@/features/instance-settings/components/update-indicator";
import { LicenseLimitWarning } from "@/features/licensing/components/license-limit-warning";
import { CommandMenu } from "@/features/navigation/components/command-menu";
import { SpaceDropdown } from "@/features/space/components/space-dropdown";
@@ -61,7 +63,16 @@ export default async function Layout({
<IfFeatureEnabled feature="feedback">
<FeedbackMenuItem />
</IfFeatureEnabled>
- <ControlPanelMenuItem />
+ <ControlPanelMenuItem>
+ {/* Admin-only and behind its own boundary: the update
+ check is a network call that must not hold the
+ sidebar back */}
+ {user.role === "admin" ? (
+ <Suspense fallback={null}>
+ <UpdateIndicator />
+ </Suspense>
+ ) : null}
+ </ControlPanelMenuItem>
<SidebarMenuItem>
<SidebarMenuButton
render={<HoverPrefetchLink href="/settings/profile" />}
diff --git a/apps/web/src/app/[locale]/control-panel/layout.tsx b/apps/web/src/app/[locale]/control-panel/layout.tsx
index 0789d517e..bd85a3648 100644
--- a/apps/web/src/app/[locale]/control-panel/layout.tsx
+++ b/apps/web/src/app/[locale]/control-panel/layout.tsx
@@ -3,6 +3,7 @@ import { GaugeIcon } from "lucide-react";
import type { Metadata } from "next";
import { Suspense } from "react";
import { RouterLoadingIndicator } from "@/components/router-loading-indicator";
+import { SecurityUpdateBanner } from "@/features/instance-settings/components/security-update-banner";
import { LicenseLimitWarning } from "@/features/licensing/components/license-limit-warning";
import { CommandMenu } from "@/features/navigation/components/command-menu";
import { UserProvider } from "@/features/user/client";
@@ -44,6 +45,11 @@ async function AdminGate({ children }: { children: React.ReactNode }) {
</div>
</div>
</header>
+ {/* Own boundary: the update check may take up to 3s on a cold
+ cache and must not hold back the page */}
+ <Suspense fallback={null}>
+ <SecurityUpdateBanner />
+ </Suspense>
<div className="flex-1 p-4 lg:py-12">{children}</div>
</div>
</SidebarInset>
diff --git a/apps/web/src/app/[locale]/control-panel/version-tile.tsx b/apps/web/src/app/[locale]/control-panel/version-tile.tsx
index 77ce9a29f..2f3037db7 100644
--- a/apps/web/src/app/[locale]/control-panel/version-tile.tsx
+++ b/apps/web/src/app/[locale]/control-panel/version-tile.tsx
@@ -5,9 +5,9 @@ import { Suspense } from "react";
import { PageIcon } from "@/components/page-icons";
import { loadUpdateStatus } from "@/features/instance-settings/loaders";
import { getTranslation } from "@/i18n/server";
-import { appVersion } from "@/lib/constants";
+import { appVersion, githubRepoUrl } from "@/lib/constants";
-const RELEASES_URL = "https://github.com/lukevella/rallly/releases";
+const RELEASES_URL = `${githubRepoUrl}/releases`;
const versionLabel = appVersion
? `v${appVersion.replace(/^v/, "")}`
diff --git a/apps/web/src/app/[locale]/error.tsx b/apps/web/src/app/[locale]/error.tsx
index 480255987..870202851 100644
--- a/apps/web/src/app/[locale]/error.tsx
+++ b/apps/web/src/app/[locale]/error.tsx
@@ -11,6 +11,7 @@ import { Link } from "@/components/link";
import { DefaultLogo } from "@/features/branding/components/default-logo";
import { Trans } from "@/i18n/client";
import { signOut } from "@/lib/auth-client";
+import { githubRepoUrl } from "@/lib/constants";
import { INVALID_SESSION } from "@/lib/errors/invalid-session-error";
export default function LocaleErrorBoundary({
@@ -125,7 +126,7 @@ export default function LocaleErrorBoundary({
}
/>
<ErrorPageLinkItem
- href="https://github.com/lukevella/rallly"
+ href={githubRepoUrl}
icon={<GithubIcon className="size-4 text-muted-foreground" />}
title={<Trans i18nKey="errorLinkGithub" defaults="GitHub" />}
description={
diff --git a/apps/web/src/app/[locale]/not-found.tsx b/apps/web/src/app/[locale]/not-found.tsx
index 1e7c715e4..052ebfa6e 100644
--- a/apps/web/src/app/[locale]/not-found.tsx
+++ b/apps/web/src/app/[locale]/not-found.tsx
@@ -6,6 +6,7 @@ import { Link } from "@/components/link";
import { DefaultLogo } from "@/features/branding/components/default-logo";
import { loadFooterLinks } from "@/features/instance-settings/loaders";
import { getTranslation } from "@/i18n/server";
+import { githubRepoUrl } from "@/lib/constants";
export default async function NotFoundPage() {
// TODO (Luke Vella) [2023-11-03]: not-found doesn't have access to params right now
@@ -63,7 +64,7 @@ export default async function NotFoundPage() {
})}
/>
<ErrorPageLinkItem
- href="https://github.com/lukevella/rallly"
+ href={githubRepoUrl}
icon={<GithubIcon className="size-4 text-muted-foreground" />}
title={t("errorLinkGithub", { defaultValue: "GitHub" })}
description={t("errorLinkGithubDescription", {
diff --git a/apps/web/src/app/api/updates/release-channels.test.ts b/apps/web/src/app/api/updates/release-channels.test.ts
index 1c62e4144..2bdb7b16b 100644
--- a/apps/web/src/app/api/updates/release-channels.test.ts
+++ b/apps/web/src/app/api/updates/release-channels.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, it } from "vitest";
-import { buildReleaseChannels } from "./release-channels";
+import { buildReleaseChannels, buildUpdatesPayload } from "./release-channels";
+import { buildSecurityAdvisories } from "./security-advisories";
function release(tag: string, overrides: Record<string, unknown> = {}) {
return {
@@ -12,6 +13,17 @@ function release(tag: string, overrides: Record<string, unknown> = {}) {
};
}
+function advisories(...ranges: string[]) {
+ return buildSecurityAdvisories(
+ ranges.map((range, i) => ({
+ ghsa_id: `GHSA-${i}`,
+ html_url: `https://github.com/lukevella/rallly/security/advisories/GHSA-${i}`,
+ severity: "high",
+ vulnerabilities: [{ vulnerable_version_range: range }],
+ })),
+ );
+}
+
describe("buildReleaseChannels", () => {
it("keeps the newest release per major regardless of list order", () => {
const channels = buildReleaseChannels([
@@ -69,3 +81,103 @@ describe("buildReleaseChannels", () => {
expect(buildReleaseChannels({ not: "an array" })).toBeNull();
});
});
+
+describe("buildUpdatesPayload", () => {
+ const built = buildReleaseChannels([
+ release("v3.9.0"),
+ release("v4.12.0"),
+ release("v4.13.1"),
+ release("v4.15.1"),
+ ]);
+ if (!built) throw new Error("fixture failed to build");
+ const channels = built;
+
+ function payload(requestedVersion: string | null, ...ranges: string[]) {
+ return buildUpdatesPayload({
+ channels,
+ advisories: advisories(...ranges),
+ requestedVersion,
+ });
+ }
+
+ it("flags security when the caller is inside a range the channel update fixes", () => {
+ const result = payload("4.12.0", "< 4.13.1");
+ expect(result.latest).toBe("v4.15.1");
+ expect(result.security).toBe(true);
+ expect(result.advisories).toEqual([
+ {
+ ghsaId: "GHSA-0",
+ url: "https://github.com/lukevella/rallly/security/advisories/GHSA-0",
+ severity: "high",
+ },
+ ]);
+ });
+
+ it("does not flag security when the caller is outside every range", () => {
+ expect(payload("4.13.1", "< 4.13.1").security).toBe(false);
+ expect(payload("4.15.1", "< 4.13.1").security).toBe(false);
+ expect(payload("4.12.0").security).toBe(false);
+ });
+
+ it("does not flag security without a caller version", () => {
+ const result = payload(null, "< 4.13.1");
+ expect(result.latest).toBe("v4.15.1");
+ expect(result.security).toBe(false);
+ expect(result.newMajor).toBeUndefined();
+ });
+
+ it("does not flag the new-major notice for a range confined to the newer major", () => {
+ const result = payload("3.9.0", ">= 4.0.0, < 4.13.1");
+ expect(result.latest).toBe("v3.9.0");
+ expect(result.security).toBe(false);
+ expect(result.newMajor).toEqual({
+ version: "v4.15.1",
+ migrationGuideUrl: "https://support.rallly.co/self-hosting/migrate-to-v4",
+ security: false,
+ advisories: [],
+ });
+ });
+
+ it("flags the new-major notice when only the newer major is outside the range", () => {
+ const result = payload("3.9.0", "< 4.13.1");
+ expect(result.security).toBe(false);
+ expect(result.advisories).toEqual([]);
+ expect(result.newMajor?.security).toBe(true);
+ expect(result.newMajor?.advisories.map((a) => a.ghsaId)).toEqual([
+ "GHSA-0",
+ ]);
+ });
+
+ it("flags the new-major notice when the caller's major has no channel at all", () => {
+ const result = payload("2.0.0", "< 4.13.1");
+ expect(result.latest).toBeNull();
+ expect(result.newMajor?.security).toBe(true);
+ });
+
+ it("prefers the channel update over the new major when both fix it", () => {
+ const backported = buildReleaseChannels([
+ release("v3.9.0"),
+ release("v3.9.1"),
+ release("v4.13.1"),
+ ]);
+ if (!backported) throw new Error("fixture failed to build");
+
+ expect(
+ buildUpdatesPayload({
+ channels: backported,
+ advisories: advisories(">= 4.0.0, < 4.13.1", "< 3.9.1"),
+ requestedVersion: "3.9.0",
+ }),
+ ).toMatchObject({
+ latest: "v3.9.1",
+ security: true,
+ newMajor: { security: false },
+ });
+ });
+
+ it("stays quiet when nothing published fixes the range", () => {
+ const result = payload("4.15.1", "< 5.0.0");
+ expect(result.security).toBe(false);
+ expect(result.newMajor).toBeUndefined();
+ });
+});
diff --git a/apps/web/src/app/api/updates/release-channels.ts b/apps/web/src/app/api/updates/release-channels.ts
index 2e735bd85..56d71b1dd 100644
--- a/apps/web/src/app/api/updates/release-channels.ts
+++ b/apps/web/src/app/api/updates/release-channels.ts
@@ -3,6 +3,8 @@ import {
getMajorVersion,
isOutdated,
} from "@/features/instance-settings/utils";
+import type { AdvisorySummary, SecurityAdvisory } from "./security-advisories";
+import { isVulnerable, summarizeAdvisory } from "./security-advisories";
const releaseSchema = z.object({
tag_name: z.string().min(1),
@@ -25,6 +27,26 @@ export type ReleaseChannels = {
latestMajor: number;
};
+export type UpdatesPayload = {
+ latest: string | null;
+ url: string | null;
+ publishedAt: string | null;
+ security: boolean;
+ advisories: AdvisorySummary[];
+ newMajor?: {
+ version: string;
+ migrationGuideUrl: string;
+ security: boolean;
+ advisories: AdvisorySummary[];
+ };
+};
+
+// The fleet starts linking here the moment a new major's first release is
+// tagged — the guide must be published at this path before tagging.
+function getMigrationGuideUrl(major: number) {
+ return `https://support.rallly.co/self-hosting/migrate-to-v${major}`;
+}
+
export function buildReleaseChannels(input: unknown): ReleaseChannels | null {
if (!Array.isArray(input)) return null;
@@ -56,3 +78,64 @@ export function buildReleaseChannels(input: unknown): ReleaseChannels | null {
return { latestByMajor, latestMajor: Math.max(...majors) };
}
+
+export function buildUpdatesPayload({
+ channels,
+ advisories,
+ requestedVersion,
+}: {
+ channels: ReleaseChannels;
+ advisories: SecurityAdvisory[];
+ requestedVersion: string | null;
+}): UpdatesPayload {
+ const latestRelease = channels.latestByMajor[channels.latestMajor];
+ const requestedMajor =
+ requestedVersion === null ? null : getMajorVersion(requestedVersion);
+
+ if (requestedVersion === null || requestedMajor === null) {
+ return {
+ latest: latestRelease.version,
+ url: latestRelease.url,
+ publishedAt: latestRelease.publishedAt,
+ security: false,
+ advisories: [],
+ };
+ }
+
+ const ownChannel = channels.latestByMajor[requestedMajor];
+
+ // Severity comes from the advisories' version ranges, so it is exact for
+ // the caller: an advisory the caller falls inside is fixed by the channel
+ // update when the channel's latest falls outside it, and only by the new
+ // major when the channel's latest is still inside it.
+ const open = advisories.filter((advisory) =>
+ isVulnerable(requestedVersion, advisory),
+ );
+ const fixedInChannel = (advisory: SecurityAdvisory) =>
+ !!ownChannel && !isVulnerable(ownChannel.version, advisory);
+ const fixedInLatest = (advisory: SecurityAdvisory) =>
+ !isVulnerable(latestRelease.version, advisory);
+
+ const channelAdvisories = open.filter(fixedInChannel).map(summarizeAdvisory);
+ const newMajorAdvisories = open
+ .filter((advisory) => !fixedInChannel(advisory) && fixedInLatest(advisory))
+ .map(summarizeAdvisory);
+
+ return {
+ latest: ownChannel?.version ?? null,
+ url: ownChannel?.url ?? null,
+ publishedAt: ownChannel?.publishedAt ?? null,
+ security: channelAdvisories.length > 0,
+ advisories: channelAdvisories,
+ ...(channels.latestMajor > requestedMajor
+ ? {
+ newMajor: {
+ version: latestRelease.version,
+ migrationGuideUrl: getMigrationGuideUrl(channels.latestMajor),
+ security: newMajorAdvisories.length > 0,
+ advisories: newMajorAdvisories,
+ },
+ }
+ : {}),
+ };
+}
diff --git a/apps/web/src/app/api/updates/route.ts b/apps/web/src/app/api/updates/route.ts
index 35f1ebbab..c1c0cfbfe 100644
--- a/apps/web/src/app/api/updates/route.ts
+++ b/apps/web/src/app/api/updates/route.ts
@@ -3,43 +3,33 @@ import { createLogger } from "@rallly/logger";
import type { NextRequest } from "next/server";
import { after, NextResponse } from "next/server";
import * as z from "zod";
-import { getMajorVersion } from "@/features/instance-settings/utils";
import { createCache } from "@/lib/cache";
-import { isSelfHosted } from "@/lib/constants";
+import { githubRepo, isSelfHosted } from "@/lib/constants";
import { createRatelimit } from "@/lib/rate-limit";
import type { ReleaseChannels } from "./release-channels";
-import { buildReleaseChannels } from "./release-channels";
+import { buildReleaseChannels, buildUpdatesPayload } from "./release-channels";
+import type { SecurityAdvisory } from "./security-advisories";
+import { buildSecurityAdvisories } from "./security-advisories";
const logger = createLogger("api/updates");
-const GITHUB_RELEASES_URL =
- "https://api.github.com/repos/lukevella/rallly/releases";
+const GITHUB_RELEASES_URL = `https://api.github.com/repos/${githubRepo}/releases`;
+const GITHUB_ADVISORIES_URL = `https://api.github.com/repos/${githubRepo}/security-advisories`;
const RELEASES_PER_PAGE = 100;
// Sequential unauthenticated requests count against a 60/hour IP budget, so
// pagination is bounded; older majors beyond this window report no update.
const MAX_RELEASE_PAGES = 3;
-// The fleet starts linking here the moment a new major's first release is
-// tagged — the guide must be published at this path before tagging.
-function getMigrationGuideUrl(major: number) {
- return `https://support.rallly.co/self-hosting/migrate-to-v${major}`;
-}
-
-type UpdatesPayload = {
- latest: string | null;
- url: string | null;
- publishedAt: string | null;
- newMajor?: {
- version: string;
- migrationGuideUrl: string;
- };
-};
-
const releaseChannelsCache = createCache<ReleaseChannels>({
namespace: "updates:release-channels",
ttl: "1 h",
});
+const advisoriesCache = createCache<SecurityAdvisory[]>({
+ namespace: "updates:advisories",
+ ttl: "1 h",
+});
+
const seenInstanceCache = createCache<string>({
namespace: "updates:seen-instance",
ttl: "1 d",
@@ -88,6 +78,60 @@ async function fetchReleaseChannels(): Promise<ReleaseChannels | null> {
}
}
+// Advisories are the severity source: a repository advisory's vulnerable
+// version range decides which callers get the security flag. A failed fetch
+// degrades to no severity rather than failing the update check.
+async function fetchSecurityAdvisories(): Promise<SecurityAdvisory[] | null> {
+ try {
+ const signal = AbortSignal.timeout(2500);
+ const advisories: unknown[] = [];
+ // Cursor pagination: the next page is only known from the Link header
+ let url: string | null =
+ `${GITHUB_ADVISORIES_URL}?state=published&per_page=${RELEASES_PER_PAGE}`;
+
+ for (let page = 1; url && page <= MAX_RELEASE_PAGES; page++) {
+ const res = await fetch(url, {
+ headers: {
+ Accept: "application/vnd.github+json",
+ "User-Agent": "Rallly",
+ },
+ signal,
+ });
+ if (!res.ok) return null;
+
+ const batch = await res.json();
+ if (!Array.isArray(batch)) return null;
+
+ advisories.push(...batch);
+ url = getNextLink(res.headers.get("link"));
+ if (url && page === MAX_RELEASE_PAGES) {
+ logger.warn(
+ { pages: MAX_RELEASE_PAGES },
+ "Advisory list truncated at the pagination bound",
+ );
+ }
+ }
+
+ return buildSecurityAdvisories(advisories);
+ } catch (error) {
+ logger.warn({ error }, "Failed to fetch security advisories from GitHub");
+ return null;
+ }
+}
+
+function getNextLink(header: string | null) {
+ return header?.match(/<([^>]+)>;\s*rel="next"/)?.[1] ?? null;
+}
+
+async function getSecurityAdvisories(): Promise<SecurityAdvisory[]> {
+ const cached = await advisoriesCache.get("advisories");
+ if (cached) return cached;
+
+ const fresh = await fetchSecurityAdvisories();
+ if (fresh) await advisoriesCache.set("advisories", fresh);
+ return fresh ?? [];
+}
+
async function getReleaseChannels(): Promise<ReleaseChannels | null> {
const cached = await releaseChannelsCache.get("channels");
if (cached) return cached;
@@ -97,37 +141,6 @@ async function getReleaseChannels(): Promise<ReleaseChannels | null> {
return fresh;
}
-function buildPayload(
- channels: ReleaseChannels,
- requestedMajor: number | null,
-): UpdatesPayload {
- const latestRelease = channels.latestByMajor[channels.latestMajor];
-
- if (requestedMajor === null) {
- return {
- latest: latestRelease.version,
- url: latestRelease.url,
- publishedAt: latestRelease.publishedAt,
- };
- }
-
- const ownChannel = channels.latestByMajor[requestedMajor];
-
- return {
- latest: ownChannel?.version ?? null,
- url: ownChannel?.url ?? null,
- publishedAt: ownChannel?.publishedAt ?? null,
- ...(channels.latestMajor > requestedMajor
- ? {
- newMajor: {
- version: latestRelease.version,
- migrationGuideUrl: getMigrationGuideUrl(channels.latestMajor),
- },
- }
- : {}),
- };
-}
-
export async function GET(request: NextRequest) {
if (isSelfHosted) {
return new NextResponse(null, { status: 404 });
@@ -142,7 +155,10 @@ export async function GET(request: NextRequest) {
}
}
- const channels = await getReleaseChannels();
+ const [channels, advisories] = await Promise.all([
+ getReleaseChannels(),
+ getSecurityAdvisories(),
+ ]);
if (!channels) {
return NextResponse.json(
@@ -183,9 +199,11 @@ export async function GET(request: NextRequest) {
});
}
- const requestedMajor = parsedVersion.success
- ? getMajorVersion(parsedVersion.data)
- : null;
-
- return NextResponse.json(buildPayload(channels, requestedMajor));
+ return NextResponse.json(
+ buildUpdatesPayload({
+ channels,
+ advisories,
+ requestedVersion: parsedVersion.success ? parsedVersion.data : null,
+ }),
+ );
}
diff --git a/apps/web/src/app/api/updates/security-advisories.test.ts b/apps/web/src/app/api/updates/security-advisories.test.ts
new file mode 100644
index 000000000..7d190905d
--- /dev/null
+++ b/apps/web/src/app/api/updates/security-advisories.test.ts
@@ -0,0 +1,103 @@
+import { describe, expect, it } from "vitest";
+import {
+ buildSecurityAdvisories,
+ isVulnerable,
+ parseVersionRange,
+} from "./security-advisories";
+
+function advisory(
+ ranges: (string | null)[],
+ overrides: Record<string, unknown> = {},
+) {
+ return {
+ ghsa_id: "GHSA-xxxx-xxxx-xxxx",
+ html_url:
+ "https://github.com/lukevella/rallly/security/advisories/GHSA-xxxx-xxxx-xxxx",
+ severity: "high",
+ published_at: "2026-08-25T00:00:00Z",
+ vulnerabilities: ranges.map((vulnerable_version_range) => ({
+ vulnerable_version_range,
+ })),
+ ...overrides,
+ };
+}
+
+describe("parseVersionRange", () => {
+ it("parses the range syntaxes GitHub emits", () => {
+ expect(parseVersionRange("< 4.12.0")).toEqual([
+ { operator: "<", version: "4.12.0" },
+ ]);
+ expect(parseVersionRange("<=3.11.2")).toEqual([
+ { operator: "<=", version: "3.11.2" },
+ ]);
+ expect(parseVersionRange(">= 4.0.0, < 4.13.1")).toEqual([
+ { operator: ">=", version: "4.0.0" },
+ { operator: "<", version: "4.13.1" },
+ ]);
+ expect(parseVersionRange(">= 10.0.0 < 15.5.24")).toEqual([
+ { operator: ">=", version: "10.0.0" },
+ { operator: "<", version: "15.5.24" },
+ ]);
+ expect(parseVersionRange("v4.5.4")).toEqual([
+ { operator: "=", version: "4.5.4" },
+ ]);
+ });
+
+ it("rejects anything it cannot read", () => {
+ expect(parseVersionRange("")).toBeNull();
+ expect(parseVersionRange("all versions")).toBeNull();
+ expect(parseVersionRange("< 4.12.0, nope")).toBeNull();
+ expect(parseVersionRange("~4.12.0")).toBeNull();
+ });
+});
+
+describe("isVulnerable", () => {
+ const [adv] = buildSecurityAdvisories([
+ advisory([">= 4.0.0, < 4.13.1", "<=3.11.2"]),
+ ]);
+ if (!adv) throw new Error("fixture failed to build");
+
+ it("matches versions inside any range", () => {
+ expect(isVulnerable("4.12.3", adv)).toBe(true);
+ expect(isVulnerable("v4.0.0", adv)).toBe(true);
+ expect(isVulnerable("3.11.2", adv)).toBe(true);
+ expect(isVulnerable("3.0.0", adv)).toBe(true);
+ });
+
+ it("clears versions outside every range", () => {
+ expect(isVulnerable("4.13.1", adv)).toBe(false);
+ expect(isVulnerable("4.15.1", adv)).toBe(false);
+ expect(isVulnerable("3.11.3", adv)).toBe(false);
+ expect(isVulnerable("5.0.0", adv)).toBe(false);
+ });
+});
+
+describe("buildSecurityAdvisories", () => {
+ it("keeps advisories with at least one readable range", () => {
+ const advisories = buildSecurityAdvisories([
+ advisory(["< 4.12.0"]),
+ advisory(["all versions", "< 4.5.4"], { ghsa_id: "GHSA-2" }),
+ advisory(["all versions"], { ghsa_id: "GHSA-3" }),
+ advisory([null], { ghsa_id: "GHSA-4" }),
+ { ghsa_id: "GHSA-5" },
+ null,
+ ]);
+
+ expect(advisories.map((a) => a.ghsaId)).toEqual([
+ "GHSA-xxxx-xxxx-xxxx",
+ "GHSA-2",
+ ]);
+ expect(advisories[1]?.ranges).toHaveLength(1);
+ });
+
+ it("drops an unknown severity to null", () => {
+ const [adv] = buildSecurityAdvisories([
+ advisory(["< 4.12.0"], { severity: "moderate" }),
+ ]);
+ expect(adv?.severity).toBeNull();
+ });
+
+ it("returns nothing for a non-array", () => {
+ expect(buildSecurityAdvisories({ message: "rate limited" })).toEqual([]);
+ });
+});
diff --git a/apps/web/src/app/api/updates/security-advisories.ts b/apps/web/src/app/api/updates/security-advisories.ts
new file mode 100644
index 000000000..fd4532dbc
--- /dev/null
+++ b/apps/web/src/app/api/updates/security-advisories.ts
@@ -0,0 +1,123 @@
+import * as z from "zod";
+import { isOutdated } from "@/features/instance-settings/utils";
+
+export const severitySchema = z.enum(["low", "medium", "high", "critical"]);
+
+export type Severity = z.infer<typeof severitySchema>;
+
+const advisorySchema = z.object({
+ ghsa_id: z.string().min(1),
+ html_url: z.string().min(1),
+ severity: z.string().nullish(),
+ published_at: z.string().nullish(),
+ vulnerabilities: z
+ .array(z.object({ vulnerable_version_range: z.string().nullish() }))
+ .optional(),
+});
+
+type Comparator = {
+ operator: "<" | "<=" | ">" | ">=" | "=";
+ version: string;
+};
+
+export type SecurityAdvisory = {
+ ghsaId: string;
+ url: string;
+ severity: Severity | null;
+ ranges: Comparator[][];
+};
+
+export type AdvisorySummary = Pick<
+ SecurityAdvisory,
+ "ghsaId" | "url" | "severity"
+>;
+
+export function summarizeAdvisory({
+ ghsaId,
+ url,
+ severity,
+}: SecurityAdvisory): AdvisorySummary {
+ return { ghsaId, url, severity };
+}
+
+const COMPARATOR_REGEX = /^(<=|>=|<|>|=)?\s*v?(\d+(?:\.\d+){0,2})$/;
+
+// GitHub's range syntax: comparators separated by commas or spaces, all of
+// which must hold ("< 4.12.0", ">= 4.0.0, < 4.13.1", "<=3.11.2"). A range that
+// does not parse yields null so a malformed advisory cannot match everyone.
+export function parseVersionRange(range: string): Comparator[] | null {
+ // Insert a separator between an operand and the next operator so
+ // ">= 4.0.0 < 4.13.1" splits the same as ">= 4.0.0, < 4.13.1"
+ const tokens = range
+ .trim()
+ .replace(/(\d)\s+(?=[<>=])/g, "$1,")
+ .split(/\s*,\s*/)
+ .filter(Boolean);
+ if (tokens.length === 0) return null;
+
+ const comparators: Comparator[] = [];
+ for (const token of tokens) {
+ const match = COMPARATOR_REGEX.exec(token);
+ if (!match) return null;
+ comparators.push({
+ operator: (match[1] as Comparator["operator"] | undefined) ?? "=",
+ version: match[2],
+ });
+ }
+ return comparators;
+}
+
+function compare(a: string, b: string) {
+ if (isOutdated(a, b)) return -1;
+ if (isOutdated(b, a)) return 1;
+ return 0;
+}
+
+function satisfies(version: string, comparators: Comparator[]) {
+ return comparators.every(({ operator, version: bound }) => {
+ const c = compare(version, bound);
+ switch (operator) {
+ case "<":
+ return c < 0;
+ case "<=":
+ return c <= 0;
+ case ">":
+ return c > 0;
+ case ">=":
+ return c >= 0;
+ default:
+ return c === 0;
+ }
+ });
+}
+
+export function isVulnerable(version: string, advisory: SecurityAdvisory) {
+ return advisory.ranges.some((range) => satisfies(version, range));
+}
+
+export function buildSecurityAdvisories(input: unknown): SecurityAdvisory[] {
+ if (!Array.isArray(input)) return [];
+
+ const advisories: SecurityAdvisory[] = [];
+ for (const item of input) {
+ const parsed = advisorySchema.safeParse(item);
+ if (!parsed.success) continue;
+
+ const { ghsa_id, html_url, severity, vulnerabilities } = parsed.data;
+ const ranges = (vulnerabilities ?? [])
+ .map((v) => v.vulnerable_version_range)
+ .filter((r): r is string => !!r)
+ .map(parseVersionRange)
+ .filter((r): r is Comparator[] => r !== null);
+ if (ranges.length === 0) continue;
+
+ advisories.push({
+ ghsaId: ghsa_id,
+ url: html_url,
+ // Unknown labels degrade to null rather than dropping the advisory
+ severity: severitySchema.safeParse(severity).data ?? null,
+ ranges,
+ });
+ }
+ return advisories;
+}
diff --git a/apps/web/src/features/instance-settings/components/security-update-banner.tsx b/apps/web/src/features/instance-settings/components/security-update-banner.tsx
new file mode 100644
index 000000000..90997f286
--- /dev/null
+++ b/apps/web/src/features/instance-settings/components/security-update-banner.tsx
@@ -0,0 +1,119 @@
+import {
+ Alert,
+ AlertAction,
+ AlertDescription,
+ AlertTitle,
+} from "@rallly/ui/alert";
+import { ShieldAlertIcon } from "lucide-react";
+import { Trans } from "react-i18next/TransWithoutContext";
+import { getTranslation } from "@/i18n/server";
+import { githubRepoUrl } from "@/lib/constants";
+import { loadUpdateStatus } from "../loaders";
+import type { UpdateAdvisory } from "../service";
+
+const ADVISORIES_URL = `${githubRepoUrl}/security/advisories`;
+
+const SEVERITY_RANK = { critical: 4, high: 3, medium: 2, low: 1 } as const;
+
+function highestSeverity(advisories: UpdateAdvisory[]) {
+ return advisories.reduce<UpdateAdvisory["severity"]>((highest, advisory) => {
+ if (!advisory.severity) return highest;
+ if (!highest || SEVERITY_RANK[advisory.severity] > SEVERITY_RANK[highest]) {
+ return advisory.severity;
+ }
+ return highest;
+ }, null);
+}
+
+// Rendered on every control panel page: an operator must not have to open
+// the home tile to learn that the running version has a known vulnerability.
+export async function SecurityUpdateBanner() {
+ const update = await loadUpdateStatus();
+
+ if (!update) {
+ return null;
+ }
+
+ const inChannel = update.status === "update-available" && update.security;
+ const inNewMajor = update.newMajor?.security === true;
+
+ if (!inChannel && !inNewMajor) {
+ return null;
+ }
+
+ const { t, i18n } = await getTranslation();
+
+ const advisories = inChannel
+ ? update.advisories
+ : (update.newMajor?.advisories ?? []);
+ const severity = t("advisorySeverity", {
+ defaultValue:
+ "{severity, select, critical {critical} high {high} medium {medium} low {low} other {unrated}}",
+ severity: highestSeverity(advisories) ?? "other",
+ });
+ const advisoryUrl =
+ advisories.length === 1 ? advisories[0]?.url : ADVISORIES_URL;
+
+ return (
+ <div className="p-4 pb-0 lg:pt-12 lg:pb-0">
+ <Alert variant="error">
+ <ShieldAlertIcon />
+ <AlertTitle>
+ <Trans
+ t={t}
+ i18n={i18n}
+ ns="app"
+ i18nKey="securityUpdateAvailable"
+ defaults="Security update available"
+ />
+ </AlertTitle>
+ <AlertDescription>
+ {inChannel ? (
+ <Trans
+ t={t}
+ i18n={i18n}
+ ns="app"
+ i18nKey="securityUpdateBannerDescription"
+ defaults="Rallly {version} fixes {count, plural, one {a {severity} severity vulnerability} other {# vulnerabilities, the most severe rated {severity},}} affecting the version you are running. Update as soon as possible."
+ values={{
+ version: update.latest,
+ count: advisories.length,
+ severity,
+ }}
+ />
+ ) : (
+ <Trans
+ t={t}
+ i18n={i18n}
+ ns="app"
+ i18nKey="securityUpdateBannerNewMajorDescription"
+ defaults="Rallly v{major} fixes {count, plural, one {a {severity} severity vulnerability} other {# vulnerabilities, the most severe rated {severity},}} affecting the version you are running, and the fix is not available for your major version. Migrate as soon as possible."
+ values={{
+ major: update.newMajor?.major,
+ count: advisories.length,
+ severity,
+ }}
+ />
+ )}
+ </AlertDescription>
+ <AlertAction>
+ <a
+ href={advisoryUrl}
+ target="_blank"
+ rel="noreferrer noopener"
+ className="text-link-inherit"
+ >
+ <Trans
+ t={t}
+ i18n={i18n}
+ ns="app"
+ i18nKey="viewAdvisory"
+ defaults="{count, plural, one {View advisory} other {View advisories}}"
+ values={{ count: advisories.length }}
+ />
+ </a>
+ </AlertAction>
+ </Alert>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/instance-settings/components/update-indicator.tsx b/apps/web/src/features/instance-settings/components/update-indicator.tsx
new file mode 100644
index 000000000..14773c952
--- /dev/null
+++ b/apps/web/src/features/instance-settings/components/update-indicator.tsx
@@ -0,0 +1,43 @@
+import { SidebarMenuBadge } from "@rallly/ui/sidebar";
+import { ShieldAlertIcon } from "lucide-react";
+import { getTranslation } from "@/i18n/server";
+import { loadUpdateStatus } from "../loaders";
+
+// Sidebar annotation on the control panel link. The caller gates on the
+// admin role; this only decides what to show.
+export async function UpdateIndicator() {
+ const update = await loadUpdateStatus();
+
+ if (!update) {
+ return null;
+ }
+
+ const hasUpdate = update.status === "update-available" || !!update.newMajor;
+
+ if (!hasUpdate) {
+ return null;
+ }
+
+ const security =
+ (update.status === "update-available" && update.security) ||
+ update.newMajor?.security === true;
+
+ const { t } = await getTranslation();
+
+ return (
+ <SidebarMenuBadge>
+ {security ? (
+ <ShieldAlertIcon className="size-4 text-destructive" />
+ ) : (
+ <span className="size-2 rounded-full bg-primary" />
+ )}
+ <span className="sr-only">
+ {security
+ ? t("securityUpdateAvailable", {
+ defaultValue: "Security update available",
+ })
+ : t("updateAvailable", { defaultValue: "Update available" })}
+ </span>
+ </SidebarMenuBadge>
+ );
+}
diff --git a/apps/web/src/features/instance-settings/loaders.ts b/apps/web/src/features/instance-settings/loaders.ts
index 1d6513673..220129bc0 100644
--- a/apps/web/src/features/instance-settings/loaders.ts
+++ b/apps/web/src/features/instance-settings/loaders.ts
@@ -2,10 +2,15 @@ import "server-only";
import { cache } from "react";
import { isSelfHosted } from "@/lib/constants";
+import { isFeatureEnabled } from "@/lib/feature-flags/server";
import { getInstanceSettings } from "./data";
import { getUpdateStatus } from "./service";
export const loadUpdateStatus = cache(async () => {
+ if (!isFeatureEnabled("updateCheck")) {
+ return null;
+ }
+
const { instanceId } = await getInstanceSettings();
if (!instanceId) {
diff --git a/apps/web/src/features/instance-settings/service.ts b/apps/web/src/features/instance-settings/service.ts
index 190dc1bf1..2d5af96fe 100644
--- a/apps/web/src/features/instance-settings/service.ts
+++ b/apps/web/src/features/instance-settings/service.ts
@@ -8,14 +8,26 @@ import { getMajorVersion, isOutdated } from "./utils";
const logger = createLogger("update-check");
+const advisorySchema = z.object({
+ ghsaId: z.string(),
+ url: z.string(),
+ severity: z.enum(["low", "medium", "high", "critical"]).nullish(),
+});
+
+export type UpdateAdvisory = z.infer<typeof advisorySchema>;
+
const updateStatusSchema = z.object({
latest: z.string().nullish(),
url: z.string().nullish(),
publishedAt: z.string().nullish(),
+ security: z.boolean().nullish(),
+ advisories: z.array(advisorySchema).nullish(),
newMajor: z
.object({
version: z.string(),
migrationGuideUrl: z.string(),
+ security: z.boolean().nullish(),
+ advisories: z.array(advisorySchema).nullish(),
})
.nullish(),
});
@@ -51,7 +63,14 @@ export async function getUpdateStatus({ instanceId }: { instanceId: string }) {
}
const currentMajor = getMajorVersion(appVersion);
- const { latest, url: releaseUrl, publishedAt, newMajor } = parsed.data;
+ const {
+ latest,
+ url: releaseUrl,
+ publishedAt,
+ security,
+ advisories,
+ newMajor,
+ } = parsed.data;
// The endpoint scopes `latest` to our own major. Guard anyway: a release
// from another major must never surface as a pullable update, and this
@@ -68,6 +87,10 @@ export async function getUpdateStatus({ instanceId }: { instanceId: string }) {
latest,
url: releaseUrl,
publishedAt,
+ // Only meaningful alongside a pullable update; never let the
+ // flag alone raise an alarm
+ security: security === true,
+ advisories: security === true ? (advisories ?? []) : [],
}
: { status: "up-to-date" as const };
@@ -83,6 +106,9 @@ export async function getUpdateStatus({ instanceId }: { instanceId: string }) {
? {
major: newMajorVersion,
migrationGuideUrl: newMajor.migrationGuideUrl,
+ security: newMajor.security === true,
+ advisories:
+ newMajor.security === true ? (newMajor.advisories ?? []) : [],
}
: null,
};
diff --git a/apps/web/src/lib/constants.ts b/apps/web/src/lib/constants.ts
index e868ea928..3c36205f5 100644
--- a/apps/web/src/lib/constants.ts
+++ b/apps/web/src/lib/constants.ts
@@ -1,3 +1,8 @@
export const isSelfHosted = process.env.NEXT_PUBLIC_SELF_HOSTED === "true";
export const appVersion = process.env.NEXT_PUBLIC_APP_VERSION;
+
+// GitHub redirects the old path after a transfer, so fleet binaries keep
+// working; update here and the cloud side follows on the next deploy.
+export const githubRepo = "lukevella/rallly";
+export const githubRepoUrl = `https://github.com/${githubRepo}`;
diff --git a/apps/web/src/lib/feature-flags/config.ts b/apps/web/src/lib/feature-flags/config.ts
index 96e0845e9..1bfa3f8fc 100644
--- a/apps/web/src/lib/feature-flags/config.ts
+++ b/apps/web/src/lib/feature-flags/config.ts
@@ -43,4 +43,7 @@ export const featureFlagConfig: FeatureFlagConfig = {
// channel carries the API host and its docs.
api: !isSelfHosted,
webhooks: isWebhooksEnabled,
+ // Cloud deploys continuously and is never behind a release; the check
+ // exists for operators who pull images.
+ updateCheck: isSelfHosted,
};
diff --git a/apps/web/src/lib/feature-flags/types.ts b/apps/web/src/lib/feature-flags/types.ts
index fdff2a2ce..3f59aa8de 100644
--- a/apps/web/src/lib/feature-flags/types.ts
+++ b/apps/web/src/lib/feature-flags/types.ts
@@ -13,6 +13,7 @@ export interface FeatureFlagConfig {
nonprofitDiscount: boolean;
api: boolean;
webhooks: boolean;
+ updateCheck: boolean;
}
export type Feature = keyof FeatureFlagConfig;
diff --git a/packages/ui/src/sidebar.tsx b/packages/ui/src/sidebar.tsx
index 6ee8566b2..2cb2e8c9d 100644
--- a/packages/ui/src/sidebar.tsx
+++ b/packages/ui/src/sidebar.tsx
@@ -597,12 +597,12 @@ function SidebarMenuAction({
{
"data-sidebar": "menu-action",
className: cn(
- "absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",
+ "absolute top-2 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",
// Increases the hit area of the button on mobile.
"after:absolute after:-inset-2 md:after:hidden",
"peer-data-[size=sm]/menu-button:top-1",
- "peer-data-[size=default]/menu-button:top-1.5",
- "peer-data-[size=lg]/menu-button:top-2.5",
+ "peer-data-[size=default]/menu-button:top-2",
+ "peer-data-[size=lg]/menu-button:top-3.5",
"group-data-[collapsible=icon]:hidden",
showOnHover &&
"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-popup-open:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",
@@ -625,8 +625,8 @@ const SidebarMenuBadge = React.forwardRef<
"pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 font-medium text-sidebar-foreground text-xs tabular-nums",
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
"peer-data-[size=sm]/menu-button:top-1",
- "peer-data-[size=default]/menu-button:top-1.5",
- "peer-data-[size=lg]/menu-button:top-2.5",
+ "peer-data-[size=default]/menu-button:top-2",
+ "peer-data-[size=lg]/menu-button:top-3.5",
"group-data-[collapsible=icon]:hidden",
className,
)}