fix(tvix/nar-bridge): fix root node decoding and validation
This got broken while moving things around. We need to parse the b64-decoded bytes. Since we're now validating the root node, we also need to rename the root node to get past the node name validation. There probably should be some tests for this. Co-Authored-By: sinavir@sinavir.fr Change-Id: I8f24a4a0ac107b1ea5b94c0e0ed872a34eb7b587 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11996 Reviewed-by: Brian Olsen <me@griff.name> Tested-by: BuildkiteCI
This commit is contained in:
parent
fca8462530
commit
d136f2c881
1 changed files with 7 additions and 2 deletions
|
@ -46,13 +46,18 @@ pub async fn get(
|
|||
}
|
||||
|
||||
// parse the proto
|
||||
let root_node: tvix_castore::proto::Node = Message::decode(Bytes::from(root_node_enc))
|
||||
let mut root_node: tvix_castore::proto::Node = Message::decode(Bytes::from(root_node_proto))
|
||||
.map_err(|e| {
|
||||
warn!(err=%e, "unable to decode root node proto");
|
||||
StatusCode::NOT_FOUND
|
||||
})?;
|
||||
|
||||
// validate it.
|
||||
// validate the node, but add a dummy node name, as we only send unnamed
|
||||
// nodes
|
||||
if let Some(rn) = root_node.node {
|
||||
root_node.node = Some(rn.rename("00000000000000000000000000000000-dummy".into()))
|
||||
}
|
||||
|
||||
let root_node = root_node
|
||||
.validate()
|
||||
.map_err(|e| {
|
||||
|
|
Loading…
Reference in a new issue