Skip to content

RHCLOUD-48760: Add SEC-MON-REQ-1 security logging - #573

Open
platex-rehor-bot wants to merge 1 commit into
RedHatInsights:masterfrom
platex-rehor-bot:bot/RHCLOUD-48760
Open

RHCLOUD-48760: Add SEC-MON-REQ-1 security logging#573
platex-rehor-bot wants to merge 1 commit into
RedHatInsights:masterfrom
platex-rehor-bot:bot/RHCLOUD-48760

Conversation

@platex-rehor-bot

@platex-rehor-bot platex-rehor-bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

What?

Implements SEC-MON-REQ-1 security logging compliance for the Payload Tracker service (RHCLOUD-48760).

Why?

SEC-MON-REQ-1 requires structured security logging for Events of Interest (EOI) to meet compliance requirements.

How?

New internal/securitylog package with structured helpers using logrus. All security events include the 5 required fields: action, resource_type, resource_id, outcome, and principal (org_id, user_id, type). Events are marked with security_event: true for log aggregation.

Covered EOI categories:

  • EOI-5 (Lifecycle): STARTUP/SHUTDOWN events for both pt-api and pt-consumer binaries
  • EOI-7 (Authentication failures): Missing, invalid base64, or malformed identity headers in checkForRole
  • EOI-8 (Authorization failures): Required role not found in associate identity
  • Data access: Successful archive link retrieval (the only auth-protected endpoint)

Excluded (with justification):

  • EOI-1 CRUD on read-only API endpoints (all GET, high-volume, no mutations)
  • EOI-4 (no RBAC system beyond role check)
  • EOI-6 (authentication handled upstream)

Also adds graceful shutdown signal handling to pt-api so SHUTDOWN events are reliably captured.

Testing

  • 10 new unit tests for securitylog package (principal extraction, log output verification)
  • All 31 existing endpoint tests pass
  • Build verified: make build-all succeeds

Anything Else?

Principal extraction supports User, Associate, and ServiceAccount identity types from the x-rh-identity header. The package follows the same pattern used in other SEC-MON-REQ-1 implementations across the platform (insights-ingress-go, export-service-go, chrome-service-backend).

Secure Coding Practices Checklist Link

Secure Coding Checklist

  • Input Validation
  • Output Encoding
  • Authentication and Password Management
  • Session Management
  • Access Control
  • Cryptographic Practices
  • Error Handling and Logging
  • Data Protection
  • Communication Security
  • System Configuration
  • Database Security
  • File Management
  • Memory Management
  • General Coding Practices

RHCLOUD-48760

Add structured security event logging per SEC-MON-REQ-1 compliance:
- EOI-5: STARTUP/SHUTDOWN lifecycle events for pt-api and pt-consumer
- EOI-7: Authentication failure logging in checkForRole
- EOI-8: Authorization failure logging for missing roles
- Data access logging for archive link retrieval

New securitylog package with helpers for auth, authz, lifecycle,
and data access events. All events include required fields: action,
resource_type, resource_id, outcome, and principal. Graceful shutdown
added to pt-api for proper SHUTDOWN event capture.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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