[Duplicate Code] assertGithubCapabilityLifetime duplicated across host-enclave modules
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 75/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
Hướng nghiên cứu
Đọc src/cloud-hypervisor/host-enclave-executor-policy.ts và src/cloud-hypervisor/host-enclave-workload-profile.ts, sau đó kiểm tra các bài kiểm thử hiện có cho assertGithubCapabilityLifetime. Gộp phần xác thực bị trùng lặp vào một cách triển khai duy nhất, đồng thời giữ lại các mục xuất cần thiết; chạy các bài kiểm thử liên quan. Công việc hoàn tất khi cả hai mô-đun dùng chung phần kiểm tra và các bài kiểm thử hiện có về thời hạn đều thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Duplicate Code Opportunity
Summary
- Pattern:
assertGithubCapabilityLifetime(policy, timeoutMs)(GitHub credential/capability lifetime validation for host enclave executors) is defined in two files with identical signature and leading logic (if (!policy) return; const hasCredentials = policy.githubAgentId !== undefined || policy.githubBearer !== undefined;). - Locations: see below. jscpd reports a 58-line clone.
- Impact: ~58 duplicated lines removed. This is a security-critical credential-lifetime check, so the two copies can drift. One copy could then enforce a weaker bound than the other.
Evidence
src/cloud-hypervisor/host-enclave-executor-policy.ts: lines 29-86src/cloud-hypervisor/host-enclave-workload-profile.ts: lines 20-77
Both contain:
export function assertGithubCapabilityLifetime(
policy: HostExecutorAgentPolicy | undefined,
timeoutMs: number,
): void {
if (!policy) return;
const hasCredentials = policy.githubAgentId !== undefined || policy.githubBearer !== undefined;
...
Suggested Refactoring
Keep a single exported assertGithubCapabilityLifetime in host-enclave-executor-policy.ts, or in a small shared module such as host-enclave-github-lifetime.ts. Have host-enclave-workload-profile.ts import it, and re-export it if needed to preserve the public API. Keep the existing tests pointed at the single implementation.
Affected Files
src/cloud-hypervisor/host-enclave-executor-policy.ts— lines 29-86src/cloud-hypervisor/host-enclave-workload-profile.ts— lines 20-77
Effort Estimate
Low
Detected by Duplicate Code Detector workflow.
Generated by Duplicate Code Detector · copilot · auto (Claude Sonnet 5.5) · ~20 AIC · ⊞ 23.6K · ◷
- expires on Dec 18, 2026, 9:50 PM UTC
- Ngôn ngữ chính
- TypeScript
- Star
- 165
- Fork
- 84
- Merge trung bình
- 5 giờ 57 phút
- Pull request đã merge (30 ngày)
- 390
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/gh-aw-firewall
-
awf-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/gh-aw-firewall#11612 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agentic-workflows automated dependencies
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
github/gh-aw-firewall#3837 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agentic-workflows
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
github/gh-aw-firewall#11802 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
automation otel smoke-test tracing
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 1/100
github/gh-aw-firewall#11801 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
automation otel smoke-test tracing
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
github/gh-aw-firewall#11800 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của github/gh-aw-firewall
Issue tương tự
-
bug documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Potential Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Comfy-Org/ComfyUI_frontend#23773 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
lingdojo/kana-dojo#34301 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
code-yeongyu/senpi#7007 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/renderer bug plugin/echarts priority/P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày