Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
355f21b
Passwords also refuse a distinctive word of an institute's name, not …
omerFixesBugs Nov 16, 2026
7016eff
Sprint 1 P1-J plan (docs/plans/sprint-1-p1j-password-hash.md): the ap…
omerFixesBugs Nov 16, 2026
25da8a3
Sprint 1 P2 plan (docs/plans/sprint-1-p2-files.md): institute profile…
omerFixesBugs Nov 16, 2026
995e61e
Test users get phone numbers no other test user of the same database …
omerFixesBugs Nov 16, 2026
356c448
The app login can no longer read users.password_hash (P1-J): SELECT o…
omerFixesBugs Nov 16, 2026
3ca69eb
Every Prisma client leaves users.password_hash out of its reads (P1-J…
omerFixesBugs Nov 16, 2026
30e85f6
Files and the institute profile in the database (P2 task 1): stored_f…
omerFixesBugs Nov 16, 2026
687a83b
CORS_ORIGINS is normalised in env.ts as browsers send Origin (lower-c…
omerFixesBugs Nov 16, 2026
ff8981c
Shared file caps, types and the institute profile schema (P2 task 2):…
omerFixesBugs Nov 16, 2026
917d5eb
The start-up login check also refuses a login with REPLICATION (a rep…
omerFixesBugs Nov 16, 2026
bc6644b
Password login without the hash (P1-J): the API hashes the typed pass…
omerFixesBugs Nov 16, 2026
b0e6315
GET /me/password reads hasPassword from auth_my_password_is_set() (P1…
omerFixesBugs Nov 16, 2026
47fb357
Docs for P1-J: database.md (password_hash not readable by the app, a …
omerFixesBugs Nov 16, 2026
20b29e9
Redis is pinned to one exact version, redis:7.4.11-alpine (the versio…
omerFixesBugs Nov 16, 2026
81bfc26
Docs for the follow-ups: decisions-pending gets the section "Small fo…
omerFixesBugs Nov 16, 2026
9cc9d54
Image processing for uploads (P2 task 3): sharp 0.35.5 (already in th…
omerFixesBugs Nov 16, 2026
b0e010b
FileStore and the per-institute cap (P2 task 4): PostgresFileStore is…
omerFixesBugs Nov 16, 2026
caec9f7
Photo and profile routes (P2 task 5): GET/PUT/DELETE /students/:id/ph…
omerFixesBugs Nov 16, 2026
57cf79f
Web (P2 task 6): Settings → Institute profile (names, EIIN, contact, …
omerFixesBugs Nov 16, 2026
4e4cbb2
Docs for P2 (task 7): docs/files.md, database.md (the three tables an…
omerFixesBugs Nov 16, 2026
724ffb0
The photo dialog's preview URL is made when a file is chosen, not in …
omerFixesBugs Nov 16, 2026
110857d
files.spec: the profile fields by id ("নাম (বাংলা)" is also part of t…
omerFixesBugs Nov 16, 2026
8c3a4f9
After the review (P1-J7): a dedicated login for the password login. j…
omerFixesBugs Nov 16, 2026
72b714b
The password login looks the hash up on its own database login (Login…
omerFixesBugs Nov 16, 2026
06f3236
Docs after the P1-J review: what an injection in an ordinary request …
omerFixesBugs Nov 16, 2026
82f6600
Test phones never wrap and their lock survives races (review of PR #1…
omerFixesBugs Nov 16, 2026
27403c3
The institute-name rule compares passwords and names like the phone r…
omerFixesBugs Nov 16, 2026
7aa31c5
An origin setting with a login, a path, a query or a fragment is no o…
omerFixesBugs Nov 16, 2026
fd6430e
Docs after the review of PR #17: P1-I's title line says it is built h…
omerFixesBugs Nov 16, 2026
9dbee45
P1-J migration after the second review: it first checks that jantrik_…
omerFixesBugs Nov 16, 2026
a980a60
The password login's database login must reach the same database, por…
omerFixesBugs Nov 16, 2026
ff673b8
Docs after the second P1-J review: the server upgrade creates the rol…
omerFixesBugs Nov 16, 2026
13deed2
A file reference is tied to its kind (review R6): UNIQUE (tenant_id, …
omerFixesBugs Nov 16, 2026
cb86722
Uploads hold no database connection while they arrive (review R1): th…
omerFixesBugs Nov 16, 2026
459bcf7
Web after the review: a chosen image is shrunk in the browser to 1600…
omerFixesBugs Nov 16, 2026
944e840
Docs after the review: auth.md (the request pipeline and @OwnTransact…
omerFixesBugs Nov 16, 2026
282c8b6
Review round 2, API: uploads in flight bounded before multer (16 per …
omerFixesBugs Nov 16, 2026
cfd4506
Review round 2, web: the browser asks for the EXIF orientation explic…
omerFixesBugs Nov 16, 2026
73eb83b
Docs for review round 2: auth.md (the upload routes' re-checks, Uploa…
omerFixesBugs Nov 16, 2026
e622e52
The interceptor opens its transaction through an unchecked entry (aro…
omerFixesBugs Nov 16, 2026
3d2c5d5
Review round 3: no upload slot leaks when the client left before Uplo…
omerFixesBugs Nov 16, 2026
de19108
The two new origin tests' development settings also name DATABASE_LOG…
omerFixesBugs Nov 16, 2026
aa0105b
Merge P1-J (#16) into the small follow-ups (#17): the ready resolutio…
omerFixesBugs Nov 16, 2026
b1efceb
Merge remote-tracking branch 'origin/feature/sprint-1-p1j-password-ha…
omerFixesBugs Nov 16, 2026
b5d3697
Merge remote-tracking branch 'origin/feature/sprint-1-p2-files' into …
omerFixesBugs Nov 16, 2026
c857102
Merge remote-tracking branch 'origin/feature/small-followups-after-p1…
omerFixesBugs Nov 16, 2026
9309fa8
Work in progress: a staff guide draft and draft legal texts (terms of…
omerFixesBugs Nov 19, 2026
ed5d56c
Docs only: a plain staff guide draft (signing in, setup, students, gu…
omerFixesBugs Nov 19, 2026
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
Prev Previous commit
Next Next commit
Review round 3: no upload slot leaks when the client left before Uplo…
…adGuard ran (a client already gone gets no slot, on-finished's test; every slot comes back after 5 minutes at the latest); the revoked-session check runs before the transaction with Redis's 2 s deadline; a browser without imageOrientation decodes without it when the photo needs no turning (a small EXIF reader checks) and sends the original otherwise; the timeout test uses sharp's real message. Each code fix with a test that failed first; docs (round 3 in the plan and decisions-pending, files.md, auth.md)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
  • Loading branch information
omerFixesBugs and claude committed Nov 16, 2026
commit 3d2c5d572e7c7473f1ed197ca69c614524de44c6
3 changes: 2 additions & 1 deletion apps/api/src/files/image.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ describe('processImage', () => {

describe('imageFailure (review round 2)', () => {
it("maps sharp's timeout to 422 IMAGE_TIMEOUT and anything else to IMAGE_INVALID", () => {
const timeout = imageFailure(new Error('timeout: 10s exceeded'));
// sharp 0.35.5's own message (src/common.cc): "timeout: N% complete".
const timeout = imageFailure(new Error('timeout: 37% complete'));
expect([timeout.getStatus(), (timeout.getResponse() as { code: string }).code]).toEqual([
422,
'IMAGE_TIMEOUT',
Expand Down
41 changes: 39 additions & 2 deletions apps/api/src/files/upload-limits.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { EventEmitter } from 'node:events';
import type { Request, Response } from 'express';
import {
UPLOAD_BODY_TIMEOUT_MS,
UPLOAD_SLOT_BACKSTOP_MS,
UPLOADS_IN_FLIGHT,
UPLOADS_IN_FLIGHT_PER_USER,
UploadLimits,
Expand All @@ -11,8 +12,12 @@ import {
// byte, and every slot is given back when the response closes (finished, aborted or failed).

function exchange() {
const req = Object.assign(new EventEmitter(), { destroy: vi.fn() });
const res = new EventEmitter();
const req = Object.assign(new EventEmitter(), { destroy: vi.fn(), destroyed: false });
const res = Object.assign(new EventEmitter(), {
destroyed: false,
writableFinished: false,
socket: { writable: true } as { writable: boolean } | null,
});
return { req, res, asReq: req as unknown as Request, asRes: res as unknown as Response };
}

Expand Down Expand Up @@ -68,6 +73,38 @@ describe('UploadLimits', () => {
expect(limits.inFlight).toBe(2);
});

it('takes no slot for a client already gone (its one close event was before the guard ran)', () => {
const limits = new UploadLimits();
// The socket closed while the global guards awaited Redis: Node destroyed the response and
// emitted its only 'close' before enter() could listen for it.
const gone = exchange();
gone.res.emit('close');
gone.res.destroyed = true;
gone.res.socket = null;
gone.req.destroyed = true;
expect(() => limits.enter('u1', gone.asReq, gone.asRes)).toThrow();
const ended = exchange();
ended.res.writableFinished = true;
expect(() => limits.enter('u1', ended.asReq, ended.asRes)).toThrow();
expect(limits.inFlight).toBe(0);
// The person can still upload twice.
limits.enter('u1', exchange().asReq, exchange().asRes);
limits.enter('u1', exchange().asReq, exchange().asRes);
expect(limits.inFlight).toBe(2);
});

it('a slot whose close never comes is given back after the backstop', () => {
vi.useFakeTimers();
const limits = new UploadLimits();
const lost = exchange();
limits.enter('u1', lost.asReq, lost.asRes);
lost.req.emit('end');
vi.advanceTimersByTime(UPLOAD_SLOT_BACKSTOP_MS);
expect(limits.inFlight).toBe(0);
lost.res.emit('close'); // a late close changes nothing
expect(limits.inFlight).toBe(0);
});

it(`drops a body that has not arrived within ${UPLOAD_BODY_TIMEOUT_MS / 1000} s; one that has is left alone`, () => {
vi.useFakeTimers();
const limits = new UploadLimits();
Expand Down
28 changes: 24 additions & 4 deletions apps/api/src/files/upload-limits.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Injectable, type CanActivate, type ExecutionContext } from '@nestjs/common';
import { HttpException, Injectable, type CanActivate, type ExecutionContext } from '@nestjs/common';
import type { Request, Response } from 'express';
import { apiError } from '../common/api-error.js';
import { RequestContext } from '../common/request-context.js';
Expand All @@ -9,6 +9,19 @@ export const UPLOADS_IN_FLIGHT = 16;
export const UPLOADS_IN_FLIGHT_PER_USER = 2;
/** A body not fully received by then is dropped (5 MB at 0.75 Mbps takes about 55 s). */
export const UPLOAD_BODY_TIMEOUT_MS = 60_000;
/** A slot whose response somehow never closes is given back after this anyway (a backstop). */
export const UPLOAD_SLOT_BACKSTOP_MS = 5 * 60_000;

/**
* The client is gone, or the answer was sent: on-finished's own test (Express's dependency).
* Then the response's one 'close' event may already be past, and a slot taken now would never
* be given back.
*/
function finished(req: Request, res: Response): boolean {
return (
req.destroyed || res.destroyed || res.writableFinished || !res.socket || !res.socket.writable
);
}

const busy = () => apiError(503, 'IMAGE_BUSY', 'Too many uploads at once; try again in a moment');

Expand All @@ -17,7 +30,8 @@ const busy = () => apiError(503, 'IMAGE_BUSY', 'Too many uploads at once; try ag
* with no request transaction (@OwnTransaction), into memory (multer), so nothing else limited
* how many bodies could be in flight. A slot is taken before multer reads a byte, refused at once
* with 503 IMAGE_BUSY when the process or the person has too many, and given back when the
* response closes, however it ends (sent, failed, or the client went away). A body that has not
* response closes, however it ends (sent, failed, or the client went away), or after
* UPLOAD_SLOT_BACKSTOP_MS at the latest; a client already gone gets no slot. A body that has not
* arrived within UPLOAD_BODY_TIMEOUT_MS is dropped, which closes the response too.
*/
@Injectable()
Expand All @@ -30,22 +44,28 @@ export class UploadLimits {
}

enter(userId: string, req: Request, res: Response): void {
// The client left while the global guards awaited Redis (review round 3): no slot at all.
if (finished(req, res)) throw new HttpException('Client closed the request', 499);
const mine = this.perUser.get(userId) ?? 0;
if (this.total >= UPLOADS_IN_FLIGHT || mine >= UPLOADS_IN_FLIGHT_PER_USER) throw busy();
this.total++;
this.perUser.set(userId, mine + 1);
const timer = setTimeout(() => req.destroy(), UPLOAD_BODY_TIMEOUT_MS);
req.once('end', () => clearTimeout(timer));
let released = false;
res.once('close', () => {
const release = () => {
if (released) return;
released = true;
clearTimeout(timer);
clearTimeout(backstop);
this.total--;
const left = (this.perUser.get(userId) ?? 1) - 1;
if (left > 0) this.perUser.set(userId, left);
else this.perUser.delete(userId);
});
};
const backstop = setTimeout(release, UPLOAD_SLOT_BACKSTOP_MS);
backstop.unref?.();
res.once('close', release);
}
}

Expand Down
15 changes: 15 additions & 0 deletions apps/api/src/tenancy/request-transaction.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,19 @@ describe('RequestTransaction.run', () => {
expect(fn).not.toHaveBeenCalled();
expect(withContext).not.toHaveBeenCalled();
});

it('checks the session in Redis before opening the transaction, with a deadline (review round 3)', async () => {
const transaction = vi.fn();
const prisma = { client: { $transaction: transaction } } as unknown as PrismaService;
const context = {
tx: undefined,
requirePrincipal: () => ({ userId: 'u', sessionId: 's', tenantId: 't' }),
} as unknown as RequestContext;
// A Redis that never answers: 503 after the deadline, and no connection was taken.
const silent = { exists: () => new Promise(() => undefined) };
const tx = new RequestTransaction(prisma, context, silent as never);
const failure = await tx.run(vi.fn(), { roles: ['ADMIN'] }).catch((e: unknown) => e);
expect((failure as { getStatus(): number }).getStatus()).toBe(503);
expect(transaction).not.toHaveBeenCalled();
});
});
20 changes: 17 additions & 3 deletions apps/api/src/tenancy/request-transaction.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { Redis } from 'ioredis';
import { RequestContext, type Principal } from '../common/request-context.js';
import { revokedSessionKey } from '../common/revocation.js';
import { PrismaService } from '../prisma/prisma.service.js';
import { REDIS_CALL_TIMEOUT_MS, withRedisDeadline } from '../redis/redis-deadline.js';
import { REDIS } from '../redis/redis.constants.js';

export const REQUEST_TX_TIMEOUT_MS = 15_000;
Expand Down Expand Up @@ -59,14 +60,23 @@ export class RequestTransaction {
opts: { userScoped?: boolean; roles?: readonly Role[] } = {},
): Promise<T> {
const principal = this.context.requirePrincipal();
// The session first, outside the transaction and with Redis's deadline (review round 3): a
// slow Redis never holds a pooled connection.
if (opts.roles) {
await withRedisDeadline(
() => this.sessionLive(principal),
REDIS_CALL_TIMEOUT_MS,
'SERVICE_UNAVAILABLE',
);
}
const tenantId = opts.userScoped ? null : (principal.tenantId ?? null);
let committed: (() => unknown)[] = [];
const result = await withContext(
this.prisma.client,
{ tenantId, userId: principal.userId },
async (tx) => {
if (tenantId) await assertTenantAccess(tx);
if (opts.roles) await this.recheck(tx, principal, opts.roles);
if (opts.roles) await this.recheckRoles(tx, opts.roles);
this.context.beginTransaction(tx);
try {
const value = await fn();
Expand All @@ -83,11 +93,15 @@ export class RequestTransaction {
return result;
}

/** The session still live and the person still holding one of `roles` here, read now. */
private async recheck(tx: TenantTx, principal: Principal, roles: readonly Role[]) {
/** The session not revoked since the guards checked it. */
private async sessionLive(principal: Principal): Promise<void> {
if (await this.redis.exists(revokedSessionKey(principal.sessionId))) {
throw new UnauthorizedException();
}
}

/** The person still holding one of `roles` here, read in the transaction. */
private async recheckRoles(tx: TenantTx, roles: readonly Role[]) {
const held = await tx.$queryRaw<{ role: Role }[]>`
SELECT role FROM memberships
WHERE user_id = app_current_user_id() AND status = 'ACTIVE'`;
Expand Down
79 changes: 77 additions & 2 deletions apps/web/src/lib/image-shrink.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
import { describe, expect, it } from 'vitest';
import { fitWithin, shrinkForUpload, UPLOAD_LONG_SIDE } from './image-shrink';
import { afterEach, describe, expect, it, vi } from 'vitest';
import {
decodeUpright,
fitWithin,
jpegOrientation,
shrinkForUpload,
UPLOAD_LONG_SIDE,
} from './image-shrink';

/** A JPEG start with an EXIF APP1 segment holding only the Orientation tag. */
function jpegWithOrientation(
orientation: number,
order: 'MM' | 'II' = 'MM',
): Uint8Array<ArrayBuffer> {
const be = order === 'MM';
const u16 = (n: number) => (be ? [n >> 8, n & 255] : [n & 255, n >> 8]);
const u32 = (n: number) =>
be
? [n >>> 24, (n >> 16) & 255, (n >> 8) & 255, n & 255]
: [n & 255, (n >> 8) & 255, (n >> 16) & 255, n >>> 24];
const tiff = [
...(be ? [0x4d, 0x4d] : [0x49, 0x49]),
...u16(42),
...u32(8),
...u16(1), // one IFD entry
...u16(0x0112), // Orientation
...u16(3), // SHORT
...u32(1),
...u16(orientation),
0,
0,
...u32(0),
];
const app1 = [...[0x45, 0x78, 0x69, 0x66, 0, 0], ...tiff]; // "Exif\0\0"
const len = app1.length + 2;
return new Uint8Array([0xff, 0xd8, 0xff, 0xe1, len >> 8, len & 255, ...app1, 0xff, 0xd9]);
}

describe('fitWithin (the browser-side shrink before upload)', () => {
it('scales the long side down to the limit, keeping the shape', () => {
Expand All @@ -21,6 +56,46 @@ describe('fitWithin (the browser-side shrink before upload)', () => {
});
});

describe('jpegOrientation', () => {
it('reads the EXIF orientation of a JPEG (both byte orders), null without one', () => {
expect(jpegOrientation(jpegWithOrientation(6).buffer as ArrayBuffer)).toBe(6);
expect(jpegOrientation(jpegWithOrientation(3, 'II').buffer as ArrayBuffer)).toBe(3);
expect(jpegOrientation(jpegWithOrientation(1).buffer as ArrayBuffer)).toBe(1);
expect(jpegOrientation(new Uint8Array([0xff, 0xd8, 0xff, 0xd9]).buffer)).toBeNull();
expect(jpegOrientation(new Uint8Array([0x89, 0x50, 0x4e, 0x47]).buffer)).toBeNull();
});
});

describe('decodeUpright (an engine without imageOrientation, review round 3)', () => {
afterEach(() => vi.unstubAllGlobals());
const oldEngine = () => {
const decoded = { width: 10, height: 10, close: () => undefined };
const decode = vi.fn((_file: Blob, options?: object) =>
options ? Promise.reject(new TypeError('unknown option')) : Promise.resolve(decoded),
);
vi.stubGlobal('createImageBitmap', decode);
return { decode, decoded };
};

it('decodes without the option when nothing needs turning', async () => {
const { decode, decoded } = oldEngine();
const upright = new File([jpegWithOrientation(1)], 'a.jpg', { type: 'image/jpeg' });
expect(await decodeUpright(upright)).toBe(decoded);
const png = new File([new Uint8Array([0x89, 0x50, 0x4e, 0x47])], 'a.png', {
type: 'image/png',
});
expect(await decodeUpright(png)).toBe(decoded);
expect(decode).toHaveBeenCalledTimes(4);
});

it('gives up (the original is sent; the server turns it) when the photo needs turning', async () => {
const { decode } = oldEngine();
const sideways = new File([jpegWithOrientation(6)], 'a.jpg', { type: 'image/jpeg' });
expect(await decodeUpright(sideways)).toBeNull();
expect(decode).toHaveBeenCalledTimes(1);
});
});

describe('shrinkForUpload', () => {
it('sends the original when the browser cannot decode images (no createImageBitmap)', async () => {
const file = new File([new Uint8Array(10)], 'a.jpg', { type: 'image/jpeg' });
Expand Down
53 changes: 50 additions & 3 deletions apps/web/src/lib/image-shrink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,54 @@ export function fitWithin(
};
}

/**
* The EXIF orientation (1-8) of a JPEG from its first bytes, or null (not a JPEG, or no EXIF
* orientation before the image data).
*/
export function jpegOrientation(buffer: ArrayBuffer): number | null {
const v = new DataView(buffer);
if (v.byteLength < 4 || v.getUint16(0) !== 0xffd8) return null;
let at = 2;
while (at + 4 <= v.byteLength) {
const marker = v.getUint16(at);
if ((marker & 0xff00) !== 0xff00 || marker === 0xffda || marker === 0xffd9) return null;
const size = v.getUint16(at + 2);
const exif = marker === 0xffe1 && at + 18 <= v.byteLength && v.getUint32(at + 4) === 0x45786966;
if (exif) {
const tiff = at + 10;
const little = v.getUint16(tiff) === 0x4949;
const ifd = tiff + v.getUint32(tiff + 4, little);
if (ifd + 2 > v.byteLength) return null;
const count = v.getUint16(ifd, little);
for (let i = 0; i < count; i++) {
const entry = ifd + 2 + i * 12;
if (entry + 12 > v.byteLength) return null;
if (v.getUint16(entry, little) === 0x0112) return v.getUint16(entry + 8, little);
}
return null;
}
at += 2 + size;
}
return null;
}

/**
* The image decoded upright. An engine that predates `imageOrientation` throws a TypeError for
* it (review round 3): then it is decoded without the option when nothing needs turning (no EXIF
* orientation, or 1), and otherwise not at all (null: the original is sent, and the server turns
* it upright).
*/
export async function decodeUpright(file: File): Promise<ImageBitmap | null> {
try {
return await createImageBitmap(file, { imageOrientation: 'from-image' });
} catch (error) {
if (!(error instanceof TypeError)) throw error;
const orientation = jpegOrientation(await file.slice(0, 128 * 1024).arrayBuffer());
if (orientation !== null && orientation !== 1) return null;
return createImageBitmap(file);
}
}

/**
* A smaller copy of `file` to upload: JPEG (quality 0.85) on white for photos (`opaque`), PNG
* otherwise (logos, signatures and seals keep their transparency). The original is returned when
Expand All @@ -30,9 +78,8 @@ export function fitWithin(
export async function shrinkForUpload(file: File, opaque: boolean): Promise<File> {
try {
if (typeof createImageBitmap !== 'function') return file;
// Upright as the camera meant it; an engine that does not know the option throws, and the
// original is sent (the server turns it upright too).
const bitmap = await createImageBitmap(file, { imageOrientation: 'from-image' });
const bitmap = await decodeUpright(file);
if (!bitmap) return file;
const size = fitWithin(bitmap.width, bitmap.height, UPLOAD_LONG_SIDE);
if (!size.scaled && file.size <= SMALL_ENOUGH_BYTES) {
bitmap.close();
Expand Down
6 changes: 3 additions & 3 deletions docs/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,9 @@ TenantContextInterceptor withContext({ tenantId: tid, userId: sub }) around the
- Everything that touches the database goes inside `run`. Nothing outside it may use `Db.tx`
(it throws: no request transaction), and `run` refuses to start inside one.
- The guards' checks can be a minute old by then (a slow body, the image queue), so the upload
routes pass `roles` to `run`: in its transaction it re-checks the session (not revoked) and
that the person still holds one of the route's roles, besides the institute's status and the
membership. A short `run` before decoding refuses a lost role or a wrong target early.
routes pass `roles` to `run`: it re-checks the session (not revoked; in Redis, before the
transaction opens, with the 2 s deadline) and, in the transaction, that the person still holds
one of the route's roles, besides the institute's status and the membership. A short `run` before decoding refuses a lost role or a wrong target early.
- `UploadGuard` bounds the bodies in memory: 16 uploads in flight per process, 2 per person
(503 `IMAGE_BUSY`), a body not received within 60 s dropped.
- The CSV imports (student import, device people) still read their uploads inside the request
Expand Down
Loading