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

feat(lib): mitre d3fend #1394

Merged
merged 7 commits into from
Jan 23, 2025
Merged

feat(lib): mitre d3fend #1394

merged 7 commits into from
Jan 23, 2025

Conversation

eric-intuitem
Copy link
Collaborator

@eric-intuitem eric-intuitem commented Jan 22, 2025

Add Mitre D3FEND
Add default value for library_publication_date
ruff format on tools

Summary by CodeRabbit

  • New Features

    • Added a new YAML file for the Mitre D3FEND cybersecurity ontology.
    • Created a Python script to generate D3FEND library in Excel format.
    • Introduced a tool to prepare cybersecurity mapping documentation.
  • Chores

    • Updated various tool scripts with improved code formatting and readability.
    • Added default publication date handling in library conversion tool.
    • Enhanced branch name sanitization in functional tests workflow.
    • Improved branch name sanitization in startup tests workflow.
  • Documentation

    • Enhanced documentation for cybersecurity techniques and controls.

Copy link

coderabbitai bot commented Jan 22, 2025

Walkthrough

The pull request introduces a comprehensive update to the cybersecurity library tools, focusing on the integration of the Mitre D3FEND cybersecurity ontology. A new YAML file for D3FEND has been added, along with a Python script to generate an Excel library. The changes primarily involve adding new functionality for processing cybersecurity techniques, improving code formatting, and standardizing string representations across multiple utility scripts.

Changes

File Change Summary
backend/library/libraries/d3fend.yaml New file added for Mitre D3FEND cybersecurity ontology
tools/convert_library.py Added datetime import, modified publication date handling
tools/mitre/d3fend.py New script for generating D3FEND library in Excel format
tools/mitre/mitre.py Formatting improvements for copyright string and worksheet appends
tools/nzism/prep_nzism.py Minor formatting changes to string constructions
tools/prepare_mapping.py Updated string delimiters from single to double quotes
tools/tisax/convert_tisax_5.1.py Improved formatting for output table appends
.github/workflows/functional-tests.yml Enhanced branch name sanitization and updated action version
.github/workflows/startup-tests.yml Enhanced branch name sanitization

Sequence Diagram

sequenceDiagram
    participant CSV as D3FEND CSV
    participant Script as D3FEND Generator
    participant Excel as Output Workbook
    
    CSV->>Script: Read Cybersecurity Techniques
    Script->>Script: Process Technique Data
    Script->>Excel: Create Library Metadata Sheet
    Script->>Excel: Create Controls Sheet
    Script->>Excel: Populate Sheets with Technique Details
    Excel-->>Script: Workbook Completed
    Script->>Excel: Save Excel File
Loading

Poem

🐰 In the realm of cyber defense so bright,
D3FEND emerges with tactical might!
YAML and Excel, our tools of the trade,
Mapping threats where security is made.
A rabbit's guide to digital delight! 🛡️


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f711740 and a207e6c.

