fix(api): scope GET /api/workflows/{id}/runs to the path workflow#6298
Merged
Conversation
list_workflow_runs ignored its {id} path parameter and called list_runs(None), so it returned every workflow's runs instead of the one named in the path.
Each run carries its initial input string, so the unscoped list also exposed unrelated workflows' run inputs to any caller of one workflow's runs endpoint.
Parse the id, filter list_runs(None) by workflow_id, and return 400 on an unparseable id to match the other workflow endpoints.
Adds a regression integration test that creates two workflows, seeds runs on each, and asserts each {id}/runs endpoint returns only its own runs.
CLAUDE.md rule: 'Never write multi-paragraph docstrings or multi-line comment blocks — one short line max.' - workflow.rs: 3-line inline comment → 1 line - workflow_lifecycle_test.rs: 2-line doc comment → 1 line
houko
force-pushed
the
fix/workflow-runs-id-scope
branch
from
June 24, 2026 03:22
1d00c9b to
c2471fe
Compare
houko
enabled auto-merge (squash)
June 24, 2026 03:22
This was referenced Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
GET /api/workflows/{id}/runsignored its{id}path parameter: the handler bound it asPath(_id)and calledlist_runs(None), which returns every workflow's runs. SoGET /api/workflows/A/runsreturned the runs of all workflows, not just A's.Since each
WorkflowRuncarries its initialinputstring, the unscoped list also leaked the inputs of unrelated workflows to any caller of a single workflow's runs endpoint.Changes
crates/librefang-api/src/routes/workflows/workflow.rs— parse the path id into aWorkflowId(400 on an unparseable id, matchingget_workflow/run_workflowand the other endpoints), thenfilter(|r| r.workflow_id == workflow_id)overlist_runs(None). Both return paths now produce(StatusCode, Json<Value>).crates/librefang-api/tests/workflow_lifecycle_test.rs— regression testlist_workflow_runs_is_scoped_to_path_workflow: creates two workflows, seeds one run on A and two on B viaengine.create_run, then assertsGET /api/workflows/{A}/runsreturns only A's run,{B}/runsreturns B's two, and an invalid id returns 400.Verification
cargo test -p librefang-api --test workflow_lifecycle_test— 13 passed, incl. the new test.cargo fmt -p librefang-apiclean; pre-commit hooks (CHANGELOG[Unreleased]attribution, gitleaks) pass.Notes
input/errorto this same endpoint's payload, which is what escalates the unscoped list into an input-data leak. The two PRs touch the same handler, so whichever lands second needs a trivial conflict resolution — flagged on fix(email,api): AUTH PLAIN fallback for SMTP + expose input/error in workflow runs list #6293.list_runssignature is unchanged (its other callers passNone/state filters and are unaffected).