[attacks] Improve attack interceptor lifecycle management

Đang mở
#212 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Dorguy đang làm issue này rồi.

Từ ngày 11/11/2026.

  • #227 của @Dorguy — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

enhancement
Problem or motivation

Attack stages currently wrap service methods and store callbacks that restore the previous implementation. This works for individual interceptors, but overlapping attacks on the same handler depend on their removal order. Stopping one attack before another can leave its interceptor active or restore it later.

Attack failure and success transitions also do not automatically remove installed interceptors. Introduce centralized interceptor management with independent removal and consistent cleanup on completion, failure, cancellation, and simulation shutdown. Define explicit lifecycle rules for stages whose effects continue after interceptor installation.

Proposed solution

I suggest moving interceptor installation and removal into a shared manager. It would keep the original handler and a list of active interceptors, so each attack can be stopped independently, regardless of the order in which attacks start or stop. Once the last interceptor is removed, the manager would restore the original handler.

We also need to distinguish between installing an interceptor and completing a stage. For spoofing, dropping, replay, and sniffing, installation starts the effect, which continues until the stage’s stop condition is met or the attack ends. If a stage has no stop condition of its own, I suggest allowing the next stage to start after installation while keeping the previous stage’s effect active.

All interceptors belonging to an attack should be removed when it completes, fails, or is cancelled, and when the simulation shuts down. Cleanup should also handle cases where some interceptors have already been removed before an error occurs. Repeating cleanup should be safe, and a failure in one stage should not prevent the remaining stages from being cleaned up.

I’ll add tests for overlapping attacks stopped in different orders, restoration of the original handler, installation failures, attack restarts, and cleanup during simulation shutdown.

Area

Automotive cybersecurity

Alternatives considered

No response

Additional context

No response

Ngôn ngữ chính
Python
Star
11
Fork
11
Merge trung bình
1 ngày 16 giờ
Pull request đã merge (30 ngày)
12

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của CAVISE/OpenCDA

Tất cả issue của CAVISE/OpenCDA

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.