/** * A Catalog shall not contain the EmbeddedFiles entry. * * @param ctx * @throws ValidationException */ protected void validateNames(PreflightContext ctx) throws ValidationException { PDDocumentNameDictionary names = catalog.getNames(); if (names != null) { PDEmbeddedFilesNameTreeNode efs = names.getEmbeddedFiles(); if (efs != null) { addValidationError(ctx, new ValidationError(ERROR_SYNTAX_TRAILER_CATALOG_EMBEDDEDFILES, "EmbeddedFile entry is present in the Names dictionary")); } if (names.getJavaScript() != null) { addValidationError(ctx, new ValidationError(ERROR_ACTION_FORBIDDEN_ACTIONS_NAMED, "Javascript entry is present in the Names dictionary")); } } }
private void sanitizeNamed(PDDocument doc, PDDocumentNameDictionary names) { if (names == null) { return; } new PDEmbeddedFileBleach(this, doc).sanitize(names.getEmbeddedFiles()); if (names.getJavaScript() != null) { recordJavascriptThreat("Named JavaScriptAction", "Action"); names.setJavascript(null); } }
/** * A Catalog shall not contain the EmbeddedFiles entry. * * @param ctx * @throws ValidationException */ protected void validateNames(PreflightContext ctx) throws ValidationException { PDDocumentNameDictionary names = catalog.getNames(); if (names != null) { PDEmbeddedFilesNameTreeNode efs = names.getEmbeddedFiles(); if (efs != null) { addValidationError(ctx, new ValidationError(ERROR_SYNTAX_TRAILER_CATALOG_EMBEDDEDFILES, "EmbeddedFile entry is present in the Names dictionary")); } if (names.getJavaScript() != null) { addValidationError(ctx, new ValidationError(ERROR_ACTION_FORBIDDEN_ACTIONS_NAMED, "Javascript entry is present in the Names dictionary")); } } }
/** * A Catalog shall not contain the EmbeddedFiles entry. * * @param ctx * @throws ValidationException */ protected void validateNames(PreflightContext ctx) throws ValidationException { PDDocumentNameDictionary names = catalog.getNames(); if (names != null) { PDEmbeddedFilesNameTreeNode efs = names.getEmbeddedFiles(); if (efs != null) { addValidationError(ctx, new ValidationError(ERROR_SYNTAX_TRAILER_CATALOG_EMBEDDEDFILES, "EmbeddedFile entry is present in the Names dictionary")); } if (names.getJavaScript() != null) { addValidationError(ctx, new ValidationError(ERROR_ACTION_FORBIDDEN_ACTIONS_NAMED, "Javascript entry is present in the Names dictionary")); } } }