Skip to content

Conversation

@ikrispin
Copy link
Contributor

  • Added integration with Open Scan Hub (OSH)
  • Automated Polling System: Implemented OshSchedulerService that automatically polls OSH for new scans on configured packages with configurable intervals and batch processing. NOTE: currently the packages list is empty, meaning all tasks will get scanned - we should decide on a list.
  • API Client Layer: Created OshClient and OshClientService with health checks, JSON/HTML response parsing, and error handling for OSH API interactions.
  • Job Creation Pipeline: Built OshJobCreationService that converts OSH scan results into SAST-AI workflow jobs, including NVR parsing and metadata extraction
  • Report Download Service: Added OshJsonDownloadService to fetch SAST scan results from OSH log files and convert them into processable formats

Retry Algorithm Implementation:

  • Two-Phase Polling System: Enhanced OshSchedulerService with incremental scan processing (new scans) and retry processing (failed scans) in a single polling cycle
  • Retry Configuration: Added OshRetryConfiguration with master toggle, configurable max attempts, exponential backoff timing, retention policies, and batch sizing controls
  • Retry Queue Management: Implemented OshRetryService for the retry lifecycle - recording failures with classification, fetching retry-eligible scans with backoff enforcement, tracking attempt counts and automated cleanup
  • Failure Classification: Built failure categorization system (network errors, JSON parsing, data validation, database issues, API failures) for targeted retry strategies (if needed)
  • Database Layer: Created OshUncollectedScanRepository for core retry operations with database-level locking (FOR UPDATE SKIP LOCKED) for concurrent scheduler safety, and OshRetryStatisticsRepository for monitoring and statistical queries
  • Admin Monitoring: Added OshAdminResource with comprehensive admin endpoints for retry queue status, statistics, manual cleanup operations, and troubleshooting tools
  • Concurrent Safety: Implemented database-level row locking (FOR UPDATE SKIP LOCKED) and optimistic locking in case we need to handle multiple scheduler instances safely, with additional protection against concurrent manual database access
  • Retention Management: Automated cleanup of expired retry records and scans exceeding maximum attempts to prevent unbounded growth

Data Model Extensions:

  • Extended Job entity with oshScanId field and unique constraints to prevent duplicate processing
  • Added OshSchedulerCursor entity for tracking polling state and resuming from where it left off
  • Added OshUncollectedScan entity for retry queue management with attempt tracking, failure classification, and JSON scan data storage
  • Enhanced JobCreationDto to support OSH scan data input with transient JSON content handling

Key Capabilities:

  • Monitors specific Red Hat packages for new security scans
  • Automatically creates SAST-AI analysis jobs from OSH findings
  • Maintains polling state across application restarts
  • Resilient Processing: Failed scans are automatically retried with backoff strategies
  • Failure Recovery: System can recover from temporary network issues, API failures, and database problems without losing scan data
  • Configurable batch processing with rate limiting and timeout controls
  • Production Monitoring: Comprehensive admin interface for monitoring retry queue health, performance metrics, and manual intervention capabilities

…hecks and configuration validation

implement sequential scan ID discovery for batch processing
…ry processing), configurable backoff, retry limits, retention policies, failure classification and automatic cleanup
…s for retry queue inspection and statistics and manual cleanup operations and polling triggers for troubleshooting
@ikrispin ikrispin requested a review from JudeNiroshan October 20, 2025 08:23
@JudeNiroshan JudeNiroshan requested a review from Yael-F October 20, 2025 14:16
@github-actions
Copy link

AI Code Review Skipped: This PR is too large for automated review (diff size exceeds 100KB).

@github-actions
Copy link

AI Code Review Skipped: This PR is too large for automated review (diff size exceeds 100KB).

Signed-off-by: Jude Niroshan <[email protected]>
@github-actions
Copy link

AI Code Review Skipped: This PR is too large for automated review (diff size exceeds 100KB).

@github-actions
Copy link

AI Code Review Skipped: This PR is too large for automated review (diff size exceeds 100KB).

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

AI Code Review Skipped: This PR is too large for automated review (diff size exceeds 100KB).

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

AI Code Review Skipped: This PR is too large for automated review (diff size exceeds 100KB).

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 3, 2025

@JudeNiroshan JudeNiroshan merged commit 67a0d68 into main Nov 3, 2025
3 checks passed
@JudeNiroshan JudeNiroshan deleted the feature/osh-integration branch November 3, 2025 10:36
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.

3 participants