📒 Files selected for processing (1)
  • .github/workflows/functional-tests.yml (2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/functional-tests.yml

120-120: shellcheck reported issue in this script: SC2086:info:1:76: Double quote to prevent globbing and word splitting

(shellcheck)


226-226: shellcheck reported issue in this script: SC2086:info:1:76: Double quote to prevent globbing and word splitting

(shellcheck)

⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: startup-functional-test (3.12)
  • GitHub Check: startup-docker-compose-test
  • GitHub Check: enterprise-functional-tests (3.12, chromium)
  • GitHub Check: enterprise-startup-functional-test (3.12)
  • GitHub Check: enterprise-startup-docker-compose-test
  • GitHub Check: Analyze (python)
  • GitHub Check: functional-tests (3.12, chromium)
  • GitHub Check: build (3.12)
  • GitHub Check: test (3.12)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
.github/workflows/functional-tests.yml (3)

120-120: LGTM! Branch name sanitization improved.

The branch name sanitization has been properly fixed by:

  • Adding proper quoting around the variable
  • Including parentheses in the character set to be replaced
🧰 Tools
🪛 actionlint (1.7.4)

120-120: shellcheck reported issue in this script: SC2086:info:1:76: Double quote to prevent globbing and word splitting

(shellcheck)


226-226: LGTM! Consistent branch name sanitization.

The branch name sanitization has been consistently updated across both jobs.

🧰 Tools
🪛 actionlint (1.7.4)

226-226: shellcheck reported issue in this script: SC2086:info:1:76: Double quote to prevent globbing and word splitting

(shellcheck)


226-226: Verify compatibility with setup-python@v5.

The upgrade from v4 to v5 is a major version change. Please ensure that:

  1. All required features are supported in v5
  2. There are no breaking changes that could affect the workflow

Run this script to check the changelog and any breaking changes:

✅ Verification successful

setup-python@v5 is generally stable for standard Python installations

While there are some open issues with v5, they primarily affect specific scenarios like PyPy on arm64, internal package repos, or certain OS/architecture combinations. The core functionality for standard Python versions on common platforms remains stable, with active maintenance and bug fixes being applied.

Consider testing the workflow if you're using:

  • PyPy on Linux arm64 runners
  • Internal package repositories with caching
  • Self-hosted runners requiring admin privileges
  • Python 3.9 specifically on macOS
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for breaking changes in setup-python action v5

# Fetch the latest release notes and changelog
gh api repos/actions/setup-python/releases/latest --jq '.body'

# Check for any reported issues with v5
gh api search/issues -X GET -f q='repo:actions/setup-python is:issue label:bug v5'

Length of output: 66752

🧰 Tools
🪛 actionlint (1.7.4)

226-226: shellcheck reported issue in this script: SC2086:info:1:76: Double quote to prevent globbing and word splitting

(shellcheck)


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 25269f7 and a45ee5a.

⛔ Files ignored due to path filters (2)
  • tools/mitre/d3fend.csv is excluded by !**/*.csv
  • tools/mitre/d3fend.xlsx is excluded by !**/*.xlsx
📒 Files selected for processing (7)
  • backend/library/libraries/d3fend.yaml (1 hunks)
  • tools/convert_library.py (7 hunks)
  • tools/mitre/d3fend.py (1 hunks)
  • tools/mitre/mitre.py (4 hunks)
  • tools/nzism/prep_nzism.py (4 hunks)
  • tools/prepare_mapping.py (3 hunks)
  • tools/tisax/convert_tisax_5.1.py (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • tools/mitre/mitre.py
  • tools/nzism/prep_nzism.py
  • tools/tisax/convert_tisax_5.1.py
  • tools/prepare_mapping.py
🧰 Additional context used
🪛 Ruff (0.8.2)
tools/convert_library.py

845-845: Use is and is not for type comparisons, or isinstance() for isinstance checks

(E721)

⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: enterprise-startup-functional-test (3.12)
  • GitHub Check: enterprise-startup-docker-compose-test
  • GitHub Check: functional-tests (3.12, chromium)
  • GitHub Check: startup-functional-test (3.12)
  • GitHub Check: enterprise-functional-tests (3.12, chromium)
  • GitHub Check: ruff (3.12)
  • GitHub Check: test (3.12)
  • GitHub Check: build (3.12)
  • GitHub Check: startup-docker-compose-test
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (6)
tools/mitre/d3fend.py (3)

1-28: LGTM! Well-structured initialization.

The imports, mapping dictionary, and library metadata are well-organized and appropriate for generating the D3FEND library.


45-45: Review the hardcoded future publication date.

The library_publication_date is set to "2025-01-22", which is a future date. Consider using the current date or making it configurable.


62-82: LGTM! Well-structured CSV processing logic.

The code effectively handles different technique levels and maintains consistent description formatting.

tools/convert_library.py (1)

14-14: LGTM! Documentation and import changes are appropriate.

The datetime import and updated documentation for library_publication_date default value are well-documented.

Also applies to: 115-115

backend/library/libraries/d3fend.yaml (2)

23-23: Review the future publication date.

The publication_date is set to "2025-01-22". Consider using the current date or making it configurable.


26-2214: LGTM! Well-structured reference controls.

The reference controls are consistently formatted and provide comprehensive information including URNs, categories, CSF functions, and detailed descriptions.

Comment on lines +31 to +33
with open("d3fend.csv", newline="") as csvfile:
reader = csv.reader(csvfile, delimiter=",")

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling for CSV file operations.

The script may fail silently if the CSV file is missing or inaccessible. Consider adding proper error handling.

-with open("d3fend.csv", newline="") as csvfile:
+try:
+    with open("d3fend.csv", newline="") as csvfile:
+        reader = csv.reader(csvfile, delimiter=",")
+except FileNotFoundError:
+    print("Error: d3fend.csv file not found")
+    exit(1)
+except PermissionError:
+    print("Error: Permission denied accessing d3fend.csv")
+    exit(1)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
with open("d3fend.csv", newline="") as csvfile:
reader = csv.reader(csvfile, delimiter=",")
try:
with open("d3fend.csv", newline="") as csvfile:
reader = csv.reader(csvfile, delimiter=",")
except FileNotFoundError:
print("Error: d3fend.csv file not found")
exit(1)
except PermissionError:
print("Error: Permission denied accessing d3fend.csv")
exit(1)

(ref_id, name, description, "technical", tactic_to_csf_funtion[tactic])
)

wb_output.save(output_file_name)
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling for workbook saving.

The workbook save operation could fail due to permission issues or disk space. Add proper error handling.

-    wb_output.save(output_file_name)
+    try:
+        wb_output.save(output_file_name)
+        print(f"Successfully generated {output_file_name}")
+    except PermissionError:
+        print(f"Error: Permission denied saving {output_file_name}")
+        exit(1)
+    except Exception as e:
+        print(f"Error saving workbook: {str(e)}")
+        exit(1)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
wb_output.save(output_file_name)
try:
wb_output.save(output_file_name)
print(f"Successfully generated {output_file_name}")
except PermissionError:
print(f"Error: Permission denied saving {output_file_name}")
exit(1)
except Exception as e:
print(f"Error saving workbook: {str(e)}")
exit(1)

Comment on lines +844 to +846
lib_date = library_vars.get("library_publication_date", datetime.datetime.now())
if type(lib_date) == datetime.datetime:
lib_date = lib_date.date()
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use isinstance() for type checking.

Replace type() comparison with isinstance() for better Python practices.

lib_date = library_vars.get("library_publication_date", datetime.datetime.now())
-if type(lib_date) == datetime.datetime:
+if isinstance(lib_date, datetime.datetime):
    lib_date = lib_date.date()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
lib_date = library_vars.get("library_publication_date", datetime.datetime.now())
if type(lib_date) == datetime.datetime:
lib_date = lib_date.date()
lib_date = library_vars.get("library_publication_date", datetime.datetime.now())
if isinstance(lib_date, datetime.datetime):
lib_date = lib_date.date()
🧰 Tools
🪛 Ruff (0.8.2)

845-845: Use is and is not for type comparisons, or isinstance() for isinstance checks

(E721)

try fix startup test
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
.github/workflows/functional-tests.yml (1)

Line range hint 145-148: Maintain consistent action versions across jobs.

The setup-python action is using different versions across jobs:

  • functional-tests job uses v4
  • enterprise-functional-tests job uses v5

This inconsistency could lead to different behavior between jobs.

Either update both jobs to use v5 or keep both at v4. Here's how to update the functional-tests job to match:

       - name: Set up python ${{ matrix.python-version }}
-        uses: actions/setup-python@v4
+        uses: actions/setup-python@v5
         with:
           python-version: ${{ matrix.python-version }}
           cache: "pip"
🧰 Tools
🪛 actionlint (1.7.4)

118-118: shellcheck reported issue in this script: SC2086:info:1:44: Double quote to prevent globbing and word splitting

(shellcheck)


120-120: shellcheck reported issue in this script: SC1009:info:1:56: The mentioned syntax error was in this simple command

(shellcheck)


120-120: shellcheck reported issue in this script: SC1073:error:1:68: Couldn't parse this single quoted string. Fix to allow more checks

(shellcheck)


120-120: shellcheck reported issue in this script: SC1072:error:2:1: Expected end of single quoted string. Fix any mentioned problems and try again

(shellcheck)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a45ee5a and f5b887a.

📒 Files selected for processing (1)
  • .github/workflows/functional-tests.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/functional-tests.yml

120-120: shellcheck reported issue in this script: SC1009:info:1:56: The mentioned syntax error was in this simple command

(shellcheck)


120-120: shellcheck reported issue in this script: SC1073:error:1:68: Couldn't parse this single quoted string. Fix to allow more checks

(shellcheck)


120-120: shellcheck reported issue in this script: SC1072:error:2:1: Expected end of single quoted string. Fix any mentioned problems and try again

(shellcheck)

⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: enterprise-startup-functional-test (3.12)
  • GitHub Check: startup-functional-test (3.12)
  • GitHub Check: startup-docker-compose-test
  • GitHub Check: functional-tests (3.12, chromium)
  • GitHub Check: test (3.12)
  • GitHub Check: build (3.12)
  • GitHub Check: enterprise-functional-tests (3.12, chromium)
  • GitHub Check: enterprise-startup-docker-compose-test
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (javascript-typescript)

@@ -117,7 +117,7 @@ jobs:
- name: Set current date as env variable
run: echo "NOW=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_ENV
- name: Sanitize branch name
run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr "/" "_")" >> $GITHUB_ENV
run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr '/()'' '_')" >> $GITHUB_ENV
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix shell script syntax error in branch name sanitization.

