The invention relates to the technical field of
database security, and discloses a semantic analysis-based
SQL (Structured
Query Language) risk check method and device, and the method comprises the following steps: analyzing based on an input
SQL statement to obtain a standardized
SQL statement; constructing an
abstract syntax tree according to the standardized SQL statement; extracting key
semantic information according to the
abstract syntax tree; obtaining a
risk assessment result according to the key
semantic information; and recording an audit log according to the
risk assessment result. Compared with the technical problem that a traditional auditing
system mainly depends on
pattern matching of basic rules, and potential safety risks cannot be accurately recognized when complex SQL statements are processed, especially under the condition that multi-layer nesting and dynamic construction are included, due to the fact that the efficient semantic analysis technology and the
risk assessment algorithm are combined for use, the
safety risk assessment method and device have the advantages that the
safety risk assessment efficiency is improved, and the
safety risk assessment efficiency is improved. Therefore, the occurrence of security events is effectively avoided, the accuracy and efficiency of SQL risk check are improved, and then the security of the
database is ensured.