Skip to content

chore: add repository synchronization gates - #13

Open
anurag6569201 wants to merge 1 commit into
qa/agent-triggerdotdev-trigger-dev/pr-08-4859/basefrom
qa/agent-triggerdotdev-trigger-dev/pr-08-4859/head
Open

chore: add repository synchronization gates#13
anurag6569201 wants to merge 1 commit into
qa/agent-triggerdotdev-trigger-dev/pr-08-4859/basefrom
qa/agent-triggerdotdev-trigger-dev/pr-08-4859/head

Conversation

@anurag6569201

Copy link
Copy Markdown

Summary

Adds disabled repository synchronization workflows and guards merge-queue entries against unsynchronized changes. The workflows remain inactive until the repository configuration is explicitly enabled.

Source merge-base: 43ecf15f80277c0eb931c08ddd89de55179cc795
Source head: 892e95c80b12bd51c44171f3fcaa2b729cdcc48e

@shipwright-agent

Copy link
Copy Markdown

⛔ Shipwright · Blocked

Recommendation: do not merge PR #13 · Tier T3
Checks: 0 total · 0 needing attention

Next step: resolve the blocking findings before merge.

Findings (8)

  • CRITICAL The wait loop runs 'mono/tooling/plan-repo-ops-outbound.sh' and then parses 'native_count' from its output file. · .github/workflows/repo-ops-sync-gate.yml:70
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • CRITICAL The workflow embeds the GitHub token directly into the clone URL: 'https://x-access-token:${PUBLIC_TOKEN}@github.com/...'. · .github/workflows/repo-ops-sync-gate.yml:66
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • CRITICAL The same token-in-URL pattern is used for the private mono repository with the GitHub App token: 'https://x-access-token:${APP_TOKEN}@github.com/${MONO_REPOSITORY}.git'. · .github/workflows/repo-ops-sync-gate.yml:68
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • HIGH The 'plan-repo-ops-outbound.sh' script is invoked with positional arguments 'mono public "$(git -C mono rev-parse origin/main)" "$MONO_BASELINE" "$PUBLIC_BASELINE" "$output"', but · .github/workflows/repo-ops-sync-gate.yml:73
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • HIGH The 'dispatch' workflow has a 'concurrency' group with 'cancel-in-progress: false', which means multiple pushes to main will queue up dispatches. · .github/workflows/dispatch-repo-ops-sync.yml:10
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • HIGH The 'dispatch' job in the dispatch workflow uses 'permission-contents: write' for the GitHub App token, but the workflow-level permissions are 'contents: read'. · .github/workflows/dispatch-repo-ops-sync.yml:24
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • HIGH The 'Reject reserved RepoOps trailers' step only checks the PR title and body for 'OSS-RevId:' or 'Mono-RevId:' trailers. · .github/workflows/repo-ops-sync-gate.yml:24
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • LOW The merge_group gate job condition is 'github.event_name == 'pull_request' || vars.REPO_OPS_SYNC_ENABLED == 'true''. · .github/workflows/repo-ops-sync-gate.yml:15
    • Fix: Fix the review finding before release.

Fireworks usage: 8,370 input · 1,333 output · 9,703 total tokens · $0.0027 · 22s · 0 fix iteration(s)

Open the Shipwright check for full evidence and the audit bundle. Use /shipwright rerun to verify again.


for _ in $(seq 1 60); do
git -C public fetch --no-tags origin \
+refs/heads/main:refs/remotes/origin/main

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · CRITICAL

The wait loop runs 'mono/tooling/plan-repo-ops-outbound.sh' and then parses 'native_count' from its output file.

Impact: The wait loop runs 'mono/tooling/plan-repo-ops-outbound.sh' and then parses 'native_count' from its output file. If the script fails, 'set -euo pipefail' will abort the step, but the temporary output file is never cleaned up because 'rm -f "$output"' is skipped on failure. More importantly, if the script produces no 'native_count=' line, 'grep' returns non-zero and the step fails immediately rather than retrying, wh…

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

git clone --filter=blob:none --no-tags \
"https://x-access-token:${PUBLIC_TOKEN}@github.com/${PUBLIC_REPOSITORY}.git" public
git clone --filter=blob:none --no-tags \
"https://x-access-token:${APP_TOKEN}@github.com/${MONO_REPOSITORY}.git" mono

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · CRITICAL

The workflow embeds the GitHub token directly into the clone URL: 'https://x-access-token:${PUBLIC_TOKEN}@github.com/...'.

