Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ include = [
"pyproject.toml"
]

[tool.hatch.metadata]
allow-direct-references = true

exclude = [
# Without this, the folder is still included to the output tar.gz because it has a Markdown file.
"/developer",
Expand Down Expand Up @@ -95,7 +98,7 @@ dependencies = [
"WebSockets",

# HTML2PDF dependencies
"html2pdf4doc >= 0.0.22",
"html2pdf4doc @ git+https://github.com/strictdoc-project/html2pdf4doc_python.git@main",

# Robot Framework dependencies
"robotframework >= 4.0.0",
Expand Down
50 changes: 50 additions & 0 deletions tests/integration/features/html2pdf/08_long_pre_blocks/input.sdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[DOCUMENT]
TITLE: long source

[TEXT]
STATEMENT: Main file

[REQUIREMENT]
UID: REQ-003
TITLE: one
STATEMENT: >>>
long source content:

i++

i++

i++

i++

i++

i++

i++

i++

i++

i++

i++

i++

i++

i++

i++

i++

i++

i++

i++
<<<
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[project]

cache_dir = "./Output/cache"

features = [
"HTML2PDF",
]
13 changes: 13 additions & 0 deletions tests/integration/features/html2pdf/08_long_pre_blocks/test.itest
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# @relation(SDOC-SRS-51, scope=file)

REQUIRES: TEST_HTML2PDF

RUN: %strictdoc export %S --formats=html2pdf --output-dir %T | filecheck %s --dump-input=fail
CHECK: html2pdf4doc: ChromeDriver available at path: {{.*}}
CHECK: html2pdf4doc: JS logs from the print session

RUN: %check_exists --file %T/html2pdf/pdf/input.pdf

RUN: %check_exists --file %T/html2pdf/html/%THIS_TEST_FOLDER/input-PDF.html

RUN: python %S/test_pdf.py
13 changes: 13 additions & 0 deletions tests/integration/features/html2pdf/08_long_pre_blocks/test_pdf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""
@relation(SDOC-SRS-51, scope=file)
"""

from pypdf import PdfReader

reader = PdfReader("Output/html2pdf/pdf/input.pdf")

assert len(reader.pages) == 4, reader.pages

page3_text = reader.pages[2].extract_text()
assert "long source content" in page3_text
assert "i++" in page3_text
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[DOCUMENT]
TITLE: text in header

[TEXT]
STATEMENT: Main file

[REQUIREMENT]
UID: REQ-003
TITLE: text in header
STATEMENT: >>>
CRA Annex I:

* 'Annex I Part 1 (1)', 'Products with digital elements shall be designed, developed and produced in such a way that they ensure an appropriate level of cybersecurity based on the risks.'
* 'Annex I Part 1 (2-a)', 'On the basis of the cybersecurity risk assessment referred to in Article 13(2) and where applicable, products with digital elements shall:\nbe made available on the market without known exploitable vulnerabilities'
* 'Annex I Part 1 (2-b)', 'On the basis of the cybersecurity risk assessment referred to in Article 13(2) and where applicable, products with digital elements shall:\nbe made available on the market with a secure by default configuration, unless otherwise agreed between manufacturer and business user in relation to a tailor-made product with digital elements, including the possibility to reset the product to its original state'
* 'Annex I Part 1 (2-c)', 'On the basis of the cybersecurity risk assessment referred to in Article 13(2) and where applicable, products with digital elements shall:\nensure that vulnerabilities can be addressed through security updates, including, where applicable, through automatic security updates that are installed within an appropriate timeframe enabled as a default setting, with a clear and easy-to-use opt-out mechanism, through the notification of available updates to users, and the option to temporarily postpone them'
* 'Annex I Part 1 (2-d)', 'On the basis of the cybersecurity risk assessment referred to in Article 13(2) and where applicable, products with digital elements shall:\nensure protection from unauthorised access by appropriate control mechanisms, including but not limited to authentication, identity or access management systems, and report on possible unauthorised access'
* 'Annex I Part 1 (2-e)', 'On the basis of the cybersecurity risk assessment referred to in Article 13(2) and where applicable, products with digital elements shall:\nprotect the confidentiality of stored, transmitted or otherwise processed data, personal or other, such as by encrypting relevant data at rest or in transit by state of the art mechanisms, and by using other technical means'
* 'Annex I Part 1 (2-f)', 'On the basis of the cybersecurity risk assessment referred to in Article 13(2) and where applicable, products with digital elements shall:\nprotect the integrity of stored, transmitted or otherwise processed data, personal or other, commands, programs and configuration against any manipulation or modification not authorised by the user, and report on corruptions'
* 'Annex I Part 1 (2-g)', 'On the basis of the cybersecurity risk assessment referred to in Article 13(2) and where applicable, products with digital elements shall:\nprocess only data, personal or other, that are adequate, relevant and limited to what is necessary in relation to the intended purpose of the product with digital elements (data minimisation)'
* 'Annex I Part 1 (2-h)', 'On the basis of the cybersecurity risk assessment referred to in Article 13(2) and where applicable, products with digital elements shall:\nprotect the availability of essential and basic functions, also after an incident, including through resilience and mitigation measures against denial-of-service attacks'
* 'Annex I Part 1 (2-i)', 'On the basis of the cybersecurity risk assessment referred to in Article 13(2) and where applicable, products with digital elements shall:\nminimise the negative impact by the products themselves or connected devices on the availability of services provided by other devices or networks'
* 'Annex I Part 1 (2-j)', 'On the basis of the cybersecurity risk assessment referred to in Article 13(2) and where applicable, products with digital elements shall:\nbe designed, developed and produced to limit attack surfaces, including external interfaces'
* 'Annex I Part 1 (2-k)', 'On the basis of the cybersecurity risk assessment referred to in Article 13(2) and where applicable, products with digital elements shall:\nbe designed, developed and produced to reduce the impact of an incident using appropriate exploitation mitigation mechanisms and techniques'
* 'Annex I Part 1 (2-l)', 'On the basis of the cybersecurity risk assessment referred to in Article 13(2) and where applicable, products with digital elements shall:\nprovide security related information by recording and monitoring relevant internal activity, including the access to or modification of data, services or functions, with an opt-out mechanism for the user'
* 'Annex I Part 1 (2-m)', 'On the basis of the cybersecurity risk assessment referred to in Article 13(2) and where applicable, products with digital elements shall:\nprovide the possibility for users to securely and easily remove on a permanent basis all data and settings and, where such data can be transferred to other products or systems, ensure that this is done in a secure manner'
* 'Annex I Part 2 (1)', 'Manufacturers of products with digital elements shall:\nidentify and document vulnerabilities and components contained in products with digital elements, including by drawing up a software bill of materials in a commonly used and machine-readable format covering at the very least the top-level dependencies of the products'
* 'Annex I Part 2 (2)', 'Manufacturers of products with digital elements shall:\nin relation to the risks posed to products with digital elements, address and remediate vulnerabilities without delay, including by providing security updates\nwhere technically feasible, new security updates shall be provided separately from functionality updates'
* 'Annex I Part 2 (3)', 'Manufacturers of products with digital elements shall:\napply effective and regular tests and reviews of the security of the product with digital elements'
* 'Annex I Part 2 (4)', 'Manufacturers of products with digital elements shall:\nonce a security update has been made available, share and publicly disclose information about fixed vulnerabilities, including a description of the vulnerabilities, information allowing users to identify the product with digital elements affected, the impacts of the vulnerabilities, their severity and clear and accessible information helping users to remediate the vulnerabilities\nin duly justified cases, where manufacturers consider the security risks of publication to outweigh the security benefits, they may delay making public information regarding a fixed vulnerability until after users have been given the possibility to apply the relevant patch'
* 'Annex I Part 2 (5)', 'Manufacturers of products with digital elements shall:\nput in place and enforce a policy on coordinated vulnerability disclosure'
* 'Annex I Part 2 (6)', 'Manufacturers of products with digital elements shall:\ntake measures to facilitate the sharing of information about potential vulnerabilities in their product with digital elements as well as in third-party components contained in that product, including by providing a contact address for the reporting of the vulnerabilities discovered in the product with digital elements'
* 'Annex I Part 2 (7)', 'Manufacturers of products with digital elements shall:\nprovide for mechanisms to securely distribute updates for products with digital elements to ensure that vulnerabilities are fixed or mitigated in a timely manner and, where applicable for security updates, in an automatic manner'
* 'Annex I Part 2 (8)', 'Manufacturers of products with digital elements shall:\nensure that, where security updates are available to address identified security issues, they are disseminated without delay and, unless otherwise agreed between a manufacturer and a business user in relation to a tailor-made product with digital elements, free of charge, accompanied by advisory messages providing users with the relevant information, including on potential action to be taken'
<<<
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[project]

cache_dir = "./Output/cache"

features = [
"HTML2PDF",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# @relation(SDOC-SRS-51, scope=file)

REQUIRES: TEST_HTML2PDF

RUN: %strictdoc export %S --formats=html2pdf --output-dir %T | filecheck %s --dump-input=fail
CHECK: html2pdf4doc: ChromeDriver available at path: {{.*}}
CHECK: html2pdf4doc: JS logs from the print session

RUN: %check_exists --file %T/html2pdf/pdf/input.pdf

RUN: %check_exists --file %T/html2pdf/html/%THIS_TEST_FOLDER/input-PDF.html

RUN: python %S/test_pdf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""
@relation(SDOC-SRS-51, scope=file)
"""

from pypdf import PdfReader

reader = PdfReader("Output/html2pdf/pdf/input.pdf")

assert len(reader.pages) == 6, reader.pages

page3_text = reader.pages[2].extract_text()
assert "CRA Annex I:" in page3_text, page3_text