Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/mail/components/ui/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ import { useLocation } from 'react-router';
import { useTranslations } from 'use-intl';
import { useForm } from 'react-hook-form';
import { FOLDERS } from '@/lib/utils';
import { NavMain } from './nav-main';
import { NavUser } from './nav-user';
import { NavMain } from './nav-main';
import { useQueryState } from 'nuqs';
import { Input } from './input';
import { toast } from 'sonner';
Expand Down Expand Up @@ -277,7 +277,7 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
)}
</AnimatePresence>
</SidebarHeader>
{/* {!session?.user.phoneNumberVerified && !isSessionPending ? <CallInboxDialog /> : null} */}
{!session?.user.phoneNumberVerified && !isSessionPending ? <CallInboxDialog /> : null}
<SidebarContent
className={`scrollbar scrollbar-w-1 scrollbar-thumb-accent/40 scrollbar-track-transparent hover:scrollbar-thumb-accent scrollbar-thumb-rounded-full overflow-x-hidden py-0 pt-0 ${state !== 'collapsed' ? 'mt-5 md:px-4' : 'px-2'}`}
>
Expand Down
3 changes: 3 additions & 0 deletions apps/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@
"date-fns": "^4.1.0",
"dedent": "^1.6.0",
"drizzle-orm": "catalog:",
"elevenlabs": "1.59.0",
"email-addresses": "^5.0.0",
"google-auth-library": "9.15.1",
"he": "^1.2.0",
"hono": "^4.7.8",
"hono-agents": "0.0.83",
"hono-party": "^0.0.12",
"jose": "6.0.11",
"jsonrepair": "^3.12.0",
"mimetext": "^3.0.27",
"p-retry": "6.2.1",
Expand All @@ -62,6 +64,7 @@
"sanitize-html": "^2.16.0",
"string-strip-html": "^13.4.12",
"superjson": "catalog:",
"twilio": "5.7.0",
"wrangler": "catalog:",
"zod": "catalog:"
},
Expand Down
4 changes: 3 additions & 1 deletion apps/server/src/ctx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import type { Autumn } from 'autumn-js';
import type { Auth } from './lib/auth';
import type { DB } from './db';

export type SessionUser = NonNullable<Awaited<ReturnType<Auth['api']['getSession']>>>['user'];

export type HonoVariables = {
auth: Auth;
session: Awaited<ReturnType<Auth['api']['getSession']>>;
sessionUser?: SessionUser;
db: DB;
autumn: Autumn;
};
Expand Down
8 changes: 8 additions & 0 deletions apps/server/src/db/migrations/0028_worried_molecule_man.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE "mail0_jwks" (
"id" text PRIMARY KEY NOT NULL,
"public_key" text NOT NULL,
"private_key" text NOT NULL,
"created_at" timestamp NOT NULL
);
Comment on lines +1 to +6
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Encrypt private keys at rest
Persisting private_key as plain text poses a security risk. Consider encrypting this column using Postgres’s pgcrypto (e.g. pgp_sym_encrypt) or storing keys in a dedicated secrets manager/vault.

🤖 Prompt for AI Agents
In apps/server/src/db/migrations/0028_worried_molecule_man.sql at lines 1 to 6,
the private_key column is stored as plain text, which is a security risk. Modify
the migration to encrypt the private_key column using Postgres's pgcrypto
extension, such as applying pgp_sym_encrypt on insert and pgp_sym_decrypt on
select, or alternatively, refactor the design to store private keys securely in
a dedicated secrets manager or vault instead of the database.

🛠️ Refactor suggestion

Use native UUID type for id and default timestamp with timezone
Switching id to UUID with a default generation function and using TIMESTAMPTZ for created_at with a default of now() will improve consistency and avoid relying on external UUID generation.

Proposed diff:

-CREATE TABLE "mail0_jwks" (
-	"id" text PRIMARY KEY NOT NULL,
+CREATE TABLE "mail0_jwks" (
+	"id" UUID PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
 	"public_key" text NOT NULL,
 	"private_key" text NOT NULL,
-	"created_at" timestamp NOT NULL
+	"created_at" TIMESTAMPTZ NOT NULL DEFAULT now()
 );

Note: ensure the pgcrypto extension (or uuid-ossp) is enabled before using gen_random_uuid().

🤖 Prompt for AI Agents
In apps/server/src/db/migrations/0028_worried_molecule_man.sql lines 1 to 6,
change the "id" column type from text to native UUID and set its default value
to gen_random_uuid() to generate UUIDs within the database. Also, update the
"created_at" column type to TIMESTAMPTZ and set its default to now() to store
timestamps with timezone. Before applying these changes, ensure the pgcrypto
extension is enabled in the database to support gen_random_uuid().

--> statement-breakpoint
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix invalid SQL comment syntax
The line --> statement-breakpoint uses -->, which Postgres interprets as an operator rather than a comment. Replace it with a proper -- comment or remove it if not required.

Proposed diff:

---> statement-breakpoint
+-- statement-breakpoint

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In apps/server/src/db/migrations/0028_worried_molecule_man.sql at line 7, the
line uses an invalid SQL comment syntax `--> statement-breakpoint`. Replace
`-->` with the correct single-line comment syntax `--` to make it a valid
Postgres comment, or remove the line entirely if the comment is unnecessary.

ALTER TABLE "mail0_user_settings" ALTER COLUMN "settings" SET DEFAULT '{"language":"en","timezone":"UTC","dynamicContent":false,"externalImages":true,"customPrompt":"","trustedSenders":[],"isOnboarded":false,"colorTheme":"system","zeroSignature":true}'::jsonb;
Loading