REPAIRING DEVICE, REPAIRING METHOD AND REPAIRING PROGRAM
A correction device includes processing circuitry configured to extract a first regular expression from a source code, determine whether the first regular expression satisfies a condition indicating that the first regular expression is vulnerable to Regular Expression Denial of Service (ReDoS), and synthesize a second regular expression that does not satisfy the condition on a basis of the first regular expression.
1 . A correction device comprising:
processing circuitry configured to:
extract a first regular expression from a source code;
determine whether the first regular expression satisfies a condition indicating that the first regular expression is vulnerable to Regular Expression Denial of Service (ReDoS); and
synthesize a second regular expression that does not satisfy the condition on a basis of the first regular expression.
2 . The correction device according to claim 1 , wherein the processing circuitry is further configured to convert the source code into a syntax analysis tree, and extract a regular expression restored on a basis of a variable extracted from the syntax analysis tree as the first regular expression.
3 . The correction device according to claim 1 , wherein the processing circuitry is further configured to:
generate a first set that is a set of character strings accepted by the first regular expression and a second set that is a set of character strings rejected by the first regular expression, and
synthesize a second regular expression that is a regular expression obtained by replacing range characters in the first regular expression with a predetermined syntax, that is, a regular expression that accepts a character string of the first set and rejects the character string of the second set.
4 . The correction device according to claim 3 , wherein the processing circuitry is further configured to convert the first regular expression into a nondeterministic finite automaton, generate a set of character strings obtained by a path reaching an acceptance state among paths on the nondeterministic finite automaton as the first set, and generate a set of character strings obtained by a path not reaching the acceptance state among the paths on the nondeterministic finite automaton as the second set.
5 . A correction method executed by a correction device, the correction method comprising:
extracting a first regular expression from a source code;
determining whether the first regular expression satisfies a condition indicating that the first regular expression is vulnerable to Regular Expression Denial of Service (ReDoS); and
synthesizing a second regular expression that does not satisfy the condition on a basis of the first regular expression.
6 . A non-transitory computer-readable recording medium storing therein a correction program for causing a computer to execute a process comprising:
extracting a first regular expression from a source code;
determining whether the first regular expression satisfies a condition indicating that the first regular expression is vulnerable to Regular Expression Denial of Service (ReDoS); and
synthesizing a second regular expression that does not satisfy the condition on a basis of the first regular expression.