Skip to content

[BUG] Alert Service #261

@LucasGois1

Description

@LucasGois1

What is the bug?

Hello guys, I have an use case where I need to stop my workflow when for example an Email is detected instead just applying the REDACTED message

The detection is working well and I suppose that the alert service is what I need. But, I'm getting no alerts on DefaultAlertService, take a look on my code:

            final var email = new EmailAddress();
            final var emailStrategy = new EmailAddressFilterStrategy();
            emailStrategy.setAlert(true);
            email.setEmailAddressFilterStrategies(List.of(emailStrategy));
            final var identifiers = new Identifiers();
            identifiers.setEmailAddress(email);
            final Policy policy = new Policy();
            policy.setIdentifiers(identifiers);

            final var cache = new InMemoryCache();
            final var alertService = new DefaultAlertService(cache);
            final FilterConfiguration filterConfiguration = new FilterConfiguration.FilterConfigurationBuilder()
                    .withAlertService(alertService)
                    .withAnonymizationService(new AgeAnonymizationService(cache))
                    .build();

            final var emailFilter = new EmailAddressFilter(filterConfiguration, false, false);

            FilterResult result = emailFilter.filter(policy, null, null, 0, candidate, new HashMap<>());

             //  result contains spans about detected emails

             // alert service getAlerts() return empty list
             // cache service also is empty

It's a bug or i'm using wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions