Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
fix(release): trust the publish stage's issue only on the App's commit
jkomyno committed
Nov 5, 2026 at 19:52 UTC
d41beed9216fb52319852a0d371157e31027b850
4 files changed
+31
-6
.github/workflows/sdk.release.yml
+1
@@ -247,6 +247,7 @@ jobs:
247
id: approve
248
env:
249
SDK_READ_TOKEN: ${{ github.token }}
250
+ SDK_RELEASE_APP_SLUG: ${{ vars.SDK_RELEASE_APP_SLUG }}
251
run: bun scripts/sdk-release/candidates.ts approve
252
253
publish-npm:
scripts/sdk-release/approval.ts
+6
-3
@@ -119,17 +119,20 @@ export const readReleasePull = (number: number) =>
119
* Whether the release PR head is the release App's own verified commit on the planned source. A
120
* person can sign a commit that names the bot as author, but not one it committed.
121
*/
122
-export const isReleaseAppHead = (pull: Pull, batch: ReleaseBatch, appSlug: string) =>
122
+export const isReleaseAppCommit = (sha: string, inputBase: string, appSlug: string) =>
123
Effect.map(
124
- request('GET', `${REPOSITORY_PATH}/commits/${pull.head.sha}`, HeadCommit),
124
+ request('GET', `${REPOSITORY_PATH}/commits/${sha}`, HeadCommit),
125
head =>
126
head.author?.login === `${appSlug}[bot]` &&
127
head.committer?.login === `${appSlug}[bot]` &&
128
head.commit.verification.verified &&
129
head.parents.length === 1 &&
130
- head.parents[0].sha === batch.inputBase
130
+ head.parents[0].sha === inputBase
131
);
132
133
+export const isReleaseAppHead = (pull: Pull, batch: ReleaseBatch, appSlug: string) =>
134
+ isReleaseAppCommit(pull.head.sha, batch.inputBase, appSlug);
135
+
136
/**
137
* The request issue named by a release PR's plan, only when the release App committed that plan.
138
* Anyone with write access can push a `sdk-release/batch-*` branch, so its plan cannot pick the
scripts/sdk-release/candidates.ts
+9
-2
@@ -1,5 +1,6 @@
1
import { Config, Effect, FileSystem, Option, Path, Schema, Stdio } from 'effect';
2
import { getPackages } from '@manypkg/get-packages';
3
+import { isReleaseAppCommit } from './approval';
4
import {
5
ActionArtifact,
6
ApprovedCandidates,
@@ -357,6 +358,7 @@ const reportMode = (language: Language) =>
358
359
const ApproveEnvironment = Config.all({
360
sha: Config.schema(Sha, 'GITHUB_SHA'),
361
+ appSlug: Config.String('SDK_RELEASE_APP_SLUG'),
362
ref: Config.String('GITHUB_REF'),
363
outputPath: Config.String('GITHUB_OUTPUT'),
364
summaryPath: Config.String('GITHUB_STEP_SUMMARY'),
@@ -381,8 +383,13 @@ const approveMode = Effect.gen(function* () {
383
env.ref === `refs/tags/${releaseTag(batch.id)}`,
384
`Approved candidates are pinned only by the release tag of batch ${batch.id}`
385
);
384
- // Written first, so the publish status still reaches the request issue if adoption fails.
385
- yield* appendFile(env.outputPath, `issue=${batch.issue}\n`);
386
+ // Written first, so the publish status still reaches the request issue if adoption fails. Only
387
+ // a plan the release App committed may name that issue: the tag ruleset should stop anyone
388
+ // else from pushing a release tag, and this keeps a forged one from steering the bot.
389
+ const trusted = yield* isReleaseAppCommit(env.sha, batch.inputBase, env.appSlug).pipe(
390
+ Effect.provide(GitHub.layer(env.token))
391
+ );
392
+ if (trusted) yield* appendFile(env.outputPath, `issue=${batch.issue}\n`);
393
const approved: Record<string, ApprovedCandidate> = {};
394
yield* Effect.gen(function* () {
395
for (const language of batchLanguages(batch)) {
test/sdk-release-candidate-pin.test.ts
+15
-1
@@ -40,7 +40,7 @@ const approvedArchive = async () => {
40
/** The tag run's pinning job for tag run 9, run as the CLI on a fresh checkout. */
41
const pinAttempt = async (
42
archive: { zip: string; digest: string },
43
- options: { expired?: boolean } = {}
43
+ options: { expired?: boolean; headAuthor?: string } = {}
44
) => {
45
const directory = await directories.create();
46
await writeText(`${directory}/package.json`, JSON.stringify({ name: 'root', private: true }));
@@ -50,7 +50,14 @@ const pinAttempt = async (
50
JSON.stringify({ name: '@composio/core', version: '1.0.1' })
51
);
52
await writeText(`${directory}/.github/sdk-release-plan.json`, JSON.stringify(batch));
53
+ const app = 'sdk-release-app[bot]';
54
const routes = {
55
+ [`/commits/${head}`]: {
56
+ author: { login: options.headAuthor ?? app },
57
+ committer: { login: options.headAuthor ?? app },
58
+ commit: { verification: { verified: true } },
59
+ parents: [{ sha: batch.inputBase }],
60
+ },
61
'/actions/workflows/sdk.release.candidates.yml/runs': {
62
workflow_runs: [
63
{
@@ -132,6 +139,7 @@ globalThis.fetch = async input => {
139
GITHUB_OUTPUT: output,
140
GITHUB_STEP_SUMMARY: summary,
141
SDK_READ_TOKEN: 'fixture',
142
+ SDK_RELEASE_APP_SLUG: 'sdk-release-app',
143
SDK_RELEASE_TOKEN: '',
144
},
145
}
@@ -166,3 +174,9 @@ test('a failed adoption still names the request issue, so the publish status rea
174
expect(pinned.exitCode).not.toBe(0);
175
expect(pinned.output).toBe('issue=8\n');
176
});
177
+
178
+test('a release tag on a commit the App did not make names no issue for the bot to write to', async () => {
179
+ const pinned = await pinAttempt(await approvedArchive(), { expired: true, headAuthor: 'writer' });
180
+ expect(pinned.exitCode).not.toBe(0);
181
+ expect(pinned.output).toBe('');
182
+});