Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure whitespace doesn't get trimmed when the text placeholders are replaced inside the paragraph. #446

Merged
merged 2 commits into from
Apr 26, 2024

Conversation

sydseter
Copy link
Collaborator

@sydseter sydseter commented Apr 25, 2024

In this pull-request:

  • Improve the consistency and readability for the asvs, capec, scp and appsensor code tables
  • Support for having multiple text placeholders within the same paragraph without getting tabs, space and other whitespace characters stripped. Needed for correctly being able to build the leaflet.

I found some complicated code related to the replacing the text placeholders correctly even if the case was wrong. Very considerate, but it added a lot of complexity that didn't really take away the need for doing QA so I removed it. (only used for the idml files btw.)

owasp_cornucopia_ecommerce_cards_en_1.30_leaflet.pdf

owasp_cornucopia_ecommerce_cards_en_1.30_static.pdf

@sydseter sydseter requested a review from rewtd April 25, 2024 23:41
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
Copy link
Contributor

🤖 Pull request artifacts

The generated Cornucopia cards in this pull request.

file commit
owasp_cornucopia_ecommerce_cards_en_1.21_dynamic.docx 4afbad3
owasp_cornucopia_ecommerce_cards_en_1.21_dynamic.idml 4afbad3
owasp_cornucopia_ecommerce_cards_en_1.21_static.docx 4afbad3
owasp_cornucopia_ecommerce_cards_en_1.21_static.idml 4afbad3
owasp_cornucopia_ecommerce_cards_en_1.30_dynamic.docx 4afbad3
owasp_cornucopia_ecommerce_cards_en_1.30_dynamic.idml 4afbad3
owasp_cornucopia_ecommerce_cards_en_1.30_dynamic.pdf 4afbad3
owasp_cornucopia_ecommerce_cards_en_1.30_leaflet.idml 4afbad3
owasp_cornucopia_ecommerce_cards_en_1.30_static.docx 4afbad3
owasp_cornucopia_ecommerce_cards_en_1.30_static.idml 4afbad3
owasp_cornucopia_ecommerce_cards_en_1.30_static.pdf 4afbad3
owasp_cornucopia_ecommerce_cards_es_1.20_dynamic.docx 4afbad3
owasp_cornucopia_ecommerce_cards_es_1.20_dynamic.idml 4afbad3
owasp_cornucopia_ecommerce_cards_es_1.20_static.docx 4afbad3
owasp_cornucopia_ecommerce_cards_es_1.20_static.idml 4afbad3
owasp_cornucopia_ecommerce_cards_es_1.30_dynamic.docx 4afbad3
owasp_cornucopia_ecommerce_cards_es_1.30_dynamic.pdf 4afbad3
owasp_cornucopia_ecommerce_cards_es_1.30_dynamic.idml 4afbad3
owasp_cornucopia_ecommerce_cards_es_1.30_leaflet.idml 4afbad3
owasp_cornucopia_ecommerce_cards_es_1.30_static.docx 4afbad3
owasp_cornucopia_ecommerce_cards_es_1.30_static.pdf 4afbad3
owasp_cornucopia_ecommerce_cards_es_1.30_static.idml 4afbad3
owasp_cornucopia_ecommerce_cards_fr_1.20_dynamic.docx 4afbad3
owasp_cornucopia_ecommerce_cards_fr_1.20_dynamic.idml 4afbad3
owasp_cornucopia_ecommerce_cards_fr_1.20_static.docx 4afbad3
owasp_cornucopia_ecommerce_cards_fr_1.20_static.idml 4afbad3
owasp_cornucopia_ecommerce_cards_fr_1.30_dynamic.docx 4afbad3
owasp_cornucopia_ecommerce_cards_fr_1.30_dynamic.idml 4afbad3
owasp_cornucopia_ecommerce_cards_fr_1.30_dynamic.pdf 4afbad3
owasp_cornucopia_ecommerce_cards_fr_1.30_leaflet.idml 4afbad3
owasp_cornucopia_ecommerce_cards_fr_1.30_static.docx 4afbad3
owasp_cornucopia_ecommerce_cards_fr_1.30_static.idml 4afbad3
owasp_cornucopia_ecommerce_cards_fr_1.30_static.pdf 4afbad3
owasp_cornucopia_ecommerce_cards_nl_1.21_dynamic.docx 4afbad3
owasp_cornucopia_ecommerce_cards_nl_1.21_dynamic.idml 4afbad3
owasp_cornucopia_ecommerce_cards_nl_1.21_static.docx 4afbad3
owasp_cornucopia_ecommerce_cards_nl_1.21_static.idml 4afbad3
owasp_cornucopia_ecommerce_cards_nl_1.30_dynamic.docx 4afbad3
owasp_cornucopia_ecommerce_cards_nl_1.30_dynamic.idml 4afbad3
owasp_cornucopia_ecommerce_cards_nl_1.30_dynamic.pdf 4afbad3
owasp_cornucopia_ecommerce_cards_nl_1.30_leaflet.idml 4afbad3
owasp_cornucopia_ecommerce_cards_nl_1.30_static.docx 4afbad3
owasp_cornucopia_ecommerce_cards_nl_1.30_static.idml 4afbad3
owasp_cornucopia_ecommerce_cards_nl_1.30_static.pdf 4afbad3
owasp_cornucopia_ecommerce_cards_no-nb_1.30_dynamic.docx 4afbad3
owasp_cornucopia_ecommerce_cards_no-nb_1.30_dynamic.idml 4afbad3
owasp_cornucopia_ecommerce_cards_no-nb_1.30_dynamic.pdf 4afbad3
owasp_cornucopia_ecommerce_cards_no-nb_1.30_leaflet.idml 4afbad3
owasp_cornucopia_ecommerce_cards_no-nb_1.30_static.docx 4afbad3
owasp_cornucopia_ecommerce_cards_no-nb_1.30_static.idml 4afbad3
owasp_cornucopia_ecommerce_cards_no-nb_1.30_static.pdf 4afbad3
owasp_cornucopia_ecommerce_cards_pt-br_1.20_dynamic.docx 4afbad3
owasp_cornucopia_ecommerce_cards_pt-br_1.20_dynamic.idml 4afbad3
owasp_cornucopia_ecommerce_cards_pt-br_1.20_static.docx 4afbad3
owasp_cornucopia_ecommerce_cards_pt-br_1.20_static.idml 4afbad3
owasp_cornucopia_ecommerce_cards_pt-br_1.30_dynamic.docx 4afbad3
owasp_cornucopia_ecommerce_cards_pt-br_1.30_dynamic.idml 4afbad3
owasp_cornucopia_ecommerce_cards_pt-br_1.30_dynamic.pdf 4afbad3
owasp_cornucopia_ecommerce_cards_pt-br_1.30_leaflet.idml 4afbad3
owasp_cornucopia_ecommerce_cards_pt-br_1.30_static.docx 4afbad3
owasp_cornucopia_ecommerce_cards_pt-br_1.30_static.idml 4afbad3
owasp_cornucopia_ecommerce_cards_pt-br_1.30_static.pdf 4afbad3

github-actions bot added a commit that referenced this pull request Apr 26, 2024
github-actions bot added a commit that referenced this pull request Apr 26, 2024
Copy link
Collaborator

@rewtd rewtd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - assuming _misc is not used for anything?

@@ -1488,7 +1488,6 @@ def setUp(self) -> None:
self.replacement_values = [
("${VE_suit}", "Validation & Encoding"),
("${VE_VE2_desc}", "You have invented a new attack against Data Validation and Encoding"),
("${VE_VE2_misc'}", "Read more about this topic in OWASP's free Cheat Sheets"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the _misc never called?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really testing misc it’s testing how templating is suppose to work if the template label has the wrong case, contain apostroph or the template value is surrounded with whitespace. I removed it as this functionality is not used and make the code complicated and error prone.

return v
elif el_text.strip().lower() == k2.lower():
return v2
elif convert_vars.making_template:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code allowed templates to be created in the first place - it's probably no longer required and it exists in the git history if we ever need it again.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I would not automaticly build templates. Keep in mind that we are talking about idml templates here, not yaml or docx

@sydseter sydseter merged commit b0d5ebb into master Apr 26, 2024
10 checks passed
@sydseter sydseter deleted the bugfix/whitespace-trimming branch May 10, 2024 05:24
sydseter added a commit to sydseter/cornucopia that referenced this pull request Jun 7, 2024
Ensure whitespace doesn't get trimmed when the text placeholders are replaced inside the paragraph.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants