diff --git a/.github/workflows/auto-assign-pr.yml b/.github/workflows/auto-assign-pr.yml new file mode 100644 index 0000000..08c2361 --- /dev/null +++ b/.github/workflows/auto-assign-pr.yml @@ -0,0 +1,15 @@ +# .github/workflows/auto-author-assign.yml +name: 'Auto Author Assign' + +on: + pull_request_target: + types: [opened, reopened] + +permissions: + pull-requests: write + +jobs: + assign-author: + runs-on: ubuntu-latest + steps: + - uses: toshimaru/auto-author-assign@v1.6.2 diff --git a/.github/workflows/pre-commit-actions.yml b/.github/workflows/pre-commit-actions.yml new file mode 100644 index 0000000..b269c9b --- /dev/null +++ b/.github/workflows/pre-commit-actions.yml @@ -0,0 +1,37 @@ +name: precommit-actions +run-name: ${{ github.actor }} is running precommit actions. +on: + push: + branches-ignore: [main] + pull_request: + branches: [main] +jobs: + build: + name: Lint + runs-on: ubuntu-latest + + permissions: + contents: read + packages: read + # To report GitHub Actions status checks + statuses: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + # super-linter needs the full git history to get the + # list of files that changed across commits + fetch-depth: 0 + + - name: Super-linter + uses: super-linter/super-linter@v6.5.1 # x-release-please-version + env: + DEFAULT_BRANCH: main + # To report GitHub Actions status checks + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + IGNORE_GITIGNORED_FILES: true + VALIDATE_ALL_CODEBASE: true + VALIDATE_PYTHON_FLAKE8: true + VALIDATE_HTML: true + diff --git a/.github/workflows/semantic-pr.yml b/.github/workflows/semantic-pr.yml new file mode 100644 index 0000000..d93a930 --- /dev/null +++ b/.github/workflows/semantic-pr.yml @@ -0,0 +1,32 @@ +name: "Semantic PRs" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # first type as the one from https://github.com/commitizen/conventional-commit-types/blob/master/index.json + # l10n (localization) is for translations updates + types: | + feat + fix + docs + style + refactor + test + build + ci + chore + revert + l10n diff --git a/README.md b/README.md index 594e492..96993ae 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ A command-line tool designed to detect and purge any and all macros and dynamic content from commonly used office document formats (including MS Office Files, PDFs, etc.). +[![Super-Linter](https://github.com/Anti-Malware-Alliance/ms-office-macro-bleach/actions/workflows/pre-commit-actions.yml/badge.svg)](https://github.com/marketplace/actions/super-linter) + ## Supported formats ### Word diff --git a/ms_office_macro_bleach/bleach.py b/ms_office_macro_bleach/bleach.py index a2f34f4..1c338c9 100644 --- a/ms_office_macro_bleach/bleach.py +++ b/ms_office_macro_bleach/bleach.py @@ -1,20 +1,28 @@ """This module removes any and all macros/dynamic content from MS Office files. -VBA and OLE content in MS Office files can, and have sometimes been made to, act as vehicles for malware delivery. +VBA and OLE content in MS Office files can, and have sometimes been made to, +act as vehicles for malware delivery. -Microsoft has previously attempted to protect users from macros by disabling them by default. +Microsoft has previously attempted to protect users from macros by disabling +them by default. -However, anybody is able to enable macros in an MS Office file before sending them on to a potential victim. +However, anybody is able to enable macros in an MS Office file before sending +them on to a potential victim. -This module enables users to simply and safely remove any and all macros/dynamic content from MS Office files. +This module enables users to simply and safely remove any and all +macros/dynamic content from MS Office files. -It converts the given file into a '.zip' archive, unzips it, and deletes the files containing macro data. +It converts the given file into a '.zip' archive, unzips it, and +deletes the files containing macro data. -It then re-zips the unzipped archive and reverts it to its original file format. +It then re-zips the unzipped archive and reverts it to its original +file format. -It is part of a suite of programs developed by the AntiMalware Alliance. +It is part of a suite of programs developed by the AntiMalware +Alliance. -Visit https://github.com/Anti-Malware-Alliance for more details about our organisation and projects. +Visit https://github.com/Anti-Malware-Alliance for more details +about our organisation and projects. """ from argparse import ArgumentParser from os import rename, path, remove @@ -23,7 +31,6 @@ from shutil import make_archive, rmtree from olefile import OleFileIO - ooxml_formats = [ "docx", "docm", @@ -50,7 +57,6 @@ bff_formats = [ "doc", - #"ppt", "xls", ] @@ -155,7 +161,8 @@ def validate_file(file): def main(): parser = ArgumentParser() parser.add_argument("file", help="file to be bleached") - parser.add_argument("-c", help="notify if macros or potentially dangerous content is found", action="store_true") + parser.add_argument("-c", help="notify if macros or potentially dangerous " + "content is found", action="store_true") args = parser.parse_args() if validate_file(args.file):