Skip to content

feat(scan-all): allow scheduling scans for selected projects or repositories#22392

Closed
SoumyaRaikwar wants to merge 6 commits intogoharbor:mainfrom
SoumyaRaikwar:feature/selective-image-scanning
Closed

feat(scan-all): allow scheduling scans for selected projects or repositories#22392
SoumyaRaikwar wants to merge 6 commits intogoharbor:mainfrom
SoumyaRaikwar:feature/selective-image-scanning

Conversation

@SoumyaRaikwar
Copy link
Copy Markdown
Contributor

@SoumyaRaikwar SoumyaRaikwar commented Sep 29, 2025

This PR adds selective scoping to scheduled “Scan All” executions so admins can target only the artifacts they care about. The backend now accepts an optional X-Scan-All-Scope header on schedule create/update that limits the scan set by either:

  1. project_ids: [number, ...]
  2. repositories: [string, ...] (e.g., project/repo or project/repo:tag)

When the header is present, the scan-all execution enumerates only matching artifacts; when omitted, behavior remains unchanged and all artifacts are scanned (backward compatible).

Portal updates: in Interrogation Services > Vulnerability, users can select projects and optionally load and multi-select repositories before saving the schedule; the chosen scope is sent via X-Scan-All-Scope. A small TS fix switches the Project import to the local app model to resolve a type mismatch and ensure a successful Angular build.

Notes/limits:

  • This change scopes scheduled runs only; manual “Scan All now” remains global in this iteration.
  • Invalid or unauthorized targets in the scope are ignored safely.

Build status:

  • Backend: compile succeeds.
  • Frontend: npm ci + ng build succeed after the type import fix.

Related issue

@stonezdj
Copy link
Copy Markdown
Contributor

@SoumyaRaikwar, thanks for your contribution! because it involves much of code change in Harbor, could you please raise a proposal in github.com/goharbor/community?

Comment thread WARP.md Outdated
Copy link
Copy Markdown
Contributor

@stonezdj stonezdj left a comment

Choose a reason for hiding this comment

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

could you please add your proposal in github.com/goharbor/community

@SoumyaRaikwar
Copy link
Copy Markdown
Contributor Author

Hi @stonezdj,

Thank you for the feedback! I've submitted the design proposal to the community repository as requested:

Proposal PR: Add proposal for selective scan-all scope

The proposal includes:

  • Detailed technical specification for the X-Scan-All-Scope header approach
  • Implementation plan covering backend, frontend, and testing
  • Backward compatibility analysis
  • Security considerations and open issues

I'll wait for the community review and approval before proceeding with any further changes to this implementation PR.
Thanks for guiding me through Harbor's contribution process!

@github-actions
Copy link
Copy Markdown

This PR is being marked stale due to a period of inactivty. If this PR is still relevant, please comment or remove the stale label. Otherwise, this PR will close in 30 days.

@github-actions github-actions Bot added the Stale label Dec 10, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 9, 2026

This PR was closed because it has been stalled for 30 days with no activity. If this PR is still relevant, please re-open a new PR against main.

SoumyaRaikwar and others added 5 commits January 18, 2026 20:14
…an-All-Scope header; propagate scope into execution and filter artifacts by project IDs or repositories; add simple UI to choose projects for schedule

Signed-off-by: SoumyaRaikwar <somuraik@gmail.com>
…der sends repositories if chosen

Signed-off-by: SoumyaRaikwar <somuraik@gmail.com>
…2322 by importing the local app Project model instead of the swagger-generated Project type. The ProjectService returns the app model (creation_time: string | Date), which mismatched the swagger model (creation_time: string). This unblocks Angular build for the selective scan scope UI.

Signed-off-by: SoumyaRaikwar <somuraik@gmail.com>
Signed-off-by: Soumya Raikwar <164396577+SoumyaRaikwar@users.noreply.github.com>
Signed-off-by: SoumyaRaikwar <somuraik@gmail.com>
@SoumyaRaikwar
Copy link
Copy Markdown
Contributor Author

SoumyaRaikwar commented Jan 18, 2026

@stonezdj , @Vad1mo
I have pushed the latest changes which include:

  1. Backend: X-Scan-All-Scope header parsing and propagation to the execution manager.
  2. Controller: Logic to filter artifacts based on the scope (Project IDs and Repository names).
  3. Testing: Added comprehensive unit tests covering the scope propagation and artifact filtering, including edge cases. Tests are passing locally.

I've also ensured the changes are backward compatible; if the header is missing, the scan defaults to the global behavior.

I've implemented the changes in the working PR including the backend logic and the UI coverage.

Here are the mockups/screenshots of the UI implementation as requested:

Selective Scan Configuration:
Screenshot from 2026-01-19 00-17-02

@github-actions
Copy link
Copy Markdown

This PR is being marked stale due to a period of inactivty. If this PR is still relevant, please comment or remove the stale label. Otherwise, this PR will close in 30 days.

@github-actions github-actions Bot added the Stale label Mar 23, 2026
@github-actions
Copy link
Copy Markdown

This PR was closed because it has been stalled for 30 days with no activity. If this PR is still relevant, please re-open a new PR against main.

@github-actions github-actions Bot closed this Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow Selective Image Scanning Instead of "Scan All" in Scheduled Interrogation Services

8 participants