-
Notifications
You must be signed in to change notification settings - Fork 523
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
[Bug] Fix URL links in autogenerated security docs #3474
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great peer review! LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Glad to see these bugs addressed at the same time. We'll revisit this all when we migrate all docs to the new site/ mdx format.
* added content() class method for guide and setup * removed non-existent variable * removed unnecessary newlines * adjusted levels for titles * reverting changes * added method to convert markdown links to asciidoc * adjusted regex to include trailing periods * fixing linting errors * adjusted regex pattern * added content() class method for guide and setup * stripped # out of investigation guide, setup or note * adjusted formatting outcome * changed function call * fixed linting errors * fixing auto-formatting for rule asciidoc * fixing URL link removal * fixing URL link removal * removed strip() from string for setup * fixed linting errors * fixed linting errors * adjusting code formatting for convert_markdown_to_asciidoc (cherry picked from commit 8e0ca42)
* added content() class method for guide and setup * removed non-existent variable * removed unnecessary newlines * adjusted levels for titles * reverting changes * added method to convert markdown links to asciidoc * adjusted regex to include trailing periods * fixing linting errors * adjusted regex pattern * added content() class method for guide and setup * stripped # out of investigation guide, setup or note * adjusted formatting outcome * changed function call * fixed linting errors * fixing auto-formatting for rule asciidoc * fixing URL link removal * fixing URL link removal * removed strip() from string for setup * fixed linting errors * fixed linting errors * adjusting code formatting for convert_markdown_to_asciidoc (cherry picked from commit 8e0ca42)
* added content() class method for guide and setup * removed non-existent variable * removed unnecessary newlines * adjusted levels for titles * reverting changes * added method to convert markdown links to asciidoc * adjusted regex to include trailing periods * fixing linting errors * adjusted regex pattern * added content() class method for guide and setup * stripped # out of investigation guide, setup or note * adjusted formatting outcome * changed function call * fixed linting errors * fixing auto-formatting for rule asciidoc * fixing URL link removal * fixing URL link removal * removed strip() from string for setup * fixed linting errors * fixed linting errors * adjusting code formatting for convert_markdown_to_asciidoc (cherry picked from commit 8e0ca42)
* added content() class method for guide and setup * removed non-existent variable * removed unnecessary newlines * adjusted levels for titles * reverting changes * added method to convert markdown links to asciidoc * adjusted regex to include trailing periods * fixing linting errors * adjusted regex pattern * added content() class method for guide and setup * stripped # out of investigation guide, setup or note * adjusted formatting outcome * changed function call * fixed linting errors * fixing auto-formatting for rule asciidoc * fixing URL link removal * fixing URL link removal * removed strip() from string for setup * fixed linting errors * fixed linting errors * adjusting code formatting for convert_markdown_to_asciidoc (cherry picked from commit 8e0ca42)
* added content() class method for guide and setup * removed non-existent variable * removed unnecessary newlines * adjusted levels for titles * reverting changes * added method to convert markdown links to asciidoc * adjusted regex to include trailing periods * fixing linting errors * adjusted regex pattern * added content() class method for guide and setup * stripped # out of investigation guide, setup or note * adjusted formatting outcome * changed function call * fixed linting errors * fixing auto-formatting for rule asciidoc * fixing URL link removal * fixing URL link removal * removed strip() from string for setup * fixed linting errors * fixed linting errors * adjusting code formatting for convert_markdown_to_asciidoc (cherry picked from commit 8e0ca42)
* added content() class method for guide and setup * removed non-existent variable * removed unnecessary newlines * adjusted levels for titles * reverting changes * added method to convert markdown links to asciidoc * adjusted regex to include trailing periods * fixing linting errors * adjusted regex pattern * added content() class method for guide and setup * stripped # out of investigation guide, setup or note * adjusted formatting outcome * changed function call * fixed linting errors * fixing auto-formatting for rule asciidoc * fixing URL link removal * fixing URL link removal * removed strip() from string for setup * fixed linting errors * fixed linting errors * adjusting code formatting for convert_markdown_to_asciidoc (cherry picked from commit 8e0ca42)
* added content() class method for guide and setup * removed non-existent variable * removed unnecessary newlines * adjusted levels for titles * reverting changes * added method to convert markdown links to asciidoc * adjusted regex to include trailing periods * fixing linting errors * adjusted regex pattern * added content() class method for guide and setup * stripped # out of investigation guide, setup or note * adjusted formatting outcome * changed function call * fixed linting errors * fixing auto-formatting for rule asciidoc * fixing URL link removal * fixing URL link removal * removed strip() from string for setup * fixed linting errors * fixed linting errors * adjusting code formatting for convert_markdown_to_asciidoc (cherry picked from commit 8e0ca42)
* added content() class method for guide and setup * removed non-existent variable * removed unnecessary newlines * adjusted levels for titles * reverting changes * added method to convert markdown links to asciidoc * adjusted regex to include trailing periods * fixing linting errors * adjusted regex pattern * added content() class method for guide and setup * stripped # out of investigation guide, setup or note * adjusted formatting outcome * changed function call * fixed linting errors * fixing auto-formatting for rule asciidoc * fixing URL link removal * fixing URL link removal * removed strip() from string for setup * fixed linting errors * fixed linting errors * adjusting code formatting for convert_markdown_to_asciidoc (cherry picked from commit 8e0ca42)
* added content() class method for guide and setup * removed non-existent variable * removed unnecessary newlines * adjusted levels for titles * reverting changes * added method to convert markdown links to asciidoc * adjusted regex to include trailing periods * fixing linting errors * adjusted regex pattern * added content() class method for guide and setup * stripped # out of investigation guide, setup or note * adjusted formatting outcome * changed function call * fixed linting errors * fixing auto-formatting for rule asciidoc * fixing URL link removal * fixing URL link removal * removed strip() from string for setup * fixed linting errors * fixed linting errors * adjusting code formatting for convert_markdown_to_asciidoc (cherry picked from commit 8e0ca42)
* added content() class method for guide and setup * removed non-existent variable * removed unnecessary newlines * adjusted levels for titles * reverting changes * added method to convert markdown links to asciidoc * adjusted regex to include trailing periods * fixing linting errors * adjusted regex pattern * added content() class method for guide and setup * stripped # out of investigation guide, setup or note * adjusted formatting outcome * changed function call * fixed linting errors * fixing auto-formatting for rule asciidoc * fixing URL link removal * fixing URL link removal * removed strip() from string for setup * fixed linting errors * fixed linting errors * adjusting code formatting for convert_markdown_to_asciidoc (cherry picked from commit 8e0ca42)
Summary
Security docs for prebuilt rule releases are currently generating links that do not pass tests upstream. We need to adjust accordingly in
docs.py
. More details to come.Additional details
This PR introduces changes to
doc.py
which programmatically creates security rule AsciiDocs that are pushed as updates in a PR to elastic/security-docs.Thread conversation with docs team for debugging
What was the issue?
investigation_guide
andsetup
, when generating the rule asciidoc, we would write these strings to the file as asciidoc codeblocks, with the source being markdownCI Job with broken links reference
NOTE: OSQuery code still appears in the final rule documentation and thus does not render into a hyperlink like it does in the Kibana UI.
Solution evidence
Bugs Fixed
Setup
is added to the rule but was missing. This was completed in a previous PR.Comparison from Preview Sites
Note that with these changes do remove markdown
#
headers and thus we loose the markdown header levels since we are converting these to asciidoc and making them bolded strings. The reason we do not attempt to convert them to asciidoc levels is because of the leveling sequential requirements noted here.Suggested changes:
![Screenshot 2024-02-23 at 4 01 54 PM](https://private-user-images.githubusercontent.com/99630311/307454665-134990cc-cfd5-4c00-b16a-f21ecd64dfbb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MzYzODUsIm5iZiI6MTczOTQzNjA4NSwicGF0aCI6Ii85OTYzMDMxMS8zMDc0NTQ2NjUtMTM0OTkwY2MtY2ZkNS00YzAwLWIxNmEtZjIxZWNkNjRkZmJiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA4NDEyNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQwYjUzNTg4M2I2NjQ4OTZhY2U2OTY3ZTg4NDkxYzg0NDNkNGUwNzQ1ZjcxYWE5YjA3ZjJjZDZjMjhhMGQ2OGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.XqRe3M5JKusbZ-merTldqI9MJYUgcUaYrvpoSaLmtOU)
Existing:
![Screenshot 2024-02-23 at 4 02 16 PM](https://private-user-images.githubusercontent.com/99630311/307454679-ae680e38-3281-436b-8beb-e3edc5fedee3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MzYzODUsIm5iZiI6MTczOTQzNjA4NSwicGF0aCI6Ii85OTYzMDMxMS8zMDc0NTQ2NzktYWU2ODBlMzgtMzI4MS00MzZiLThiZWItZTNlZGM1ZmVkZWUzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA4NDEyNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTEzMjI5NmNjN2FkMDM5MGYxNThkODllZDY4ZTI0YWEwYzdkYjUzZDM4MmJkZjJmMmY1M2MyZWVhODM2NjUzMWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.plVkZ8A6o6W2rMFQyKzRVpO_WTdotXa_TvM0xSGsLsE)