The current command has a syntax error with single quotes that could cause the workflow to fail.

Apply this fix:

-        run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr '/()'' '_')" >> $GITHUB_ENV
+        run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr '/()\'' '_')" >> $GITHUB_ENV
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr '/()'' '_')" >> $GITHUB_ENV
run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr '/()\'' '_')" >> $GITHUB_ENV
🧰 Tools
🪛 actionlint (1.7.4)

120-120: shellcheck reported issue in this script: SC1009:info:1:56: The mentioned syntax error was in this simple command

(shellcheck)


120-120: shellcheck reported issue in this script: SC1073:error:1:68: Couldn't parse this single quoted string. Fix to allow more checks

(shellcheck)


120-120: shellcheck reported issue in this script: SC1072:error:2:1: Expected end of single quoted string. Fix any mentioned problems and try again

(shellcheck)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
.github/workflows/functional-tests.yml (1)

120-120: ⚠️ Potential issue

Fix shell script syntax error in branch name sanitization.

The command has a syntax error with single quotes that could cause the workflow to fail.

Apply this fix:

-        run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr '/()'' '_')" >> $GITHUB_ENV
+        run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr '/()\'' '_')" >> $GITHUB_ENV
🧰 Tools
🪛 actionlint (1.7.4)

120-120: shellcheck reported issue in this script: SC1009:info:1:56: The mentioned syntax error was in this simple command

