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
19 changes: 18 additions & 1 deletion src/backend/controllers/fs/LegacyFSController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,12 @@ export class LegacyFSController extends PuterController {
}

const signed = signEntry(entry, signingCfg);
result.signatures.push({ ...signed, path: entry.path });
if (finalAction !== 'write') {
const { write_url: _, ...rest } = signed;
result.signatures.push({ ...rest, path: entry.path });
} else {
result.signatures.push({ ...signed, path: entry.path });
}
} catch {
// Silently skip unresolvable items.
result.signatures.push({});
Expand Down Expand Up @@ -1067,6 +1072,18 @@ export class LegacyFSController extends PuterController {
}

// `write` — multipart upload, streamed directly to the v2 write path.
// ACL re-check: if the caller is session-authenticated, verify they
// have write permission on the target. This prevents a read-only
// share recipient from using a leaked write signature.
if (operation === 'write' && req.actor) {
await assertAccess(
this.services.acl,
this.services.fs,
req.actor,
targetEntry.path,
'write',
);
}
if (operation === 'write') {
const body = asRecord(req.body);
const parentEntry = targetEntry.isDir
Expand Down
2 changes: 1 addition & 1 deletion src/backend/util/fileSigning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface SignedFile {
signature: string;
url: string;
read_url: string;
write_url: string;
write_url?: string;
metadata_url: string;
fsentry_type: string | null;
fsentry_is_dir: boolean;
Expand Down
Loading