Skip to content

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

Merged
shahzadhaider1 merged 4 commits into
trufflesecurity:mainfrom
hibare:main
Jul 8, 2026
Merged

feat: Support archived repo exclusion from GH org scans#4875
shahzadhaider1 merged 4 commits into
trufflesecurity:mainfrom
hibare:main

Conversation

@hibare

@hibare hibare commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

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

Low Risk
Opt-in flag defaults off; change is limited to skipping repos during enumeration with existing fork/include logic unchanged when disabled.

Overview
Adds optional archived repository exclusion for GitHub org (and other list-based) scans via --exclude-archived, wired through CLI, GithubConfig, protobuf exclude_archived, and the GitHub source connection.

During repo enumeration in processRepos, archived repos are skipped when the flag is set (after the existing fork filter). Enumeration logs now include archived and skipped counts. Behavior is unchanged when the flag is omitted.

README and man page document the flag; unit tests cover archived filtering and interaction with --include-forks, plus an integration test comparing repo counts with the flag on vs off.

Reviewed by Cursor Bugbot for commit d651a67. 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 a review from a team as a code owner April 8, 2026 16:34
@hibare
hibare requested review from a team April 8, 2026 16:34
Comment thread pkg/sources/github/repo.go
@hibare
hibare marked this pull request as ready for review April 8, 2026 16:55

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread pkg/sources/github/repo.go
@MuneebUllahKhan222

Copy link
Copy Markdown
Contributor

Hi @hibare,
Thanks for the contributions.

Can you please address the bugbot comments.

@hibare

hibare commented May 15, 2026

Copy link
Copy Markdown
Contributor Author

@MuneebUllahKhan222 All comments are addressed. Please review the changes.

@hibare

hibare commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@MuneebUllahKhan222 Could you please review the PR. Thank you!

@hibare
hibare force-pushed the main branch 2 times, most recently from c2d3f64 to e8ae356 Compare July 4, 2026 10:30
@hibare

hibare commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@MuneebUllahKhan222 Wondering if you could give a quick review on this one before it diverges a lot

@MuneebUllahKhan222

Copy link
Copy Markdown
Contributor

@MuneebUllahKhan222 Wondering if you could give a quick review on this one before it diverges a lot

@hibare Unfortunately, I can't provide a Scanning approval on your PR since I'm not part of that team. However, I've already pinged Team Scanning to take a look. Hopefully, someone from the team will review it soon.

@hibare

hibare commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Thank you @MuneebUllahKhan222

@hibare

hibare commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

I think the PR needs to go through some checks. Could you please approve workflow runs @mustansir14 @camgunz @kashifkhan0771 ?

@MuneebUllahKhan222

MuneebUllahKhan222 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

I think the PR needs to go through some checks. Could you please approve workflow runs @mustansir14 @camgunz @kashifkhan0771 ?

I have approve the workflows once they pass I will merge the PR.

Thanks for your contribution🚀

Edit: Can you run make man and push the updated files so the check in CI run successfully.

Shubham Hibare added 2 commits July 7, 2026 22:15
Signed-off-by: Shubham Hibare <Shubham.Hibare@thomsonreuters.com>
Signed-off-by: Shubham Hibare <Shubham.Hibare@thomsonreuters.com>
Signed-off-by: Shubham Hibare <shubham@hibare.in>
@hibare

hibare commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

I think the PR needs to go through some checks. Could you please approve workflow runs @mustansir14 @camgunz @kashifkhan0771 ?

I have approve the workflows once they pass I will merge the PR.

Thanks for your contribution🚀

Edit: Can you run make man and push the updated files so the check in CI run successfully.

Updated man page. Thank you!

@shahzadhaider1
shahzadhaider1 merged commit d7dcc6d into trufflesecurity:main Jul 8, 2026
16 checks passed
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.

6 participants