Skip to content

Add log entry when versions are suppressed#329

Open
reiniercriel wants to merge 4 commits intomainfrom
feat/min-package-log
Open

Add log entry when versions are suppressed#329
reiniercriel wants to merge 4 commits intomainfrom
feat/min-package-log

Conversation

@reiniercriel
Copy link
Copy Markdown
Contributor

@reiniercriel reiniercriel commented Apr 22, 2026

Summary by Aikido

Security Issues: 0 🔍 Quality Issues: 3 Resolved Issues: 0

🚀 New Features

  • Added end-to-end minimum-package-age log event support across backend and frontend

⚡ Enhancements

  • Integrated minimum-package-age entries into Logs list and added detail view
  • Exposed new daemon API and client methods for min-package-age events
  • Implemented deduplicating min-package-age event store with stable ecosystem IDs

More info

Comment thread ui/daemon/client.go
return out, nil
}

// ListMinPackageAgeEvents fetches GET /v1/min-package-age-events?limit=N.
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.

ListMinPackageAgeEvents and GetMinPackageAgeEvent duplicate the request/response handling logic already used by ListTlsEvents/GetTlsEvent; consider extracting a shared helper to avoid repeating nearly identical code.

Details

✨ AI Reasoning
​Two new API helper functions were added that follow the exact same control flow and error handling as existing ListTlsEvents/GetTlsEvent: they validate input (for get), perform a doRequest, check StatusCode, decode JSON into a slice/struct, sort (for list), and return. This is a repeated business operation (fetching paginated events) implemented twice with only the endpoint path and Go type differing. Consolidation into a shared helper (parameterized by path and target type) would avoid duplicating the same request/response logic and reduce maintenance burden when behaviour changes (timeouts, decoding, status handling). The duplication was introduced by this change; it appears in the same file and is substantial (entire function bodies are near-identical).

🔧 How do I fix it?
Delete extra code. Extract repeated code sequences into reusable functions or methods. Use loops or data structures to eliminate repetitive patterns.

Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

Comment thread ui/daemon/types.go
return nil
}

func (e *MinPackageAgeEvent) Validate() error {
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.

MinPackageAgeEvent.Validate duplicates existing Validate logic (repeated required-field checks). Consider consolidating common validation to avoid duplicated business logic.

Details

✨ AI Reasoning
​A new event type and its Validate method were added that duplicate the same field-presence validation pattern already present for other event types in this file. This repeats non-trivial business logic (required-field checks) in the same source, increasing maintenance surface: future changes to validation rules will need to be applied in multiple places.

🔧 How do I fix it?
Delete extra code. Extract repeated code sequences into reusable functions or methods. Use loops or data structures to eliminate repetitive patterns.

Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

Comment thread ui/appserver/server.go
w.WriteHeader(http.StatusOK)
}

func (s *Server) handleMinPackageAge(w http.ResponseWriter, r *http.Request) {
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.

handleMinPackageAge duplicates the token-validate/decode/validate/callback pattern in other handlers; extract common request-handling steps into a shared helper to avoid repeating the same logic.

Details

✨ AI Reasoning
​A new HTTP handler was added that performs the same sequence of steps as several existing handlers: validate token, decode JSON into a typed event, call Validate(), acquire lock to fetch a callback field, invoke the callback if present, and return HTTP 200. This repeats substantial, non-trivial logic already implemented in other handler functions in the same module, increasing maintenance burden because bug fixes or behavioral changes would need to be applied in multiple places. Consolidating the shared flow into a helper or common handler would reduce duplication and the risk of inconsistent behavior.

🔧 How do I fix it?
Delete extra code. Extract repeated code sequences into reusable functions or methods. Use loops or data structures to eliminate repetitive patterns.

Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

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