Skip to content

Commit

Permalink
Merge pull request #8494 from mandy-chessell/oak2024
Browse files Browse the repository at this point in the history
SafeRegEx check should allow invlid RegExs
  • Loading branch information
mandy-chessell authored Nov 15, 2024
2 parents 0d6a30d + 1e08463 commit aea88e9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private String getSearchStringClause() throws RepositoryErrorException
private String getSafeRegex(Object suppliedSearchString) throws RepositoryErrorException
{
final String methodName = "getSafeRegex";
final String tester = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\\E\\Q1234567890";
final String tester = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";

if (suppliedSearchString != null)
{
Expand All @@ -152,7 +152,17 @@ private String getSafeRegex(Object suppliedSearchString) throws RepositoryErrorE
*/
Date currentTime = new Date();
Date maxExecutionTime = new Date(currentTime.getTime() + 500);
tester.matches(strippedSearchString);
try
{
tester.matches(strippedSearchString);
}
catch (Exception badRegex)
{
// This is not a problem as we are not necessarily expecting it to be a regex.
// If it is supposed to be a regex, and it is ill-formed, PostgreSQL will throw it out.
// This test is just to catch valid RegEx's that take a long time to execute.
}

Date completionTime = new Date();

if (completionTime.after(maxExecutionTime))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ Content-Type: application/json

{
"supportedSeverities" : ["Error", "Exception", "Activity", "Action", "Decision"],
"databaseURL": "~{postgreSQLDatabaseURL}~?currentSchema=auditlog_active_metadata_store",
"databaseSchema": "auditlog_active_metadata_store",
"databaseURL": "~{postgreSQLDatabaseURL}~?currentSchema=audit_logs",
"databaseSchema": "audit_logs",
"secretsStore": "~{secretsStore}~",
"secretsCollectionName": "~{postgreSQLServerCollectionName}~"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ public enum FileExtension
*/
MD_FILE("md", new FileType[]{FileType.MARKDOWN_FILE}),

/**
* A formal diagram in Mermaid Markdown format.
*/
MMD_FILE("mmd", new FileType[]{FileType.MERMAID_FILE}),

/**
* A free-form text document.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ public enum FileType
DeployedImplementationType.DOCUMENT,
"A document of words and linked to diagrams in Markdown format that describes the other files in the same directory (folder)."),

/**
* A formal diagram in Mermaid Markdown format.
*/
MERMAID_FILE("Mermaid Markdown Document",
"Mermaid Markdown",
OpenMetadataType.DOCUMENT.typeName,
DeployedImplementationType.DOCUMENT,
"A formal diagram in Mermaid Markdown format."),

/**
* A text file with comma-separated values.
*/
Expand Down

0 comments on commit aea88e9

Please sign in to comment.