fix: unify fetch calls to use authedFetch for protected routes#342
Merged
Conversation
Replace plain fetch() with authedFetch() in all client-side API calls to protected mutating and data routes. This ensures DISPATCH_AUTH_MODE=basic operators get consistent Basic Auth header injection. Files changed: - src/app/automation/activity/page.tsx: events list fetch - src/app/automation/workflows/[id]/page.tsx: workflow detail, dispatch, rerun - src/app/agents/agent-work-panel.tsx: agent work panel CRUD operations Left unchanged: login page session check (pre-auth, not a protected route) Fixes #319
There was a problem hiding this comment.
AI Automated Review
Full PR review.
Analysis engine: review@https://litellm.jory.dev/v1 (openai)
Recommendation
Approved. This PR correctly addresses the technical debt identified in issue PR 319 by replacing plain fetch() calls with authedFetch() in client-side components that interact with protected API routes. This ensures consistent authentication (specifically Basic Auth) for operators when DISPATCH_AUTH_MODE=basic is configured.
Change-by-Change Findings
src/app/agents/agent-work-panel.tsx: ReplacedfetchwithauthedFetchfor retrieving agent work and for mutating actions (release,reassign).src/app/automation/activity/page.tsx: ReplacedfetchwithauthedFetchfor retrieving the activity feed.src/app/automation/workflows/[id]/page.tsx: ReplacedfetchwithauthedFetchfor fetching workflow details and for dispatching/rerunning workflow runs.
Standards Compliance
- Code Standards: The changes follow the repository's pattern of using
authedFetchfor protected routes as documented inREADME.mdandAGENTS.md. - Security: By using
authedFetch, the implementation ensures that mutating requests (POST) and sensitive data reads are properly authenticated, preventing 401 errors for operators using Basic Auth.
Linked Issue Fit
- Issue PR 319: The PR directly implements the recommendation from the audit finding: "Other active UI paths still use plain
fetch()for protected mutating routes, which meansDISPATCH_AUTH_MODE=basicoperators can hit 401s". The implementation covers the specific files identified in the audit evidence.
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.
Fixes #319
Replace plain
fetch()withauthedFetch()in all client-side API calls to protected mutating and data routes. This ensuresDISPATCH_AUTH_MODE=basicoperators get consistent Basic Auth header injection.Files changed:
src/app/automation/activity/page.tsx: events list fetchsrc/app/automation/workflows/[id]/page.tsx: workflow detail, dispatch, rerunsrc/app/agents/agent-work-panel.tsx: agent work panel CRUD operationsLeft unchanged: login page session check (pre-auth, not a protected route)