Adds more regression tests to SecRemoteRules

This commit is contained in:
Felipe Zimmerle
2015-07-25 08:18:06 -03:00
parent 7ba5c76c78
commit 0e7c13e3c0
6 changed files with 130 additions and 7 deletions

View File

@@ -323,11 +323,11 @@ expression:
{
driver.responseBodyLimitAction = ModSecurity::Rules::BodyLimitAction::RejectBodyLimitAction;
}
| CONFIG_SEC_REMOTE_RULES_FAIL_ACTION CONFIG_VALUE_ABORT
| CONFIG_SEC_REMOTE_RULES_FAIL_ACTION SPACE CONFIG_VALUE_ABORT
{
driver.remoteRulesActionOnFailed = Rules::OnFailedRemoteRulesAction::AbortOnFailedRemoteRulesAction;
}
| CONFIG_SEC_REMOTE_RULES_FAIL_ACTION CONFIG_VALUE_WARN
| CONFIG_SEC_REMOTE_RULES_FAIL_ACTION SPACE CONFIG_VALUE_WARN
{
driver.remoteRulesActionOnFailed = Rules::OnFailedRemoteRulesAction::WarnOnFailedRemoteRulesAction;
}

View File

@@ -236,6 +236,7 @@ FREE_TEXT_NEW_LINE [^\"|\n]+
std::vector<std::string> conf = split(yytext, ' ');
key = conf[1];
url = conf[2];
driver.ref.push_back(url);
driver.loc.push_back(*(new yy::location()));
YY_BUFFER_STATE temp = YY_CURRENT_BUFFER;
@@ -244,13 +245,12 @@ FREE_TEXT_NEW_LINE [^\"|\n]+
bool ret = c.download(url);
if (ret == false) {
/**
* TODO: Implement the fail action.
*
*/
if (driver.remoteRulesActionOnFailed == Rules::OnFailedRemoteRulesAction::WarnOnFailedRemoteRulesAction) {
/** TODO: Implement the server logging mechanism. */
}
if (driver.remoteRulesActionOnFailed == Rules::OnFailedRemoteRulesAction::AbortOnFailedRemoteRulesAction) {
driver.error (driver.loc.back(), "", yytext + std::string(" - Failed to download: ") + c.error);
throw yy::seclang_parser::syntax_error(driver.loc.back(), "");
}
}