Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(api): return 404 for missing and hidden resources

Andrejb3480cb7361f
diff --git a/apps/api/src/activity/index.ts b/apps/api/src/activity/index.ts
index 39366f8e0..efb666065 100644
--- a/apps/api/src/activity/index.ts
+++ b/apps/api/src/activity/index.ts
@@ -48,10 +48,8 @@ const getWorkspaceActivitiesRoute = createRoute({
"Recent activity in the workspace",
workspaceActivityListSchema,
),
- 400: errorResponse("Workspace ID could not be determined"),
- 403: errorResponse(
- "No workspace access, or missing project:read or task:read permission",
- ),
+ 403: errorResponse("Missing project:read or task:read permission"),
+ 404: errorResponse("Workspace not found"),
},
});
@@ -67,10 +65,8 @@ const getActivitiesRoute = createRoute({
request: { params: taskIdParam, query: activitiesQuery },
responses: {
200: jsonResponse("List of activities for the task", activityListSchema),
- 400: errorResponse(
- "Unknown task, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the task's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Task not found"),
},
});
@@ -96,15 +92,16 @@ const createActivityRoute = createRoute({
200: jsonResponse("The created activity", activitySchema),
400: {
description:
- "Invalid body, unknown task, or comment activity submitted through the generic endpoint",
+ "Invalid body, or comment activity submitted through the generic endpoint",
content: {
"text/plain": { schema: z.string() },
"application/json": { schema: z.object({ message: z.string() }) },
},
},
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
+ 404: errorResponse("Task not found"),
},
});
@@ -128,10 +125,11 @@ const createCommentRoute = createRoute({
},
responses: {
200: jsonResponse("The created comment", activitySchema),
- 400: errorResponse("Invalid body, or unknown task"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
+ 404: errorResponse("Task not found"),
},
});
@@ -151,9 +149,9 @@ const updateCommentRoute = createRoute({
},
responses: {
200: jsonResponse("The updated comment", activitySchema),
- 400: errorResponse("Invalid body, or unknown activity"),
- 403: errorResponse("Not the author, or no access to the workspace"),
- 404: errorResponse("Comment not found"),
+ 400: errorResponse("Invalid body"),
+ 403: errorResponse("Not the author, or no access to the project"),
+ 404: errorResponse("Activity or comment not found"),
},
});
@@ -173,9 +171,9 @@ const deleteCommentRoute = createRoute({
},
responses: {
200: jsonResponse("The deleted comment", activitySchema),
- 400: errorResponse("Invalid body, or unknown activity"),
- 403: errorResponse("Not the author, or no access to the workspace"),
- 404: errorResponse("Comment not found"),
+ 400: errorResponse("Invalid body"),
+ 403: errorResponse("Not the author, or no access to the project"),
+ 404: errorResponse("Activity or comment not found"),
},
});
diff --git a/apps/api/src/billing/index.ts b/apps/api/src/billing/index.ts
index e11acf78e..9d6fefd12 100644
--- a/apps/api/src/billing/index.ts
+++ b/apps/api/src/billing/index.ts
@@ -88,7 +88,7 @@ const getWorkspaceBillingRoute = createRoute({
"Billing state for the workspace",
workspaceBillingSchema,
),
- 403: errorResponse("No access to the workspace"),
+ 404: errorResponse("Workspace not found"),
},
});
@@ -113,6 +113,7 @@ const createCheckoutRoute = createRoute({
200: jsonResponse("The checkout session", checkoutSchema),
400: errorResponse("Invalid plan or interval"),
403: errorResponse("Not a workspace owner or admin"),
+ 404: errorResponse("Workspace not found"),
},
});
@@ -131,6 +132,7 @@ const createPortalRoute = createRoute({
200: jsonResponse("The portal link", portalSchema),
400: errorResponse("No billing customer exists for this workspace yet"),
403: errorResponse("Not a workspace owner or admin"),
+ 404: errorResponse("Workspace not found"),
},
});
diff --git a/apps/api/src/calendar-feed/index.ts b/apps/api/src/calendar-feed/index.ts
index b1e2de9cb..dea068d87 100644
--- a/apps/api/src/calendar-feed/index.ts
+++ b/apps/api/src/calendar-feed/index.ts
@@ -30,11 +30,12 @@ const sharingMiddleware = [
requireWorkspacePermission({ project: ["share"] }),
];
const managementErrors = {
- 400: errorResponse("Invalid request or unknown project"),
+ 400: errorResponse("Invalid request"),
401: errorResponse("Authentication required"),
403: errorResponse(
- "No workspace access or missing project sharing permission",
+ "No access to the project, or missing project sharing permission",
),
+ 404: errorResponse("Project not found"),
};
export const publicCalendarFeed = apiRouter().openapi(
@@ -112,7 +113,7 @@ const calendarFeed = apiRouter<BaseVariables & { workspaceId: string }>()
201: jsonResponse("Calendar feed created", calendarFeedSchema),
...managementErrors,
403: errorResponse(
- "No workspace access, missing project:share permission, or missing label:create permission for a new workspace label definition",
+ "No access to the project, missing project:share permission, or missing label:create permission for a new workspace label definition",
),
},
}),
@@ -147,8 +148,8 @@ const calendarFeed = apiRouter<BaseVariables & { workspaceId: string }>()
"Calendar feed revoked",
z.object({ success: z.boolean() }),
),
- 404: errorResponse("Calendar feed not found in this project"),
...managementErrors,
+ 404: errorResponse("Project or calendar feed not found"),
},
}),
async (c) =>
diff --git a/apps/api/src/column/index.ts b/apps/api/src/column/index.ts
index 0711ddb95..23d665f49 100644
--- a/apps/api/src/column/index.ts
+++ b/apps/api/src/column/index.ts
@@ -31,10 +31,8 @@ const getColumnsRoute = createRoute({
request: { params: projectIdParam },
responses: {
200: jsonResponse("List of columns ordered by position", columnListSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the project's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Project not found"),
},
});
@@ -59,11 +57,12 @@ const createColumnRoute = createRoute({
},
responses: {
200: jsonResponse("The created column", columnSchema),
- 400: errorResponse("Invalid body, or unknown project"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing project:update permission",
+ "No access to the project, or missing project:update permission",
),
409: errorResponse("The slug is reserved, or already used in this project"),
+ 404: errorResponse("Project not found"),
},
});
@@ -90,8 +89,9 @@ const reorderColumnsRoute = createRoute({
200: jsonResponse("The reordered columns", columnListSchema),
400: errorResponse("A column does not belong to this project"),
403: errorResponse(
- "No workspace access, or missing project:update permission",
+ "No access to the project, or missing project:update permission",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -116,10 +116,11 @@ const updateColumnRoute = createRoute({
},
responses: {
200: jsonResponse("The updated column", columnSchema),
- 400: errorResponse("Invalid body, or unknown column"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing project:update permission",
+ "No access to the project, or missing project:update permission",
),
+ 404: errorResponse("Column not found"),
},
});
@@ -138,13 +139,11 @@ const deleteColumnRoute = createRoute({
request: { params: columnParam },
responses: {
200: jsonResponse("The deleted column", columnSchema),
- 400: errorResponse(
- "Unknown column, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing project:update permission",
+ "No access to the project, or missing project:update permission",
),
409: errorResponse("The column still contains tasks"),
+ 404: errorResponse("Column not found"),
},
});
diff --git a/apps/api/src/comment/index.ts b/apps/api/src/comment/index.ts
index 1aa59f6b1..eac6a0208 100644
--- a/apps/api/src/comment/index.ts
+++ b/apps/api/src/comment/index.ts
@@ -35,10 +35,8 @@ const getTaskCommentsRoute = createRoute({
request: { params: taskIdParam },
responses: {
200: jsonResponse("List of comments for the task", commentListSchema),
- 400: errorResponse(
- "Unknown task, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the task's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Task not found"),
},
});
@@ -63,10 +61,11 @@ const createTaskCommentRoute = createRoute({
},
responses: {
200: jsonResponse("The created comment", activitySchema),
- 400: errorResponse("Invalid body, or unknown task"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, missing task:update permission, or external attribution without workspace:manage_settings",
+ "No access to the project, missing task:update permission, or external attribution without workspace:manage_settings",
),
+ 404: errorResponse("Task not found"),
},
});
@@ -90,7 +89,7 @@ const updateTaskCommentRoute = createRoute({
},
responses: {
200: jsonResponse("The updated comment", activitySchema),
- 400: errorResponse("Invalid body, or unknown comment"),
+ 400: errorResponse("Invalid body"),
403: errorResponse("Not the author, or missing task:update permission"),
404: errorResponse("Comment not found"),
},
@@ -110,9 +109,6 @@ const deleteTaskCommentRoute = createRoute({
request: { params: commentParam },
responses: {
200: jsonResponse("The deleted comment", activitySchema),
- 400: errorResponse(
- "Unknown comment, or its workspace could not be determined",
- ),
403: errorResponse("Not the author, or missing task:update permission"),
404: errorResponse("Comment not found"),
},
diff --git a/apps/api/src/custom-field/index.ts b/apps/api/src/custom-field/index.ts
index b255c4f7b..c1563da01 100644
--- a/apps/api/src/custom-field/index.ts
+++ b/apps/api/src/custom-field/index.ts
@@ -48,10 +48,8 @@ const getCustomFieldsRoute = createRoute({
"List of custom field definitions",
customFieldDefinitionListSchema,
),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No workspace access or missing read permission"),
+ 403: errorResponse("No access to the project, or missing read permission"),
+ 404: errorResponse("Project not found"),
},
});
@@ -72,10 +70,8 @@ const getCustomFieldValuesByProjectRoute = createRoute({
"List of custom field values for the project",
customFieldValueListSchema,
),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No workspace access or missing read permission"),
+ 403: errorResponse("No access to the project, or missing read permission"),
+ 404: errorResponse("Project not found"),
},
});
@@ -96,10 +92,10 @@ const getCustomFieldValuesByTaskRoute = createRoute({
"List of custom field values for the task",
customFieldValueListSchema,
),
- 400: errorResponse(
- "Unknown task, or its workspace could not be determined",
+ 403: errorResponse(
+ "No access to the project, or missing task:read permission",
),
- 403: errorResponse("No workspace access or missing task:read permission"),
+ 404: errorResponse("Task not found"),
},
});
@@ -121,10 +117,8 @@ const getCustomFieldFilterValuesRoute = createRoute({
"Distinct values used for each custom field",
customFieldFilterValuesListSchema,
),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No workspace access or missing read permission"),
+ 403: errorResponse("No access to the project, or missing read permission"),
+ 404: errorResponse("Project not found"),
},
});
@@ -147,10 +141,11 @@ const createCustomFieldRoute = createRoute({
},
responses: {
200: jsonResponse("The created custom field", customFieldDefinitionSchema),
- 400: errorResponse("Invalid body, or unknown project"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing project:update permission",
+ "No access to the project, or missing project:update permission",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -179,8 +174,9 @@ const reorderCustomFieldsRoute = createRoute({
),
400: errorResponse("A custom field does not belong to this project"),
403: errorResponse(
- "No workspace access, or missing project:update permission",
+ "No access to the project, or missing project:update permission",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -206,10 +202,11 @@ const setCustomFieldValueRoute = createRoute({
"The saved custom field value",
setCustomFieldValueResponseSchema,
),
- 400: errorResponse("Invalid body, unknown task, or unknown custom field"),
+ 400: errorResponse("Invalid body, or unknown custom field"),
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
+ 404: errorResponse("Task not found"),
},
});
@@ -227,12 +224,10 @@ const deleteCustomFieldRoute = createRoute({
request: { params: customFieldIdParam },
responses: {
200: jsonResponse("The deleted custom field", customFieldDefinitionSchema),
- 400: errorResponse(
- "Unknown custom field, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing project:update permission",
+ "No access to the project, or missing project:update permission",
),
+ 404: errorResponse("Custom field not found"),
},
});
diff --git a/apps/api/src/discord-integration/index.ts b/apps/api/src/discord-integration/index.ts
index 9b4a90368..b13a11401 100644
--- a/apps/api/src/discord-integration/index.ts
+++ b/apps/api/src/discord-integration/index.ts
@@ -99,10 +99,8 @@ const getDiscordIntegrationRoute = createRoute({
"Discord integration details, or null",
discordIntegrationSchema.nullable(),
),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the project's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Project not found"),
},
});
@@ -129,8 +127,9 @@ const createDiscordIntegrationRoute = createRoute({
),
400: errorResponse("The webhook URL failed validation"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -157,9 +156,9 @@ const updateDiscordIntegrationRoute = createRoute({
),
400: errorResponse("The resulting config failed validation"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: errorResponse("Discord integration not found"),
+ 404: errorResponse("Project or Discord integration not found"),
},
});
@@ -174,13 +173,10 @@ const deleteDiscordIntegrationRoute = createRoute({
request: { params: projectIdParam },
responses: {
200: jsonResponse("The integration was removed", deletedSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: errorResponse("Discord integration not found"),
+ 404: errorResponse("Project or Discord integration not found"),
},
});
diff --git a/apps/api/src/external-link/index.ts b/apps/api/src/external-link/index.ts
index 6e81b3ae9..41791f78f 100644
--- a/apps/api/src/external-link/index.ts
+++ b/apps/api/src/external-link/index.ts
@@ -53,6 +53,7 @@ const createExternalLinkRoute = createRoute({
400: errorResponse("Invalid external link data"),
401: errorResponse("Unauthorized"),
403: errorResponse("No permission to update the task"),
+ 404: errorResponse("Task not found"),
},
});
@@ -71,10 +72,10 @@ const deleteExternalLinkRoute = createRoute({
request: { params: deleteExternalLinkParam },
responses: {
200: jsonResponse("Resource link removed", deletedExternalLinkSchema),
- 400: errorResponse("Unknown task or invalid link data"),
+ 400: errorResponse("Invalid link data"),
401: errorResponse("Unauthorized"),
403: errorResponse("No permission to update the task"),
- 404: errorResponse("Manual resource link not found on this task"),
+ 404: errorResponse("Task or manual resource link not found"),
},
});
@@ -90,10 +91,8 @@ const getExternalLinksByTaskRoute = createRoute({
request: { params: taskIdParam },
responses: {
200: jsonResponse("External links for the task", externalLinkListSchema),
- 400: errorResponse(
- "Unknown task, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the task's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Task not found"),
},
});
diff --git a/apps/api/src/generic-webhook-integration/index.ts b/apps/api/src/generic-webhook-integration/index.ts
index e268bb5f8..3fb54340c 100644
--- a/apps/api/src/generic-webhook-integration/index.ts
+++ b/apps/api/src/generic-webhook-integration/index.ts
@@ -92,10 +92,8 @@ const getGenericWebhookIntegrationRoute = createRoute({
"Webhook integration details, or null",
genericWebhookIntegrationSchema.nullable(),
),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the project's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Project not found"),
},
});
@@ -122,8 +120,9 @@ const createGenericWebhookIntegrationRoute = createRoute({
),
400: errorResponse("The webhook URL failed validation"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -150,9 +149,9 @@ const updateGenericWebhookIntegrationRoute = createRoute({
),
400: errorResponse("The resulting config failed validation"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: errorResponse("Webhook integration not found"),
+ 404: errorResponse("Project or webhook integration not found"),
},
});
@@ -167,13 +166,10 @@ const deleteGenericWebhookIntegrationRoute = createRoute({
request: { params: projectIdParam },
responses: {
200: jsonResponse("The integration was removed", deletedSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: errorResponse("Webhook integration not found"),
+ 404: errorResponse("Project or webhook integration not found"),
},
});
diff --git a/apps/api/src/gitea-integration/index.ts b/apps/api/src/gitea-integration/index.ts
index cace23655..6261fbfa4 100644
--- a/apps/api/src/gitea-integration/index.ts
+++ b/apps/api/src/gitea-integration/index.ts
@@ -12,6 +12,7 @@ import {
createRoute,
errorResponse,
jsonResponse,
+ z,
} from "../openapi";
import { type GiteaConfig, validateGiteaConfig } from "../plugins/gitea/config";
import { handleGiteaWebhookRequest } from "../plugins/gitea/webhook-handler";
@@ -64,12 +65,11 @@ const listRepositoriesRoute = createRoute({
},
responses: {
200: jsonResponse("Accessible repositories", giteaRepositoryListSchema),
- 400: errorResponse(
- "Invalid body, unknown project, or invalid Gitea credentials",
- ),
+ 400: errorResponse("Invalid body, or invalid Gitea credentials"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -92,12 +92,11 @@ const verifyRoute = createRoute({
200: jsonResponse("Verification result", giteaVerificationResultSchema),
401: errorResponse("Kaneo authentication required"),
500: errorResponse("Gitea verification failed"),
- 400: errorResponse(
- "Invalid body, unknown project, or invalid Gitea credentials",
- ),
+ 400: errorResponse("Invalid body, or invalid Gitea credentials"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -116,10 +115,8 @@ const getIntegrationRoute = createRoute({
"Gitea integration details, or null",
giteaIntegrationSchema.nullable(),
),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the project's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Project not found"),
},
});
@@ -141,10 +138,11 @@ const createIntegrationRoute = createRoute({
},
responses: {
200: jsonResponse("The stored integration", giteaIntegrationSchema),
- 400: errorResponse("Invalid body, or unknown project"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -168,9 +166,15 @@ const updateIntegrationRoute = createRoute({
200: jsonResponse("The updated integration", giteaIntegrationSchema),
400: errorResponse("The resulting config failed validation"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: jsonResponse("Integration not found", integrationNotFoundSchema),
+ 404: {
+ description: "Project or integration not found",
+ content: {
+ "text/plain": { schema: z.string() },
+ "application/json": { schema: integrationNotFoundSchema },
+ },
+ },
409: errorResponse("Integration changed; refresh before updating settings"),
},
});
@@ -186,13 +190,10 @@ const deleteIntegrationRoute = createRoute({
request: { params: projectIdParam },
responses: {
200: jsonResponse("The integration was removed", giteaDeleteResultSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: errorResponse("Gitea integration not found"),
+ 404: errorResponse("Project or Gitea integration not found"),
},
});
@@ -218,7 +219,7 @@ const importIssuesRoute = createRoute({
200: jsonResponse("Import summary", giteaImportResultSchema),
400: errorResponse("projectId is required"),
403: errorResponse(
- "No workspace access, or missing task:create or task:update permission",
+ "No access to the project, or missing task:create or task:update permission",
),
404: errorResponse("Project not found"),
},
diff --git a/apps/api/src/github-integration/index.ts b/apps/api/src/github-integration/index.ts
index 182b4f759..cb7694255 100644
--- a/apps/api/src/github-integration/index.ts
+++ b/apps/api/src/github-integration/index.ts
@@ -12,6 +12,7 @@ import {
createRoute,
errorResponse,
jsonResponse,
+ z,
} from "../openapi";
import {
type GitHubConfig,
@@ -80,12 +81,10 @@ const listRepositoriesRoute = createRoute({
"Repositories reachable through the installed App",
githubRepositoryListSchema,
),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -110,10 +109,11 @@ const verifyRoute = createRoute({
},
responses: {
200: jsonResponse("Verification result", verificationResultSchema),
- 400: errorResponse("Invalid body, or unknown project"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -132,10 +132,8 @@ const getIntegrationRoute = createRoute({
"GitHub integration details, or null",
githubIntegrationSchema.nullable(),
),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the project's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Project not found"),
},
});
@@ -160,10 +158,11 @@ const createIntegrationRoute = createRoute({
409: errorResponse(
"Integration changed or another repository is already linked",
),
- 400: errorResponse("Invalid body, or unknown project"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -193,9 +192,15 @@ const updateIntegrationRoute = createRoute({
),
400: errorResponse("The resulting config failed validation"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: jsonResponse("Integration not found", integrationNotFoundSchema),
+ 404: {
+ description: "Project or integration not found",
+ content: {
+ "text/plain": { schema: z.string() },
+ "application/json": { schema: integrationNotFoundSchema },
+ },
+ },
},
});
@@ -210,13 +215,10 @@ const deleteIntegrationRoute = createRoute({
request: { params: projectIdParam },
responses: {
200: jsonResponse("The integration was removed", deleteResultSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: errorResponse("GitHub integration not found"),
+ 404: errorResponse("Project or GitHub integration not found"),
},
});
@@ -253,7 +255,7 @@ const importIssuesRoute = createRoute({
),
400: errorResponse("projectId is required"),
403: errorResponse(
- "No workspace access, or missing task:create or task:update permission",
+ "No access to the project, or missing task:create or task:update permission",
),
404: errorResponse("Project not found"),
},
diff --git a/apps/api/src/gitlab-integration/index.ts b/apps/api/src/gitlab-integration/index.ts
index 1b0e80b75..c1ceaa89b 100644
--- a/apps/api/src/gitlab-integration/index.ts
+++ b/apps/api/src/gitlab-integration/index.ts
@@ -12,6 +12,7 @@ import {
createRoute,
errorResponse,
jsonResponse,
+ z,
} from "../openapi";
import {
type GitlabConfig,
@@ -67,13 +68,14 @@ const listProjectsRoute = createRoute({
},
responses: {
200: jsonResponse("Accessible projects", gitlabProjectListSchema),
- 400: errorResponse("Invalid body, or unknown project"),
+ 400: errorResponse("Invalid body"),
401: errorResponse(
"GitLab rejected the token, or the instance is unreachable",
),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -94,11 +96,12 @@ const verifyRoute = createRoute({
},
responses: {
200: jsonResponse("Verification result", gitlabVerificationResultSchema),
- 400: errorResponse("Invalid body, or unknown project"),
+ 400: errorResponse("Invalid body"),
401: errorResponse("GitLab rejected the token"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -117,10 +120,8 @@ const getIntegrationRoute = createRoute({
"GitLab integration details, or null",
gitlabIntegrationSchema.nullable(),
),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the project's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Project not found"),
},
});
@@ -142,13 +143,14 @@ const createIntegrationRoute = createRoute({
},
responses: {
200: jsonResponse("The stored integration", gitlabIntegrationSchema),
- 400: errorResponse("Invalid body, or unknown project"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
409: errorResponse(
"That GitLab project is already linked to another Kaneo project",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -172,9 +174,15 @@ const updateIntegrationRoute = createRoute({
200: jsonResponse("The updated integration", gitlabIntegrationSchema),
400: errorResponse("The resulting config failed validation"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: jsonResponse("Integration not found", integrationNotFoundSchema),
+ 404: {
+ description: "Project or integration not found",
+ content: {
+ "text/plain": { schema: z.string() },
+ "application/json": { schema: integrationNotFoundSchema },
+ },
+ },
409: errorResponse("Integration changed; refresh before updating settings"),
},
});
@@ -190,13 +198,10 @@ const deleteIntegrationRoute = createRoute({
request: { params: projectIdParam },
responses: {
200: jsonResponse("The integration was removed", gitlabDeleteResultSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: errorResponse("GitLab integration not found"),
+ 404: errorResponse("Project or GitLab integration not found"),
},
});
@@ -222,7 +227,7 @@ const importIssuesRoute = createRoute({
200: jsonResponse("Import summary", gitlabImportResultSchema),
400: errorResponse("projectId is required"),
403: errorResponse(
- "No workspace access, or missing task:create or task:update permission",
+ "No access to the project, or missing task:create or task:update permission",
),
404: errorResponse("Project not found"),
},
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index f9d94f44f..a4cdf4075 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -443,7 +443,10 @@ export function createApp() {
content: { "*/*": { schema: { type: "string", format: "binary" } } },
},
304: { description: "Not modified" },
- 403: { description: "No access to this asset" },
+ 403: {
+ description:
+ "Staged upload owned by another user, or no access to the asset's project",
+ },
404: { description: "Asset not found" },
},
}),
@@ -841,10 +844,12 @@ export function createApp() {
.limit(1);
if (!project) {
- throw new HTTPException(401, { message: "Unauthorized" });
+ throw new HTTPException(404, { message: "Project not found" });
}
- await validateWorkspaceAccess(userId, project.workspaceId);
+ await validateWorkspaceAccess(userId, project.workspaceId, undefined, {
+ notFoundMessage: "Project not found",
+ });
await assertProjectAccess(userId, projectId);
workspaceId = project.workspaceId;
}
diff --git a/apps/api/src/integration-sync/index.ts b/apps/api/src/integration-sync/index.ts
index 616d8b8aa..df25ef14c 100644
--- a/apps/api/src/integration-sync/index.ts
+++ b/apps/api/src/integration-sync/index.ts
@@ -36,8 +36,10 @@ const manage = [
];
const errors = {
400: errorResponse("Invalid rule or workspace label"),
- 403: errorResponse("No workspace access or required permission"),
- 404: errorResponse("Integration or linked task not found"),
+ 403: errorResponse(
+ "No access to the project, or missing required permission",
+ ),
+ 404: errorResponse("Project, integration, or linked task not found"),
409: errorResponse(
"Configuration, impact or comparison changed; review again",
),
diff --git a/apps/api/src/integrations/middleware.ts b/apps/api/src/integrations/middleware.ts
index 5cc51ff5e..00883c987 100644
--- a/apps/api/src/integrations/middleware.ts
+++ b/apps/api/src/integrations/middleware.ts
@@ -35,6 +35,7 @@ export async function scopeToProjectFromBody(c: Context, next: Next) {
userId,
project.workspaceId,
c.get("apiKey")?.id,
+ { notFoundMessage: "Project not found" },
);
await assertProjectAccess(userId, projectId);
c.set("workspaceId", project.workspaceId);
diff --git a/apps/api/src/label/index.ts b/apps/api/src/label/index.ts
index fc1c7cc92..4a7bf175a 100644
--- a/apps/api/src/label/index.ts
+++ b/apps/api/src/label/index.ts
@@ -39,10 +39,8 @@ const getTaskLabelsRoute = createRoute({
request: { params: taskIdParam },
responses: {
200: jsonResponse("List of labels for the task", labelListSchema),
- 400: errorResponse(
- "Unknown task, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the task's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Task not found"),
},
});
@@ -57,8 +55,7 @@ const getWorkspaceLabelsRoute = createRoute({
request: { params: workspaceIdParam },
responses: {
200: jsonResponse("List of labels in the workspace", labelListSchema),
- 400: errorResponse("Workspace ID could not be determined"),
- 403: errorResponse("No access to the workspace"),
+ 404: errorResponse("Workspace not found"),
},
});
@@ -82,10 +79,8 @@ const createLabelRoute = createRoute({
responses: {
200: jsonResponse("Label created successfully", labelSchema),
400: errorResponse("Invalid body, or workspace ID could not be determined"),
- 403: errorResponse(
- "No workspace access, or missing label:create permission",
- ),
- 404: errorResponse("Task not found"),
+ 403: errorResponse("Missing label:create permission"),
+ 404: errorResponse("Workspace or task not found"),
409: errorResponse("The workspace label is being deleted"),
},
});
@@ -101,10 +96,8 @@ const getLabelRoute = createRoute({
request: { params: labelParam },
responses: {
200: jsonResponse("Label details", labelSchema),
- 400: errorResponse(
- "Unknown label, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the label's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Label not found"),
},
});
@@ -128,13 +121,11 @@ const attachLabelToTaskRoute = createRoute({
},
responses: {
200: jsonResponse("Label attached to task successfully", labelSchema),
- 400: errorResponse(
- "Unknown label, or label and task belong to different workspaces",
- ),
+ 400: errorResponse("Label and task belong to different workspaces"),
403: errorResponse(
- "No workspace access, or missing label:update permission",
+ "No access to the project, or missing label:update permission",
),
- 404: errorResponse("Task not found"),
+ 404: errorResponse("Label or task not found"),
409: errorResponse("The workspace label is being deleted"),
},
});
@@ -153,11 +144,11 @@ const detachLabelFromTaskRoute = createRoute({
request: { params: labelParam },
responses: {
200: jsonResponse("Label detached from task successfully", labelSchema),
- 400: errorResponse("Unknown label, or label is not assigned to a task"),
+ 400: errorResponse("Label is not assigned to a task"),
403: errorResponse(
- "No workspace access, or missing label:update permission",
+ "No access to the project, or missing label:update permission",
),
- 404: errorResponse("Task not found"),
+ 404: errorResponse("Label or task not found"),
},
});
@@ -182,10 +173,11 @@ const updateLabelRoute = createRoute({
responses: {
200: jsonResponse("Label updated successfully", labelSchema),
409: errorResponse("The workspace label is being deleted"),
- 400: errorResponse("Invalid body, or unknown label"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing label:update permission",
+ "No access to the project, or missing label:update permission",
),
+ 404: errorResponse("Label not found"),
},
});
@@ -209,13 +201,10 @@ const deleteLabelRoute = createRoute({
pendingLabelDeletionSchema,
),
429: errorResponse("Deletion capacity is busy; retry after Retry-After"),
- 400: errorResponse(
- "Unknown label, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing label:delete permission",
+ "No access to the project, or missing label:delete permission",
),
- 404: errorResponse("The label's task no longer exists"),
+ 404: errorResponse("Label not found, or the label's task no longer exists"),
},
});
diff --git a/apps/api/src/mattermost-integration/index.ts b/apps/api/src/mattermost-integration/index.ts
index e7f346fc9..11bed4ba5 100644
--- a/apps/api/src/mattermost-integration/index.ts
+++ b/apps/api/src/mattermost-integration/index.ts
@@ -97,10 +97,8 @@ const getMattermostIntegrationRoute = createRoute({
"Mattermost integration details, or null",
mattermostIntegrationSchema.nullable(),
),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the project's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Project not found"),
},
});
@@ -127,8 +125,9 @@ const createMattermostIntegrationRoute = createRoute({
),
400: errorResponse("The webhook URL failed validation"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -155,9 +154,9 @@ const updateMattermostIntegrationRoute = createRoute({
),
400: errorResponse("The resulting config failed validation"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: errorResponse("Mattermost integration not found"),
+ 404: errorResponse("Project or Mattermost integration not found"),
},
});
@@ -172,13 +171,10 @@ const deleteMattermostIntegrationRoute = createRoute({
request: { params: projectIdParam },
responses: {
200: jsonResponse("The integration was removed", deletedSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: errorResponse("Mattermost integration not found"),
+ 404: errorResponse("Project or Mattermost integration not found"),
},
});
diff --git a/apps/api/src/project/index.ts b/apps/api/src/project/index.ts
index bc215a290..66f28be24 100644
--- a/apps/api/src/project/index.ts
+++ b/apps/api/src/project/index.ts
@@ -81,8 +81,10 @@ const moveProjectRoute = createRoute({
400: errorResponse("Invalid destination or same workspace"),
401: errorResponse("Unauthorized"),
402: errorResponse("Destination workspace plan has expired"),
- 403: errorResponse("Missing workspace access or permission"),
- 404: errorResponse("Project not found in the source workspace"),
+ 403: errorResponse(
+ "No access to the project, or missing permission in the source or destination workspace",
+ ),
+ 404: errorResponse("Project or destination workspace not found"),
409: errorResponse(
"Project key conflict or cross-project task relationships",
),
@@ -102,7 +104,7 @@ const listProjectsRoute = createRoute({
responses: {
200: jsonResponse("List of projects", projectListSchema),
400: errorResponse("Workspace ID could not be determined"),
- 403: errorResponse("No access to the workspace"),
+ 404: errorResponse("Workspace not found"),
},
});
@@ -128,10 +130,9 @@ const createProjectRoute = createRoute({
responses: {
200: jsonResponse("The created project", projectSchema),
400: errorResponse("Invalid body, or workspace ID could not be determined"),
- 403: errorResponse(
- "No workspace access, or missing project:create permission",
- ),
+ 403: errorResponse("Missing project:create permission"),
409: errorResponse("Another project in the workspace uses this key"),
+ 404: errorResponse("Workspace not found"),
},
});
@@ -146,10 +147,8 @@ const getProjectRoute = createRoute({
request: { params: projectParam },
responses: {
200: jsonResponse("Project details", projectSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the project's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Project not found"),
},
});
@@ -178,8 +177,9 @@ const reorderProjectsRoute = createRoute({
200: jsonResponse("The reordered projects", z.array(projectSchema)),
400: errorResponse("Invalid body, or workspace ID could not be determined"),
403: errorResponse(
- "No workspace access, missing project:update permission, or no access to a listed project",
+ "Missing project:update permission, or no access to a listed project",
),
+ 404: errorResponse("Workspace not found"),
},
});
@@ -204,11 +204,12 @@ const updateProjectRoute = createRoute({
},
responses: {
200: jsonResponse("The updated project", projectSchema),
- 400: errorResponse("Invalid body, or unknown project"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, missing project:update, or missing project:share when visibility changes",
+ "No access to the project, missing project:update, or missing project:share when visibility changes",
),
409: errorResponse("Another project in the workspace uses the new key"),
+ 404: errorResponse("Project not found"),
},
});
@@ -227,12 +228,10 @@ const deleteProjectRoute = createRoute({
request: { params: projectParam },
responses: {
200: jsonResponse("The deleted project", projectSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing project:delete permission",
+ "No access to the project, or missing project:delete permission",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -251,12 +250,10 @@ const archiveProjectRoute = createRoute({
request: { params: projectParam },
responses: {
200: jsonResponse("The archived project", projectSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing project:update permission",
+ "No access to the project, or missing project:update permission",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -274,13 +271,11 @@ const unarchiveProjectRoute = createRoute({
request: { params: projectParam },
responses: {
200: jsonResponse("The restored project", projectSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing project:update permission",
+ "No access to the project, or missing project:update permission",
),
409: errorResponse("Another project in the workspace uses this key"),
+ 404: errorResponse("Project not found"),
},
});
@@ -301,11 +296,8 @@ const getProjectBackgroundRoute = createRoute({
},
},
304: { description: "Not modified" },
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the project's workspace"),
- 404: errorResponse("Project background not found"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Project or project background not found"),
},
});
@@ -335,9 +327,9 @@ const uploadProjectBackgroundRoute = createRoute({
"Background image upload URL",
projectBackgroundUploadSchema,
),
- 400: errorResponse("Invalid image upload request, or unknown project"),
+ 400: errorResponse("Invalid image upload request"),
403: errorResponse(
- "No workspace access, or missing project:update permission",
+ "No access to the project, or missing project:update permission",
),
404: errorResponse("Project not found"),
503: errorResponse("Image uploads are not configured"),
@@ -370,9 +362,9 @@ const finalizeProjectBackgroundRoute = createRoute({
"Finalized project background",
projectBackgroundFinalizeSchema,
),
- 400: errorResponse("Invalid image upload request, or unknown project"),
+ 400: errorResponse("Invalid image upload request"),
403: errorResponse(
- "No workspace access, or missing project:update permission",
+ "No access to the project, or missing project:update permission",
),
404: errorResponse("Project not found"),
500: errorResponse("Failed to save the project background"),
@@ -393,12 +385,10 @@ const deleteProjectBackgroundRoute = createRoute({
request: { params: projectParam },
responses: {
204: { description: "Project background removed" },
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing project:update permission",
+ "No access to the project, or missing project:update permission",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -412,6 +402,7 @@ const project = apiRouter<BaseVariables & { workspaceId: string }>()
userId,
targetWorkspaceId,
c.get("apiKey")?.id,
+ { notFoundMessage: "Destination workspace not found" },
);
if (
!(await hasWorkspacePermission(
diff --git a/apps/api/src/search/index.ts b/apps/api/src/search/index.ts
index e6893e575..33323bcac 100644
--- a/apps/api/src/search/index.ts
+++ b/apps/api/src/search/index.ts
@@ -24,7 +24,7 @@ const globalSearchRoute = createRoute({
400: errorResponse(
"Invalid query, or workspace ID could not be determined",
),
- 403: errorResponse("No access to the workspace"),
+ 404: errorResponse("Workspace not found"),
},
});
diff --git a/apps/api/src/slack-integration/index.ts b/apps/api/src/slack-integration/index.ts
index 4619f6161..979b60762 100644
--- a/apps/api/src/slack-integration/index.ts
+++ b/apps/api/src/slack-integration/index.ts
@@ -97,10 +97,8 @@ const getSlackIntegrationRoute = createRoute({
"Slack integration details, or null",
slackIntegrationSchema.nullable(),
),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the project's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Project not found"),
},
});
@@ -127,8 +125,9 @@ const createSlackIntegrationRoute = createRoute({
),
400: errorResponse("The webhook URL failed validation"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -155,9 +154,9 @@ const updateSlackIntegrationRoute = createRoute({
),
400: errorResponse("The resulting config failed validation"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: errorResponse("Slack integration not found"),
+ 404: errorResponse("Project or Slack integration not found"),
},
});
@@ -172,13 +171,10 @@ const deleteSlackIntegrationRoute = createRoute({
request: { params: projectIdParam },
responses: {
200: jsonResponse("The integration was removed", deletedSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: errorResponse("Slack integration not found"),
+ 404: errorResponse("Project or Slack integration not found"),
},
});
diff --git a/apps/api/src/task-relation/index.ts b/apps/api/src/task-relation/index.ts
index 9b665e84f..4d5e4c0ab 100644
--- a/apps/api/src/task-relation/index.ts
+++ b/apps/api/src/task-relation/index.ts
@@ -67,7 +67,9 @@ async function scopeToSourceTask(c: Context, next: Next) {
throw new HTTPException(404, { message: "Source task not found" });
}
- await validateWorkspaceAccess(userId, scope.workspaceId);
+ await validateWorkspaceAccess(userId, scope.workspaceId, undefined, {
+ notFoundMessage: "Source task not found",
+ });
await assertProjectAccess(userId, scope.projectId);
c.set("workspaceId", scope.workspaceId);
return next();
@@ -91,7 +93,9 @@ async function scopeToRelation(c: Context, next: Next) {
throw new HTTPException(404, { message: "Task not found" });
}
- await validateWorkspaceAccess(userId, scope.workspaceId);
+ await validateWorkspaceAccess(userId, scope.workspaceId, undefined, {
+ notFoundMessage: "Task relation not found",
+ });
await assertProjectAccess(userId, scope.projectId);
c.set("workspaceId", scope.workspaceId);
return next();
@@ -112,10 +116,8 @@ const getTaskRelationsRoute = createRoute({
"Task relations with the linked task summaries",
taskRelationWithTasksListSchema,
),
- 400: errorResponse(
- "Unknown task, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the task's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Task not found"),
},
});
@@ -141,7 +143,7 @@ const createTaskRelationRoute = createRoute({
200: jsonResponse("The created relation", taskRelationSchema),
400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
404: errorResponse("Source or target task not found"),
409: errorResponse("This relation already exists"),
@@ -163,7 +165,7 @@ const deleteTaskRelationRoute = createRoute({
responses: {
200: jsonResponse("The deleted relation", taskRelationSchema),
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
404: errorResponse("Task relation not found, or its source task is gone"),
},
diff --git a/apps/api/src/task/index.ts b/apps/api/src/task/index.ts
index 1835b2034..df97c14e3 100644
--- a/apps/api/src/task/index.ts
+++ b/apps/api/src/task/index.ts
@@ -126,9 +126,8 @@ const listAssignedTasksRoute = createRoute({
responses: {
200: jsonResponse("Open tasks assigned to the caller", assignedTasksSchema),
400: errorResponse("Invalid workspace ID or query parameters"),
- 403: errorResponse(
- "No workspace access, or missing project:read or task:read permission",
- ),
+ 403: errorResponse("Missing project:read or task:read permission"),
+ 404: errorResponse("Workspace not found"),
},
});
@@ -145,10 +144,8 @@ const listTasksRoute = createRoute({
responses: {
200: jsonResponse("The project board", boardSchema),
503: errorResponse("Task list request timed out"),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the project's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Project not found"),
},
});
@@ -177,7 +174,7 @@ const bulkUpdateTasksRoute = createRoute({
"Invalid body, or the tasks span more than one workspace",
),
403: errorResponse(
- "No workspace access, or missing the permission the operation needs",
+ "No access to the project, or missing the permission the operation needs",
),
404: errorResponse("No tasks found"),
409: errorResponse("Tasks changed projects; retry the operation"),
@@ -270,7 +267,9 @@ const reorderTasksRoute = createRoute({
),
400: errorResponse("Invalid positions or column"),
403: errorResponse("Missing task:update permission"),
- 404: errorResponse("Tasks do not belong to the project"),
+ 404: errorResponse(
+ "Project not found, or tasks do not belong to the project",
+ ),
409: errorResponse(
"Board changed or task moved; refresh before reordering",
),
@@ -298,10 +297,11 @@ const createTaskRoute = createRoute({
},
responses: {
200: jsonResponse("The created task", taskSchema),
- 400: errorResponse("Invalid body, or unknown project"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing task:create permission",
+ "No access to the project, or missing task:create permission",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -330,7 +330,7 @@ const duplicateTaskRoute = createRoute({
400: errorResponse("Invalid task fields or request"),
401: errorResponse("Unauthorized"),
403: errorResponse(
- "No workspace access, missing task:create, or missing task:update when copying parent links",
+ "No access to the project, missing task:create, or missing task:update when copying parent links",
),
404: errorResponse("Task or project not found"),
409: errorResponse("Task column has reached its capacity"),
@@ -353,10 +353,8 @@ const getTaskRoute = createRoute({
},
responses: {
200: jsonResponse("Task details", taskWithAssigneeSchema),
- 400: errorResponse(
- "Unknown task, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the task's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Task not found"),
},
});
@@ -402,9 +400,9 @@ const moveTaskRoute = createRoute({
"The moved task, with both project ids",
moveTaskResultSchema,
),
- 400: errorResponse("Invalid body, or unknown task"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
404: errorResponse("Task or destination project not found"),
409: errorResponse("Task or project moved concurrently; retry the move"),
@@ -434,10 +432,11 @@ const updateTaskRoute = createRoute({
},
responses: {
200: jsonResponse("The updated task", taskSchema),
- 400: errorResponse("Invalid body, or unknown task"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing task:update or task:assign permission",
+ "No access to the project, or missing task:update or task:assign permission",
),
+ 404: errorResponse("Task not found"),
},
});
@@ -453,10 +452,8 @@ const exportTasksRoute = createRoute({
request: { params: projectIdParam },
responses: {
200: jsonResponse("The exported project and tasks", taskExportSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the project's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Project not found"),
},
});
@@ -482,10 +479,11 @@ const importTasksRoute = createRoute({
},
responses: {
200: jsonResponse("Per-task import outcome", taskImportResultSchema),
- 400: errorResponse("Invalid body, or unknown project"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing task:create permission",
+ "No access to the project, or missing task:create permission",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -504,13 +502,11 @@ const deleteTaskRoute = createRoute({
request: { params: taskParam },
responses: {
200: jsonResponse("The deleted task", taskSchema),
- 400: errorResponse(
- "Unknown task, or its workspace could not be determined",
- ),
409: errorResponse("Task changed projects; retry the operation"),
403: errorResponse(
- "No workspace access, or missing task:delete permission",
+ "No access to the project, or missing task:delete permission",
),
+ 404: errorResponse("Task not found"),
},
});
@@ -535,10 +531,11 @@ const updateTaskStatusRoute = createRoute({
},
responses: {
200: jsonResponse("The updated task", taskSchema),
- 400: errorResponse("Invalid body, or unknown task"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
+ 404: errorResponse("Task not found"),
},
});
@@ -563,10 +560,11 @@ const updateTaskPriorityRoute = createRoute({
},
responses: {
200: jsonResponse("The updated task", taskSchema),
- 400: errorResponse("Invalid priority, or unknown task"),
+ 400: errorResponse("Invalid priority"),
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
+ 404: errorResponse("Task not found"),
},
});
@@ -592,11 +590,13 @@ const updateTaskAssigneeRoute = createRoute({
},
responses: {
200: jsonResponse("The updated task", taskSchema),
- 400: errorResponse("Invalid body, or unknown task"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing task:assign permission",
+ "No access to the project, or missing task:assign permission",
+ ),
+ 404: errorResponse(
+ "Task not found, or assignee is not a member of the workspace",
),
- 404: errorResponse("Assignee is not a member of the workspace"),
},
});
@@ -621,10 +621,11 @@ const updateTaskDueDateRoute = createRoute({
},
responses: {
200: jsonResponse("The updated task", taskSchema),
- 400: errorResponse("Invalid date, or unknown task"),
+ 400: errorResponse("Invalid date"),
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
+ 404: errorResponse("Task not found"),
},
});
@@ -649,10 +650,11 @@ const updateTaskTitleRoute = createRoute({
},
responses: {
200: jsonResponse("The updated task", taskSchema),
- 400: errorResponse("Invalid body, or unknown task"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
+ 404: errorResponse("Task not found"),
},
});
@@ -680,7 +682,7 @@ const createTaskImageUploadRoute = createRoute({
200: jsonResponse("The presigned upload", imageUploadSchema),
400: errorResponse("Unsupported content type, or the file is too large"),
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
404: errorResponse("Task not found"),
503: errorResponse("Image uploads are not configured on this instance"),
@@ -713,7 +715,7 @@ const finalizeTaskImageUploadRoute = createRoute({
"Invalid upload, or the key does not belong to this task",
),
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
404: errorResponse("Task not found"),
},
@@ -740,10 +742,11 @@ const updateTaskDescriptionRoute = createRoute({
},
responses: {
200: jsonResponse("The updated task", taskSchema),
- 400: errorResponse("Invalid body, or unknown task"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
+ 404: errorResponse("Task not found"),
},
});
@@ -758,7 +761,7 @@ const descriptionPageRoute = createRoute({
responses: {
200: jsonResponse("Description page", descriptionPageSchema),
400: errorResponse("Invalid offset or version"),
- 403: errorResponse("No workspace access"),
+ 403: errorResponse("No access to the project"),
404: errorResponse("Task not found"),
409: errorResponse("Description changed; reload from offset zero"),
503: errorResponse("Description request timed out"),
@@ -775,8 +778,9 @@ const descriptionMatchesRoute = createRoute({
responses: {
200: jsonResponse("Matching task IDs", descriptionMatchesSchema),
400: errorResponse("Invalid search query or cursor"),
- 403: errorResponse("No workspace access"),
+ 403: errorResponse("No access to the project"),
503: errorResponse("Description search timed out"),
+ 404: errorResponse("Project not found"),
},
});
diff --git a/apps/api/src/telegram-integration/index.ts b/apps/api/src/telegram-integration/index.ts
index e9b9b9136..c1b5df7fd 100644
--- a/apps/api/src/telegram-integration/index.ts
+++ b/apps/api/src/telegram-integration/index.ts
@@ -65,10 +65,8 @@ const getTelegramIntegrationRoute = createRoute({
"Telegram integration details, or null",
telegramIntegrationSchema.nullable(),
),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the project's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Project not found"),
},
});
@@ -95,8 +93,9 @@ const createTelegramIntegrationRoute = createRoute({
),
400: errorResponse("The bot token or chat failed validation"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -123,9 +122,9 @@ const updateTelegramIntegrationRoute = createRoute({
),
400: errorResponse("The resulting config failed validation"),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: errorResponse("Telegram integration not found"),
+ 404: errorResponse("Project or Telegram integration not found"),
},
});
@@ -140,13 +139,10 @@ const deleteTelegramIntegrationRoute = createRoute({
request: { params: projectIdParam },
responses: {
200: jsonResponse("The integration was removed", deletedSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing workspace:manage_settings",
+ "No access to the project, or missing workspace:manage_settings",
),
- 404: errorResponse("Telegram integration not found"),
+ 404: errorResponse("Project or Telegram integration not found"),
},
});
diff --git a/apps/api/src/time-entry/index.ts b/apps/api/src/time-entry/index.ts
index cc1cf4d47..46c45cdc9 100644
--- a/apps/api/src/time-entry/index.ts
+++ b/apps/api/src/time-entry/index.ts
@@ -29,10 +29,8 @@ const getTaskTimeEntriesRoute = createRoute({
request: { params: taskIdParam },
responses: {
200: jsonResponse("List of time entries for the task", timeEntryListSchema),
- 400: errorResponse(
- "Unknown task, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the task's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Task not found"),
},
});
@@ -47,10 +45,8 @@ const getTimeEntryRoute = createRoute({
request: { params: timeEntryParam },
responses: {
200: jsonResponse("Time entry details", timeEntrySchema),
- 400: errorResponse(
- "Unknown entry, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the entry's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Time entry not found"),
},
});
@@ -74,10 +70,11 @@ const createTimeEntryRoute = createRoute({
},
responses: {
200: jsonResponse("The created time entry", timeEntrySchema),
- 400: errorResponse("Invalid timestamps, or unknown task"),
+ 400: errorResponse("Invalid body or timestamps"),
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
+ 404: errorResponse("Task not found"),
},
});
@@ -102,10 +99,11 @@ const updateTimeEntryRoute = createRoute({
},
responses: {
200: jsonResponse("The updated time entry", timeEntrySchema),
- 400: errorResponse("Invalid timestamps, or unknown entry"),
+ 400: errorResponse("Invalid timestamps"),
403: errorResponse(
- "No workspace access, or missing task:update permission",
+ "No access to the project, or missing task:update permission",
),
+ 404: errorResponse("Time entry not found"),
},
});
diff --git a/apps/api/src/utils/authorize-asset-access.ts b/apps/api/src/utils/authorize-asset-access.ts
index 7fcbc79f8..84f5f2306 100644
--- a/apps/api/src/utils/authorize-asset-access.ts
+++ b/apps/api/src/utils/authorize-asset-access.ts
@@ -26,10 +26,12 @@ export async function authorizeAssetAccess(
}
const { userId, apiKeyId } = await resolveAssetBearerOrCookie(c);
+ await validateWorkspaceAccess(userId, asset.workspaceId, apiKeyId, {
+ notFoundMessage: "Asset not found",
+ });
if (asset.surface.startsWith("draft") && asset.createdBy !== userId)
throw new HTTPException(403, {
message: "Staged uploads are private to their owner",
});
- await validateWorkspaceAccess(userId, asset.workspaceId, apiKeyId);
await assertProjectAccess(userId, asset.projectId);
}
diff --git a/apps/api/src/utils/validate-workspace-access.ts b/apps/api/src/utils/validate-workspace-access.ts
index 9300f53be..1b6f37c47 100644
--- a/apps/api/src/utils/validate-workspace-access.ts
+++ b/apps/api/src/utils/validate-workspace-access.ts
@@ -3,10 +3,15 @@ import { HTTPException } from "hono/http-exception";
import db, { schema } from "../database";
import { hasInstanceAdminRole } from "./instance-admin-role";
+type ValidateWorkspaceAccessOptions = {
+ notFoundMessage?: string;
+};
+
export async function validateWorkspaceAccess(
userId: string,
workspaceId: string,
apiKeyId?: string,
+ options: ValidateWorkspaceAccessOptions = {},
): Promise<void> {
if (apiKeyId) {
const apiKey = await db
@@ -31,6 +36,11 @@ export async function validateWorkspaceAccess(
}
}
+ const notFound = () =>
+ new HTTPException(404, {
+ message: options.notFoundMessage ?? "Workspace not found",
+ });
+
const [user] = await db
.select({ role: schema.userTable.role })
.from(schema.userTable)
@@ -38,6 +48,15 @@ export async function validateWorkspaceAccess(
.limit(1);
if (hasInstanceAdminRole(user?.role)) {
+ const [workspace] = await db
+ .select({ id: schema.workspaceTable.id })
+ .from(schema.workspaceTable)
+ .where(eq(schema.workspaceTable.id, workspaceId))
+ .limit(1);
+
+ if (!workspace) {
+ throw notFound();
+ }
return;
}
@@ -53,8 +72,6 @@ export async function validateWorkspaceAccess(
.limit(1);
if (membership.length === 0) {
- throw new HTTPException(403, {
- message: "You don't have access to this workspace",
- });
+ throw notFound();
}
}
diff --git a/apps/api/src/utils/workspace-access-middleware.ts b/apps/api/src/utils/workspace-access-middleware.ts
index 39e21a956..e6367429e 100644
--- a/apps/api/src/utils/workspace-access-middleware.ts
+++ b/apps/api/src/utils/workspace-access-middleware.ts
@@ -5,22 +5,24 @@ import db, { schema } from "../database";
import { assertProjectAccess } from "../project-access/assert-project-access";
import { validateWorkspaceAccess } from "./validate-workspace-access";
+type LookupResource =
+ | "project"
+ | "task"
+ | "label"
+ | "timeEntry"
+ | "activity"
+ | "comment"
+ | "column"
+ | "workflowRule"
+ | "customField";
+
type WorkspaceIdSource =
| { type: "query"; key: string }
| { type: "body"; key: string }
| { type: "param"; key: string }
| {
type: "lookup";
- resource:
- | "project"
- | "task"
- | "label"
- | "timeEntry"
- | "activity"
- | "comment"
- | "column"
- | "workflowRule"
- | "customField";
+ resource: LookupResource;
idKey: string;
}
| {
@@ -29,6 +31,21 @@ type WorkspaceIdSource =
idKey: string;
};
+const WORKSPACE_NOT_FOUND = "Workspace not found";
+const TASKS_NOT_FOUND = "No tasks found";
+
+const RESOURCE_NOT_FOUND: Record<LookupResource, string> = {
+ project: "Project not found",
+ task: "Task not found",
+ label: "Label not found",
+ timeEntry: "Time entry not found",
+ activity: "Activity not found",
+ comment: "Comment not found",
+ column: "Column not found",
+ workflowRule: "Workflow rule not found",
+ customField: "Custom field not found",
+};
+
type WorkspaceAccessMiddlewareConfig = {
sources: WorkspaceIdSource[];
};
@@ -57,6 +74,7 @@ export function workspaceAccessMiddleware(
let workspaceId: string | null = null;
let projectIds: string[] = [];
+ let notFoundMessage = WORKSPACE_NOT_FOUND;
for (const source of config.sources) {
if (source.type === "query") {
@@ -77,9 +95,13 @@ export function workspaceAccessMiddleware(
// handler acted on another (`{"taskId": "<someone else's>"}`).
const id = c.req.param(source.idKey) || idFromBody;
if (id) {
+ notFoundMessage = RESOURCE_NOT_FOUND[source.resource];
const scope = await lookupScope(source.resource, id);
- workspaceId = scope?.workspaceId ?? null;
- projectIds = scope?.projectId ? [scope.projectId] : [];
+ if (!scope) {
+ throw new HTTPException(404, { message: notFoundMessage });
+ }
+ workspaceId = scope.workspaceId;
+ projectIds = scope.projectId ? [scope.projectId] : [];
}
} else if (source.type === "lookupMany") {
const body = await readJsonObjectBody(c);
@@ -89,6 +111,7 @@ export function workspaceAccessMiddleware(
(id): id is string => typeof id === "string",
);
if (taskIds.length > 0) {
+ notFoundMessage = TASKS_NOT_FOUND;
const tasks = await db
.select({
workspaceId: schema.projectTable.workspaceId,
@@ -104,7 +127,7 @@ export function workspaceAccessMiddleware(
...new Set(tasks.map((task) => task.workspaceId)),
];
if (workspaceIds.length === 0) {
- throw new HTTPException(404, { message: "No tasks found" });
+ throw new HTTPException(404, { message: notFoundMessage });
}
if (workspaceIds.length > 1) {
throw new HTTPException(400, {
@@ -131,7 +154,9 @@ export function workspaceAccessMiddleware(
const apiKey = c.get("apiKey");
const apiKeyId = apiKey?.id;
- await validateWorkspaceAccess(userId, workspaceId, apiKeyId);
+ await validateWorkspaceAccess(userId, workspaceId, apiKeyId, {
+ notFoundMessage,
+ });
await assertProjectAccess(userId, projectIds);
c.set("workspaceId", workspaceId);
@@ -141,16 +166,7 @@ export function workspaceAccessMiddleware(
}
async function lookupScope(
- resource:
- | "project"
- | "task"
- | "label"
- | "timeEntry"
- | "activity"
- | "comment"
- | "column"
- | "workflowRule"
- | "customField",
+ resource: LookupResource,
id: string,
): Promise<ResourceScope | null> {
switch (resource) {
diff --git a/apps/api/src/workflow-rule/index.ts b/apps/api/src/workflow-rule/index.ts
index d742fdbaa..a9a9d2c82 100644
--- a/apps/api/src/workflow-rule/index.ts
+++ b/apps/api/src/workflow-rule/index.ts
@@ -28,10 +28,8 @@ const getWorkflowRulesRoute = createRoute({
request: { params: projectIdParam },
responses: {
200: jsonResponse("List of workflow rules", workflowRuleListSchema),
- 400: errorResponse(
- "Unknown project, or its workspace could not be determined",
- ),
- 403: errorResponse("No access to the project's workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse("Project not found"),
},
});
@@ -56,10 +54,11 @@ const upsertWorkflowRuleRoute = createRoute({
},
responses: {
200: jsonResponse("The created or updated rule", workflowRuleRowSchema),
- 400: errorResponse("Invalid body, or unknown project"),
+ 400: errorResponse("Invalid body"),
403: errorResponse(
- "No workspace access, or missing project:update permission",
+ "No access to the project, or missing project:update permission",
),
+ 404: errorResponse("Project not found"),
},
});
@@ -77,12 +76,10 @@ const deleteWorkflowRuleRoute = createRoute({
request: { params: workflowRuleParam },
responses: {
200: jsonResponse("The deleted rule", workflowRuleRowSchema),
- 400: errorResponse(
- "Unknown rule, or its workspace could not be determined",
- ),
403: errorResponse(
- "No workspace access, or missing project:update permission",
+ "No access to the project, or missing project:update permission",
),
+ 404: errorResponse("Workflow rule not found"),
},
});
diff --git a/apps/api/src/workspace/index.ts b/apps/api/src/workspace/index.ts
index 185974b7f..48cb2270d 100644
--- a/apps/api/src/workspace/index.ts
+++ b/apps/api/src/workspace/index.ts
@@ -35,9 +35,10 @@ const getWorkspaceMembersRoute = createRoute({
request: { params: workspaceIdParam, query: workspaceMembersQuery },
responses: {
200: jsonResponse("List of workspace members", workspaceMemberListSchema),
- 400: errorResponse("Workspace ID could not be determined"),
- 403: errorResponse("No access to the workspace or to the project"),
- 404: errorResponse("Project not found in this workspace"),
+ 403: errorResponse("No access to the project"),
+ 404: errorResponse(
+ "Workspace not found, or project not found in this workspace",
+ ),
},
});
@@ -59,10 +60,8 @@ const getWorkspaceProjectAccessRoute = createRoute({
"Members limited to selected projects",
memberProjectAccessListSchema,
),
- 400: errorResponse("Workspace ID could not be determined"),
- 403: errorResponse(
- "No workspace access, or missing member:update permission",
- ),
+ 403: errorResponse("Missing member:update permission"),
+ 404: errorResponse("Workspace not found"),
},
});
@@ -78,8 +77,7 @@ const getMyProjectAccessRoute = createRoute({
request: { params: workspaceIdParam },
responses: {
200: jsonResponse("The caller's project access", memberProjectAccessSchema),
- 400: errorResponse("Workspace ID could not be determined"),
- 403: errorResponse("No access to the workspace"),
+ 404: errorResponse("Workspace not found"),
},
});
@@ -112,7 +110,7 @@ const updateMemberProjectAccessRoute = createRoute({
403: errorResponse(
"Missing member:update permission, changing your own access, or granting a project you can't access",
),
- 404: errorResponse("Member not found"),
+ 404: errorResponse("Workspace or member not found"),
},
});
diff --git a/apps/docs/api-reference/introduction.mdx b/apps/docs/api-reference/introduction.mdx
index e1bdc784d..5849a7f1e 100644
--- a/apps/docs/api-reference/introduction.mdx
+++ b/apps/docs/api-reference/introduction.mdx
@@ -51,11 +51,13 @@ For a single task, request `GET /api/task/TASK_ID`. Check the endpoint reference
| --- | --- |
| 400 | Required IDs, query parameters, and request body |
| 401 | Missing, invalid, or expired credentials |
-| 403 | Workspace membership and permission for the requested action |
-| 404 | The resource ID and endpoint path |
+| 403 | Your role's permission for the requested action, or your access to a restricted project |
+| 404 | The resource ID, the endpoint path, and your membership in the resource's workspace |
| 429 | Rate limits; wait before retrying |
| 5xx | Instance logs and service health |
+Resources in a workspace you are not a member of return `404`, the same response as a resource that does not exist.
+
Inspect the response body for the specific error. Do not retry a mutation blindly when you are unsure whether it already succeeded.
## API reference
diff --git a/apps/docs/core/operations/troubleshooting.mdx b/apps/docs/core/operations/troubleshooting.mdx
index a431aec90..c583d9361 100644
--- a/apps/docs/core/operations/troubleshooting.mdx
+++ b/apps/docs/core/operations/troubleshooting.mdx
@@ -26,7 +26,7 @@ A browser on another computer cannot use your server's `localhost` URL. Use the
docker compose up -d --force-recreate kaneo
```
-Check the browser's Network panel for the failed request and its status. A `401` usually calls for checking authentication; a `403` calls for checking workspace access or the required permission.
+Check the browser's Network panel for the failed request and its status. A `401` usually calls for checking authentication; a `403` calls for checking the required permission or project access; a `404` calls for checking that the resource exists and that you are a member of its workspace.
## Changes only appear after refreshing
diff --git a/apps/docs/openapi.json b/apps/docs/openapi.json
index b43605a8b..282fa38ec 100644
--- a/apps/docs/openapi.json
+++ b/apps/docs/openapi.json
@@ -5247,7 +5247,7 @@
"description": "Not modified"
},
"403": {
- "description": "No access to this asset"
+ "description": "Staged upload owned by another user, or no access to the asset's project"
},
"404": {
"description": "Asset not found"
@@ -7832,7 +7832,7 @@
}
},
"403": {
- "description": "Missing workspace access or permission",
+ "description": "No access to the project, or missing permission in the source or destination workspace",
"content": {
"text/plain": {
"schema": {
@@ -7842,7 +7842,7 @@
}
},
"404": {
- "description": "Project not found in the source workspace",
+ "description": "Project or destination workspace not found",
"content": {
"text/plain": {
"schema": {
@@ -7919,8 +7919,8 @@
"401": {
"description": "Missing or invalid credentials"
},
- "403": {
- "description": "No access to the workspace",
+ "404": {
+ "description": "Workspace not found",
"content": {
"text/plain": {
"schema": {
@@ -7993,7 +7993,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing project:create permission",
+ "description": "Missing project:create permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Workspace not found",
"content": {
"text/plain": {
"schema": {
@@ -8044,8 +8054,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -8054,11 +8067,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the project's workspace",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -8132,7 +8142,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown project",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -8145,7 +8155,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, missing project:update, or missing project:share when visibility changes",
+ "description": "No access to the project, missing project:update, or missing project:share when visibility changes",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -8194,8 +8214,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project, or missing project:delete permission",
"content": {
"text/plain": {
"schema": {
@@ -8204,11 +8227,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access, or missing project:delete permission",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -8253,21 +8273,11 @@
"304": {
"description": "Not modified"
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
"401": {
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No access to the project's workspace",
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -8277,7 +8287,7 @@
}
},
"404": {
- "description": "Project background not found",
+ "description": "Project or project background not found",
"content": {
"text/plain": {
"schema": {
@@ -8309,8 +8319,11 @@
"204": {
"description": "Project background removed"
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project, or missing project:update permission",
"content": {
"text/plain": {
"schema": {
@@ -8319,11 +8332,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access, or missing project:update permission",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -8416,7 +8426,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, missing project:update permission, or no access to a listed project",
+ "description": "Missing project:update permission, or no access to a listed project",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Workspace not found",
"content": {
"text/plain": {
"schema": {
@@ -8457,8 +8477,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project, or missing project:update permission",
"content": {
"text/plain": {
"schema": {
@@ -8467,11 +8490,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access, or missing project:update permission",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -8512,8 +8532,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project, or missing project:update permission",
"content": {
"text/plain": {
"schema": {
@@ -8522,11 +8545,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access, or missing project:update permission",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -8600,7 +8620,7 @@
}
},
"400": {
- "description": "Invalid image upload request, or unknown project",
+ "description": "Invalid image upload request",
"content": {
"text/plain": {
"schema": {
@@ -8613,7 +8633,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing project:update permission",
+ "description": "No access to the project, or missing project:update permission",
"content": {
"text/plain": {
"schema": {
@@ -8705,7 +8725,7 @@
}
},
"400": {
- "description": "Invalid image upload request, or unknown project",
+ "description": "Invalid image upload request",
"content": {
"text/plain": {
"schema": {
@@ -8718,7 +8738,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing project:update permission",
+ "description": "No access to the project, or missing project:update permission",
"content": {
"text/plain": {
"schema": {
@@ -8783,7 +8803,7 @@
}
},
"400": {
- "description": "Invalid request or unknown project",
+ "description": "Invalid request",
"content": {
"text/plain": {
"schema": {
@@ -8803,7 +8823,17 @@
}
},
"403": {
- "description": "No workspace access or missing project sharing permission",
+ "description": "No access to the project, or missing project sharing permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -8869,7 +8899,7 @@
}
},
"400": {
- "description": "Invalid request or unknown project",
+ "description": "Invalid request",
"content": {
"text/plain": {
"schema": {
@@ -8889,7 +8919,17 @@
}
},
"403": {
- "description": "No workspace access, missing project:share permission, or missing label:create permission for a new workspace label definition",
+ "description": "No access to the project, missing project:share permission, or missing label:create permission for a new workspace label definition",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -8947,7 +8987,7 @@
}
},
"400": {
- "description": "Invalid request or unknown project",
+ "description": "Invalid request",
"content": {
"text/plain": {
"schema": {
@@ -8967,7 +9007,7 @@
}
},
"403": {
- "description": "No workspace access or missing project sharing permission",
+ "description": "No access to the project, or missing project sharing permission",
"content": {
"text/plain": {
"schema": {
@@ -8977,7 +9017,7 @@
}
},
"404": {
- "description": "Calendar feed not found in this project",
+ "description": "Project or calendar feed not found",
"content": {
"text/plain": {
"schema": {
@@ -9051,7 +9091,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access",
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -9155,7 +9195,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access",
+ "description": "No access to the project",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -9235,7 +9285,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing project:read or task:read permission",
+ "description": "Missing project:read or task:read permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Workspace not found",
"content": {
"text/plain": {
"schema": {
@@ -9374,8 +9434,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -9384,11 +9447,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the project's workspace",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -9485,7 +9545,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing the permission the operation needs",
+ "description": "No access to the project, or missing the permission the operation needs",
"content": {
"text/plain": {
"schema": {
@@ -9880,7 +9940,7 @@
}
},
"404": {
- "description": "Tasks do not belong to the project",
+ "description": "Project not found, or tasks do not belong to the project",
"content": {
"text/plain": {
"schema": {
@@ -10005,7 +10065,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown project",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -10018,7 +10078,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:create permission",
+ "description": "No access to the project, or missing task:create permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -10095,7 +10165,7 @@
}
},
"403": {
- "description": "No workspace access, missing task:create, or missing task:update when copying parent links",
+ "description": "No access to the project, missing task:create, or missing task:update when copying parent links",
"content": {
"text/plain": {
"schema": {
@@ -10280,8 +10350,11 @@
}
}
},
- "400": {
- "description": "Unknown task, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -10290,11 +10363,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the task's workspace",
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -10390,7 +10460,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown task",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -10403,7 +10473,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update or task:assign permission",
+ "description": "No access to the project, or missing task:update or task:assign permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -10442,8 +10522,11 @@
}
}
},
- "400": {
- "description": "Unknown task, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project, or missing task:delete permission",
"content": {
"text/plain": {
"schema": {
@@ -10452,11 +10535,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access, or missing task:delete permission",
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -10530,7 +10610,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown task",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -10543,7 +10623,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
"content": {
"text/plain": {
"schema": {
@@ -10604,8 +10684,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -10614,11 +10697,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the project's workspace",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -10717,7 +10797,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown project",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -10730,7 +10810,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:create permission",
+ "description": "No access to the project, or missing task:create permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -10790,7 +10880,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown task",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -10803,7 +10893,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -10870,7 +10970,7 @@
}
},
"400": {
- "description": "Invalid priority, or unknown task",
+ "description": "Invalid priority",
"content": {
"text/plain": {
"schema": {
@@ -10883,7 +10983,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -10947,7 +11057,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown task",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -10960,7 +11070,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:assign permission",
+ "description": "No access to the project, or missing task:assign permission",
"content": {
"text/plain": {
"schema": {
@@ -10970,7 +11080,7 @@
}
},
"404": {
- "description": "Assignee is not a member of the workspace",
+ "description": "Task not found, or assignee is not a member of the workspace",
"content": {
"text/plain": {
"schema": {
@@ -11027,7 +11137,7 @@
}
},
"400": {
- "description": "Invalid date, or unknown task",
+ "description": "Invalid date",
"content": {
"text/plain": {
"schema": {
@@ -11040,7 +11150,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -11100,7 +11220,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown task",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -11113,7 +11233,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
"content": {
"text/plain": {
"schema": {
@@ -11121,9 +11241,19 @@
}
}
}
- }
- }
- }
+ },
+ "404": {
+ "description": "Task not found",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
},
"/task/image-upload/{id}": {
"put": {
@@ -11203,7 +11333,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
"content": {
"text/plain": {
"schema": {
@@ -11318,7 +11448,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
"content": {
"text/plain": {
"schema": {
@@ -11388,7 +11518,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown task",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -11401,7 +11531,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -11445,8 +11585,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -11455,11 +11598,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the project's workspace",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -11526,7 +11666,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown project",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -11539,7 +11679,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing project:update permission",
+ "description": "No access to the project, or missing project:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -11641,7 +11791,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing project:update permission",
+ "description": "No access to the project, or missing project:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -11713,7 +11873,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown column",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -11726,7 +11886,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing project:update permission",
+ "description": "No access to the project, or missing project:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Column not found",
"content": {
"text/plain": {
"schema": {
@@ -11765,8 +11935,11 @@
}
}
},
- "400": {
- "description": "Unknown column, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project, or missing project:update permission",
"content": {
"text/plain": {
"schema": {
@@ -11775,11 +11948,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access, or missing project:update permission",
+ "404": {
+ "description": "Column not found",
"content": {
"text/plain": {
"schema": {
@@ -11834,8 +12004,11 @@
}
}
},
- "400": {
- "description": "Workspace ID could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "Missing project:read or task:read permission",
"content": {
"text/plain": {
"schema": {
@@ -11844,11 +12017,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access, or missing project:read or task:read permission",
+ "404": {
+ "description": "Workspace not found",
"content": {
"text/plain": {
"schema": {
@@ -11904,8 +12074,11 @@
}
}
},
- "400": {
- "description": "Unknown task, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -11914,11 +12087,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the task's workspace",
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -11989,7 +12159,7 @@
}
},
"400": {
- "description": "Invalid body, unknown task, or comment activity submitted through the generic endpoint",
+ "description": "Invalid body, or comment activity submitted through the generic endpoint",
"content": {
"text/plain": {
"schema": {
@@ -12015,7 +12185,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -12070,7 +12250,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown task",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -12083,7 +12263,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -12136,7 +12326,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown activity",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -12149,7 +12339,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "Not the author, or no access to the workspace",
+ "description": "Not the author, or no access to the project",
"content": {
"text/plain": {
"schema": {
@@ -12159,7 +12349,7 @@
}
},
"404": {
- "description": "Comment not found",
+ "description": "Activity or comment not found",
"content": {
"text/plain": {
"schema": {
@@ -12207,7 +12397,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown activity",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -12220,7 +12410,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "Not the author, or no access to the workspace",
+ "description": "Not the author, or no access to the project",
"content": {
"text/plain": {
"schema": {
@@ -12230,7 +12420,7 @@
}
},
"404": {
- "description": "Comment not found",
+ "description": "Activity or comment not found",
"content": {
"text/plain": {
"schema": {
@@ -12274,8 +12464,11 @@
}
}
},
- "400": {
- "description": "Unknown task, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -12284,11 +12477,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the task's workspace",
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -12362,7 +12552,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown task",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -12375,7 +12565,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, missing task:update permission, or external attribution without workspace:manage_settings",
+ "description": "No access to the project, missing task:update permission, or external attribution without workspace:manage_settings",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -12437,7 +12637,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown comment",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -12499,16 +12699,6 @@
}
}
},
- "400": {
- "description": "Unknown comment, or its workspace could not be determined",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
"401": {
"description": "Missing or invalid credentials"
},
@@ -12567,8 +12757,11 @@
}
}
},
- "400": {
- "description": "Unknown task, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -12577,11 +12770,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the task's workspace",
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -12622,8 +12812,11 @@
}
}
},
- "400": {
- "description": "Unknown entry, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -12632,11 +12825,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the entry's workspace",
+ "404": {
+ "description": "Time entry not found",
"content": {
"text/plain": {
"schema": {
@@ -12704,7 +12894,7 @@
}
},
"400": {
- "description": "Invalid timestamps, or unknown entry",
+ "description": "Invalid timestamps",
"content": {
"text/plain": {
"schema": {
@@ -12717,7 +12907,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Time entry not found",
"content": {
"text/plain": {
"schema": {
@@ -12782,7 +12982,7 @@
}
},
"400": {
- "description": "Invalid timestamps, or unknown task",
+ "description": "Invalid body or timestamps",
"content": {
"text/plain": {
"schema": {
@@ -12795,7 +12995,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -12839,8 +13049,11 @@
}
}
},
- "400": {
- "description": "Unknown task, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -12849,11 +13062,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the task's workspace",
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -12897,21 +13107,11 @@
}
}
},
- "400": {
- "description": "Workspace ID could not be determined",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
"401": {
"description": "Missing or invalid credentials"
},
- "403": {
- "description": "No access to the workspace",
+ "404": {
+ "description": "Workspace not found",
"content": {
"text/plain": {
"schema": {
@@ -12985,7 +13185,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing label:create permission",
+ "description": "Missing label:create permission",
"content": {
"text/plain": {
"schema": {
@@ -12995,7 +13195,7 @@
}
},
"404": {
- "description": "Task not found",
+ "description": "Workspace or task not found",
"content": {
"text/plain": {
"schema": {
@@ -13046,8 +13246,11 @@
}
}
},
- "400": {
- "description": "Unknown label, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -13056,11 +13259,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the label's workspace",
+ "404": {
+ "description": "Label not found",
"content": {
"text/plain": {
"schema": {
@@ -13122,7 +13322,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown label",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -13135,7 +13335,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing label:update permission",
+ "description": "No access to the project, or missing label:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Label not found",
"content": {
"text/plain": {
"schema": {
@@ -13194,21 +13404,11 @@
}
}
},
- "400": {
- "description": "Unknown label, or its workspace could not be determined",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
"401": {
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing label:delete permission",
+ "description": "No access to the project, or missing label:delete permission",
"content": {
"text/plain": {
"schema": {
@@ -13218,7 +13418,7 @@
}
},
"404": {
- "description": "The label's task no longer exists",
+ "description": "Label not found, or the label's task no longer exists",
"content": {
"text/plain": {
"schema": {
@@ -13288,7 +13488,7 @@
}
},
"400": {
- "description": "Unknown label, or label and task belong to different workspaces",
+ "description": "Label and task belong to different workspaces",
"content": {
"text/plain": {
"schema": {
@@ -13301,7 +13501,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing label:update permission",
+ "description": "No access to the project, or missing label:update permission",
"content": {
"text/plain": {
"schema": {
@@ -13311,7 +13511,7 @@
}
},
"404": {
- "description": "Task not found",
+ "description": "Label or task not found",
"content": {
"text/plain": {
"schema": {
@@ -13361,7 +13561,7 @@
}
},
"400": {
- "description": "Unknown label, or label is not assigned to a task",
+ "description": "Label is not assigned to a task",
"content": {
"text/plain": {
"schema": {
@@ -13374,7 +13574,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing label:update permission",
+ "description": "No access to the project, or missing label:update permission",
"content": {
"text/plain": {
"schema": {
@@ -13384,7 +13584,7 @@
}
},
"404": {
- "description": "Task not found",
+ "description": "Label or task not found",
"content": {
"text/plain": {
"schema": {
@@ -14042,9 +14242,9 @@
"401": {
"description": "Missing or invalid credentials"
},
- "403": {
- "description": "No access to the workspace",
- "content": {
+ "404": {
+ "description": "Workspace not found",
+ "content": {
"text/plain": {
"schema": {
"type": "string"
@@ -14120,7 +14320,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access or required permission",
+ "description": "No access to the project, or missing required permission",
"content": {
"text/plain": {
"schema": {
@@ -14130,7 +14330,7 @@
}
},
"404": {
- "description": "Integration or linked task not found",
+ "description": "Project, integration, or linked task not found",
"content": {
"text/plain": {
"schema": {
@@ -14341,7 +14541,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access or required permission",
+ "description": "No access to the project, or missing required permission",
"content": {
"text/plain": {
"schema": {
@@ -14351,7 +14551,7 @@
}
},
"404": {
- "description": "Integration or linked task not found",
+ "description": "Project, integration, or linked task not found",
"content": {
"text/plain": {
"schema": {
@@ -14558,7 +14758,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access or required permission",
+ "description": "No access to the project, or missing required permission",
"content": {
"text/plain": {
"schema": {
@@ -14568,7 +14768,7 @@
}
},
"404": {
- "description": "Integration or linked task not found",
+ "description": "Project, integration, or linked task not found",
"content": {
"text/plain": {
"schema": {
@@ -14655,7 +14855,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access or required permission",
+ "description": "No access to the project, or missing required permission",
"content": {
"text/plain": {
"schema": {
@@ -14665,7 +14865,7 @@
}
},
"404": {
- "description": "Integration or linked task not found",
+ "description": "Project, integration, or linked task not found",
"content": {
"text/plain": {
"schema": {
@@ -14799,7 +14999,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access or required permission",
+ "description": "No access to the project, or missing required permission",
"content": {
"text/plain": {
"schema": {
@@ -14809,7 +15009,7 @@
}
},
"404": {
- "description": "Integration or linked task not found",
+ "description": "Project, integration, or linked task not found",
"content": {
"text/plain": {
"schema": {
@@ -14915,8 +15115,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -14925,11 +15128,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -14992,7 +15192,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown project",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -15005,7 +15205,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -15046,8 +15256,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -15056,11 +15269,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the project's workspace",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -15126,7 +15336,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown project",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -15139,7 +15349,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -15220,7 +15440,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -15230,8 +15450,13 @@
}
},
"404": {
- "description": "Integration not found",
+ "description": "Project or integration not found",
"content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ },
"application/json": {
"schema": {
"$ref": "#/components/schemas/GitHubIntegrationNotFound"
@@ -15279,21 +15504,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
"401": {
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -15303,7 +15518,7 @@
}
},
"404": {
- "description": "GitHub integration not found",
+ "description": "Project or GitHub integration not found",
"content": {
"text/plain": {
"schema": {
@@ -15383,7 +15598,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:create or task:update permission",
+ "description": "No access to the project, or missing task:create or task:update permission",
"content": {
"text/plain": {
"schema": {
@@ -15484,7 +15699,7 @@
}
},
"400": {
- "description": "Invalid body, unknown project, or invalid Gitea credentials",
+ "description": "Invalid body, or invalid Gitea credentials",
"content": {
"text/plain": {
"schema": {
@@ -15497,7 +15712,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -15568,7 +15793,7 @@
}
},
"400": {
- "description": "Invalid body, unknown project, or invalid Gitea credentials",
+ "description": "Invalid body, or invalid Gitea credentials",
"content": {
"text/plain": {
"schema": {
@@ -15588,7 +15813,17 @@
}
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -15639,8 +15874,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -15649,11 +15887,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the project's workspace",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -15726,7 +15961,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown project",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -15739,7 +15974,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -15810,7 +16055,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -15820,8 +16065,13 @@
}
},
"404": {
- "description": "Integration not found",
+ "description": "Project or integration not found",
"content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ },
"application/json": {
"schema": {
"$ref": "#/components/schemas/GiteaIntegrationNotFound"
@@ -15869,21 +16119,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
"401": {
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -15893,7 +16133,7 @@
}
},
"404": {
- "description": "Gitea integration not found",
+ "description": "Project or Gitea integration not found",
"content": {
"text/plain": {
"schema": {
@@ -15956,7 +16196,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:create or task:update permission",
+ "description": "No access to the project, or missing task:create or task:update permission",
"content": {
"text/plain": {
"schema": {
@@ -16035,7 +16275,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown project",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -16055,7 +16295,17 @@
}
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -16130,7 +16380,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown project",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -16150,7 +16400,17 @@
}
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -16191,8 +16451,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -16201,11 +16464,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the project's workspace",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -16281,7 +16541,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown project",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -16294,7 +16554,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -16375,7 +16645,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -16385,8 +16655,13 @@
}
},
"404": {
- "description": "Integration not found",
+ "description": "Project or integration not found",
"content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ },
"application/json": {
"schema": {
"$ref": "#/components/schemas/GitlabIntegrationNotFound"
@@ -16434,21 +16709,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
"401": {
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -16458,7 +16723,7 @@
}
},
"404": {
- "description": "GitLab integration not found",
+ "description": "Project or GitLab integration not found",
"content": {
"text/plain": {
"schema": {
@@ -16521,7 +16786,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:create or task:update permission",
+ "description": "No access to the project, or missing task:create or task:update permission",
"content": {
"text/plain": {
"schema": {
@@ -16572,8 +16837,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -16582,11 +16850,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the project's workspace",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -16709,7 +16974,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -16834,7 +17109,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -16844,7 +17119,7 @@
}
},
"404": {
- "description": "Webhook integration not found",
+ "description": "Project or webhook integration not found",
"content": {
"text/plain": {
"schema": {
@@ -16891,21 +17166,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
"401": {
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -16915,7 +17180,7 @@
}
},
"404": {
- "description": "Webhook integration not found",
+ "description": "Project or webhook integration not found",
"content": {
"text/plain": {
"schema": {
@@ -16956,8 +17221,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -16966,11 +17234,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the project's workspace",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -17068,7 +17333,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -17168,7 +17443,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -17178,7 +17453,7 @@
}
},
"404": {
- "description": "Discord integration not found",
+ "description": "Project or Discord integration not found",
"content": {
"text/plain": {
"schema": {
@@ -17225,21 +17500,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
"401": {
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -17249,7 +17514,7 @@
}
},
"404": {
- "description": "Discord integration not found",
+ "description": "Project or Discord integration not found",
"content": {
"text/plain": {
"schema": {
@@ -17290,8 +17555,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -17300,11 +17568,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the project's workspace",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -17402,7 +17667,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -17502,7 +17777,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -17512,7 +17787,7 @@
}
},
"404": {
- "description": "Mattermost integration not found",
+ "description": "Project or Mattermost integration not found",
"content": {
"text/plain": {
"schema": {
@@ -17559,21 +17834,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
"401": {
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -17583,7 +17848,7 @@
}
},
"404": {
- "description": "Mattermost integration not found",
+ "description": "Project or Mattermost integration not found",
"content": {
"text/plain": {
"schema": {
@@ -17624,8 +17889,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -17634,11 +17902,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the project's workspace",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -17736,7 +18001,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -17836,7 +18111,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -17846,7 +18121,7 @@
}
},
"404": {
- "description": "Slack integration not found",
+ "description": "Project or Slack integration not found",
"content": {
"text/plain": {
"schema": {
@@ -17893,21 +18168,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
"401": {
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -17917,7 +18182,7 @@
}
},
"404": {
- "description": "Slack integration not found",
+ "description": "Project or Slack integration not found",
"content": {
"text/plain": {
"schema": {
@@ -17958,8 +18223,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -17968,11 +18236,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the project's workspace",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -18079,7 +18344,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -18188,7 +18463,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -18198,7 +18473,7 @@
}
},
"404": {
- "description": "Telegram integration not found",
+ "description": "Project or Telegram integration not found",
"content": {
"text/plain": {
"schema": {
@@ -18245,21 +18520,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
"401": {
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing workspace:manage_settings",
+ "description": "No access to the project, or missing workspace:manage_settings",
"content": {
"text/plain": {
"schema": {
@@ -18269,7 +18534,7 @@
}
},
"404": {
- "description": "Telegram integration not found",
+ "description": "Project or Telegram integration not found",
"content": {
"text/plain": {
"schema": {
@@ -18313,8 +18578,11 @@
}
}
},
- "400": {
- "description": "Unknown task, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -18323,11 +18591,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the task's workspace",
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -18403,7 +18668,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
"content": {
"text/plain": {
"schema": {
@@ -18468,7 +18733,7 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
"content": {
"text/plain": {
"schema": {
@@ -18572,6 +18837,16 @@
}
}
}
+ },
+ "404": {
+ "description": "Task not found",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
}
}
},
@@ -18606,8 +18881,11 @@
}
}
},
- "400": {
- "description": "Unknown task, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -18616,11 +18894,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the task's workspace",
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -18670,7 +18945,7 @@
}
},
"400": {
- "description": "Unknown task or invalid link data",
+ "description": "Invalid link data",
"content": {
"text/plain": {
"schema": {
@@ -18700,7 +18975,7 @@
}
},
"404": {
- "description": "Manual resource link not found on this task",
+ "description": "Task or manual resource link not found",
"content": {
"text/plain": {
"schema": {
@@ -18744,8 +19019,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -18754,11 +19032,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No access to the project's workspace",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -18824,7 +19099,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown project",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -18837,7 +19112,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing project:update permission",
+ "description": "No access to the project, or missing project:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -18878,8 +19163,11 @@
}
}
},
- "400": {
- "description": "Unknown rule, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project, or missing project:update permission",
"content": {
"text/plain": {
"schema": {
@@ -18888,11 +19176,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access, or missing project:update permission",
+ "404": {
+ "description": "Workflow rule not found",
"content": {
"text/plain": {
"schema": {
@@ -19009,21 +19294,11 @@
}
}
},
- "400": {
- "description": "Workspace ID could not be determined",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
"401": {
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No access to the workspace or to the project",
+ "description": "No access to the project",
"content": {
"text/plain": {
"schema": {
@@ -19033,7 +19308,7 @@
}
},
"404": {
- "description": "Project not found in this workspace",
+ "description": "Workspace not found, or project not found in this workspace",
"content": {
"text/plain": {
"schema": {
@@ -19074,21 +19349,11 @@
}
}
},
- "400": {
- "description": "Workspace ID could not be determined",
- "content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
"401": {
"description": "Missing or invalid credentials"
},
- "403": {
- "description": "No access to the workspace",
+ "404": {
+ "description": "Workspace not found",
"content": {
"text/plain": {
"schema": {
@@ -19133,8 +19398,11 @@
}
}
},
- "400": {
- "description": "Workspace ID could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "Missing member:update permission",
"content": {
"text/plain": {
"schema": {
@@ -19143,11 +19411,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access, or missing member:update permission",
+ "404": {
+ "description": "Workspace not found",
"content": {
"text/plain": {
"schema": {
@@ -19251,7 +19516,7 @@
}
},
"404": {
- "description": "Member not found",
+ "description": "Workspace or member not found",
"content": {
"text/plain": {
"schema": {
@@ -19295,8 +19560,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project, or missing read permission",
"content": {
"text/plain": {
"schema": {
@@ -19305,11 +19573,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access or missing read permission",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -19353,8 +19618,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project, or missing read permission",
"content": {
"text/plain": {
"schema": {
@@ -19363,11 +19631,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access or missing read permission",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -19411,8 +19676,11 @@
}
}
},
- "400": {
- "description": "Unknown task, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project, or missing task:read permission",
"content": {
"text/plain": {
"schema": {
@@ -19421,11 +19689,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access or missing task:read permission",
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -19469,8 +19734,11 @@
}
}
},
- "400": {
- "description": "Unknown project, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project, or missing read permission",
"content": {
"text/plain": {
"schema": {
@@ -19479,11 +19747,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access or missing read permission",
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -19562,7 +19827,7 @@
}
},
"400": {
- "description": "Invalid body, or unknown project",
+ "description": "Invalid body",
"content": {
"text/plain": {
"schema": {
@@ -19575,7 +19840,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing project:update permission",
+ "description": "No access to the project, or missing project:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -19663,7 +19938,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing project:update permission",
+ "description": "No access to the project, or missing project:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Project not found",
"content": {
"text/plain": {
"schema": {
@@ -19721,7 +20006,7 @@
}
},
"400": {
- "description": "Invalid body, unknown task, or unknown custom field",
+ "description": "Invalid body, or unknown custom field",
"content": {
"text/plain": {
"schema": {
@@ -19734,7 +20019,17 @@
"description": "Missing or invalid credentials"
},
"403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "No access to the project, or missing task:update permission",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Task not found",
"content": {
"text/plain": {
"schema": {
@@ -19775,8 +20070,11 @@
}
}
},
- "400": {
- "description": "Unknown custom field, or its workspace could not be determined",
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the project, or missing project:update permission",
"content": {
"text/plain": {
"schema": {
@@ -19785,11 +20083,8 @@
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access, or missing project:update permission",
+ "404": {
+ "description": "Custom field not found",
"content": {
"text/plain": {
"schema": {
diff --git a/tests/api-integration/asset-visibility.test.ts b/tests/api-integration/asset-visibility.test.ts
index 5701fee91..50e34798f 100644
--- a/tests/api-integration/asset-visibility.test.ts
+++ b/tests/api-integration/asset-visibility.test.ts
@@ -64,7 +64,7 @@ describe("API integration: public project asset visibility", () => {
expect(readObject).toHaveBeenCalledTimes(1);
mockAuthenticatedSession(outsider.user);
- expect((await app.request(`/api/asset/${comment?.id}`)).status).toBe(403);
+ expect((await app.request(`/api/asset/${comment?.id}`)).status).toBe(404);
expect(readObject).toHaveBeenCalledTimes(1);
mockAuthenticatedSession(member.user);
diff --git a/tests/api-integration/assigned-tasks.test.ts b/tests/api-integration/assigned-tasks.test.ts
index e38735da1..fca09a906 100644
--- a/tests/api-integration/assigned-tasks.test.ts
+++ b/tests/api-integration/assigned-tasks.test.ts
@@ -233,7 +233,7 @@ describe("API integration: assigned tasks", () => {
const response = await app.request(
`/api/task/assigned?workspaceId=${member.workspace.id}&countOnly=${countOnly}`,
);
- expect(response.status).toBe(403);
+ expect(response.status).toBe(404);
}
});
it.each([
diff --git a/tests/api-integration/authorization-boundaries.test.ts b/tests/api-integration/authorization-boundaries.test.ts
index 01ce0c806..56ea64de7 100644
--- a/tests/api-integration/authorization-boundaries.test.ts
+++ b/tests/api-integration/authorization-boundaries.test.ts
@@ -67,7 +67,8 @@ describe("github integration routes are workspace scoped", () => {
`/api/github-integration/repositories/${project.id}`,
);
- expect(response.status).toBe(403);
+ expect(response.status).toBe(404);
+ expect(await response.text()).toContain("Project not found");
});
});
diff --git a/tests/api-integration/calendar-feed.test.ts b/tests/api-integration/calendar-feed.test.ts
index ce40f8075..5174df1e1 100644
--- a/tests/api-integration/calendar-feed.test.ts
+++ b/tests/api-integration/calendar-feed.test.ts
@@ -503,7 +503,7 @@ describe("API integration: calendar feeds", () => {
expect(
(await app.request(`${endpoint}?workspaceId=${outsider.workspace.id}`))
.status,
- ).toBe(403);
+ ).toBe(404);
expect(
(
await app.request(
@@ -517,7 +517,7 @@ describe("API integration: calendar feeds", () => {
expect(
(await app.request(`${endpoint}/${feed.id}`, { method: "DELETE" }))
.status,
- ).toBe(403);
+ ).toBe(404);
expect((await app.request(feedPath(feed))).status).toBe(200);
});
});
diff --git a/tests/api-integration/custom-field-security.test.ts b/tests/api-integration/custom-field-security.test.ts
index e1565b9fa..a6a590f8c 100644
--- a/tests/api-integration/custom-field-security.test.ts
+++ b/tests/api-integration/custom-field-security.test.ts
@@ -114,7 +114,7 @@ describe("custom field read authorization", () => {
const outsider = await createWorkspaceMember({ role: "admin" });
mockAuthenticatedSession(outsider.user);
for (const path of paths)
- expect((await app.request(path)).status).toBe(403);
+ expect((await app.request(path)).status).toBe(404);
});
});
diff --git a/tests/api-integration/gitea-verification.test.ts b/tests/api-integration/gitea-verification.test.ts
index d22528efe..39d42be38 100644
--- a/tests/api-integration/gitea-verification.test.ts
+++ b/tests/api-integration/gitea-verification.test.ts
@@ -104,7 +104,7 @@ describe("saved Gitea token verification route", () => {
const { project } = await fixture();
const outsider = await createWorkspaceMember();
mockAuthenticatedSession(outsider.user);
- expect((await verify(project.id)).status).toBe(403);
+ expect((await verify(project.id)).status).toBe(404);
expect(verifyGiteaAccess).not.toHaveBeenCalled();
});
it("uses a saved Gitea token only for its project and unchanged destination", async () => {
diff --git a/tests/api-integration/github-binding-routes.test.ts b/tests/api-integration/github-binding-routes.test.ts
index 659aa3f5c..277cfb395 100644
--- a/tests/api-integration/github-binding-routes.test.ts
+++ b/tests/api-integration/github-binding-routes.test.ts
@@ -102,14 +102,17 @@ describe("GitHub binding HTTP and webhook tenant boundaries", () => {
const member = await fixture("member");
const outsider = await fixture();
const { app } = createApp();
- for (const user of [member.user, outsider.user]) {
+ for (const [user, status] of [
+ [member.user, 403],
+ [outsider.user, 404],
+ ] as const) {
mockAuthenticatedSession(user);
for (const [url, options] of calls(member.project.id)) {
const response = await app.request(url, {
...options,
headers: { "content-type": "application/json" },
});
- expect(response.status).toBe(403);
+ expect(response.status).toBe(status);
}
}
expect(m.installation).not.toHaveBeenCalled();
diff --git a/tests/api-integration/github-import-bounds.test.ts b/tests/api-integration/github-import-bounds.test.ts
index fc4ae85c2..aca8ca3ab 100644
--- a/tests/api-integration/github-import-bounds.test.ts
+++ b/tests/api-integration/github-import-bounds.test.ts
@@ -752,11 +752,11 @@ describe("bounded resumable GitHub import", () => {
const calls = mocks.graphql.mock.calls.length;
const other = await createWorkspaceMember({ role: "admin" });
mockAuthenticatedSession(other.user);
- expect((await request(first.runId)).status).toBe(403);
+ expect((await request(first.runId)).status).toBe(404);
expect(
(await app.request(`/api/github-integration/project/${project.id}`))
.status,
- ).toBe(403);
+ ).toBe(404);
expect(mocks.graphql).toHaveBeenCalledTimes(calls);
});
diff --git a/tests/api-integration/instance-admin-workspace-access.test.ts b/tests/api-integration/instance-admin-workspace-access.test.ts
index 1afa0fda7..11f6705ea 100644
--- a/tests/api-integration/instance-admin-workspace-access.test.ts
+++ b/tests/api-integration/instance-admin-workspace-access.test.ts
@@ -41,7 +41,26 @@ describe("API integration: instance admin workspace access", () => {
await expect(
validateWorkspaceAccess(outsider.id, owner.workspace.id),
).rejects.toMatchObject({
- status: 403,
+ status: 404,
+ message: "Workspace not found",
+ });
+ });
+
+ it("rejects an instance admin for a workspace that does not exist", async () => {
+ const admin = await createUser("user,admin");
+
+ await expect(
+ validateWorkspaceAccess(
+ admin.id,
+ `workspace-${randomUUID()}`,
+ undefined,
+ {
+ notFoundMessage: "Project not found",
+ },
+ ),
+ ).rejects.toMatchObject({
+ status: 404,
+ message: "Project not found",
});
});
});
diff --git a/tests/api-integration/integration-sync-rules.test.ts b/tests/api-integration/integration-sync-rules.test.ts
index 6818d8662..180f053c9 100644
--- a/tests/api-integration/integration-sync-rules.test.ts
+++ b/tests/api-integration/integration-sync-rules.test.ts
@@ -410,7 +410,7 @@ describe("integration label policies", () => {
).toBe(403);
const outsider = await createWorkspaceMember({ role: "owner" });
mockAuthenticatedSession(outsider.user);
- expect((await f.request("", "GET")).status).toBe(403);
+ expect((await f.request("", "GET")).status).toBe(404);
});
it("rejects a rule save if the project moves after workspace authorization", async () => {
@@ -858,7 +858,7 @@ describe("reviewed sync resume", () => {
).toBe(403);
const outsider = await createWorkspaceMember({ role: "owner" });
mockAuthenticatedSession(outsider.user);
- expect((await f.request(`${suffix}/review`, "GET")).status).toBe(403);
+ expect((await f.request(`${suffix}/review`, "GET")).status).toBe(404);
expect(
(
await f.request(`${suffix}/resume`, "POST", {
@@ -866,7 +866,7 @@ describe("reviewed sync resume", () => {
token: "a".repeat(64),
})
).status,
- ).toBe(403);
+ ).toBe(404);
expect(provider.read).not.toHaveBeenCalled();
expect(provider.write).not.toHaveBeenCalled();
});
diff --git a/tests/api-integration/label-deletion-bounds.test.ts b/tests/api-integration/label-deletion-bounds.test.ts
index 8f775d2fa..a74ba9311 100644
--- a/tests/api-integration/label-deletion-bounds.test.ts
+++ b/tests/api-integration/label-deletion-bounds.test.ts
@@ -308,7 +308,7 @@ describe("bounded, resumable label deletion", () => {
mockAuthenticatedSession(other.user);
expect(
(await app.request(`/api/label/${root.id}`, { method: "DELETE" })).status,
- ).toBe(403);
+ ).toBe(404);
expect(await labelsFor(member.workspace.id)).toHaveLength(2);
expect(github).toHaveBeenCalledTimes(LABEL_DELETE_BATCH_SIZE);
mockAuthenticatedSession(member.user);
diff --git a/tests/api-integration/label.test.ts b/tests/api-integration/label.test.ts
index 186d5a6a0..d949fa5e4 100644
--- a/tests/api-integration/label.test.ts
+++ b/tests/api-integration/label.test.ts
@@ -102,10 +102,8 @@ describe("API integration: labels", () => {
}),
});
- expect(response.status).toBe(403);
- await expect(response.text()).resolves.toBe(
- "You don't have access to this workspace",
- );
+ expect(response.status).toBe(404);
+ await expect(response.text()).resolves.toContain("Workspace not found");
const persisted = await db.query.labelTable.findFirst({
where: eq(schema.labelTable.name, "Blocked"),
diff --git a/tests/api-integration/manual-external-links.test.ts b/tests/api-integration/manual-external-links.test.ts
index 0cc7c943d..e66149248 100644
--- a/tests/api-integration/manual-external-links.test.ts
+++ b/tests/api-integration/manual-external-links.test.ts
@@ -180,10 +180,10 @@ describe("manual external resource links", () => {
url: "https://example.com",
})
).status,
- ).toBe(403);
+ ).toBe(404);
expect(
(await request(`/${other.task.id}/${entry.id}`, "DELETE")).status,
- ).toBe(403);
+ ).toBe(404);
expect(
(await request(`/${own.task.id}/${entry.id}`, "DELETE")).status,
).toBe(404);
diff --git a/tests/api-integration/not-found-status-codes.test.ts b/tests/api-integration/not-found-status-codes.test.ts
new file mode 100644
index 000000000..e64bad830
--- /dev/null
+++ b/tests/api-integration/not-found-status-codes.test.ts
@@ -0,0 +1,250 @@
+import { randomUUID } from "node:crypto";
+import { beforeEach, describe, expect, it } from "vite-plus/test";
+import { mockAuthenticatedSession } from "./helpers/auth";
+import { createInstanceAdmin } from "./helpers/admin/create-instance-admin";
+import { resetTestDatabase } from "./helpers/database";
+import {
+ createProjectFixture,
+ createWorkspaceMember,
+} from "./helpers/fixtures";
+import { createTaskFixture } from "./helpers/project-access/create-task-fixture";
+import { projectAccessApi } from "./helpers/project-access/project-access-api";
+
+beforeEach(resetTestDatabase);
+
+async function snapshot(response: Response) {
+ return { status: response.status, body: await response.text() };
+}
+
+async function workspaceWithTask(role = "owner") {
+ const member = await createWorkspaceMember({ role });
+ const project = await createProjectFixture({
+ workspaceId: member.workspace.id,
+ });
+ const task = await createTaskFixture(project, "Seeded", member.user.id);
+ return { ...member, project: project.project, task };
+}
+
+describe("missing and deleted resources return 404", () => {
+ it("returns 404 for a project that never existed", async () => {
+ const own = await workspaceWithTask();
+ mockAuthenticatedSession(own.user);
+
+ const response = await projectAccessApi()(`/project/${randomUUID()}`);
+
+ expect(response.status).toBe(404);
+ expect(await response.text()).toContain("Project not found");
+ });
+
+ it("returns 404 for a deleted project", async () => {
+ const own = await workspaceWithTask();
+ mockAuthenticatedSession(own.user);
+ const request = projectAccessApi();
+
+ const created = await request("/project", {
+ method: "POST",
+ body: {
+ workspaceId: own.workspace.id,
+ name: "Short lived",
+ icon: "Folder",
+ slug: "short-lived",
+ },
+ });
+ expect(created.status).toBe(200);
+ const { id } = (await created.json()) as { id: string };
+
+ expect((await request(`/project/${id}`, { method: "DELETE" })).status).toBe(
+ 200,
+ );
+
+ const response = await request(`/project/${id}`);
+ expect(response.status).toBe(404);
+ expect(await response.text()).toContain("Project not found");
+ });
+
+ it("returns 404 for a task that never existed", async () => {
+ const own = await workspaceWithTask();
+ mockAuthenticatedSession(own.user);
+
+ const response = await projectAccessApi()(`/task/${randomUUID()}`);
+
+ expect(response.status).toBe(404);
+ expect(await response.text()).toContain("Task not found");
+ });
+
+ it("returns 404 for a deleted task", async () => {
+ const own = await workspaceWithTask();
+ mockAuthenticatedSession(own.user);
+ const request = projectAccessApi();
+
+ expect(
+ (await request(`/task/${own.task.id}`, { method: "DELETE" })).status,
+ ).toBe(200);
+
+ const response = await request(`/task/${own.task.id}`);
+ expect(response.status).toBe(404);
+ expect(await response.text()).toContain("Task not found");
+ });
+
+ it("does not fall back to a workspace query when the task lookup fails", async () => {
+ const own = await workspaceWithTask();
+ mockAuthenticatedSession(own.user);
+
+ const response = await projectAccessApi()(
+ `/task/${randomUUID()}?workspaceId=${own.workspace.id}`,
+ );
+
+ expect(response.status).toBe(404);
+ expect(await response.text()).toContain("Task not found");
+ });
+
+ it("returns 404 for a workspace that does not exist", async () => {
+ const own = await workspaceWithTask();
+ mockAuthenticatedSession(own.user);
+
+ const response = await projectAccessApi()(
+ `/project?workspaceId=workspace-${randomUUID()}`,
+ );
+
+ expect(response.status).toBe(404);
+ expect(await response.text()).toContain("Workspace not found");
+ });
+
+ it("keeps 400 when no workspace id is given at all", async () => {
+ const own = await workspaceWithTask();
+ mockAuthenticatedSession(own.user);
+
+ const response = await projectAccessApi()("/project");
+
+ expect(response.status).toBe(400);
+ expect(await response.text()).toContain(
+ "Workspace ID could not be determined",
+ );
+ });
+});
+
+describe("resources in another workspace look missing", () => {
+ it("answers a foreign project exactly like a missing one", async () => {
+ const own = await workspaceWithTask();
+ const foreign = await workspaceWithTask();
+ mockAuthenticatedSession(own.user);
+ const request = projectAccessApi();
+
+ const hidden = await snapshot(
+ await request(`/project/${foreign.project.id}`),
+ );
+ const missing = await snapshot(await request(`/project/${randomUUID()}`));
+
+ expect(hidden).toEqual(missing);
+ expect(hidden.status).toBe(404);
+ expect(hidden.body).not.toContain(foreign.project.name);
+ });
+
+ it("answers a foreign task exactly like a missing one", async () => {
+ const own = await workspaceWithTask();
+ const foreign = await workspaceWithTask();
+ mockAuthenticatedSession(own.user);
+ const request = projectAccessApi();
+
+ const hidden = await snapshot(await request(`/task/${foreign.task.id}`));
+ const missing = await snapshot(await request(`/task/${randomUUID()}`));
+
+ expect(hidden).toEqual(missing);
+ expect(hidden.status).toBe(404);
+ });
+
+ it("answers a foreign task mutation exactly like a missing one", async () => {
+ const own = await workspaceWithTask();
+ const foreign = await workspaceWithTask();
+ mockAuthenticatedSession(own.user);
+ const request = projectAccessApi();
+ const body = { title: "Renamed" };
+
+ const hidden = await snapshot(
+ await request(`/task/title/${foreign.task.id}`, { method: "PUT", body }),
+ );
+ const missing = await snapshot(
+ await request(`/task/title/${randomUUID()}`, { method: "PUT", body }),
+ );
+
+ expect(hidden).toEqual(missing);
+ expect(hidden.status).toBe(404);
+ });
+
+ it("answers a foreign workspace exactly like a missing one", async () => {
+ const own = await workspaceWithTask();
+ const foreign = await workspaceWithTask();
+ mockAuthenticatedSession(own.user);
+ const request = projectAccessApi();
+
+ const hidden = await snapshot(
+ await request(`/project?workspaceId=${foreign.workspace.id}`),
+ );
+ const missing = await snapshot(
+ await request(`/project?workspaceId=workspace-${randomUUID()}`),
+ );
+
+ expect(hidden).toEqual(missing);
+ expect(hidden.status).toBe(404);
+ });
+});
+
+describe("members without a permission still get 403", () => {
+ it("refuses to delete a project for the built-in member role", async () => {
+ const member = await workspaceWithTask("member");
+ mockAuthenticatedSession(member.user);
+
+ const response = await projectAccessApi()(`/project/${member.project.id}`, {
+ method: "DELETE",
+ });
+
+ expect(response.status).toBe(403);
+ expect(await response.text()).toContain("Insufficient permissions");
+ });
+});
+
+describe("instance admins need an existing workspace", () => {
+ it("returns 404 instead of an empty list for a missing workspace", async () => {
+ const admin = await createInstanceAdmin();
+ mockAuthenticatedSession(admin);
+
+ const response = await projectAccessApi()(
+ `/project?workspaceId=workspace-${randomUUID()}`,
+ );
+
+ expect(response.status).toBe(404);
+ expect(await response.text()).toContain("Workspace not found");
+ });
+
+ it("returns 404 instead of a server error when creating a project in a missing workspace", async () => {
+ const admin = await createInstanceAdmin();
+ mockAuthenticatedSession(admin);
+
+ const response = await projectAccessApi()("/project", {
+ method: "POST",
+ body: {
+ workspaceId: `workspace-${randomUUID()}`,
+ name: "Orphan",
+ icon: "Folder",
+ slug: "orphan",
+ },
+ });
+
+ expect(response.status).toBe(404);
+ expect(await response.text()).toContain("Workspace not found");
+ });
+
+ it("still reads a workspace the admin never joined", async () => {
+ const other = await workspaceWithTask();
+ const admin = await createInstanceAdmin();
+ mockAuthenticatedSession(admin);
+
+ const response = await projectAccessApi()(
+ `/project?workspaceId=${other.workspace.id}`,
+ );
+
+ expect(response.status).toBe(200);
+ const projects = (await response.json()) as { id: string }[];
+ expect(projects.map((project) => project.id)).toEqual([other.project.id]);
+ });
+});
diff --git a/tests/api-integration/project-move.test.ts b/tests/api-integration/project-move.test.ts
index cb24c8e44..68cf68772 100644
--- a/tests/api-integration/project-move.test.ts
+++ b/tests/api-integration/project-move.test.ts
@@ -82,7 +82,8 @@ describe("API integration: moving a project between workspaces", () => {
moveRequest(target.id),
);
- expect(response.status).toBe(403);
+ expect(response.status).toBe(404);
+ expect(await response.text()).toContain("Destination workspace not found");
const [unchanged] = await db
.select()
diff --git a/tests/api-integration/project.test.ts b/tests/api-integration/project.test.ts
index e392c4e80..7cec7a56c 100644
--- a/tests/api-integration/project.test.ts
+++ b/tests/api-integration/project.test.ts
@@ -125,10 +125,8 @@ describe("API integration: project creation", () => {
}),
});
- expect(response.status).toBe(403);
- await expect(response.text()).resolves.toBe(
- "You don't have access to this workspace",
- );
+ expect(response.status).toBe(404);
+ await expect(response.text()).resolves.toContain("Workspace not found");
});
it("rejects a project key already used in the workspace", async () => {
diff --git a/tests/api-integration/task-description-pages.test.ts b/tests/api-integration/task-description-pages.test.ts
index 5bf43c093..ff242e7cd 100644
--- a/tests/api-integration/task-description-pages.test.ts
+++ b/tests/api-integration/task-description-pages.test.ts
@@ -182,7 +182,7 @@ describe("large task descriptions", () => {
.where(eq(schema.projectTable.id, otherProject.id));
mockAuthenticatedSession(other.user);
expect((await app.request(`/api/task/${task.id}/description`)).status).toBe(
- 403,
+ 404,
);
expect(
(
@@ -190,7 +190,7 @@ describe("large task descriptions", () => {
`/api/task/description-matches/${project.id}?query=secret`,
)
).status,
- ).toBe(403);
+ ).toBe(404);
mockAnonymousSession();
expect((await app.request(`/api/task/${task.id}/description`)).status).toBe(
401,
diff --git a/tests/api-integration/task-duplicate.test.ts b/tests/api-integration/task-duplicate.test.ts
index f4699218e..afb5f9a59 100644
--- a/tests/api-integration/task-duplicate.test.ts
+++ b/tests/api-integration/task-duplicate.test.ts
@@ -166,10 +166,8 @@ describe("API integration: task duplication", () => {
const response = await requestDuplicate(app, task.id);
- expect(response.status).toBe(403);
- await expect(response.text()).resolves.toBe(
- "You don't have access to this workspace",
- );
+ expect(response.status).toBe(404);
+ await expect(response.text()).resolves.toContain("Task not found");
const tasks = await db.query.taskTable.findMany({
where: eq(schema.taskTable.projectId, project.id),
diff --git a/tests/api-integration/task-image-upload.test.ts b/tests/api-integration/task-image-upload.test.ts
index d35707e80..eccce357b 100644
--- a/tests/api-integration/task-image-upload.test.ts
+++ b/tests/api-integration/task-image-upload.test.ts
@@ -459,9 +459,7 @@ describe("API integration: task image upload finalize", () => {
},
);
- expect(response.status).toBe(403);
- await expect(response.text()).resolves.toBe(
- "You don't have access to this workspace",
- );
+ expect(response.status).toBe(404);
+ await expect(response.text()).resolves.toContain("Task not found");
});
});
diff --git a/tests/api-integration/task-pagination.test.ts b/tests/api-integration/task-pagination.test.ts
index d6f85a7b0..571cfbe8c 100644
--- a/tests/api-integration/task-pagination.test.ts
+++ b/tests/api-integration/task-pagination.test.ts
@@ -145,7 +145,7 @@ describe("bounded task pages", () => {
const other = await createWorkspaceMember();
mockAuthenticatedSession(other.user);
const response = await app.request(`/api/task/tasks/${project.id}?page=2`);
- expect(response.status).toBe(403);
+ expect(response.status).toBe(404);
expect(await response.text()).not.toContain("Description");
});
it("paginates public boards and rechecks visibility on every request", async () => {
diff --git a/tests/api-integration/task-related-pages.test.ts b/tests/api-integration/task-related-pages.test.ts
index 4ef80445b..11437fbf1 100644
--- a/tests/api-integration/task-related-pages.test.ts
+++ b/tests/api-integration/task-related-pages.test.ts
@@ -143,7 +143,7 @@ describe("bounded board related pages", () => {
mockAuthenticatedSession(other.user);
expect(
(await app.request(`/api/task/tasks/${project.id}?relatedPage=2`)).status,
- ).toBe(403);
+ ).toBe(404);
mockAnonymousSession();
await db
.update(schema.projectTable)
diff --git a/tests/api-integration/task-relation-boundaries.test.ts b/tests/api-integration/task-relation-boundaries.test.ts
index 1192d8d8f..fde05b8c1 100644
--- a/tests/api-integration/task-relation-boundaries.test.ts
+++ b/tests/api-integration/task-relation-boundaries.test.ts
@@ -105,7 +105,9 @@ describe("task relation tenant boundaries", () => {
const foreign = await context();
const relation = await seedRelation(foreign.task.id, own.task.id);
mockAuthenticatedSession(own.user);
- expect((await request(`/${relation.id}`, "DELETE")).status).toBe(403);
+ const response = await request(`/${relation.id}`, "DELETE");
+ expect(response.status).toBe(404);
+ expect(await response.text()).toContain("Task relation not found");
expect(await db.query.taskRelationTable.findMany()).toHaveLength(1);
expect(m.publish).not.toHaveBeenCalled();
});
diff --git a/tests/api-integration/task.test.ts b/tests/api-integration/task.test.ts
index 03e374562..f18f88e4e 100644
--- a/tests/api-integration/task.test.ts
+++ b/tests/api-integration/task.test.ts
@@ -158,10 +158,8 @@ describe("API integration: task creation", () => {
}),
});
- expect(response.status).toBe(403);
- await expect(response.text()).resolves.toBe(
- "You don't have access to this workspace",
- );
+ expect(response.status).toBe(404);
+ await expect(response.text()).resolves.toContain("Project not found");
const persistedTask = await db.query.taskTable.findFirst({
where: and(
diff --git a/tests/api-integration/tenant-resource-boundaries.test.ts b/tests/api-integration/tenant-resource-boundaries.test.ts
index 38649f712..9d1e64035 100644
--- a/tests/api-integration/tenant-resource-boundaries.test.ts
+++ b/tests/api-integration/tenant-resource-boundaries.test.ts
@@ -120,9 +120,13 @@ describe("tenant resource boundaries", () => {
["/task", "DELETE", undefined],
["/task", "PUT", { taskId: own.task.id }],
] as const) {
- expect(
- (await request(`/label/${forged.id}${suffix}`, method, body)).status,
- ).toBe(400);
+ const response = await request(
+ `/label/${forged.id}${suffix}`,
+ method,
+ body,
+ );
+ expect(response.status).toBe(404);
+ expect(await response.text()).toContain("Label not found");
}
await expect(deleteLabel(forged.id, own.user.id)).rejects.toMatchObject({
status: 404,
diff --git a/tests/api-integration/websocket-security.test.ts b/tests/api-integration/websocket-security.test.ts
index a0b4e70f7..66d1b8082 100644
--- a/tests/api-integration/websocket-security.test.ts
+++ b/tests/api-integration/websocket-security.test.ts
@@ -242,12 +242,10 @@ it("still rejects access to a foreign project with a valid Origin", async () =>
const { project } = await createProjectFixture({
workspaceId: foreign.workspace.id,
});
- expect(
- (
- await connect(project.id, {
- cookie: "test-session=valid",
- origin: "http://localhost:5173",
- })
- ).status,
- ).toBe(403);
+ const headers = {
+ cookie: "test-session=valid",
+ origin: "http://localhost:5173",
+ };
+ expect((await connect(project.id, headers)).status).toBe(404);
+ expect((await connect("missing-project", headers)).status).toBe(404);
});
diff --git a/tests/api-integration/workspace-activity.test.ts b/tests/api-integration/workspace-activity.test.ts
index 7b978caf8..d62f3bcdf 100644
--- a/tests/api-integration/workspace-activity.test.ts
+++ b/tests/api-integration/workspace-activity.test.ts
@@ -138,7 +138,7 @@ describe("API integration: workspace activity", () => {
const response = await app.request(
`/api/activity/workspace/${member.workspace.id}`,
);
- expect(response.status).toBe(403);
+ expect(response.status).toBe(404);
});
it.each([
{ workspace: ["read"] },
diff --git a/tests/api-integration/workspace-rbac.test.ts b/tests/api-integration/workspace-rbac.test.ts
index cea4f1d47..8f16f86fb 100644
--- a/tests/api-integration/workspace-rbac.test.ts
+++ b/tests/api-integration/workspace-rbac.test.ts
@@ -202,7 +202,7 @@ describe("API integration: workspace RBAC enforcement", () => {
},
);
- it("returns 403 when the user has no row in workspace_member for the workspace", async () => {
+ it("returns 404 when the user has no row in workspace_member for the workspace", async () => {
const member = await createWorkspaceMember({ role: "admin" });
const { project } = await createProjectFixture({
workspaceId: member.workspace.id,
@@ -224,7 +224,8 @@ describe("API integration: workspace RBAC enforcement", () => {
const response = await postCreateTask(app, project.id);
// workspaceAccess.fromProject runs first and rejects with its own message
- expect(response.status).toBe(403);
+ expect(response.status).toBe(404);
+ expect(await response.text()).toContain("Project not found");
});
it("does not authorize a project through a conflicting workspaceId query", async () => {
@@ -251,7 +252,7 @@ describe("API integration: workspace RBAC enforcement", () => {
},
);
- expect(response.status).toBe(403);
+ expect(response.status).toBe(404);
});
});
diff --git a/tests/api/utils/authorize-asset-access.test.ts b/tests/api/utils/authorize-asset-access.test.ts
index bde1838a0..dd7d023fa 100644
--- a/tests/api/utils/authorize-asset-access.test.ts
+++ b/tests/api/utils/authorize-asset-access.test.ts
@@ -34,11 +34,16 @@ vi.mock("../../../apps/api/src/utils/authenticate-api-request", () => ({
}));
vi.mock("../../../apps/api/src/utils/validate-workspace-access", () => ({
- validateWorkspaceAccess: async (userId: string, workspaceId: string) => {
+ validateWorkspaceAccess: async (
+ userId: string,
+ workspaceId: string,
+ _apiKeyId?: string,
+ options: { notFoundMessage?: string } = {},
+ ) => {
state.validateCalls.push({ userId, workspaceId });
if (userId !== "user-member") {
- throw new HTTPException(403, {
- message: "You don't have access to this workspace",
+ throw new HTTPException(404, {
+ message: options.notFoundMessage ?? "Workspace not found",
});
}
},
@@ -95,19 +100,19 @@ describe("authorizeAssetAccess", () => {
expect(status).toBe(401);
});
- it("rejects an authenticated non-member for a private asset", async () => {
+ it("hides a private asset from an authenticated non-member", async () => {
state.caller = "outsider";
- const status = await statusOf(
- authorizeAssetAccess(context, {
- workspaceId: "workspace-1",
- projectId: "project-1",
- surface: "description",
- isPublic: null,
- }),
- );
+ const error = await authorizeAssetAccess(context, {
+ workspaceId: "workspace-1",
+ projectId: "project-1",
+ surface: "description",
+ isPublic: null,
+ }).catch((caught: unknown) => caught);
- expect(status).toBe(403);
+ expect(error).toBeInstanceOf(HTTPException);
+ expect((error as HTTPException).status).toBe(404);
+ expect((error as HTTPException).message).toBe("Asset not found");
});
it("allows a workspace member to read a private asset", async () => {
@@ -139,7 +144,7 @@ describe("authorizeAssetAccess", () => {
expect(isPublicAsset(asset)).toBe(false);
expect(await statusOf(authorizeAssetAccess(context, asset))).toBe(401);
state.caller = "outsider";
- expect(await statusOf(authorizeAssetAccess(context, asset))).toBe(403);
+ expect(await statusOf(authorizeAssetAccess(context, asset))).toBe(404);
state.caller = "member";
expect(await statusOf(authorizeAssetAccess(context, asset))).toBe(200);
},
@@ -157,7 +162,9 @@ describe("authorizeAssetAccess", () => {
};
expect(isPublicAsset(asset)).toBe(false);
expect(await statusOf(authorizeAssetAccess(context, asset))).toBe(403);
- expect(state.validateCalls).toHaveLength(0);
+ state.caller = "outsider";
+ expect(await statusOf(authorizeAssetAccess(context, asset))).toBe(404);
+ state.caller = "member";
expect(
await statusOf(
authorizeAssetAccess(context, { ...asset, createdBy: "user-member" }),
diff --git a/tests/api/utils/workspace-access-middleware.test.ts b/tests/api/utils/workspace-access-middleware.test.ts
index 9928c894c..106d49baf 100644
--- a/tests/api/utils/workspace-access-middleware.test.ts
+++ b/tests/api/utils/workspace-access-middleware.test.ts
@@ -2,12 +2,14 @@ import { Hono } from "hono";
import { beforeEach, describe, expect, it, vi } from "vite-plus/test";
const { state } = vi.hoisted(() => ({
- state: { lookedUpIds: [] as string[] },
+ state: { lookedUpIds: [] as string[], validatedWorkspaces: [] as string[] },
}));
-const WORKSPACE_BY_TASK: Record<string, string> = {
+const WORKSPACE_BY_ID: Record<string, string> = {
"task-in-my-workspace": "workspace-mine",
"task-in-other-workspace": "workspace-theirs",
+ "project-in-my-workspace": "workspace-mine",
+ "project-in-other-workspace": "workspace-theirs",
};
vi.mock("../../../apps/api/src/database", async () => {
@@ -36,7 +38,7 @@ vi.mock("../../../apps/api/src/database", async () => {
return [];
}
state.lookedUpIds.push(boundId);
- const workspaceId = WORKSPACE_BY_TASK[boundId];
+ const workspaceId = WORKSPACE_BY_ID[boundId];
return workspaceId ? [{ workspaceId }] : [];
},
};
@@ -47,10 +49,16 @@ vi.mock("../../../apps/api/src/database", async () => {
vi.mock("../../../apps/api/src/utils/validate-workspace-access", async () => {
const { HTTPException } = await import("hono/http-exception");
return {
- validateWorkspaceAccess: async (_userId: string, workspaceId: string) => {
+ validateWorkspaceAccess: async (
+ _userId: string,
+ workspaceId: string,
+ _apiKeyId?: string,
+ options: { notFoundMessage?: string } = {},
+ ) => {
+ state.validatedWorkspaces.push(workspaceId);
if (workspaceId !== "workspace-mine") {
- throw new HTTPException(403, {
- message: "You don't have access to this workspace",
+ throw new HTTPException(404, {
+ message: options.notFoundMessage ?? "Workspace not found",
});
}
},
@@ -71,7 +79,16 @@ function buildApp() {
.post("/comment", workspaceAccess.fromTaskId(), async (c) => {
const body = (await c.req.json()) as { taskId: string };
return c.json({ actedOn: body.taskId });
- });
+ })
+ .get("/task/:id", workspaceAccess.fromTask(), async (c) =>
+ c.json({ actedOn: c.req.param("id") }),
+ )
+ .get("/project/:id", workspaceAccess.fromProject(), async (c) =>
+ c.json({ actedOn: c.req.param("id") }),
+ )
+ .get("/projects", workspaceAccess.fromQuery(), async (c) =>
+ c.json({ ok: true }),
+ );
}
function post(query: string, body: Record<string, unknown>) {
@@ -82,9 +99,18 @@ function post(query: string, body: Record<string, unknown>) {
});
}
+function get(path: string) {
+ return buildApp().request(path);
+}
+
+async function snapshot(res: Response) {
+ return { status: res.status, body: await res.text() };
+}
+
describe("workspaceAccess lookup sources", () => {
beforeEach(() => {
state.lookedUpIds.length = 0;
+ state.validatedWorkspaces.length = 0;
});
it("authorizes against the body id the handler will act on", async () => {
@@ -94,10 +120,11 @@ describe("workspaceAccess lookup sources", () => {
expect(state.lookedUpIds).toEqual(["task-in-my-workspace"]);
});
- it("rejects a body id in a workspace the caller cannot access", async () => {
+ it("hides a body id in a workspace the caller cannot access", async () => {
const res = await post("", { taskId: "task-in-other-workspace" });
- expect(res.status).toBe(403);
+ expect(res.status).toBe(404);
+ expect(await res.text()).toBe("Task not found");
expect(state.lookedUpIds).toEqual(["task-in-other-workspace"]);
});
@@ -107,6 +134,73 @@ describe("workspaceAccess lookup sources", () => {
});
expect(state.lookedUpIds).toEqual(["task-in-other-workspace"]);
- expect(res.status).toBe(403);
+ expect(res.status).toBe(404);
+ });
+
+ it("returns 404 for an unknown lookup id without falling through to the query workspace", async () => {
+ const res = await post("?workspaceId=workspace-mine", {
+ taskId: "task-missing",
+ });
+
+ expect(res.status).toBe(404);
+ expect(await res.text()).toBe("Task not found");
+ expect(state.validatedWorkspaces).toEqual([]);
+ });
+
+ it("returns 404 with the resource message for an unknown path id", async () => {
+ const task = await get("/task/task-missing?workspaceId=workspace-mine");
+ const project = await get("/project/project-missing");
+
+ expect(await snapshot(task)).toEqual({
+ status: 404,
+ body: "Task not found",
+ });
+ expect(await snapshot(project)).toEqual({
+ status: 404,
+ body: "Project not found",
+ });
+ expect(state.validatedWorkspaces).toEqual([]);
+ });
+
+ it("answers a foreign task exactly like a missing one", async () => {
+ const foreign = await snapshot(await get("/task/task-in-other-workspace"));
+ const missing = await snapshot(await get("/task/task-missing"));
+
+ expect(foreign).toEqual(missing);
+ expect(foreign.status).toBe(404);
+ });
+
+ it("answers a foreign project exactly like a missing one", async () => {
+ const foreign = await snapshot(
+ await get("/project/project-in-other-workspace"),
+ );
+ const missing = await snapshot(await get("/project/project-missing"));
+
+ expect(foreign).toEqual(missing);
+ expect(foreign.status).toBe(404);
+ });
+
+ it("uses the workspace message for a workspace id taken from the query", async () => {
+ const res = await get("/projects?workspaceId=workspace-theirs");
+
+ expect(await snapshot(res)).toEqual({
+ status: 404,
+ body: "Workspace not found",
+ });
+ });
+
+ it("returns 400 only when no source provides any id", async () => {
+ const lookup = await post("", {});
+ const query = await get("/projects");
+
+ expect(await snapshot(lookup)).toEqual({
+ status: 400,
+ body: "Workspace ID could not be determined",
+ });
+ expect(await snapshot(query)).toEqual({
+ status: 400,
+ body: "Workspace ID could not be determined",
+ });
+ expect(state.lookedUpIds).toEqual([]);
});
});