(shellcheck)


120-120: shellcheck reported issue in this script: SC1073:error:1:68: Couldn't parse this single quoted string. Fix to allow more checks

(shellcheck)


120-120: shellcheck reported issue in this script: SC1072:error:2:1: Expected end of single quoted string. Fix any mentioned problems and try again

(shellcheck)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f5b887a and 77f48bd.

📒 Files selected for processing (2)
  • .github/workflows/functional-tests.yml (2 hunks)
  • .github/workflows/startup-tests.yml (2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/startup-tests.yml

105-105: shellcheck reported issue in this script: SC2086:info:1:74: Double quote to prevent globbing and word splitting

(shellcheck)


245-245: shellcheck reported issue in this script: SC2086:info:1:74: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/functional-tests.yml

120-120: shellcheck reported issue in this script: SC1009:info:1:56: The mentioned syntax error was in this simple command

(shellcheck)


120-120: shellcheck reported issue in this script: SC1073:error:1:68: Couldn't parse this single quoted string. Fix to allow more checks

(shellcheck)


120-120: shellcheck reported issue in this script: SC1072:error:2:1: Expected end of single quoted string. Fix any mentioned problems and try again

(shellcheck)


226-226: shellcheck reported issue in this script: SC2086:info:1:74: Double quote to prevent globbing and word splitting

(shellcheck)

⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: startup-functional-test (3.12)
  • GitHub Check: functional-tests (3.12, chromium)
  • GitHub Check: enterprise-functional-tests (3.12, chromium)
  • GitHub Check: build (3.12)
  • GitHub Check: startup-docker-compose-test
  • GitHub Check: test (3.12)
  • GitHub Check: enterprise-startup-functional-test (3.12)
  • GitHub Check: enterprise-startup-docker-compose-test
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
.github/workflows/functional-tests.yml (2)

Line range hint 165-168: LGTM! Good practice to update the action version.

The update to actions/setup-python@v5 keeps the workflow current with the latest stable version.

🧰 Tools
🪛 actionlint (1.7.4)

118-118: shellcheck reported issue in this script: SC2086:info:1:44: Double quote to prevent globbing and word splitting

(shellcheck)


120-120: shellcheck reported issue in this script: SC1009:info:1:56: The mentioned syntax error was in this simple command

(shellcheck)


120-120: shellcheck reported issue in this script: SC1073:error:1:68: Couldn't parse this single quoted string. Fix to allow more checks

(shellcheck)


120-120: shellcheck reported issue in this script: SC1072:error:2:1: Expected end of single quoted string. Fix any mentioned problems and try again

(shellcheck)


226-226: ⚠️ Potential issue

Use single quotes to prevent globbing and word splitting.

The command should use single quotes for the tr pattern to ensure reliable string handling.

Apply this fix:

-        run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr "/()" "_")" >> $GITHUB_ENV
+        run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr '/()\'' '_')" >> $GITHUB_ENV

