Skip to content

fix(auth): constrain LFS writes and popup identity messages - #47

Merged
yordis merged 2 commits into
mainfrom
yordis/fix-auth-constrain-lfs-writes
Oct 29, 2026
Merged

yordis merged 2 commits into
mainfrom
yordis/fix-auth-constrain-lfs-writes

Conversation

@yordis

@yordis yordis commented Oct 29, 2026

Copy link
Copy Markdown
Member

Extract the remaining authorization fixes from PR #8. Upload batches require write access; unknown operations reject. The popup targets an allowlisted opener or its own origin, safely encodes identity JSON, and the SDK checks the opened window and origin. API integration tests passed.

(cherry picked from commit 4a0b78b)
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@cursor

cursor Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

PR Summary

High Risk
Changes authentication for LFS batch uploads and cross-origin sign-in messaging—both are security-sensitive paths where mistakes could allow unauthorized writes or leak identity to untrusted pages.

Overview
Closes two authorization gaps: LFS batch upload now requires write (download still requires read; unknown operation → 400), and the sign-in popup no longer broadcasts identity with postMessage(..., "*").

The authenticate page accepts optional ?origin= only when it matches a configured CORS origin (parsed via the new url dependency so wildcard/exact checks reject strings a browser would read as a different origin). The HTML embeds the principal with JSON/script-safe substitution; web/sdk/repos.ts passes the caller origin cross-site and accepts messages only from the server origin and the popup window.

Integration tests cover script injection in principal names, disallowed origins, and read-only tokens on LFS upload.

Reviewed by Cursor Bugbot for commit f82cead. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 741654e1-dd01-41b2-a20d-fbe322f78631
Commits

Reviewing files that changed from the base of the PR and between 2668870 and f82cead.

Files ignored due to path filters: 1
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 7
  • Cargo.toml
  • crates/walgit-server/Cargo.toml
  • crates/walgit-server/src/lfs.rs
  • crates/walgit-server/src/web/v1.rs
  • crates/walgit-server/tests/api_v1.rs
  • web/API.md
  • web/sdk/repos.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8225bac. Configure here.

Comment thread crates/walgit-server/src/web/v1.rs Resolved
A suffix such as ?.example.com passed the wildcard match while a browser
read a different origin, so the identity could be posted to a host outside
server.cors_origins.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis yordis closed this Oct 29, 2026
@yordis yordis reopened this Oct 29, 2026
@yordis yordis closed this Oct 29, 2026
@yordis yordis reopened this Oct 29, 2026
@yordis
yordis merged commit fdaaaa3 into main Oct 29, 2026
10 of 15 checks passed
@yordis
yordis deleted the yordis/fix-auth-constrain-lfs-writes branch October 29, 2026 05:39
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.

2 participants