option szsCompliant --szs-compliant bool :default false
temporary support for szs ontolotogy, print if conjecture is found
+# this is just to support security in the online version
+# (--no-include-file disables filesystem access in TPTP and SMT2 parsers)
+undocumented-option canIncludeFile /--no-include-file bool :default true
+
endmodule
d_done(false),
d_checksEnabled(true),
d_strictMode(strictMode),
- d_parseOnly(parseOnly) {
+ d_parseOnly(parseOnly),
+ d_canIncludeFile(true) {
d_input->setParser(*this);
}
/** Are we only parsing? */
bool d_parseOnly;
+ /**
+ * Can we include files? (Set to false for security purposes in
+ * e.g. the online version.)
+ */
+ bool d_canIncludeFile;
+
/** The set of operators available in the current logic. */
std::set<Kind> d_logicOperators;
bool strictModeEnabled() { return d_strictMode; }
+ bool allowIncludeFile() { d_canIncludeFile = true; }
+ bool disallowIncludeFile() { d_canIncludeFile = false; }
+ bool canIncludeFile() const { return d_canIncludeFile; }
+
/**
* Returns a variable, given a name.
*
d_exprManager = exprManager;
d_checksEnabled = true;
d_strictMode = false;
+ d_canIncludeFile = true;
d_mmap = false;
d_parseOnly = false;
}
parser->disableChecks();
}
+ if( d_canIncludeFile ) {
+ parser->allowIncludeFile();
+ } else {
+ parser->disallowIncludeFile();
+ }
+
return parser;
}
.withMmap(options[options::memoryMap])
.withChecks(options[options::semanticChecks])
.withStrictMode(options[options::strictParsing])
- .withParseOnly(options[options::parseOnly]);
+ .withParseOnly(options[options::parseOnly])
+ .withIncludeFile(options[options::canIncludeFile]);
}
ParserBuilder& ParserBuilder::withStrictMode(bool flag) {
return *this;
}
+ParserBuilder& ParserBuilder::withIncludeFile(bool flag) {
+ d_canIncludeFile = flag;
+ return *this;
+}
+
ParserBuilder& ParserBuilder::withStreamInput(std::istream& input) {
d_inputType = STREAM_INPUT;
d_streamInput = &input;
/** Should we parse in strict mode? */
bool d_strictMode;
+ /** Should we allow include-file commands? */
+ bool d_canIncludeFile;
+
/** Should we memory-map a file input? */
bool d_mmap;
*/
ParserBuilder& withStrictMode(bool flag = true);
+ /**
+ * Should the include-file commands be enabled?
+ *
+ * (Default: yes)
+ */
+ ParserBuilder& withIncludeFile(bool flag = true);
+
/** Set the parser to use the given stream for its input. */
ParserBuilder& withStreamInput(std::istream& input);
* the RPAREN_TOK is properly eaten and we are in a good state to read
* the included file's tokens. */
| LPAREN_TOK INCLUDE_TOK str[name] RPAREN_TOK
- { if(PARSER_STATE->strictModeEnabled()) {
+ { if(!PARSER_STATE->canIncludeFile()) {
+ PARSER_STATE->parseError("include-file feature was disabled for this run.");
+ }
+ if(PARSER_STATE->strictModeEnabled()) {
PARSER_STATE->parseError("Extended commands are not permitted while operating in strict compliance mode.");
}
PARSER_STATE->includeFile(name);
}
void Smt2::includeFile(const std::string& filename) {
+ // security for online version
+ if(!canIncludeFile()) {
+ parseError("include-file feature was disabled for this run.");
+ }
+
// Get the lexer
AntlrInput* ai = static_cast<AntlrInput*>(getInput());
pANTLR3_LEXER lexer = ai->getAntlr3Lexer();
void Tptp::includeFile(std::string fileName){
+ // security for online version
+ if(!canIncludeFile()) {
+ parseError("include-file feature was disabled for this run.");
+ }
+
// Get the lexer
AntlrInput * ai = static_cast<AntlrInput *>(getInput());
pANTLR3_LEXER lexer = ai->getAntlr3Lexer();