Skip to content

Commit

Permalink
[RELEASE] iText pdfSweep 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iText-CI committed Oct 11, 2024
2 parents 12c5a52 + f0cdbe7 commit 3a76a8d
Show file tree
Hide file tree
Showing 21 changed files with 440 additions and 108 deletions.
40 changes: 40 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# iText Security Policy

## Reporting a Vulnerability

We are committed to maintaining the security of our software. If you discover a security vulnerability, we encourage you to report it to us as soon as possible.

To report a vulnerability, please visit our [Vulnerability Reporting Page](https://itextpdf.com/report-vulnerability), or email [vulnerability@apryse.com](vulnerability@apryse.com). If you do not receive a response in 2 business days, please follow up as we may not have received your message.

We follow the procedure of Coordinated Vulnerability Disclosure (CVD) and, to protect the ecosystem, we request that those reporting do the same. Please visit the above page for more information, and follow the steps below to ensure that your report is handled promptly and appropriately:

1. **Do not disclose the vulnerability publicly** until we have had a chance to address it.
2. **Provide a detailed description** of the vulnerability, including steps to reproduce it, if possible.
3. **Include any relevant information** such as the version of pdfSweep you are using, your operating system, and any other pertinent details.

## Security Updates and Patches

When a vulnerability is reported, we will:

1. **Investigate and verify** the vulnerability.
2. **Develop and test** a fix for the vulnerability.
3. **Release a patch** as soon as possible.


## Known Vulnerabilities

The iText Knowledge Base has a page for known [Common Vulnerabilities and Exposures](https://kb.itextpdf.com/itext/cves) (CVEs), please check it to ensure your vulnerability has not already been disclosed or addressed.

## Supported product lines

See [Compatibility Matrix](https://kb.itextpdf.com/itext/compatibility-matrix)

## Security Best Practices

To help ensure the security of your applications using pdfSweep, we recommend the following best practices:

1. **Keep pdfSweep up to date** by regularly checking for and applying updates.
2. **Review and follow** our security guidelines for secure usage.
3. **Monitor your applications** for any unusual activity and investigate any anomalies promptly.

Thank you for helping us keep iText secure!
2 changes: 1 addition & 1 deletion doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = "pdfSweep 4.0.3 API"
PROJECT_NAME = "pdfSweep 5.0.0 API"

# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
Expand Down
6 changes: 3 additions & 3 deletions itext.tests/itext.cleanup.tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

[assembly: Guid("647c862e-d837-4901-8e7b-68f5f8bf8f34")]

[assembly: AssemblyVersion("4.0.3.0")]
[assembly: AssemblyFileVersion("4.0.3.0")]
[assembly: AssemblyInformationalVersion("4.0.3")]
[assembly: AssemblyVersion("5.0.0.0")]
[assembly: AssemblyFileVersion("5.0.0.0")]
[assembly: AssemblyInformationalVersion("5.0.0")]

[assembly: NUnit.Framework.Timeout(300000)]
6 changes: 3 additions & 3 deletions itext.tests/itext.cleanup.tests/itext.cleanup.tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\itextcore\itext\itext.io\itext.io.csproj" Condition="Exists('..\..\..\itextcore\itext\itext.io\itext.io.csproj')" />
<PackageReference Include="itext" Version="8.0.5" Condition="!Exists('..\..\..\itextcore\itext\itext.io\itext.io.csproj')" />
<PackageReference Include="itext" Version="9.0.0" Condition="!Exists('..\..\..\itextcore\itext\itext.io\itext.io.csproj')" />
<ProjectReference Include="..\..\..\itextcore\itext\itext.kernel\itext.kernel.csproj" Condition="Exists('..\..\..\itextcore\itext\itext.kernel\itext.kernel.csproj')" />
<ProjectReference Include="..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.csproj" Condition="Exists('..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.csproj')" />
<PackageReference Include="itext.pdftest" Version="8.0.5" Condition="!Exists('..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.csproj')" />
<PackageReference Include="itext.pdftest" Version="9.0.0" Condition="!Exists('..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.csproj')" />
<ProjectReference Include="..\..\..\itextcore\itext\itext.bouncy-castle-adapter\itext.bouncy-castle-adapter.csproj" Condition="Exists('..\..\..\itextcore\itext\itext.bouncy-castle-adapter\itext.bouncy-castle-adapter.csproj')" />
<PackageReference Include="itext.bouncy-castle-adapter" Version="8.0.5" Condition="!Exists('..\..\..\itextcore\itext\itext.bouncy-castle-adapter\itext.bouncy-castle-adapter.csproj')" />
<PackageReference Include="itext.bouncy-castle-adapter" Version="9.0.0" Condition="!Exists('..\..\..\itextcore\itext\itext.bouncy-castle-adapter\itext.bouncy-castle-adapter.csproj')" />

<ProjectReference Include="..\..\itext\itext.cleanup\itext.cleanup.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ public virtual void BigTaggedDocument() {
CompareByContent(cmp, output, outputPath, "4");
}

[NUnit.Framework.Test]
[LogMessage(iText.IO.Logs.IoLogMessageConstant.CREATED_ROOT_TAG_HAS_MAPPING)]
public virtual void BigTaggedDocumentDynamicOffsetMultiplier() {
String input = inputPath + "chapter8_Interactive_features.pdf";
String output = outputPath + "bigTaggedDocumentDynamicOffsetMultiplier.pdf";
String cmp = inputPath + "cmp_bigTaggedDocument.pdf";
IList<Rectangle> rects = JavaUtil.ArraysAsList(new Rectangle(60f, 80f, 460f, 65f), new Rectangle(300f, 370f
, 215f, 270f));
using (PdfDocument pdfDocument = new PdfDocument(new PdfReader(input), new PdfWriter(output))) {
PdfCleaner.CleanUp(pdfDocument, InitLocations(rects, 131), new CleanUpProperties().SetOffsetProperties(new
PathOffsetApproximationProperties().CalculateOffsetMultiplierDynamically(true)));
}
CompareByContent(cmp, output, outputPath, "4");
}

[NUnit.Framework.Test]
public virtual void TextPositioning() {
String input = inputPath + "textPositioning.pdf";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,15 @@ public virtual void SettingAspectRatioToNullIsOk() {
properties.SetOverlapRatio(null);
NUnit.Framework.Assert.IsNull(properties.GetOverlapRatio());
}

[NUnit.Framework.Test]
public virtual void SetGetPathOffsetApproximationPropertiesTest() {
PathOffsetApproximationProperties pathOffsetApproximationProperties = new PathOffsetApproximationProperties
().CalculateOffsetMultiplierDynamically(true).SetArcTolerance(0.0015);
CleanUpProperties properties = new CleanUpProperties().SetOffsetProperties(pathOffsetApproximationProperties
);
NUnit.Framework.Assert.IsTrue(properties.GetOffsetProperties().CalculateOffsetMultiplierDynamically());
NUnit.Framework.Assert.AreEqual(0.0015, properties.GetOffsetProperties().GetArcTolerance());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,86 @@ You should have received a copy of the GNU Affero General Public License
namespace iText.PdfCleanup {
[NUnit.Framework.Category("UnitTest")]
public class PdfCleanUpFilterUnitTest : ExtendedITextTest {
[NUnit.Framework.Test]
public virtual void PointIntersectLineCaseTest1() {
Point[] intersectSubject = new Point[] { new Point(50, 60), new Point(70, 60), new Point(50, 60) };
Point[] intersecting = new Point[] { new Point(50, 50), new Point(50, 70), new Point(50, 50) };
PdfCleanUpFilter filter = new PdfCleanUpFilter(new List<Rectangle>(), new CleanUpProperties());
NUnit.Framework.Assert.IsTrue(filter.CheckIfRectanglesIntersect(intersectSubject, intersecting));
}

[NUnit.Framework.Test]
public virtual void PointIntersectLineCaseTest2() {
Point[] intersectSubject = new Point[] { new Point(50, 60), new Point(70, 60), new Point(50, 60) };
Point[] intersecting = new Point[] { new Point(50, 50), new Point(50, 30), new Point(50, 50) };
PdfCleanUpFilter filter = new PdfCleanUpFilter(new List<Rectangle>(), new CleanUpProperties());
NUnit.Framework.Assert.IsFalse(filter.CheckIfRectanglesIntersect(intersectSubject, intersecting));
}

[NUnit.Framework.Test]
public virtual void PointIntersectLineCaseTest3() {
Point[] intersectSubject = new Point[] { new Point(50, 65), new Point(70, 65), new Point(50, 65) };
Point[] intersecting = new Point[] { new Point(40, 50), new Point(60, 70), new Point(40, 50) };
PdfCleanUpFilter filter = new PdfCleanUpFilter(new List<Rectangle>(), new CleanUpProperties());
NUnit.Framework.Assert.IsFalse(filter.CheckIfRectanglesIntersect(intersectSubject, intersecting));
}

[NUnit.Framework.Test]
public virtual void PointIntersectLineCaseTest4() {
Point[] intersectSubject = new Point[] { new Point(50, 60), new Point(70, 60), new Point(50, 60) };
Point[] intersecting = new Point[] { new Point(30, 50), new Point(70, 70), new Point(30, 50) };
PdfCleanUpFilter filter = new PdfCleanUpFilter(new List<Rectangle>(), new CleanUpProperties());
NUnit.Framework.Assert.IsTrue(filter.CheckIfRectanglesIntersect(intersectSubject, intersecting));
}

[NUnit.Framework.Test]
public virtual void PointIntersectLineCaseTest5() {
Point[] intersectSubject = new Point[] { new Point(50, 60), new Point(70, 60), new Point(50, 60) };
Point[] intersecting = new Point[] { new Point(70, 50), new Point(30, 70), new Point(70, 50) };
PdfCleanUpFilter filter = new PdfCleanUpFilter(new List<Rectangle>(), new CleanUpProperties());
NUnit.Framework.Assert.IsTrue(filter.CheckIfRectanglesIntersect(intersectSubject, intersecting));
}

[NUnit.Framework.Test]
public virtual void PointIntersectLineCaseTest6() {
Point[] intersectSubject = new Point[] { new Point(50, 80), new Point(70, 80), new Point(50, 80) };
Point[] intersecting = new Point[] { new Point(50, 50), new Point(50, 70), new Point(50, 50) };
PdfCleanUpFilter filter = new PdfCleanUpFilter(new List<Rectangle>(), new CleanUpProperties());
NUnit.Framework.Assert.IsFalse(filter.CheckIfRectanglesIntersect(intersectSubject, intersecting));
}

[NUnit.Framework.Test]
public virtual void PointIntersectLineCaseTest7() {
Point[] intersectSubject = new Point[] { new Point(50, 40), new Point(70, 40), new Point(50, 40) };
Point[] intersecting = new Point[] { new Point(50, 50), new Point(50, 70), new Point(50, 50) };
PdfCleanUpFilter filter = new PdfCleanUpFilter(new List<Rectangle>(), new CleanUpProperties());
NUnit.Framework.Assert.IsFalse(filter.CheckIfRectanglesIntersect(intersectSubject, intersecting));
}

[NUnit.Framework.Test]
public virtual void PointIntersectLineCaseTest8() {
Point[] intersectSubject = new Point[] { new Point(50, 20), new Point(70, 20), new Point(50, 20) };
Point[] intersecting = new Point[] { new Point(50, 50), new Point(50, 30), new Point(50, 50) };
PdfCleanUpFilter filter = new PdfCleanUpFilter(new List<Rectangle>(), new CleanUpProperties());
NUnit.Framework.Assert.IsFalse(filter.CheckIfRectanglesIntersect(intersectSubject, intersecting));
}

[NUnit.Framework.Test]
public virtual void PointIntersectLineCaseTest9() {
Point[] intersectSubject = new Point[] { new Point(50, 40), new Point(70, 40), new Point(50, 40) };
Point[] intersecting = new Point[] { new Point(50, 50), new Point(50, 30), new Point(50, 50) };
PdfCleanUpFilter filter = new PdfCleanUpFilter(new List<Rectangle>(), new CleanUpProperties());
NUnit.Framework.Assert.IsTrue(filter.CheckIfRectanglesIntersect(intersectSubject, intersecting));
}

[NUnit.Framework.Test]
public virtual void PointIntersectLineCaseTest10() {
Point[] intersectSubject = new Point[] { new Point(30, 80), new Point(90, 80), new Point(30, 80) };
Point[] intersecting = new Point[] { new Point(60, 50), new Point(40, 70), new Point(60, 50) };
PdfCleanUpFilter filter = new PdfCleanUpFilter(new List<Rectangle>(), new CleanUpProperties());
NUnit.Framework.Assert.IsFalse(filter.CheckIfRectanglesIntersect(intersectSubject, intersecting));
}

[NUnit.Framework.Test]
public virtual void CheckIfRectanglesIntersect_completelyCoveredBasic() {
Point[] intersectSubject = new Point[] { new Point(70, 70), new Point(80, 70), new Point(80, 80), new Point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,28 +144,28 @@ public virtual void OpenNotWrittenTagsEmptyTest() {
}

private void TestOpenNotWrittenTags(LinkedList<CanvasTag> tags) {
PdfCleanUpProcessor processor = new _PdfCleanUpProcessor_161(tags, null, null);
PdfCleanUpProcessor processor = new _PdfCleanUpProcessor_160(tags, null, null);
foreach (CanvasTag tag in tags) {
processor.AddNotWrittenTag(tag);
}
processor.OpenNotWrittenTags();
}

private sealed class _PdfCleanUpProcessor_161 : PdfCleanUpProcessor {
public _PdfCleanUpProcessor_161(LinkedList<CanvasTag> tags, IList<Rectangle> baseArg1, PdfDocument baseArg2
private sealed class _PdfCleanUpProcessor_160 : PdfCleanUpProcessor {
public _PdfCleanUpProcessor_160(LinkedList<CanvasTag> tags, IList<Rectangle> baseArg1, PdfDocument baseArg2
)
: base(baseArg1, baseArg2) {
this.tags = tags;
}

//\cond DO_NOT_DOCUMENT
internal override PdfCanvas GetCanvas() {
return new _PdfCanvas_164(tags, new PdfStream(), null, null);
return new _PdfCanvas_163(tags, new PdfStream(), null, null);
}
//\endcond

private sealed class _PdfCanvas_164 : PdfCanvas {
public _PdfCanvas_164(LinkedList<CanvasTag> tags, PdfStream baseArg1, PdfResources baseArg2, PdfDocument baseArg3
private sealed class _PdfCanvas_163 : PdfCanvas {
public _PdfCanvas_163(LinkedList<CanvasTag> tags, PdfStream baseArg1, PdfResources baseArg2, PdfDocument baseArg3
)
: base(baseArg1, baseArg2, baseArg3) {
this.tags = tags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,8 +638,7 @@ public virtual void AutoCleanWithFalseProcessAnnotationTest() {
IList<iText.PdfCleanup.PdfCleanUpLocation> additionalLocation = new List<iText.PdfCleanup.PdfCleanUpLocation
>();
additionalLocation.Add(new iText.PdfCleanup.PdfCleanUpLocation(1, new Rectangle(100, 560, 200, 30)));
CleanUpProperties properties = new CleanUpProperties();
properties.SetProcessAnnotations(false);
CleanUpProperties properties = new CleanUpProperties().SetProcessAnnotations(false);
PdfCleaner.AutoSweepCleanUp(new FileStream(input, FileMode.Open, FileAccess.Read), new FileStream(output,
FileMode.Create), strategy, additionalLocation, properties);
CompareByContent(cmp, output, OUTPUT_PATH, "autoCleanWithFalseProcessAnnotationTest");
Expand Down
Binary file not shown.
6 changes: 3 additions & 3 deletions itext/itext.cleanup/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@

[assembly: Guid("ec333396-8945-4d69-b626-475b4e2ede61")]

[assembly: AssemblyVersion("4.0.3.0")]
[assembly: AssemblyFileVersion("4.0.3.0")]
[assembly: AssemblyInformationalVersion("4.0.3")]
[assembly: AssemblyVersion("5.0.0.0")]
[assembly: AssemblyFileVersion("5.0.0.0")]
[assembly: AssemblyInformationalVersion("5.0.0")]
2 changes: 1 addition & 1 deletion itext/itext.cleanup/itext.cleanup.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\itextcore\itext\itext.io\itext.io.csproj" Condition="Exists('..\..\..\itextcore\itext\itext.io\itext.io.csproj')" />
<PackageReference Include="itext" Version="8.0.5" Condition="!Exists('..\..\..\itextcore\itext\itext.io\itext.io.csproj')" />
<PackageReference Include="itext" Version="9.0.0" Condition="!Exists('..\..\..\itextcore\itext\itext.io\itext.io.csproj')" />
<ProjectReference Include="..\..\..\itextcore\itext\itext.kernel\itext.kernel.csproj" Condition="Exists('..\..\..\itextcore\itext\itext.kernel\itext.kernel.csproj')" />
<ProjectReference Include="..\..\..\itextcore\itext\itext.layout\itext.layout.csproj" Condition="Exists('..\..\..\itextcore\itext\itext.layout\itext.layout.csproj')" />
</ItemGroup>
Expand Down
Loading

0 comments on commit 3a76a8d

Please # to comment.