@@ -26,8 +26,10 @@ void flb_test_file_delim_ltsv(void);
2626void flb_test_file_label_delim (void );
2727void flb_test_file_template (void );
2828void flb_test_file_mkdir (void );
29+ void flb_test_file_mkdir_hardened (void );
2930void flb_test_file_literal_percent (void );
3031void flb_test_file_dynamic_path_file (void );
32+ void flb_test_file_dynamic_path_file_hardened (void );
3133void flb_test_file_dynamic_timestamp (void );
3234void flb_test_file_dynamic_percent_values (void );
3335void flb_test_file_dynamic_requires_fallback (void );
@@ -46,8 +48,10 @@ TEST_LIST = {
4648 {"path" , flb_test_file_path },
4749 {"path_file" , flb_test_file_path_file },
4850 {"mkdir" , flb_test_file_mkdir },
51+ {"mkdir_hardened" , flb_test_file_mkdir_hardened },
4952 {"literal_percent" , flb_test_file_literal_percent },
5053 {"dynamic_path_file" , flb_test_file_dynamic_path_file },
54+ {"dynamic_path_file_hardened" , flb_test_file_dynamic_path_file_hardened },
5155 {"dynamic_timestamp" , flb_test_file_dynamic_timestamp },
5256 {"dynamic_percent_values" , flb_test_file_dynamic_percent_values },
5357 {"dynamic_requires_fallback" , flb_test_file_dynamic_requires_fallback },
@@ -615,7 +619,7 @@ void flb_test_file_literal_percent(void)
615619 flb_test_rmdir (TEST_LOGPATH );
616620}
617621
618- void flb_test_file_dynamic_path_file ( void )
622+ static void test_file_dynamic_path_file_policy ( const char * follow_symlinks )
619623{
620624 int ret ;
621625 int bytes ;
@@ -658,6 +662,7 @@ void flb_test_file_dynamic_path_file(void)
658662 flb_output_set (ctx , out_ffd , "fallback_path" , TEST_LOGPATH , NULL );
659663 flb_output_set (ctx , out_ffd , "fallback_file" , "metrics.log" , NULL );
660664 flb_output_set (ctx , out_ffd , "mkdir" , "true" , NULL );
665+ flb_output_set (ctx , out_ffd , "follow_symlinks" , follow_symlinks , NULL );
661666 flb_output_set (ctx , out_ffd , "format" , "plain" , NULL );
662667
663668 ret = flb_start (ctx );
@@ -682,6 +687,16 @@ void flb_test_file_dynamic_path_file(void)
682687 flb_test_rmdir (TEST_LOGPATH );
683688}
684689
690+ void flb_test_file_dynamic_path_file (void )
691+ {
692+ test_file_dynamic_path_file_policy ("true" );
693+ }
694+
695+ void flb_test_file_dynamic_path_file_hardened (void )
696+ {
697+ test_file_dynamic_path_file_policy ("false" );
698+ }
699+
685700void flb_test_file_dynamic_timestamp (void )
686701{
687702 int ret ;
@@ -1367,7 +1382,7 @@ void flb_test_file_template(void)
13671382 }
13681383}
13691384
1370- void flb_test_file_mkdir ( void )
1385+ static void test_file_mkdir_policy ( const char * follow_symlinks )
13711386{
13721387 int i ;
13731388 int ret ;
@@ -1409,6 +1424,7 @@ void flb_test_file_mkdir(void)
14091424 flb_output_set (ctx , out_ffd , "match" , "test" , NULL );
14101425 flb_output_set (ctx , out_ffd , "path" , TEST_LOGPATH , NULL );
14111426 flb_output_set (ctx , out_ffd , "mkdir" , "true" , NULL );
1427+ flb_output_set (ctx , out_ffd , "follow_symlinks" , follow_symlinks , NULL );
14121428
14131429 ret = flb_start (ctx );
14141430 TEST_CHECK (ret == 0 );
@@ -1435,6 +1451,16 @@ void flb_test_file_mkdir(void)
14351451 flb_test_rmdir (TEST_LOGPATH );
14361452}
14371453
1454+ void flb_test_file_mkdir (void )
1455+ {
1456+ test_file_mkdir_policy ("true" );
1457+ }
1458+
1459+ void flb_test_file_mkdir_hardened (void )
1460+ {
1461+ test_file_mkdir_policy ("false" );
1462+ }
1463+
14381464void flb_test_file_tag_escape (void )
14391465{
14401466 flb_ctx_t * ctx ;
0 commit comments