Skip to content

feat: Support archived repo exclusion from GH org scans#4875

Open
hibare wants to merge 1 commit intotrufflesecurity:mainfrom
hibare:main
Open

feat: Support archived repo exclusion from GH org scans#4875
hibare wants to merge 1 commit intotrufflesecurity:mainfrom
hibare:main

Conversation

@hibare
Copy link
Copy Markdown
Contributor

@hibare hibare commented Apr 8, 2026

Description:

Adds optional exclusion of archived GitHub repositories from organization scans. Introduces the --exclude-archived flag on the github subcommand, a matching exclude_archived field on the GitHub source protobuf (sourcespb.GitHub), and wiring through GithubConfig, the engine, and org repo enumeration so archived repos are skipped when the option is enabled. Default behavior is unchanged when the flag is not set. Includes unit tests, an integration test case, and README usage.

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

Note

Medium Risk
Primarily adds an opt-in filtering path, but it changes GitHub scan enumeration behavior and extends the GitHub source protobuf, which could affect config compatibility and scan coverage when enabled.

Overview
Adds an opt-in --exclude-archived option for GitHub org scans to skip archived repositories during repo enumeration.

Wires the new setting end-to-end (CLI → sources.GithubConfig → engine → sourcespb.GitHub/sources.proto), updates repo-processing logic to filter archived repos and log archived counts, and documents the new usage in README.md.

Includes coverage via new unit tests for org repo listing behavior and an integration test asserting fewer repos are scanned when archived repos exist.

Reviewed by Cursor Bugbot for commit 6ecbeb6. Bugbot is set up for automated code reviews on this repo. Configure here.

@hibare hibare requested a review from a team April 8, 2026 16:34
@hibare hibare marked this pull request as draft April 8, 2026 16:34
@hibare hibare requested review from a team as code owners April 8, 2026 16:34
continue
}
numArchived++
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Archived repo counter incremented only when not excluding

Low Severity

The numArchived counter is placed after the continue statement inside the ExcludeArchived check, so it's only incremented when archived repos are included (not excluded). When ExcludeArchived is true, repos are skipped via continue before numArchived++ runs, making the final log line always report num_archived=0 — exactly when you'd most want to know how many were skipped.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 64137fa. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This behaviour is inline with how numForks is counted.

@hibare hibare marked this pull request as ready for review April 8, 2026 16:55
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6ecbeb6. Configure here.

continue
}
numArchived++
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fork counter overcounts when archived repos excluded

Low Severity

When a repo is both a fork and archived, with IncludeForks=true and ExcludeArchived=true, numForks is incremented at line 268 but then the repo is skipped by the archived continue at line 274 before reaching numRepos++. This makes numForks count repos that were never actually included, so numForks can exceed numRepos in the final log output—an impossible state prior to this change.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6ecbeb6. Configure here.

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