@@ -101,4 +101,60 @@ public void Validate_keeps_valid_MaxConcurrency()
101101
102102 settings . MaxConcurrency . Should ( ) . Be ( 4 ) ;
103103 }
104+
105+ [ Fact ]
106+ public void Validate_removes_relative_path_from_RecentPipelines ( )
107+ {
108+ var settings = new AppSettings
109+ {
110+ RecentPipelines = new List < string > { "relative/path.ffpipe" , Path . Combine ( Path . GetTempPath ( ) , "valid.ffpipe" ) }
111+ } ;
112+ settings . Validate ( ) ;
113+
114+ settings . RecentPipelines . Should ( ) . ContainSingle ( )
115+ . Which . Should ( ) . Contain ( "valid.ffpipe" ) ;
116+ }
117+
118+ [ Fact ]
119+ public void Validate_removes_null_byte_path_from_RecentPipelines ( )
120+ {
121+ var settings = new AppSettings
122+ {
123+ RecentPipelines = new List < string > { Path . Combine ( Path . GetTempPath ( ) , "ok.ffpipe" ) , "/tmp/evil\0 .ffpipe" }
124+ } ;
125+ settings . Validate ( ) ;
126+
127+ settings . RecentPipelines . Should ( ) . ContainSingle ( )
128+ . Which . Should ( ) . Contain ( "ok.ffpipe" ) ;
129+ }
130+
131+ [ Fact ]
132+ public void Validate_removes_excessively_long_path_from_RecentPipelines ( )
133+ {
134+ var settings = new AppSettings
135+ {
136+ RecentPipelines = new List < string >
137+ {
138+ Path . Combine ( Path . GetTempPath ( ) , "good.ffpipe" ) ,
139+ "/" + new string ( 'a' , 5000 ) + ".ffpipe"
140+ }
141+ } ;
142+ settings . Validate ( ) ;
143+
144+ settings . RecentPipelines . Should ( ) . ContainSingle ( )
145+ . Which . Should ( ) . Contain ( "good.ffpipe" ) ;
146+ }
147+
148+ [ Fact ]
149+ public void Validate_removes_whitespace_only_entries ( )
150+ {
151+ var settings = new AppSettings
152+ {
153+ RecentPipelines = new List < string > { " " , Path . Combine ( Path . GetTempPath ( ) , "real.ffpipe" ) }
154+ } ;
155+ settings . Validate ( ) ;
156+
157+ settings . RecentPipelines . Should ( ) . ContainSingle ( )
158+ . Which . Should ( ) . Contain ( "real.ffpipe" ) ;
159+ }
104160}
0 commit comments