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 pods/server/src/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export function registerRPC (app: Express, sessions: SessionManager, ctx: Measur

const decodedToken = decodeToken(token)
if (workspaceId !== decodedToken.workspace) {
sendError(res, 401, { message: 'Invalid workspace', workspace: decodedToken.workspace })
sendError(res, 403, { message: 'Invalid workspace', workspace: decodedToken.workspace })
return
}

Expand All @@ -173,7 +173,7 @@ export function registerRPC (app: Express, sessions: SessionManager, ctx: Measur
const cs: ConnectionSocket = createClosingSocket(token, rpcSessions)
const s = await sessions.addSession(ctx, cs, decodedToken, token, token)
if (!('session' in s)) {
sendError(res, 401, {
sendError(res, 403, {
message: 'Failed to create session',
mode: 'specialError' in s ? s.specialError ?? '' : 'upgrading'
})
Expand Down
8 changes: 4 additions & 4 deletions pods/server/src/server_http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,15 @@ export function startHttpServer (
try {
const authHeader = req.headers.authorization
if (authHeader === undefined) {
res.status(403).end(JSON.stringify({ error: 'Unauthorized' }))
res.status(401).end(JSON.stringify({ error: 'Unauthorized' }))
return
}

const token = authHeader.split(' ')[1]
const wsIds = await getWorkspaceIds(token)

if (wsIds.uuid == null) {
res.status(401).end(JSON.stringify({ error: 'No workspace found' }))
res.status(403).end(JSON.stringify({ error: 'No workspace found' }))
return
}

Expand Down Expand Up @@ -390,15 +390,15 @@ export function startHttpServer (
try {
const authHeader = req.headers.authorization
if (authHeader === undefined) {
res.status(403).send({ error: 'Unauthorized' })
res.status(401).send({ error: 'Unauthorized' })
return
}

const token = authHeader.split(' ')[1]
const wsIds = await getWorkspaceIds(token)

if (wsIds.uuid == null) {
res.status(401).send({ error: 'No workspace found' })
res.status(403).send({ error: 'No workspace found' })
}

const name = req.query.name as string
Expand Down