Skip to content

Conversation

@yaga-simha
Copy link
Contributor

PR Type

Enhancement

Description

Implements a complete Pipeline History feature that allows users to view and analyse execution history of pipelines, mirroring the existing Alert History functionality.

@github-actions
Copy link
Contributor

Failed to generate code suggestions for PR

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Greptile Summary

Implements a Pipeline History feature that mirrors the existing Alert History functionality, allowing users to view pipeline execution records from the _meta organization's triggers stream.

Key Changes

  • Added /api/{org_id}/pipelines/history endpoint that queries the triggers stream with module='derived_stream' filter
  • Created new Vue component PipelineHistory.vue with datetime filtering, search, and pagination
  • Added route configuration and UI button in pipelines list to access history view
  • Mirrored the existing alert history implementation pattern

Critical Issue Found

  • SQL Injection Vulnerability: The org_id parameter is directly interpolated into the SQL query without proper escaping (line 154-161 in history.rs), creating a security risk

Confidence Score: 2/5

  • This PR has a critical SQL injection vulnerability that must be fixed before merging
  • The SQL injection vulnerability in the history endpoint allows potential attackers to manipulate SQL queries through the org_id path parameter. While the rest of the implementation follows the existing alert history pattern and appears sound, this security issue is critical and blocks safe deployment.
  • Critical: src/handler/http/request/pipelines/history.rs - must fix SQL injection vulnerability before merge

Important Files Changed

File Analysis

Filename Score Overview
src/handler/http/request/pipelines/history.rs 2/5 New endpoint for pipeline history with SQL injection vulnerability in org_id handling
src/handler/http/router/mod.rs 5/5 Registered new pipeline history endpoint in router
web/src/components/pipelines/PipelineHistory.vue 4/5 New Vue component for pipeline history display with datetime filtering and pagination

Sequence Diagram

sequenceDiagram
    participant User
    participant Browser
    participant PipelineHistory.vue
    participant Router
    participant API as /api/{org_id}/pipelines/history
    participant Handler as get_pipeline_history
    participant DB as list_pipelines
    participant Search as SearchService
    participant Meta as _meta org triggers stream

    User->>Browser: Click "Pipeline History" button
    Browser->>Router: Navigate to /pipelines/history
    Router->>PipelineHistory.vue: Load component
    
    PipelineHistory.vue->>API: GET /api/{org_id}/pipelines/history
    Note over PipelineHistory.vue,API: Query params: start_time, end_time, from, size, pipeline_name
    
    API->>Handler: Process request
    Handler->>DB: list_pipelines(org_id)
    DB-->>Handler: Return pipeline list
    
    Note over Handler: Validate pipeline_name filter<br/>Build SQL query with org_id
    
    Handler->>Search: SearchService.search(META_ORG_ID, sql)
    Search->>Meta: Query triggers stream<br/>(module='derived_stream')
    Meta-->>Search: Return execution records
    Search-->>Handler: Return search results
    
    Note over Handler: Parse hits, extract pipeline names<br/>from key field (name/id format)
    
    Handler-->>API: PipelineHistoryResponse
    API-->>PipelineHistory.vue: JSON response
    PipelineHistory.vue-->>Browser: Render table with history
    Browser-->>User: Display pipeline execution history
Loading

10 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines 154 to 161
let mut sql = format!(
"SELECT _timestamp, org, key, status, is_realtime, is_silenced, \
start_time, end_time, retries, \
delay_in_secs, evaluation_took_in_secs, \
source_node, query_took \
FROM \"{TRIGGERS_USAGE_STREAM}\" \
WHERE module = 'derived_stream' AND org = '{org_id}' AND _timestamp >= {start_time} AND _timestamp <= {end_time}"
);
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: SQL injection vulnerability: org_id interpolated directly into query without escaping

