Skip to content

Commit 5cf3e8c

Browse files
committed
fix(node): reconcile public-read messaging with per-repo enforcement
GITLAWB_PUBLIC_READ is read nowhere except a startup warning, while read enforcement actually happens per repository through is_public and path-scoped visibility rules. The flag's help text, the startup warning, .env.example, and the readiness audit all still claimed private-read enforcement was unwired. The help and warning now state the flag is reserved and inert, and point at the real per-repo control. A config test asserts the rendered help neither claims enforcement is missing nor omits that the flag does nothing. Closes #338.
1 parent bfc44f9 commit 5cf3e8c

4 files changed

Lines changed: 30 additions & 5 deletions

File tree

‎.env.example‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ GITLAWB_ENFORCE_OWNER_PUSH=true
108108
GITLAWB_P2P_BOOTSTRAP=
109109

110110
# ── Access control ────────────────────────────────────────────────────────
111-
# Reserved for private-read mode. Public/private repo read enforcement is not
112-
# wired in the current live release; do not rely on this for private repositories.
111+
# Reserved and currently inert. Repo reads are gated per repository by
112+
# is_public and path-scoped visibility rules; this flag changes nothing.
113113
GITLAWB_PUBLIC_READ=true
114114

115115
# Maximum git smart-HTTP pack request size, in bytes.

‎crates/gitlawb-node/src/config.rs‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ pub struct Config {
5555
#[arg(long, env = "GITLAWB_KEY", default_value = "~/.gitlawb/identity.pem")]
5656
pub key_path: String,
5757

58-
/// Reserved for private-read mode; per-repo read enforcement is not wired in alpha
58+
/// Reserved and currently inert: read access is enforced per repository
59+
/// through `is_public` and path-scoped visibility rules, not this flag.
60+
/// Setting it to false changes nothing; make a repo private through its
61+
/// own visibility instead.
5962
#[arg(long, env = "GITLAWB_PUBLIC_READ", default_value_t = true)]
6063
pub public_read: bool,
6164

@@ -1424,6 +1427,28 @@ mod tests {
14241427
);
14251428
}
14261429

1430+
/// #338: GITLAWB_PUBLIC_READ is inert, so its help must not claim read
1431+
/// enforcement is missing; it must tell the operator the flag changes
1432+
/// nothing and where the real control lives.
1433+
#[test]
1434+
fn public_read_help_describes_the_flag_as_inert() {
1435+
use clap::CommandFactory;
1436+
let cmd = Config::command();
1437+
let arg = cmd
1438+
.get_arguments()
1439+
.find(|a| a.get_id() == "public_read")
1440+
.expect("the argument must exist");
1441+
let help = arg.get_help().map(|h| h.to_string()).unwrap_or_default();
1442+
assert!(
1443+
!help.contains("not wired"),
1444+
"the help still claims read enforcement is unwired: {help}"
1445+
);
1446+
assert!(
1447+
help.contains("inert"),
1448+
"the help must say the flag is inert so an operator does not rely on it: {help}"
1449+
);
1450+
}
1451+
14271452
/// The flip must not strand an operator mid-upgrade.
14281453
///
14291454
/// Turning the gate on is a breaking change for any deployment whose pushers are

‎crates/gitlawb-node/src/main.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ async fn main() -> Result<()> {
110110

111111
if !config.public_read {
112112
warn!(
113-
"GITLAWB_PUBLIC_READ=false is reserved; per-repository private-read enforcement is not wired in alpha"
113+
"GITLAWB_PUBLIC_READ=false has no effect; reads are gated per repository by is_public and path-scoped visibility rules, not this flag"
114114
);
115115
}
116116

‎docs/OSS-READINESS-AUDIT.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Live-network blockers to prioritize:
9595
- GraphQL POST is still open for compatibility; GraphQL mutations should get mutation-aware auth before it becomes a public write API surface.
9696
- Push authorization is still not capability-complete. A valid DID signature is authentication, not authorization. Owner checks are now enforced on every branch, protected or not (`GITLAWB_ENFORCE_OWNER_PUSH`, on by default); what remains is that a UCAN `git/push` capability is not yet honored, so a delegated or CI key cannot push.
9797
- UCAN chain validation is incomplete and UCAN revocation/blocklisting is not implemented as an operator feature.
98-
- Private repository reads are not enforced. `is_public` and `GITLAWB_PUBLIC_READ` exist, but per-repository private-read behavior is not wired.
98+
- Private repository reads are enforced per repository through `is_public` and path-scoped visibility rules. `GITLAWB_PUBLIC_READ` remains reserved and inert.
9999
- Peer URLs are self-asserted by DIDs. Signatures prove control of the DID key when present, not ownership/safety of the announced URL.
100100
- Outbound peer fetch/ping/sync paths should be reviewed for SSRF protections before accepting arbitrary public peer registrations.
101101

0 commit comments

Comments
 (0)