-
Notifications
You must be signed in to change notification settings - Fork 3
refactor code structure #378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Moved pkg/gitlab/runners/list.go into list/ subfolder and integrated processor.go - Renamed processor_test.go to list_test.go with all tests passing - Moved pkg/gitlab/cicd/yaml.go into yaml/ subfolder for consistency - Removed duplicate/redundant files - Fixed golangci-lint issue: changed if/else chain to switch statement - All tests passing, build successful
- Update gl cicd yaml command to read gitlab/token flags at runtime - Update gl runners list command to read gitlab/token flags at runtime - Update gl runners exploit command to read gitlab/token flags at runtime - Fix issue where flags passed at command creation were empty strings - All e2e tests now pass successfully
|
@copilot i want you to analyze how we can integrate /workspaces/pipeleak/src/pipeleak/pkg/gitlab/scan with /workspaces/pipeleak/src/pipeleak/pkg/scan and in /workspaces/pipeleak/src/pipeleak/pkg/scanner like the other scan commands do. Then refactor gitlab scan to remove duplicate logic. |
* Initial plan * refactor: integrate GitLab scan with common scan packages Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com> * fix: use 'note' field instead of 'message' for dotenv findings Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR performs a comprehensive refactoring to improve code structure by separating concerns between CLI command definitions (cmd/) and business logic (pkg/). The refactoring follows a clear pattern of moving command implementations from pkg/ packages into corresponding cmd/ packages, while business logic remains in or moves to pkg/ packages with renamed exported functions (e.g., FetchVariables → RunFetchVariables).
Key changes include:
- Separation of CLI command definitions from business logic across GitLab, Gitea, and documentation commands
- Reorganization of runner, renovate, and other GitLab subcommands into proper cmd/ and pkg/ hierarchies
- Creation of new shared packages for artifact processing, log scanning, and result reporting
- Removal of obsolete internal processor packages and unused command wrapper files
- Addition of comprehensive test coverage for new code structures
Reviewed changes
Copilot reviewed 55 out of 57 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/pipeleak/tests/e2e/gitlab_commands_test.go |
Updated test to use new --project flag instead of --repo |
src/pipeleak/pkg/gitlab/vuln/vuln.go |
Moved command definition to cmd/, business logic stays in pkg/ with RunCheckVulns |
src/pipeleak/pkg/gitlab/variables/variables.go |
Refactored to export RunFetchVariables function for cmd/ layer |
src/pipeleak/pkg/gitlab/variables/scanner.go |
Removed unused wrapper file |
src/pipeleak/pkg/gitlab/shodan/shodan.go |
Exported RunShodan function, removed command definition |
src/pipeleak/pkg/gitlab/shodan/scanner.go |
Removed unused wrapper file |
src/pipeleak/pkg/gitlab/secureFiles/secure_files.go |
Exported RunFetchSecureFiles function |
src/pipeleak/pkg/gitlab/schedule/schedule.go |
Exported RunFetchSchedules function |
src/pipeleak/pkg/gitlab/schedule/scanner.go |
Removed unused wrapper file |
src/pipeleak/pkg/gitlab/scan/scanner.go |
Updated import paths from cmd/gitlab/util to pkg/gitlab/util |
src/pipeleak/pkg/gitlab/scan/queue.go |
Refactored to use new scan packages (artifact, logline, result) |
src/pipeleak/pkg/gitlab/scan/pipeline.go |
Updated to use new runner.InitScanner function |
src/pipeleak/pkg/gitlab/scan/internal/processor/*.go |
Removed obsolete internal processor files |
src/pipeleak/pkg/gitlab/runners/ |
Reorganized into list/ and exploit/ subdirectories with proper separation |
src/pipeleak/pkg/gitlab/renovate/ |
Restructured with enum/, autodiscovery/, and privesc/ subdirectories |
src/pipeleak/pkg/gitlab/register/register.go |
Removed, moved to cmd/ layer |
src/pipeleak/pkg/gitlab/enum/enum.go |
Exported RunEnum function |
src/pipeleak/pkg/gitlab/cicd/ |
Restructured with yaml/ subdirectory |
src/pipeleak/pkg/gitea/enum/enum.go |
Removed command definition, kept business logic |
src/pipeleak/pkg/docs/generator.go |
Created new documentation generator package |
src/pipeleak/main.go |
Removed unused TerminalRestoringWriter code |
src/pipeleak/cmd/gitlab/*/ |
Added command layer files that delegate to pkg/ functions |
src/pipeleak/cmd/gitlab/util/util.go |
Removed, functionality moved to pkg/gitlab/util |
src/pipeleak/cmd/gitlab/nist/nist.go |
Removed unused wrapper file |
src/pipeleak/cmd/docs/docs.go |
Simplified to use new pkg/docs package |
.github/copilot-instructions.md |
Updated project structure documentation |
| groupRunners := listGroupRunners(git) | ||
| runnerMap := MergeRunnerMaps(projectRunners, groupRunners) | ||
|
|
||
| log.Info().Msg("Listing avaialable runenrs: Runners are only shown once, even when available by multiple source e,g, group or project") |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling errors in log message: "avaialable" should be "available" and "runenrs" should be "runners". Also, "e,g" should be "e.g."
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot You are Copilot working on CompassSecurity/pipeleak (Go). Your goal: find packages under src/pipeleak that lack meaningful unit tests and add only meaningful *_test.go files next to those packages. Do this concisely: Scope: src/pipeleak only. Do NOT edit e2e tests or files outside src/pipeleak. |
No description provided.