Suggested change
let mut sql = format!(
"SELECT _timestamp, org, key, status, is_realtime, is_silenced, \
start_time, end_time, retries, \
delay_in_secs, evaluation_took_in_secs, \
source_node, query_took \
FROM \"{TRIGGERS_USAGE_STREAM}\" \
WHERE module = 'derived_stream' AND org = '{org_id}' AND _timestamp >= {start_time} AND _timestamp <= {end_time}"
);
let mut sql = format!(
"SELECT _timestamp, org, key, status, is_realtime, is_silenced, \
start_time, end_time, retries, \
delay_in_secs, evaluation_took_in_secs, \
source_node, query_took \
FROM \"{}\" \
WHERE module = 'derived_stream' AND org = '{}' AND _timestamp >= {} AND _timestamp <= {}",
TRIGGERS_USAGE_STREAM,
org_id.replace("'", "''"),
start_time,
end_time
);
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/handler/http/request/pipelines/history.rs
Line: 154:161

Comment:
**logic:** SQL injection vulnerability: `org_id` interpolated directly into query without escaping

```suggestion
    let mut sql = format!(
        "SELECT _timestamp, org, key, status, is_realtime, is_silenced, \
         start_time, end_time, retries, \
         delay_in_secs, evaluation_took_in_secs, \
         source_node, query_took \
         FROM \"{}\" \
         WHERE module = 'derived_stream' AND org = '{}' AND _timestamp >= {} AND _timestamp <= {}",
        TRIGGERS_USAGE_STREAM,
        org_id.replace("'", "''"),
        start_time,
        end_time
    );
```

How can I resolve this? If you propose a fix, please make it concise.

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: yaga-simha | Branch: feature/pipeline-history | Commit: d9b3f6e

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 346 0 19 1 95% 4m 39s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: nikhilsaikethe | Branch: feature/pipeline-history | Commit: 8080fad

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 345 0 19 2 94% 4m 38s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: yaga-simha | Branch: feature/pipeline-history | Commit: 1fdd395

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 344 0 19 3 94% 4m 39s

View Detailed Results

@yaga-simha yaga-simha force-pushed the feature/pipeline-history branch from 1fdd395 to a6ca9f0 Compare October 29, 2025 07:34
@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: yaga-simha | Branch: feature/pipeline-history | Commit: fc5f360

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 344 0 19 3 94% 4m 39s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: yaga-simha | Branch: feature/pipeline-history | Commit: 4093982

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 344 0 19 3 94% 4m 39s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: yaga-simha | Branch: feature/pipeline-history | Commit: 4093982

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 344 0 19 3 94% 4m 39s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: yaga-simha | Branch: feature/pipeline-history | Commit: 577596c

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 344 0 19 3 94% 4m 39s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: yaga-simha | Branch: feature/pipeline-history | Commit: 739c5de

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 343 0 19 4 94% 4m 39s

View Detailed Results

Copy link
Contributor

Choose a reason for hiding this comment

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

for the labels part instead of directly keeping here , can you add them to en.json and you can use that t("alerts.name") direclty this

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: yaga-simha | Branch: feature/pipeline-history | Commit: 19477b1

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 344 0 19 3 94% 4m 38s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: yaga-simha | Branch: feature/pipeline-history | Commit: 19477b1

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 343 0 19 4 94% 4m 46s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: yaga-simha | Branch: feature/pipeline-history | Commit: 45b6803

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 346 0 19 1 95% 4m 39s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: yaga-simha | Branch: feature/pipeline-history | Commit: 45b6803

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 344 0 19 3 94% 4m 39s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: yaga-simha | Branch: feature/pipeline-history | Commit: 9b784a3

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 341 0 19 6 93% 5m 41s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: yaga-simha | Branch: feature/pipeline-history | Commit: c0de861

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 339 0 19 8 93% 5m 41s

View Detailed Results

@yaga-simha yaga-simha merged commit 1aba9c5 into main Oct 31, 2025
32 of 34 checks passed
@yaga-simha yaga-simha deleted the feature/pipeline-history branch October 31, 2025 09:39
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.

2 participants