Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
b8a3bae
feat(storage): storage-agnostic BlobStore layer + push-latency quick …
kevincodex1 Jun 22, 2026
9016e25
fix(storage): address CodeRabbit review (data-integrity + robustness)
kevincodex1 Jun 23, 2026
7b93d40
fix(storage): address beardthelion review (lock soundness, durability…
kevincodex1 Jun 23, 2026
b357510
fix(storage): isolate advisory-lock pool + #[must_use] write guard
kevincodex1 Jun 24, 2026
242c593
fix(storage): propagate durability errors + serialize background uploads
kevincodex1 Jun 24, 2026
f17fee0
fix(storage): address final review round + multithreaded compression
kevincodex1 Jul 23, 2026
d30af0d
fix(storage): address CodeRabbit round — key backslash rejection, loc…
kevincodex1 Jul 23, 2026
8c4ec8e
fix(storage): pending-upload marker + review round fixes
kevincodex1 Jul 23, 2026
75060ea
fix(storage): versioned pending marker, claim-first creation, fs etag…
kevincodex1 Jul 23, 2026
f154768
docs(storage): ObjectMeta etag doc reflects the fs sidecar etag
kevincodex1 Jul 23, 2026
5605b9c
fix(storage): harden marker machinery — durable pre-ack, locked diver…
kevincodex1 Jul 24, 2026
3cbcb2b
fix(storage): keep the marker gauge live; stripe the fs publish lock
kevincodex1 Jul 24, 2026
7e9fde0
fix(storage): in-flight etag provenance closes the upload-to-clear cr…
kevincodex1 Jul 25, 2026
1d5b479
fix(storage): content-validated recovery, locked creation lifecycle, …
kevincodex1 Jul 26, 2026
b014ce7
merge: main into feat/storage-abstraction (port storage abstraction o…
kevincodex1 Aug 31, 2026
9ce694b
fix(storage): path-traversal barrier for sibling paths; restore the F…
kevincodex1 Aug 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(storage): address CodeRabbit round — key backslash rejection, loc…
…k-poll error path, config doc

- validate_key: reject backslashes outright — keys are forward-slash
  delimited, and on Windows PathBuf::join treats '\' as a separator,
  letting a key smuggle path components past the segment checks.
- LockedConn::acquire: when the pg_try_advisory_lock poll itself errors,
  close the pinned connection deliberately with an accurate rationale
  instead of falling through to Drop's dropped-holder warning. Closing
  (not repooling) is intentional: a lost response means the session may
  hold the lock, and repooling would strand it.
- config.rs: storage_backend doc no longer claims ipfs is auto-selected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
  • Loading branch information
kevincodex1 and claude committed Jul 23, 2026
commit d30af0d20becb971f60e42d93f153a2982155269
5 changes: 3 additions & 2 deletions crates/gitlawb-node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ pub struct Config {

/// Object-storage backend: `s3` (any S3-compatible service), `fs` (local
/// directory), or `ipfs` (Kubo MFS). Empty = auto-detect: `s3` when a bucket
/// is set, else `fs` when a storage dir is set, else `ipfs` when an IPFS API
/// is set, else local-only.
/// is set, else `fs` when a storage dir is set, else local-only. `ipfs` is
/// never auto-selected (`GITLAWB_IPFS_API` alone keeps its pinning-only
/// meaning) — set this explicitly to `ipfs` to opt in.
#[arg(long, env = "GITLAWB_STORAGE_BACKEND", default_value = "")]
pub storage_backend: String,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

Expand Down
18 changes: 16 additions & 2 deletions crates/gitlawb-node/src/git/repo_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,11 +477,25 @@ impl LockedConn {
};
for attempt in 0..LOCK_ACQUIRE_TIMEOUT_SECS {
let conn = this.conn.as_mut().expect("connection present until unlock");
let row: (bool,) = sqlx::query_as("SELECT pg_try_advisory_lock($1)")
let row: (bool,) = match sqlx::query_as("SELECT pg_try_advisory_lock($1)")
.bind(lock_key)
.fetch_one(&mut **conn)
.await
.context("trying advisory lock")?;
{
Ok(row) => row,
Err(e) => {
// The poll itself failed, so the lock's server-side state
// is unknown: if the query executed but the response was
// lost, this session HOLDS the lock, and repooling the
// connection would strand it. Close the connection
// deliberately (freeing any lock it may hold) instead of
// going through Drop's generic dropped-holder warning.
if let Some(conn) = this.conn.take() {
drop(conn.detach());
}
return Err(e).context("trying advisory lock");
}
};
if row.0 {
return Ok(this);
}
Expand Down
3 changes: 3 additions & 0 deletions crates/gitlawb-node/src/storage/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ mod tests {
let store = FsBlobStore::new(dir.path()).unwrap();
assert!(store.get("../escape").await.is_err());
assert!(store.put("a/../../etc/passwd", Bytes::new()).await.is_err());
// Backslashes are separators on Windows — must be rejected as keys.
assert!(store.get("a\\..\\escape").await.is_err());
assert!(store.put("repos\\v1\\x", Bytes::new()).await.is_err());
}

#[tokio::test]
Expand Down
7 changes: 5 additions & 2 deletions crates/gitlawb-node/src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,11 @@ pub(crate) fn validate_key(key: &str) -> Result<()> {
if key.split('/').any(|seg| seg == ".." || seg == ".") {
anyhow::bail!("blob key contains traversal segment: {key}");
}
if key.starts_with('/') || key.contains('\0') {
anyhow::bail!("blob key is absolute or contains null byte: {key}");
// Backslash is rejected outright: keys are forward-slash-delimited, and on
// Windows `PathBuf::join` treats `\` as a separator, which would let a key
// smuggle path components past the segment checks above.
if key.starts_with('/') || key.contains('\\') || key.contains('\0') {
anyhow::bail!("blob key is absolute, contains '\\', or contains null byte: {key}");
}
Ok(())
}
Loading