Impact: The workflow embeds the GitHub token directly into the clone URL: 'https://x-access-token:${PUBLIC_TOKEN}@github.com/...'. GitHub Actions automatically redacts registered secrets in logs, but 'PUBLIC_TOKEN' is 'github.token', which is not a registered secret and may not be redacted. If the clone command fails or is echoed by 'set -x'/debug logging, the token can leak into workflow logs. Use 'git -c http.extraheader=…

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

git clone --filter=blob:none --no-tags \
"https://x-access-token:${APP_TOKEN}@github.com/${MONO_REPOSITORY}.git" mono

for _ in $(seq 1 60); do

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · CRITICAL

The same token-in-URL pattern is used for the private mono repository with the GitHub App token: 'https://x-access-token:${APP_TOKEN}@github.com/${MONO_REPOSITORY}.git'.

Impact: The same token-in-URL pattern is used for the private mono repository with the GitHub App token: 'https://x-access-token:${APP_TOKEN}@github.com/${MONO_REPOSITORY}.git'. The App token has 'contents: read' on the private mono repository. If this URL leaks in logs, an attacker could read the entire private mono repository, which likely contains proprietary or unreleased code. This is a high-impact secret exposure risk.

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

+refs/heads/main:refs/remotes/origin/main
git -C mono fetch --no-tags origin \
+refs/heads/main:refs/remotes/origin/main
output="$(mktemp)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · HIGH

The 'plan-repo-ops-outbound.sh' script is invoked with positional arguments 'mono public "$(git -C mono rev-parse origin/main)" "$MONO_BASELINE" "$PUBLIC_BASELINE" "$output"', but

Impact: The 'plan-repo-ops-outbound.sh' script is invoked with positional arguments 'mono public "$(git -C mono rev-parse origin/main)" "$MONO_BASELINE" "$PUBLIC_BASELINE" "$output"', but there is no documentation or comment explaining what these arguments mean. A new hire would have to read the script in the private mono repository to understand the contract. The variable names 'MONO_BASELINE' and 'PUBLIC_BASELINE' are opa…

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.


permissions:
contents: read

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · HIGH

The 'dispatch' workflow has a 'concurrency' group with 'cancel-in-progress: false', which means multiple pushes to main will queue up dispatches.

Impact: The 'dispatch' workflow has a 'concurrency' group with 'cancel-in-progress: false', which means multiple pushes to main will queue up dispatches. If the private sync worker is slow, this could create a backlog of dispatches. There is no comment explaining why 'cancel-in-progress' is false, which is unusual for a dispatch workflow where only the latest SHA matters.

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ vars.REPO_OPS_DISPATCHER_APP_ID }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · HIGH

The 'dispatch' job in the dispatch workflow uses 'permission-contents: write' for the GitHub App token, but the workflow-level permissions are 'contents: read'.

Impact: The 'dispatch' job in the dispatch workflow uses 'permission-contents: write' for the GitHub App token, but the workflow-level permissions are 'contents: read'. The App token is created with write access to the private mono repository, and the workflow dispatches a 'repository_dispatch' event to that repository. If the 'MONO_REPOSITORY' secret is ever compromised or the regex validation is bypassed, an attacker coul…

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

PR_BODY: ${{ github.event.pull_request.body }}
run: |
python3 - <<'PY'
import os

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · HIGH

The 'Reject reserved RepoOps trailers' step only checks the PR title and body for 'OSS-RevId:' or 'Mono-RevId:' trailers.

Impact: The 'Reject reserved RepoOps trailers' step only checks the PR title and body for 'OSS-RevId:' or 'Mono-RevId:' trailers. It does not check commit messages, which are a common place for trailers. An attacker could add a reserved trailer to a commit message and potentially confuse the sync tooling. The regex is also case-sensitive and anchored to line start, so 'oss-revid:' or leading whitespace would bypass the chec…

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

gate:
if: github.event_name == 'pull_request' || vars.REPO_OPS_SYNC_ENABLED == 'true'
timeout-minutes: 15
runs-on: ubuntu-latest

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · LOW

The merge_group gate job condition is 'github.event_name == 'pull_request' || vars.REPO_OPS_SYNC_ENABLED == 'true''.

Impact: The merge_group gate job condition is 'github.event_name == 'pull_request' || vars.REPO_OPS_SYNC_ENABLED == 'true''. For merge_group events, the first condition is false, so the job only runs when the repository variable is enabled. However, the subsequent steps that create the app token and wait for pending mono changes are gated only on 'github.event_name == 'merge_group''. If the variable is disabled, the job is…

Suggested fix: Fix the review finding before release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant