diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index f5fa30d10..d523395f8 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -52,7 +52,7 @@ run: | pipenv run python scripts/convert.py -l all -t all -s all -v 1.22 -e webapp pipenv run python scripts/convert.py -l all -t all -s all -v 2.00 -e webapp - pipenv run python scripts/convert.py -l all -t all -s all -v 1.00 -e mobileapp + pipenv run python scripts/convert.py -l en -t all -s all -v 1.00 -e mobileapp - uses: marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0 # v1.2.1 name: "Create pre-release" with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 45a5a5c19..88ea7b57b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,9 +67,8 @@ run: pipenv run coverage report --fail-under 85 scripts/convert* - name: Generate new output files run: | - pipenv run python scripts/convert.py -l all -t all -s all -v 1.22 -e webapp pipenv run python scripts/convert.py -l all -t all -s all -v 2.00 -e webapp - pipenv run python scripts/convert.py -l all -t all -s all -v 1.00 -e mobileapp + pipenv run python scripts/convert.py -l en -t all -s all -v 1.00 -e mobileapp - uses: marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0 # v1.2.1 name: "Create release" with: @@ -80,24 +79,26 @@ creative-commons-attribution-3.0.txt LICENSE LICENSE.md - output/owasp_cornucopia_webapp_cards_en_1.22_leaflet.idml - output/owasp_cornucopia_webapp_guide_en_1.22_static.docx - output/owasp_cornucopia_webapp_cards_en_1.22_static.idml - output/owasp_cornucopia_webapp_cards_es_1.22_leaflet.idml - output/owasp_cornucopia_webapp_guide_es_1.22_static.docx - output/owasp_cornucopia_webapp_cards_es_1.22_static.idml - output/owasp_cornucopia_webapp_guide_fr_1.22_static.docx - output/owasp_cornucopia_webapp_cards_fr_1.22_static.idml - output/owasp_cornucopia_webapp_cards_fr_1.22_leaflet.idml - output/owasp_cornucopia_webapp_cards_nl_1.22_leaflet.idml - output/owasp_cornucopia_webapp_guide_nl_1.22_static.docx - output/owasp_cornucopia_webapp_cards_nl_1.22_static.idml - output/owasp_cornucopia_webapp_cards_no-nb_1.22_leaflet.idml - output/owasp_cornucopia_webapp_guide_no-nb_1.22_static.docx - output/owasp_cornucopia_webapp_cards_no-nb_1.22_static.idml - output/owasp_cornucopia_webapp_cards_pt-br_1.22_leaflet.idml - output/owasp_cornucopia_webapp_guide_pt-br_1.22_static.docx - output/owasp_cornucopia_webapp_cards_pt-br_1.22_static.idml + output/owasp_cornucopia_webapp_cards_en_2.00_leaflet.idml + output/owasp_cornucopia_webapp_guide_en_2.00_static.docx + output/owasp_cornucopia_webapp_cards_en_2.00_static.idml + output/owasp_cornucopia_webapp_cards_es_2.00_leaflet.idml + output/owasp_cornucopia_webapp_guide_es_2.00_static.docx + output/owasp_cornucopia_webapp_cards_es_2.00_static.idml + output/owasp_cornucopia_webapp_cards_fr_2.00_leaflet.idml + output/owasp_cornucopia_webapp_guide_fr_2.00_static.docx + output/owasp_cornucopia_webapp_cards_fr_2.00_static.idml + output/owasp_cornucopia_webapp_cards_nl_2.00_leaflet.idml + output/owasp_cornucopia_webapp_guide_nl_2.00_static.docx + output/owasp_cornucopia_webapp_cards_nl_2.00_static.idml + output/owasp_cornucopia_webapp_cards_no-nb_2.00_leaflet.idml + output/owasp_cornucopia_webapp_guide_no-nb_2.00_static.docx + output/owasp_cornucopia_webapp_cards_no-nb_2.00_static.idml + output/owasp_cornucopia_webapp_cards_pt-br_2.00_leaflet.idml + output/owasp_cornucopia_webapp_guide_pt-br_2.00_static.docx + output/owasp_cornucopia_webapp_cards_pt-br_2.00_static.idml + output/owasp_cornucopia_mobileapp_cards_en_1.00_static.idml + output/owasp_cornucopia_mobileapp_cards_en_1.00_leaflet.idml README.md source/*.yaml resources/case/owasp_cornucopia_webapp_1.22_case.ai diff --git a/.github/workflows/run-tests-generate-output.yaml b/.github/workflows/run-tests-generate-output.yaml index c906a88f3..c25f094ab 100644 --- a/.github/workflows/run-tests-generate-output.yaml +++ b/.github/workflows/run-tests-generate-output.yaml @@ -84,9 +84,11 @@ jobs: pipenv install -d - name: Generate new output files run: | + pipenv run python scripts/convert.py -l en -t docx -s dynamic -v 1.22 -e webapp + pipenv run python scripts/convert.py -l en -t docx -s dynamic -v 2.00 -e webapp pipenv run python scripts/convert.py -l all -t all -s all -v 1.22 -e webapp pipenv run python scripts/convert.py -l all -t all -s all -v 2.00 -e webapp - pipenv run python scripts/convert.py -l all -t all -s all -v 1.00 -e mobileapp + pipenv run python scripts/convert.py -l en -t all -s all -v 1.00 -e mobileapp - name: Create pull request artifacts uses: gavv/pull-request-artifacts@93f32f061d1fabdb41104db2493f2260c7db774f # v2.1 with: diff --git a/README.md b/README.md index 9dfec0767..19107ce2e 100644 --- a/README.md +++ b/README.md @@ -55,43 +55,44 @@ For font licensing, please read font [README.md](./resources/fonts/README.md) Merges to the main branch will generate new DOCX and IDML files to use to print off new version of the deck but if you wish to produce these locally yourself then use the ./scripts/convert.py scipt to do this: ```bash -(cornucopia) ➜ cornucopia git:(master) ✗ python ./scripts/convert.py --help -usage: convert.py [-h] [-i INPUTFILE] [-t {all,docx,pdf,idml}] [-o OUTPUTFILE] [-l {template,all,en,es,fr,nl,no-nb,pt-br}] [-d] [-s {all,static,dynamic}] [-u URL] +-(cornucopia) ➜ cornucopia git:(master) ✗ python ./scripts/convert.py --help +usage: convert.py [-h] [-i INPUTFILE] [-v {all,latest,1.00,1.20,1.21,1.22,2.00}] [-t {all,docx,pdf,idml}] [-o OUTPUTFILE] [-l {template,all,en,es,fr,nl,no-nb,pt-br}] [-d] + [-s {all,static,dynamic,leaflet}] [-e {all,webapp,mobileapp}] [-u URL] -Tool to output OWASP Cornucopia playing cards into different file types and languages. +Tool to output OWASP Cornucopia playing cards into different file types and languages. Example usage: $ ./cornucopia/convert.py -t docx -l es -v 2.00 -Example usage: c:\cornucopia\scripts\convert.py -t idml -l fr -s static -v 2.00 -o 'my_output_folder/owasp_cornucopia_edition_language_version.idml' +Example usage: c:\cornucopia\scripts\convert.py -t idml -l fr -v 2.00 -o 'my_output_folder/owasp_cornucopia_edition_language_version.idml' options: -h, --help show this help message and exit -i INPUTFILE, --inputfile INPUTFILE Input (template) file to use. - Default=resources/templates/owasp_cornucopia_edition_lang_ver_template.(docx|idml) + Default=resources\templates\owasp_cornucopia_edition_lang_ver_template.(docx|idml) Template type is dependent on output type (-t) or file (-o) specified. - -v {1.00,1.20,1.21,1.22,2.00}, --version {1.00,1.20,1.21,1.22,2.00} - Output version to produce. [`1.20`, `1.21`, `1.22`, `2.00`] + -v {all,latest,1.00,1.20,1.21,1.22,2.00}, --version {all,latest,1.00,1.20,1.21,1.22,2.00} + Output version to produce. [`all`, `latest`, `1.00`, `1.20`, `1.21`, `1.22`, `2.00`] Version 1.20 and 1.2x will deliver cards mapped to ASVS 3.0.1 Version 2.00 and 2.0x will deliver cards mapped to ASVS 4.0 Version 1.00 and 1.0x will deliver cards mapped to MASVS 2.0 Version all will deliver all versions Version latest will deliver the latest deck versions -t {all,docx,pdf,idml}, --outputfiletype {all,docx,pdf,idml} - Type of file to output. Default = docx. If specified, this overwrites the output file extension + Type of file to output. Default = (docx, idml). If specified, this overwrites the output file extension -o OUTPUTFILE, --outputfile OUTPUTFILE - Specify a path and name of output file to generate. (caution: existing file will be overwritten). - default = output/owasp_cornucopia_edition_component_lang_ver.(docx|pdf|idml) + Specify a path and name of output file to generate. (caution: existing file will be overwritten). + default = output\owasp_cornucopia_edition_component_lang_ver.(docx|pdf|idml) -l {template,all,en,es,fr,nl,no-nb,pt-br}, --language {template,all,en,es,fr,nl,no-nb,pt-br} - Output language to produce. [`en`, `es`, `fr`, `nl`, `no-nb`, `pt-br`, `template`] - Template will attempt to create a template from the english input file and + Output language to produce. [`en`, `es`, `fr`, `nl`, `no-nb`, `pt-br`, `template`] + Template will attempt to create a template from the english input file and replacing strings with the template lookup codes -d, --debug Output additional information to debug script + -s {all,static,dynamic,leaflet}, --style {all,static,dynamic,leaflet} + Output style to produce. [`static`, `dynamic` or `leaflet`] + Static cards have the mappings printed on them, dynamic ones a QRCode that points to an maintained list.The leaflet contains the instructions -e {all,webapp,mobileapp}, --edition {all,webapp,mobileapp} Output decks to produce. [`all`, `webapp` or `mobileapp`] The various Cornucopia decks. `web` will give you the web webapp edition.`mobileapp` will give you the MASVS/MASTG edition. - -s {all,static,dynamic,leaflet}, --style {all,static,dynamic,leaflet} - Output style to produce. [`static`, `dynamic` or `leaflet`] - Static cards have the mappings printed on them, dynamic ones a QRCode that points to an maintained list.The leaflet contains the instructions - -u URL, --url URL Specify a URL to use in generating dynamic cards. (caution: URL will be suffixed with / and the card ID). + -u URL, --url URL Specify a URL to use in generating dynamic cards. (caution: URL will be suffixed with / and the card ID). ``` ## Printing diff --git a/scripts/convert.py b/scripts/convert.py index 4f1b4f9ed..46689083c 100644 --- a/scripts/convert.py +++ b/scripts/convert.py @@ -217,7 +217,7 @@ def parse_arguments(input_args: List[str]) -> argparse.Namespace: description = "Tool to output OWASP Cornucopia playing cards into different file types and languages. " description += "\nExample usage: $ ./cornucopia/convert.py -t docx -l es -v 2.00" description += "\nExample usage: c:\\cornucopia\\scripts\\convert.py -t idml -l fr -v 2.00" - description += "-o 'my_output_folder/owasp_cornucopia_edition_language_version.idml'" + description += " -o 'my_output_folder/owasp_cornucopia_edition_language_version.idml'" parser = argparse.ArgumentParser(description=description, formatter_class=argparse.RawTextHelpFormatter) parser.add_argument( "-i", @@ -252,7 +252,7 @@ def parse_arguments(input_args: List[str]) -> argparse.Namespace: "--outputfiletype", type=str, choices=convert_vars.FILETYPE_CHOICES, - help="Type of file to output. Default = docx. If specified, this overwrites the output file extension", + help="Type of file to output. Default = (docx, idml). If specified, this overwrites the output file extension", ) parser.add_argument( "-o", @@ -313,7 +313,7 @@ def parse_arguments(input_args: List[str]) -> argparse.Namespace: parser.add_argument( "-u", "--url", - default="https://copi.securedelivery.io/cards", + default="https://copi.owasp.org/cards", type=str, help=( "Specify a URL to use in generating dynamic cards. (caution: URL will be suffixed with / and the card ID). " @@ -762,9 +762,8 @@ def get_valid_mapping_for_version(version: str, edition: str) -> str: def get_valid_styles() -> List[str]: styles = [] if convert_vars.args.style.lower() == "all": - for style in convert_vars.STYLE_CHOICES: - if style != "all": - styles.append(style) + styles.append("static") + styles.append("leaflet") elif convert_vars.args.style == "": styles.append("static") else: diff --git a/tests/scripts/convert_utest.py b/tests/scripts/convert_utest.py index 030641b97..86c09bfa7 100644 --- a/tests/scripts/convert_utest.py +++ b/tests/scripts/convert_utest.py @@ -133,6 +133,7 @@ def test_get_valid_style_choices_all(self) -> None: c.convert_vars.args = argparse.Namespace(style="all") want_style = c.convert_vars.STYLE_CHOICES want_style.remove("all") + want_style.remove("dynamic") got_style = c.get_valid_styles() self.assertListEqual(want_style, got_style)