Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Fail a redaction the engine could not verify (#8451)

EthanHealy019671ee51a827
diff --git a/app/common/src/main/java/stirling/software/common/util/ExceptionUtils.java b/app/common/src/main/java/stirling/software/common/util/ExceptionUtils.java
index c48a918f71..4e3b6b2294 100644
--- a/app/common/src/main/java/stirling/software/common/util/ExceptionUtils.java
+++ b/app/common/src/main/java/stirling/software/common/util/ExceptionUtils.java
@@ -752,6 +752,29 @@ public class ExceptionUtils {
getMessage(ErrorCode.PDF_UNREPAIRABLE), ErrorCode.PDF_UNREPAIRABLE.getCode());
}
+ /**
+ * The redaction engine's own check failed on some pages, so its output is withheld.
+ *
+ * @param pages the 1-based page numbers, already joined for display
+ */
+ public static ToolFailedException createRedactionUnverifiedException(String pages) {
+ return new ToolFailedException(
+ getMessage(ErrorCode.REDACTION_UNVERIFIED, pages),
+ null,
+ ErrorCode.REDACTION_UNVERIFIED.getCode());
+ }
+
+ /**
+ * The redaction engine could not run or check its own result, and named no page, so its output
+ * is withheld.
+ */
+ public static ToolFailedException createRedactionUnverifiableException(Throwable cause) {
+ return new ToolFailedException(
+ getMessage(ErrorCode.REDACTION_UNVERIFIABLE),
+ cause,
+ ErrorCode.REDACTION_UNVERIFIABLE.getCode());
+ }
+
/**
* A step refused its input on type alone, before running.
*
@@ -1327,6 +1350,18 @@ public class ExceptionUtils {
"error.pdfUnrepairable",
"This document is damaged in a way the repair tools cannot fix."),
+ // The redaction engine's post-redaction check did not pass on these pages.
+ REDACTION_UNVERIFIED(
+ "E077",
+ "error.redactionUnverified",
+ "Redaction could not be verified on page {0}, so no file was returned."),
+
+ // The redaction engine could not run or check its result; it reports no page for this.
+ REDACTION_UNVERIFIABLE(
+ "E083",
+ "error.redactionUnverifiable",
+ "Redaction could not be verified, so no file was returned."),
+
// Raised before a step runs, by whoever knows both what the step accepts and what it was
// handed. Distinct from PDF_NOT_PDF, which speaks only for steps that want a PDF.
STEP_INPUT_TYPE_REJECTED(
diff --git a/app/common/src/main/java/stirling/software/common/util/RegexPatternUtils.java b/app/common/src/main/java/stirling/software/common/util/RegexPatternUtils.java
index 9d2d1b74db..6c4321cf5a 100644
--- a/app/common/src/main/java/stirling/software/common/util/RegexPatternUtils.java
+++ b/app/common/src/main/java/stirling/software/common/util/RegexPatternUtils.java
@@ -187,8 +187,13 @@ public final class RegexPatternUtils {
log.trace("Compiled and cached regex pattern with flags {}: {}", flags, regex);
return pattern;
} catch (PatternSyntaxException e) {
- log.error(
- "Invalid regex pattern: '{}' with flags {} - {}", regex, flags, e.getMessage());
+ // Patterns can be user input such as auto-redact search terms, so the pattern text
+ // stays out of the log; getMessage() would include it.
+ log.warn(
+ "Invalid regex pattern with flags {}: {} near index {}",
+ flags,
+ e.getDescription(),
+ e.getIndex());
throw e;
}
}
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java
index 1c694da2b0..92448533c5 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java
@@ -6,7 +6,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import java.util.stream.Collectors;
@@ -42,7 +41,9 @@ import stirling.software.common.model.tool.ToolFormat;
import stirling.software.common.model.tool.ToolIO;
import stirling.software.common.service.CustomPDFDocumentFactory;
import stirling.software.common.util.ExceptionUtils;
+import stirling.software.common.util.ExceptionUtils.ToolFailedException;
import stirling.software.common.util.PdfUtils;
+import stirling.software.common.util.RegexPatternUtils;
import stirling.software.common.util.TempFile;
import stirling.software.common.util.TempFileManager;
import stirling.software.common.util.WebResponseUtils;
@@ -148,7 +149,8 @@ public class RedactController {
"This endpoint automatically redacts text from a PDF file based on specified"
+ " patterns. Users can provide text patterns to redact, with options for regex"
+ " and whole word matching.")
- public ResponseEntity<Resource> redactPdf(@ModelAttribute RedactPdfRequest request) {
+ public ResponseEntity<Resource> redactPdf(@ModelAttribute RedactPdfRequest request)
+ throws ToolFailedException {
if (request.getFileInput() == null || request.getFileInput().isEmpty()) {
log.error("File input is null or empty");
throw ExceptionUtils.createFileNullOrEmptyException();
@@ -177,7 +179,7 @@ public class RedactController {
if (useRegex) {
for (String term : terms) {
try {
- Pattern.compile(term);
+ RegexPatternUtils.getInstance().getPattern(term);
} catch (PatternSyntaxException e) {
throw ExceptionUtils.createIllegalArgumentException(
"error.redaction.no.patterns", "Invalid regex pattern: " + term);
@@ -247,6 +249,7 @@ public class RedactController {
throw new IOException("JPDFium auto-redact returned null result");
}
try {
+ TextRedactionService.requireVerified(result.pageResults());
result.save(tempOutput.getFile().toPath());
log.info(
"JPDFium auto-redact: {} matches processed into {}",
@@ -258,8 +261,12 @@ public class RedactController {
result.document().close();
}
}
+ } catch (ToolFailedException e) {
+ tempOutput.close();
+ throw e;
} catch (Exception e) {
tempOutput.close();
+ TextRedactionService.rejectUnverifiable(e);
log.warn(
"JPDFium native redaction fell back to manual redaction service: {}",
e.getMessage());
@@ -280,7 +287,7 @@ public class RedactController {
return WebResponseUtils.pdfFileToWebResponse(finalized, filename);
}
}
- } catch (IllegalArgumentException e) {
+ } catch (IllegalArgumentException | ToolFailedException e) {
throw e;
} catch (Exception e) {
log.error("Redaction operation failed: {}", e.getMessage(), e);
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/security/RedactExecuteService.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/security/RedactExecuteService.java
index 10fceee45f..1ab68cd1c0 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/security/RedactExecuteService.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/security/RedactExecuteService.java
@@ -32,6 +32,7 @@ import stirling.software.SPDF.pdf.parser.PageColumnLayout;
import stirling.software.SPDF.pdf.parser.PageImageLocator;
import stirling.software.common.service.CustomPDFDocumentFactory;
import stirling.software.common.util.ExceptionUtils;
+import stirling.software.common.util.ExceptionUtils.ToolFailedException;
import stirling.software.common.util.TempFile;
@Service
@@ -148,6 +149,8 @@ class RedactExecuteService {
convertToImage,
!needsOverlayOnly);
+ } catch (ToolFailedException e) {
+ throw e;
} catch (Exception e) {
log.error("Execute redaction failed: {}", e.getMessage(), e);
throw new RuntimeException("Failed to perform PDF redaction: " + e.getMessage(), e);
@@ -205,7 +208,8 @@ class RedactExecuteService {
* Attempts content-stream text removal for all text/regex targets. Returns {@code true} if the
* document fell back to overlay-only mode.
*/
- private boolean applyTextRemoval(PDDocument document, RedactExecuteRequest request) {
+ private boolean applyTextRemoval(PDDocument document, RedactExecuteRequest request)
+ throws ToolFailedException {
try {
boolean fallback = false;
@@ -238,6 +242,8 @@ class RedactExecuteService {
log.info("[redact/execute] content-stream text removal applied successfully");
}
return fallback;
+ } catch (ToolFailedException e) {
+ throw e;
} catch (Exception e) {
log.warn(
"[redact/execute] text removal failed, falling back to overlay: {}",
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/security/TextRedactionService.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/security/TextRedactionService.java
index c0b74f5428..7b0016bbf7 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/security/TextRedactionService.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/security/TextRedactionService.java
@@ -23,7 +23,10 @@ import lombok.extern.slf4j.Slf4j;
import stirling.software.SPDF.model.PDFText;
import stirling.software.SPDF.utils.text.TextFinderUtils;
+import stirling.software.common.util.ExceptionUtils;
+import stirling.software.common.util.ExceptionUtils.ToolFailedException;
import stirling.software.jpdfium.PdfDocument;
+import stirling.software.jpdfium.exception.JPDFiumException;
import stirling.software.jpdfium.redact.PdfRedactor;
import stirling.software.jpdfium.redact.RedactOptions;
import stirling.software.jpdfium.redact.RedactResult;
@@ -32,6 +35,34 @@ import stirling.software.jpdfium.redact.RedactResult;
@Slf4j
class TextRedactionService {
+ /**
+ * Throws when JPDFium's post-redaction check did not pass on any page. JPDFium reports that
+ * page with -1 matches but still returns a document, which is not passed on to the caller.
+ */
+ static void requireVerified(List<RedactResult.PageResult> pageResults)
+ throws ToolFailedException {
+ String failedPages =
+ pageResults.stream()
+ .filter(page -> page.matchesFound() < 0)
+ .map(page -> String.valueOf(page.pageIndex() + 1))
+ .collect(Collectors.joining(", "));
+ if (!failedPages.isEmpty()) {
+ throw ExceptionUtils.createRedactionUnverifiedException(failedPages);
+ }
+ }
+
+ /**
+ * Throws when JPDFium refused to vouch for its redaction. Callers fall back to a weaker
+ * redaction on any other failure, and doing so here would return text JPDFium could not prove
+ * was removed.
+ */
+ static void rejectUnverifiable(Exception e) throws ToolFailedException {
+ if (e instanceof JPDFiumException engineError
+ && (engineError.isRedactUnverifiable() || engineError.isRedactIncomplete())) {
+ throw ExceptionUtils.createRedactionUnverifiableException(e);
+ }
+ }
+
Map<Integer, List<PDFText>> findTextToRedact(
PDDocument document, String[] listOfText, boolean useRegex, boolean wholeWordSearch) {
@@ -76,7 +107,8 @@ class TextRedactionService {
Map<Integer, List<PDFText>> allFoundTextsByPage,
String[] listOfText,
boolean useRegex,
- boolean wholeWordSearchBool) {
+ boolean wholeWordSearchBool)
+ throws ToolFailedException {
if (allFoundTextsByPage == null || allFoundTextsByPage.isEmpty()) {
return false;
}
@@ -134,6 +166,7 @@ class TextRedactionService {
}
try {
+ requireVerified(result.pageResults());
result.save(tempOut.toPath());
} finally {
if (result.document() != null) {
@@ -151,7 +184,10 @@ class TextRedactionService {
log.info("JPDFium text replacement complete: {} total matches", result.totalMatches());
return false;
+ } catch (ToolFailedException e) {
+ throw e;
} catch (Exception e) {
+ rejectUnverifiable(e);
log.warn(
"JPDFium native text replacement failed, falling back to box-only redaction mode: {}",
e.getMessage());
diff --git a/app/core/src/test/java/stirling/software/SPDF/controller/api/security/RedactControllerMoreTest.java b/app/core/src/test/java/stirling/software/SPDF/controller/api/security/RedactControllerMoreTest.java
index 0065b02cee..aa352fdf2f 100644
--- a/app/core/src/test/java/stirling/software/SPDF/controller/api/security/RedactControllerMoreTest.java
+++ b/app/core/src/test/java/stirling/software/SPDF/controller/api/security/RedactControllerMoreTest.java
@@ -6,6 +6,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.mockStatic;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -16,6 +17,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
@@ -33,6 +35,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
+import org.mockito.MockedStatic;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.mock.web.MockMultipartFile;
@@ -43,8 +46,13 @@ import stirling.software.SPDF.model.api.security.RedactExecuteRequest;
import stirling.software.SPDF.model.api.security.RedactPdfRequest;
import stirling.software.common.model.api.security.RedactionArea;
import stirling.software.common.service.CustomPDFDocumentFactory;
+import stirling.software.common.util.ExceptionUtils.ToolFailedException;
import stirling.software.common.util.TempFile;
import stirling.software.common.util.TempFileManager;
+import stirling.software.jpdfium.exception.RedactUnverifiableException;
+import stirling.software.jpdfium.redact.PdfRedactor;
+import stirling.software.jpdfium.redact.RedactOptions;
+import stirling.software.jpdfium.redact.RedactResult;
/**
* End-to-end coverage tests for {@link RedactController} that drive the controller against real
@@ -216,6 +224,67 @@ class RedactControllerMoreTest {
assertThat(pdfText(out)).contains("public");
}
+ @Test
+ @DisplayName("a page the engine could not verify fails the request instead of returning it")
+ void unverifiedPageFailsTheRequest() throws IOException {
+ byte[] bytes = singlePageTextPdf("public CONFIDENTIAL data");
+ factoryReturns(bytes);
+
+ RedactPdfRequest request = new RedactPdfRequest();
+ request.setFileInput(pdfFile(bytes));
+ request.setListOfText("CONFIDENTIAL");
+ request.setRedactColor("#000000");
+
+ RedactResult unverified =
+ new RedactResult(
+ null,
+ List.of(new RedactResult.PageResult(0, 1, -1)),
+ 0L,
+ false,
+ null,
+ List.of(),
+ List.of(),
+ 0,
+ 0,
+ List.of());
+ try (MockedStatic<PdfRedactor> redactor = mockStatic(PdfRedactor.class)) {
+ redactor.when(() -> PdfRedactor.redact(any(Path.class), any(RedactOptions.class)))
+ .thenReturn(unverified);
+
+ assertThatThrownBy(() -> controller.redactPdf(request))
+ .isInstanceOf(ToolFailedException.class)
+ .hasMessageContaining("page 1")
+ .satisfies(
+ e ->
+ assertThat(((ToolFailedException) e).getErrorCode())
+ .isEqualTo("E077"));
+ }
+ }
+
+ @Test
+ @DisplayName("an engine that could not check its redaction fails the request, no fallback")
+ void unverifiableRedactionFailsTheRequest() throws IOException {
+ byte[] bytes = singlePageTextPdf("public CONFIDENTIAL data");
+ factoryReturns(bytes);
+
+ RedactPdfRequest request = new RedactPdfRequest();
+ request.setFileInput(pdfFile(bytes));
+ request.setListOfText("CONFIDENTIAL");
+ request.setRedactColor("#000000");
+
+ try (MockedStatic<PdfRedactor> redactor = mockStatic(PdfRedactor.class)) {
+ redactor.when(() -> PdfRedactor.redact(any(Path.class), any(RedactOptions.class)))
+ .thenThrow(new RedactUnverifiableException("text page unavailable"));
+
+ assertThatThrownBy(() -> controller.redactPdf(request))
+ .isInstanceOf(ToolFailedException.class)
+ .satisfies(
+ e ->
+ assertThat(((ToolFailedException) e).getErrorCode())
+ .isEqualTo("E083"));
+ }
+ }
+
@Test
@DisplayName("no-match returns the original document unchanged and never reloads")
void noMatchReturnsOriginal() throws IOException {
diff --git a/app/core/src/test/java/stirling/software/SPDF/controller/api/security/RedactControllerTest.java b/app/core/src/test/java/stirling/software/SPDF/controller/api/security/RedactControllerTest.java
index 2f78ee033b..759ad135e4 100644
--- a/app/core/src/test/java/stirling/software/SPDF/controller/api/security/RedactControllerTest.java
+++ b/app/core/src/test/java/stirling/software/SPDF/controller/api/security/RedactControllerTest.java
@@ -966,7 +966,7 @@ class RedactControllerTest {
@Test
@DisplayName("Should handle null redact color gracefully")
- void handleNullRedactColor() {
+ void handleNullRedactColor() throws Exception {
RedactPdfRequest request = createRedactPdfRequest();
request.setListOfText("test");
request.setRedactColor(null);
diff --git a/app/core/src/test/java/stirling/software/SPDF/controller/api/security/RedactExecuteServiceMoreTest.java b/app/core/src/test/java/stirling/software/SPDF/controller/api/security/RedactExecuteServiceMoreTest.java
index 246909efba..9e98a003ee 100644
--- a/app/core/src/test/java/stirling/software/SPDF/controller/api/security/RedactExecuteServiceMoreTest.java
+++ b/app/core/src/test/java/stirling/software/SPDF/controller/api/security/RedactExecuteServiceMoreTest.java
@@ -6,6 +6,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.mockStatic;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -13,6 +14,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -34,6 +36,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
+import org.mockito.MockedStatic;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
@@ -45,8 +48,13 @@ import stirling.software.SPDF.model.api.security.RedactExecuteRequest.RedactionS
import stirling.software.SPDF.model.api.security.RedactExecuteRequest.TextRange;
import stirling.software.SPDF.pdf.parser.PageColumnLayout;
import stirling.software.common.service.CustomPDFDocumentFactory;
+import stirling.software.common.util.ExceptionUtils.ToolFailedException;
import stirling.software.common.util.TempFile;
import stirling.software.common.util.TempFileManager;
+import stirling.software.jpdfium.exception.RedactUnverifiableException;
+import stirling.software.jpdfium.redact.PdfRedactor;
+import stirling.software.jpdfium.redact.RedactOptions;
+import stirling.software.jpdfium.redact.RedactResult;
/**
* Gap-coverage tests for {@link RedactExecuteService}. Drives the full {@code execute()} pipeline
@@ -284,6 +292,62 @@ class RedactExecuteServiceMoreTest {
}
}
+ @Test
+ @DisplayName("a page the engine could not verify fails the request, not an overlay")
+ void unverifiedPageFailsTheRequest() throws IOException {
+ byte[] pdf = singlePageTextPdf("Hide the SECRET word");
+ factoryReturns(pdf);
+
+ RedactExecuteRequest req = requestFor(pdf);
+ req.setTextValues(List.of("SECRET"));
+
+ RedactResult unverified =
+ new RedactResult(
+ null,
+ List.of(new RedactResult.PageResult(0, 1, -1)),
+ 0L,
+ false,
+ null,
+ List.of(),
+ List.of(),
+ 0,
+ 0,
+ List.of());
+ try (MockedStatic<PdfRedactor> redactor = mockStatic(PdfRedactor.class)) {
+ redactor.when(() -> PdfRedactor.redact(any(Path.class), any(RedactOptions.class)))
+ .thenReturn(unverified);
+
+ assertThatThrownBy(() -> service.execute(req))
+ .isInstanceOf(ToolFailedException.class)
+ .satisfies(
+ e ->
+ assertThat(((ToolFailedException) e).getErrorCode())
+ .isEqualTo("E077"));
+ }
+ }
+
+ @Test
+ @DisplayName("an engine that could not check its redaction fails the request, no overlay")
+ void unverifiableRedactionFailsTheRequest() throws IOException {
+ byte[] pdf = singlePageTextPdf("Hide the SECRET word");
+ factoryReturns(pdf);
+
+ RedactExecuteRequest req = requestFor(pdf);
+ req.setTextValues(List.of("SECRET"));
+
+ try (MockedStatic<PdfRedactor> redactor = mockStatic(PdfRedactor.class)) {
+ redactor.when(() -> PdfRedactor.redact(any(Path.class), any(RedactOptions.class)))
+ .thenThrow(new RedactUnverifiableException("text page unavailable"));
+
+ assertThatThrownBy(() -> service.execute(req))
+ .isInstanceOf(ToolFailedException.class)
+ .satisfies(
+ e ->
+ assertThat(((ToolFailedException) e).getErrorCode())
+ .isEqualTo("E083"));
+ }
+ }
+
@Test
@DisplayName("regex pattern redacts matching digit runs")
void regexRemovesDigits() throws IOException {
diff --git a/app/core/src/test/java/stirling/software/SPDF/controller/api/security/TextRedactionServiceExtraTest.java b/app/core/src/test/java/stirling/software/SPDF/controller/api/security/TextRedactionServiceExtraTest.java
index 94e4d7cb6c..0609d09cdb 100644
--- a/app/core/src/test/java/stirling/software/SPDF/controller/api/security/TextRedactionServiceExtraTest.java
+++ b/app/core/src/test/java/stirling/software/SPDF/controller/api/security/TextRedactionServiceExtraTest.java
@@ -1,6 +1,8 @@
package stirling.software.SPDF.controller.api.security;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.io.IOException;
import java.io.InputStream;
@@ -20,6 +22,8 @@ import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import stirling.software.SPDF.model.PDFText;
+import stirling.software.common.util.ExceptionUtils.ToolFailedException;
+import stirling.software.jpdfium.redact.RedactResult.PageResult;
@DisplayName("TextRedactionService extra coverage")
class TextRedactionServiceExtraTest {
@@ -101,4 +105,40 @@ class TextRedactionServiceExtraTest {
}
}
}
+
+ @Nested
+ @DisplayName("requireVerified")
+ class RequireVerified {
+
+ @Test
+ @DisplayName("passes when every page was verified, including pages with no matches")
+ void passesWhenEveryPageVerified() {
+ assertThatCode(
+ () ->
+ TextRedactionService.requireVerified(
+ List.of(
+ new PageResult(0, 1, 2),
+ new PageResult(1, 1, 0))))
+ .doesNotThrowAnyException();
+ }
+
+ @Test
+ @DisplayName("names every page the engine could not verify, numbered from 1")
+ void namesEveryUnverifiedPage() {
+ assertThatThrownBy(
+ () ->
+ TextRedactionService.requireVerified(
+ List.of(
+ new PageResult(0, 1, 1),
+ new PageResult(1, 1, -1),
+ new PageResult(2, 1, 0),
+ new PageResult(3, 1, -1))))
+ .isInstanceOf(ToolFailedException.class)
+ .hasMessageContaining("2, 4")
+ .satisfies(
+ e ->
+ assertThat(((ToolFailedException) e).getErrorCode())
+ .isEqualTo("E077"));
+ }
+ }
}
diff --git a/app/proprietary/src/main/java/stirling/software/proprietary/failure/FailureKind.java b/app/proprietary/src/main/java/stirling/software/proprietary/failure/FailureKind.java
index 044ac34b75..624457959d 100644
--- a/app/proprietary/src/main/java/stirling/software/proprietary/failure/FailureKind.java
+++ b/app/proprietary/src/main/java/stirling/software/proprietary/failure/FailureKind.java
@@ -210,16 +210,16 @@ public enum FailureKind {
/**
* A tool the step shells out to ran and did not deliver: OCRmyPDF or qpdf exited non-zero,
- * LibreOffice produced no PDF/A. E051 is also the bucket unrecognised Ghostscript output falls
- * into, so it carries killed processes and full disks too; the retry offered first clears
- * those.
+ * LibreOffice produced no PDF/A, the redaction engine could not verify its own result. E051 is
+ * also the bucket unrecognised Ghostscript output falls into, so it carries killed processes
+ * and full disks too; the retry offered first clears those.
*/
STEP_TOOL_FAILED(
FailureStage.INTERNAL,
FailureSeverity.ERROR,
FailureRemedy.NEEDS_FILE_FIX,
FailureScope.FILE,
- errorCodes("E044", "E051", "E052", "E060"),
+ errorCodes("E044", "E051", "E052", "E060", "E077", "E083"),
fallback("A tool this step relies on could not process this document."),
global(OPEN_IN_TOOL, OWNER, SECONDARY),
global(VIEW_FILE, OWNER, SECONDARY),
diff --git a/frontend/editor/src/core/services/notificationRetry.ts b/frontend/editor/src/core/services/notificationRetry.ts
index 7008b6a985..c43900eb21 100644
--- a/frontend/editor/src/core/services/notificationRetry.ts
+++ b/frontend/editor/src/core/services/notificationRetry.ts
@@ -56,7 +56,7 @@ export const KIND_ERROR_CODES: Record<string, readonly string[]> = {
INPUT_UNAVAILABLE: ["E030", "E033"],
TOOL_NOT_INSTALLED: ["E042", "E062", "E063", "E064", "E082"],
STEP_CANNOT_RENDER_PAGE: ["E054"],
- STEP_TOOL_FAILED: ["E044", "E051", "E052", "E060"],
+ STEP_TOOL_FAILED: ["E044", "E051", "E052", "E060", "E077", "E083"],
STEP_INTERRUPTED: ["E053"],
STEP_PAGE_TOO_LARGE: ["E081"],
STEP_MISCONFIGURED: ["E040", "E041", "E043", "E050", "E070", "E072"],
diff --git a/testing/failure-kind-codes.json b/testing/failure-kind-codes.json
index 028496dca2..d0eaaef529 100644
--- a/testing/failure-kind-codes.json
+++ b/testing/failure-kind-codes.json
@@ -17,7 +17,7 @@
"INPUT_UNAVAILABLE": ["E030", "E033"],
"TOOL_NOT_INSTALLED": ["E042", "E062", "E063", "E064", "E082"],
"STEP_CANNOT_RENDER_PAGE": ["E054"],
- "STEP_TOOL_FAILED": ["E044", "E051", "E052", "E060"],
+ "STEP_TOOL_FAILED": ["E044", "E051", "E052", "E060", "E077", "E083"],
"STEP_INTERRUPTED": ["E053"],
"STEP_PAGE_TOO_LARGE": ["E081"],
"STEP_MISCONFIGURED": ["E040", "E041", "E043", "E050", "E070", "E072"]