CodeQL: Setting paths in Github Advanced Security for Azure Devops
- Ngôn ngữ chính
- CodeQL
- Star
- 10.1k
- Fork
- 2.1k
- Merge trung bình
- 2 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 141
Mô tả
I'm using Github Advanced Security in Azure devops in a monorepo. With the given folder structure:
```
.
└── apps/
├── frontend/
│ ├── green-app
│ └── red-app
└── backend/
├── green-app
└── red-app
```
By default the codeql task will scan the ENTIRE code base. Which is not what I want.
**How can I configure Github advanced security to only scan one project? For example the front-end and backend folder for the green-app.**
I tried setting the sources folder to the back-end folder. But then I'm not able to "reach" the front-end folder when I set the codeqlpathstoinclude parameter. When I try this:
```
- task: AdvancedSecurity-Codeql-Init@1
condition: and(succeededOrFailed(), ${{parameters.runGithubAdvancedSecurity}})
displayName: 'Github Advanced Security: Initialize 🛡'
inputs:
languages: 'csharp,javascript'
sourcesfolder: '$(System.DefaultWorkingDirectory)/apps/backend/green-app'
codeqlpathstoinclude: '../frontend/green-app'
```
_(Following the [docs](https://learn-microsoft-com.translate.goog/en-us/azure/devops/pipelines/tasks/reference/advanced-security-codeql-init-v1?view=azure-pipelines&_x_tr_sl=en&_x_tr_tl=nl&_x_tr_hl=nl&_x_tr_pto=sc): "The paths must be relative to the sourcesfolder where CodeQL is running, which defaults to the Build.SourcesDirectory pipeline environment variable. For example, to include the $(Build.SourcesDirectory)/app directory, set codeqlpathstoinclude: app rather than codeqlpathstoinclude: $(Build.SourcesDirectory)/app.")_
I get:
> Only found JavaScript or TypeScript files that were empty or contained syntax errors
Wildcards are also giving issues:
`apps/*/green-app/**/*`
What am I doing wrong here? Any other way i can accomplish this?
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với tài liệu về tác vụ pipeline AdvancedSecurity-Codeql-Init@1 và các thiết lập sourcesfolder và codeqlpathstoinclude được hiển thị. Xác minh cách các đường dẫn tương đối và ký tự đại diện được phân giải, sau đó xác nhận rằng chỉ các đường dẫn frontend và backend của green-app được quét mà không có các lỗi JavaScript hoặc TypeScript đã báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- azure, csharp, javascript
- Lĩnh vực
- devops, security
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100