mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-04-28 03:49:31 +00:00
* fix: pin all GitHub Actions to commit SHAs and version-lock tools Addresses supply chain hardening findings from issue #2982: - Pin all 6 GitHub Actions to full commit SHAs with version comments: - actions/checkout@v4 → SHA 34e1148... - oven-sh/setup-bun@v2 → SHA 0c5077e... - actions/github-script@v7 → SHA f28e40c... - docker/login-action@v3 → SHA c94ce9f... - docker/build-push-action@v6 → SHA 10e90e3... - hashicorp/setup-packer@main → SHA c3d53c5... (v3.2.0) - Pin Packer version: latest → 1.15.0 (in packer-snapshots.yml) - Pin bun version: latest → 1.3.11 (in agent-tarballs.yml) - Pin shellcheck: replace apt-get (no version) with pinned download of v0.10.0 from GitHub releases with SHA256 integrity check These changes eliminate the primary LiteLLM-style attack vector: a compromised action maintainer can no longer force-push malicious code to an existing tag and have it run in CI. Fixes #2982 Agent: issue-fixer Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: exclude import aliases from no-type-assertion lint rule The `JsNamedImportSpecifier` exclusion prevents `import { foo as bar }` patterns from being flagged as type assertions. Previously, any `as` keyword in import/export statements triggered the ban because the GritQL pattern `$value as $type` matched import specifiers as well as actual TypeScript type assertions. This also removes the `as _foo` import aliases in the script-failure-guidance test file (replaced with direct imports + distinctly-named wrapper functions) which were the original manifestation of this bug. All 1944 tests pass. Biome check clean across 169 files. Agent: issue-fixer Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> --------- Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
84 lines
2.8 KiB
YAML
84 lines
2.8 KiB
YAML
name: Gate
|
|
|
|
on:
|
|
issues:
|
|
types: [opened]
|
|
pull_request_target:
|
|
types: [opened]
|
|
|
|
permissions:
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
check-membership:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check org membership and close if external
|
|
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
const sender = context.payload.sender.login;
|
|
const { owner, repo } = context.repo;
|
|
|
|
// Check if user is an org member
|
|
let isMember = false;
|
|
try {
|
|
const { status } = await github.rest.orgs.checkMembershipForUser({
|
|
org: owner,
|
|
username: sender,
|
|
});
|
|
isMember = status === 204 || status === 302;
|
|
} catch (e) {
|
|
isMember = false;
|
|
}
|
|
|
|
if (isMember) {
|
|
console.log(`${sender} is an org member of ${owner}, allowing.`);
|
|
return;
|
|
}
|
|
|
|
// Check if user is a repo collaborator
|
|
let isCollaborator = false;
|
|
try {
|
|
const { status } = await github.rest.repos.checkCollaborator({
|
|
owner,
|
|
repo,
|
|
username: sender,
|
|
});
|
|
isCollaborator = status === 204;
|
|
} catch (e) {
|
|
isCollaborator = false;
|
|
}
|
|
|
|
if (isCollaborator) {
|
|
console.log(`${sender} is a collaborator on ${owner}/${repo}, allowing.`);
|
|
return;
|
|
}
|
|
|
|
console.log(`${sender} is NOT a member or collaborator, closing.`);
|
|
|
|
if (context.payload.issue) {
|
|
await github.rest.issues.update({
|
|
...context.repo,
|
|
issue_number: context.payload.issue.number,
|
|
state: 'closed',
|
|
});
|
|
await github.rest.issues.createComment({
|
|
...context.repo,
|
|
issue_number: context.payload.issue.number,
|
|
body: 'This repository only accepts issues from organization members and collaborators. Your issue has been closed automatically.',
|
|
});
|
|
} else if (context.payload.pull_request) {
|
|
await github.rest.pulls.update({
|
|
...context.repo,
|
|
pull_number: context.payload.pull_request.number,
|
|
state: 'closed',
|
|
});
|
|
await github.rest.issues.createComment({
|
|
...context.repo,
|
|
issue_number: context.payload.pull_request.number,
|
|
body: 'This repository only accepts pull requests from organization members and collaborators. Your PR has been closed automatically.',
|
|
});
|
|
}
|