Skip to content

Commit 22cf036

Browse files
committed
fix(resolve): strip orgSlug from projectData to prevent JSON output leak
ProjectWithOrg (from findProjectsBySlug) carries an extra orgSlug field. When callers spread projectData into JSON output, this leaked an inconsistent field depending on the resolution path. Destructure out orgSlug before assigning to projectData so it's a clean SentryProject.
1 parent 4bf9cb8 commit 22cf036

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/lib/resolve-target.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,10 +1006,13 @@ export async function resolveProjectBySlug(
10061006
);
10071007
}
10081008

1009+
// Strip orgSlug (from ProjectWithOrg) so projectData is a clean SentryProject
1010+
// — prevents leaking the extra field into JSON output when callers spread it.
1011+
const { orgSlug: _org, ...projectData } = foundProject;
10091012
return {
10101013
org: foundProject.orgSlug,
10111014
project: foundProject.slug,
1012-
projectData: foundProject,
1015+
projectData,
10131016
};
10141017
}
10151018

@@ -1154,7 +1157,12 @@ export async function resolveOrgProjectTarget(
11541157
}
11551158

11561159
const match = projects[0] as (typeof projects)[number];
1157-
return { org: match.orgSlug, project: match.slug, projectData: match };
1160+
const { orgSlug: _org, ...matchData } = match;
1161+
return {
1162+
org: match.orgSlug,
1163+
project: match.slug,
1164+
projectData: matchData,
1165+
};
11581166
}
11591167

11601168
case "auto-detect": {

0 commit comments

Comments
 (0)