Add 'CONFIDENTIAL', 'DRAFT', and TLP marks to the cover

This commit is contained in:
maride 2025-11-24 14:03:37 +01:00
parent 35e7ca67f3
commit f9cb3e474d
4 changed files with 103 additions and 3 deletions

View File

@ -7,6 +7,7 @@ Penetration Test report template written in [typst](https://typst.app).
- Provides a *Management Summary*, *Test Scope*, *Findings*, and *Appendix* section
- Easy to use, handles the formatting and typesetting hassle for you - as well as all those text you copy-paste anyway
- Supports [CVSS V3.1](https://www.first.org/cvss/v3-1/)
- Supports [TLP V2.0](https://www.first.org/tlp/)
## Usage

View File

@ -133,3 +133,78 @@
}
)
}
// confidentialMark draws a "CONFIDENTIAL" stamp, used on the cover page
#let confidentialMark() = {
rect(
height: 100%,
width: 100%,
stroke: (paint: red, thickness: 2pt, dash: "solid"),
align(center + horizon,
text(
size: 18pt,
weight: "semibold",
fill: red,
"CONFIDENTIAL"
)
)
)
}
#let draftMark() = {
rect(
height: 100%,
width: 100%,
stroke: (paint: blue, thickness: 2pt, dash: "solid"),
align(center + horizon,
text(
size: 18pt,
weight: "semibold",
fill: blue,
"DRAFT"
)
)
)
}
// tlpMark draws a Traffic Light Protocol mark, used on the cover page
// light may be one of "RED", "AMBER", "AMBER+STRICT", "GREEN", or "CLEAR"
#let tlpMark(light) = {
light = upper(light)
let lightMap = (
"RED": (color: rgb("#FF2B2B"), title: "TLP:RED", content: "recipient only"),
"AMBER": (color: rgb("#FFC000"), title: "TLP:AMBER", content: "organisation only"),
"AMBER+STRICT": (color: rgb("#FFC000"), title: "TLP:AMBER+STRICT", content: "organisation\nand its clients"),
"GREEN": (color: rgb("#33FF00"), title: "TLP:GREEN", content: "within community"),
"CLEAR": (color: rgb("#FFFFFF"), title: "TLP:CLEAR", content: "public")
)
// check argument
panicOnInvalid(light, lightMap.keys())
rect(
height: 100%,
width: 100%,
stroke: (paint: lightMap.at(light).color.darken(10%), thickness: 2pt, dash: "solid"),
align(center + horizon,
grid(
columns: (80%),
rows: (18pt, auto),
gutter: 8pt,
highlight(
fill: black,
text(
size: if light == "AMBER+STRICT" { 13pt } else { 18pt },
weight: "semibold",
fill: lightMap.at(light).color,
lightMap.at(light).title
)
),
text(
size: 12pt,
fill: if light == "CLEAR" { black } else { lightMap.at(light).color.darken(10%) },
lightMap.at(light).content
)
)
)
)
}

View File

@ -18,7 +18,11 @@
#set par(justify: true)
// ----- Cover & Legal disclaimer(s) -----
#pages.cover(targetFull, place, author)
#pages.cover(targetFull, place, author,
confidential: false, // set to true for a "CONFIDENTIAL" mark on the cover
tlp: "red", // set to one of "RED", "AMBER+STRICT", "AMBER", "GREEN", "CLEAR", or none. See https://www.first.org/tlp/
draft: true // set to true for a "DRAFT" mark on the cover
)
#pages.legal(author)
#set page(

View File

@ -2,7 +2,7 @@
#import "helper.typ"
#let cover(title, place, author) = {
#let cover(title, place, author, confidential: false, tlp: none, draft: false) = {
// Define page
set page(
paper: "a4",
@ -21,11 +21,31 @@
#text(title, weight: "black")
])
v(0pt)
v(0.25pt)
text(size: 16pt, [
#place, #datetime.today().display("[day].[month].[year]") • #author
])
v(1fr)
grid(
columns: (1fr, 1fr, 1fr),
gutter: 5pt,
rows: (75pt),
// "Confidential" marking
if confidential {
helper.confidentialMark()
},
// "Draft" marking
if draft {
helper.draftMark()
},
// TLP marking, see https://www.first.org/tlp/
if tlp != none {
helper.tlpMark(tlp)
}
)
}
#let legal(author) = {