Compare commits

...

3 Commits

Author SHA1 Message Date
dqy
b01e1f9a46 test: 保留原有配置文件
Some checks are pending
Vulnerability and Backdoor Detection Workflow / security_check (pull_request) Blocked by required conditions
Vulnerability and Backdoor Detection Workflow / build (pull_request) Successful in 19s
2024-04-24 17:13:36 +08:00
dqy
3f2f6070a8 feat: 添加集成测试 2024-04-24 17:13:09 +08:00
dqy
b0a99cb4f7 test: 测试action.yml 2024-04-24 17:12:35 +08:00
3 changed files with 64 additions and 0 deletions

29
.github/workflows/detection.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: Vulnerability and Backdoor Detection Workflow
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
- name: Run tests
run: python -m unittest discover -s tests
security_check:
runs-on: ubuntu-latest
needs: build # 确保安全检查在构建后执行
steps:
- uses: actions/checkout@v2
- uses: ./ # 使用当前仓库的根目录下的 action.yml
with:
code_path: "./src"
vulnerabilities_file: "./data/vulnerabilities.txt"
requirements_file: "./data/requirements.txt"
output_format: "txt"

35
action.yml Normal file
View File

@ -0,0 +1,35 @@
name: "Backdoor Detection"
description: "Perform backdoor and vulnerability detection on your code and dependencies."
inputs:
code_path:
description: "Path to the code directory to be analyzed."
required: true
vulnerabilities_file:
description: "Path to the vulnerabilities file for requirements detection."
required: true
requirements_file:
description: "Path to the requirements.txt file."
required: true
output_format:
description: "Output format for the detection results (html, md, txt)."
required: true
default: "txt"
runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install packaging
- name: Run Backdoor Detection
run: python ${{ github.workspace }}/detection/backdoor_detection.py ${{ inputs.code_path }} ${{ inputs.output_format }}
shell: bash
- name: Run Requirements Detection
run: python ${{ github.workspace }}/detection/requirements_detection.py ${{ github.workspace }}/crawler/trans_extracted_data.txt ${{ inputs.requirements_file }} ${{ inputs.output_format }}
shell: bash