Skip to content

Commit

Permalink
Adds support to include path between quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe Zimmerle committed Sep 29, 2015
1 parent b497091 commit 70e2a4b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 17 additions & 0 deletions src/parser/seclang-scanner.ll
Expand Up @@ -382,6 +382,23 @@ CONFIG_DIR_UNICODE_MAP_FILE (?i:SecUnicodeMapFile)
yypush_buffer_state(yy_create_buffer( yyin, YY_BUF_SIZE ));
}

{CONFIG_INCLUDE}[ ]["]{CONFIG_VALUE_PATH}["] {
const char *file = strchr(yytext, ' ') + 1;
char *f = strdup(file + 1);
f[strlen(f)-1] = '\0';
yyin = fopen(f, "r" );
if (!yyin) {
BEGIN(INITIAL);
driver.error (*driver.loc.back(), "", yytext + std::string(": Not able to open file."));
throw yy::seclang_parser::syntax_error(*driver.loc.back(), "");
}
free(f);
driver.ref.push_back(file);
driver.loc.push_back(new yy::location());
yypush_buffer_state(yy_create_buffer( yyin, YY_BUF_SIZE ));
}


{CONFIG_SEC_REMOTE_RULES}[ ][^ ]+[ ][^\n\r ]+ {
HttpsClient c;
std::string key;
Expand Down
4 changes: 1 addition & 3 deletions test/benchmark/basic_rules.conf
@@ -1,3 +1 @@
SecRule ARGS "@contains /test.txt" "allow"
SecRule ARGS:teste "@contains /test.txt" " allow,deny"
SecRule ARGS "@contains /test.txt" "allow, allow,deny"
include "owasp-modsecurity-crs-orig/modsecurity_crs_10_setup.conf"

0 comments on commit 70e2a4b

Please sign in to comment.