Merge branch 'master' of github.com:ZUGFeRD/mustangproject
This commit is contained in:
29
SECURITY.md
Normal file
29
SECURITY.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
The following versions are currently being supported with security updates.
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
| ------- | ------------------ |
|
||||||
|
| 2.x.x | :white_check_mark: |
|
||||||
|
| < 2.0 | :x: |
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
Feel free to submit issues to info at mustangproject.org with [security] indicated in the subject.
|
||||||
|
We may ask back questions but we usually open (or communicate about) an issue (potentially in a private location you would be provided with access to) and decide on the severity within two working days.
|
||||||
|
|
||||||
|
Please indicate
|
||||||
|
* a proof of concept, if possible
|
||||||
|
* If any of the information you submit, e.g. an invoice which can not be [anonymized](https://github.com/ZUGFeRD/einvoice-anonymizer), is confidential
|
||||||
|
* A quick justification why you require a fix in a older version than he most up to date one, if you can not update to the most recent version
|
||||||
|
* If you require encrypted communication (our GPG fingerprint will likely be 68F4 2269 8165 F0F5 63CA A13B 7CB7 1548 B596 66A3)
|
||||||
|
|
||||||
|
|
||||||
|
## After your Report
|
||||||
|
|
||||||
|
We try to fix critical issues in less than a week, and release a fixed version in less than two weeks.
|
||||||
|
|
||||||
|
Thank you for keeping our software safe!
|
||||||
|
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
package org.mustangproject.ZUGFeRD;
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
|
import java.io.BufferedOutputStream;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.StringReader;
|
||||||
import org.apache.fop.apps.*;
|
import org.apache.fop.apps.*;
|
||||||
import org.apache.fop.apps.io.ResourceResolverFactory;
|
import org.apache.fop.apps.io.ResourceResolverFactory;
|
||||||
import org.apache.fop.configuration.Configuration;
|
import org.apache.fop.configuration.Configuration;
|
||||||
@@ -15,7 +23,7 @@ import javax.xml.transform.*;
|
|||||||
import javax.xml.transform.sax.SAXResult;
|
import javax.xml.transform.sax.SAXResult;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
import javax.xml.transform.stream.StreamSource;
|
import javax.xml.transform.stream.StreamSource;
|
||||||
import java.io.*;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
public class ValidationLogVisualizer {
|
public class ValidationLogVisualizer {
|
||||||
@@ -71,7 +79,7 @@ public class ValidationLogVisualizer {
|
|||||||
return baos.toString(StandardCharsets.UTF_8);
|
return baos.toString(StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toPDF(String xmlLogfileContent, String pdfFilename) {
|
public byte[] createPDFBytes(String xmlLogfileContent) {
|
||||||
|
|
||||||
// the writing part
|
// the writing part
|
||||||
|
|
||||||
@@ -112,7 +120,8 @@ public class ValidationLogVisualizer {
|
|||||||
// Step 2: Set up output stream.
|
// Step 2: Set up output stream.
|
||||||
// Note: Using BufferedOutputStream for performance reasons (helpful with FileOutputStreams).
|
// Note: Using BufferedOutputStream for performance reasons (helpful with FileOutputStreams).
|
||||||
|
|
||||||
try (OutputStream out = new BufferedOutputStream(new FileOutputStream(pdfFilename))) {
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
try (OutputStream out = new BufferedOutputStream(baos)) {
|
||||||
|
|
||||||
// Step 3: Construct fop with desired output format
|
// Step 3: Construct fop with desired output format
|
||||||
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
|
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
|
||||||
@@ -139,6 +148,20 @@ public class ValidationLogVisualizer {
|
|||||||
} catch (FOPException | IOException | TransformerException e) {
|
} catch (FOPException | IOException | TransformerException e) {
|
||||||
LOGGER.error("Failed to create PDF", e);
|
LOGGER.error("Failed to create PDF", e);
|
||||||
}
|
}
|
||||||
|
return baos.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] toPDF(String xmlLogfileContent) {
|
||||||
|
return createPDFBytes(xmlLogfileContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toPDF(String xmlLogfileContent, String pdfFilename) {
|
||||||
|
byte[] pdfData = createPDFBytes(xmlLogfileContent);
|
||||||
|
try (FileOutputStream fos = new FileOutputStream(pdfFilename)) {
|
||||||
|
fos.write(pdfData);
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOGGER.error("Failed to write PDF to file", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ClasspathResourceURIResolver implements URIResolver {
|
private static class ClasspathResourceURIResolver implements URIResolver {
|
||||||
|
|||||||
Reference in New Issue
Block a user