Skip to content

Check used Funtions in sql statment within guard #8

@stbischof

Description

@stbischof

Problem description

analyse the used functions agains a witelist, log the allowed and dosallowed

throw exeption if disallowed exist.

whitelistPatterns is a list of Regex pattern.

      List<String> allowedFunctions = new ArrayList<>();
        List<String> disallowedFunctions = new ArrayList<>();

        for (String function : usedFunctions) {
            boolean isAllowed = false;
            for (String pattern : whitelistPatterns) {
                if (Pattern.matches(pattern, function)) {
                    isAllowed = true;
                    break;
                }
            }
            if (isAllowed) {
                allowedFunctions.add(function);
            } else {
                disallowedFunctions.add(function);
            }
        }

Preferred solution

No response

Are you interested in contributing a solution yourself?

None

Alternatives you've considered

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions