Skip to content

Commit ee1e269

Browse files
committed
fix: it's no error if credential helpers don't receive context as input.
They might ignore all input and output hardcoded credentials for good reason, so we don't validate writes to the helper similarly to how git does it. Note that we also don't care if credentials are stored or erased for similar reasons. I would happily make the case that we should be more adamant about error handling in that case, but typically we check error codes and that's the only indicator for success or failure. Related to rust-lang/cargo#11821
1 parent 7f6e67d commit ee1e269

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

gix-credentials/src/helper/invoke.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ impl Action {
88
match self {
99
Action::Get(ctx) => ctx.write_to(write),
1010
Action::Store(last) | Action::Erase(last) => {
11-
write.write_all(last)?;
12-
write.write_all(&[b'\n'])
11+
write.write_all(last).ok();
12+
write.write_all(&[b'\n']).ok();
13+
Ok(())
1314
}
1415
}
1516
}

gix-credentials/src/protocol/context/serde.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ mod write {
2121
if let Some(value) = value {
2222
validate(key, value.as_slice().into())
2323
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?;
24-
write_key(&mut out, key, value.as_ref())?;
24+
write_key(&mut out, key, value.as_ref()).ok();
2525
}
2626
}
2727
for (key, value) in [
@@ -33,7 +33,7 @@ mod write {
3333
if let Some(value) = value {
3434
validate(key, value.as_str().into())
3535
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?;
36-
write_key(&mut out, key, value.as_bytes().as_bstr())?;
36+
write_key(&mut out, key, value.as_bytes().as_bstr()).ok();
3737
}
3838
}
3939
Ok(())

0 commit comments

Comments
 (0)