File tree Expand file tree Collapse file tree
cmd/soroban-cli/src/commands/contract Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,6 +125,12 @@ pub enum Error {
125125 #[ error( "creating tempdir: {0}" ) ]
126126 TempDir ( std:: io:: Error ) ,
127127
128+ #[ error( "hardening permissions on {path}: {source}" ) ]
129+ ChmodMaterialized {
130+ path : PathBuf ,
131+ source : std:: io:: Error ,
132+ } ,
133+
128134 #[ error( transparent) ]
129135 Verifiable ( #[ from] verifiable:: Error ) ,
130136
@@ -502,6 +508,16 @@ async fn materialize_source(
502508 print. checkln ( "Source SHA-256 matches" ) ;
503509 }
504510 extract_tarball ( & bytes, target) ?;
511+
512+ // Tighten the freshly materialized tree to 0o700 / 0o600 before docker
513+ // sees it. Uses the same per-path helper the cli already applies to its
514+ // config dirs (one source of truth for what "hardened" means).
515+ crate :: config:: locator:: enforce_hardened_tree ( target) . map_err ( |e| {
516+ Error :: ChmodMaterialized {
517+ path : target. to_path_buf ( ) ,
518+ source : e,
519+ }
520+ } ) ?;
505521 Ok ( ( ) )
506522}
507523
You can’t perform that action at this time.
0 commit comments