Likely invalid or redundant comment.

🧰 Tools
🪛 actionlint (1.7.4)

226-226: shellcheck reported issue in this script: SC2086:info:1:74: Double quote to prevent globbing and word splitting

(shellcheck)

@@ -102,7 +102,7 @@ jobs:
- name: Set current date as env variable
run: echo "NOW=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_ENV
- name: Sanitize branch name
run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr "/" "_")" >> $GITHUB_ENV
run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr "/()" "_")" >> $GITHUB_ENV
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Use single quotes to prevent globbing and word splitting.

The command should use single quotes for the tr pattern to ensure reliable string handling.

Apply this fix:

-        run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr "/()" "_")" >> $GITHUB_ENV
+        run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr '/()\'' '_')" >> $GITHUB_ENV
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr "/()" "_")" >> $GITHUB_ENV
run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr '/()\'' '_')" >> $GITHUB_ENV
🧰 Tools
🪛 actionlint (1.7.4)

105-105: shellcheck reported issue in this script: SC2086:info:1:74: Double quote to prevent globbing and word splitting

(shellcheck)

@@ -242,7 +242,7 @@
- name: Set current date as env variable
run: echo "NOW=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_ENV
- name: Sanitize branch name
run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr "/" "_")" >> $GITHUB_ENV
run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr "/()" "_")" >> $GITHUB_ENV
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Use single quotes to prevent globbing and word splitting.

The command should use single quotes for the tr pattern to ensure reliable string handling.

Apply this fix:

-        run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr "/()" "_")" >> $GITHUB_ENV
+        run: echo "BRANCH_SANITIZED=$(echo ${{ env.BRANCH_NAME }} | tr '/()\'' '_')" >> $GITHUB_ENV

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 actionlint (1.7.4)

245-245: shellcheck reported issue in this script: SC2086:info:1:74: Double quote to prevent globbing and word splitting

(shellcheck)

@ab-smith ab-smith changed the title Feat(lib) d3fend feat(lib): mitre d3fend Jan 22, 2025
@ab-smith
Copy link
Contributor

we should not use this kind of syntax for the branches:

image

@ab-smith ab-smith merged commit 57177b7 into main Jan 23, 2025
18 checks passed
@ab-smith ab-smith deleted the feat(lib)-d3fend branch January 23, 2025 13:43
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants