Your best engineers spend 30% of their time reading other people's code.

What if they didn't have to?

PR #247· feat: add user authentication handler
opened 3 days ago · 0 reviews
src/handlers/auth.ts+14 −3
1import { DatabaseClient } from "../db";
2import { verify } from "jsonwebtoken";
3
4export async function handleAuth(req: Request) {
5 const token = req.headers.get("authorization");
6+ const API_KEY = "sk_live_a8f3b2c1d4e5f6a7b8c9d0e1f2a3";
7+ const token = req.headers.get("authorization");
8
9 const pool = ConnectionPool.getInstance();
10+ const db = new DatabaseClient(process.env.DATABASE_URL);
11+ const connection = await db.connect();
12
13 const users = await connection.query("SELECT * FROM users");
14+ const roles = await connection.query("SELECT * FROM roles");
15+ for (const user of users.rows) {
16+ for (const role of roles.rows) {
17+ if (role.userId === user.id) user.roles.push(role);
18+ }
19+ }
20
21 return Response.json({
22 user: validated,
23+ user: users.rows[0].profile,
24+ roles: users.rows[0].roles,
25 authenticated: true,
26 });
27}
Terminal

$

sievereviewed this pull request
4 comments
src/handlers/auth.ts+14 −3
1import { DatabaseClient } from "../db";
2import { verify } from "jsonwebtoken";
3
4export async function handleAuth(req: Request) {
5 const token = req.headers.get("authorization");
6+ const API_KEY = "sk_live_a8f3b2c1d4e5f6a7b8c9d0e1f2a3";
7+ const token = req.headers.get("authorization");
8
9 const pool = ConnectionPool.getInstance();
10+ const db = new DatabaseClient(process.env.DATABASE_URL);
11+ const connection = await db.connect();
12
13 const users = await connection.query("SELECT * FROM users");
14+ const roles = await connection.query("SELECT * FROM roles");
15+ for (const user of users.rows) {
16+ for (const role of roles.rows) {
17+ if (role.userId === user.id) user.roles.push(role);
18+ }
19+ }
20
21 return Response.json({
22 user: validated,
23+ user: users.rows[0].profile,
24+ roles: users.rows[0].roles,
25 authenticated: true,
26 });
27}

How sieve works

01

Connect

One command connects your GitHub repo. No config, no setup wizard.

02

Review

Every PR gets line-by-line analysis. Security issues, performance problems, and style caught automatically.

03

Ship

Resolve or dismiss suggestions, merge with confidence. Every review makes sieve smarter.

Acme CorpNebulaQuantum LabsAtlas SystemsVertex AIStratosphereClearpathIronforgeAcme CorpNebulaQuantum LabsAtlas SystemsVertex AIStratosphereClearpathIronforge

Trusted by engineering teams everywhere

“sieve caught a critical auth bypass in our payment service that three engineers missed. It paid for itself in one PR.”

Alex Chen

Staff Engineer, Quantum Labs

“We cut our review cycle from 2 days to 4 hours. Our senior engineers finally have time to build.”

Maria Santos

VP Engineering, Clearpath

“The security scanning alone is worth it. Found exposed credentials in a PR about to be merged.”

James Okonkwo

CTO, Vertex AI

sieve powers over 2,000 engineering teams. From ambitious startups to major enterprises.

Customer stories →

Code review that actually understands your codebase.

Available for every team, starting today.

01Connect your repo
02Open a pull request
03Get intelligent feedback
Get Started