Paste protection doesn't work with clipboard managers
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Issue không nêu tệp hoặc bài kiểm thử nào trong repository. Hãy bắt đầu từ việc xử lý sự kiện bảo vệ paste hiện có và so sánh với cách tiếp cận CGEvent.tapCreate và pasteCallback được báo cáo; hoàn tất khi các thao tác paste được chọn qua Raycast kích hoạt cảnh báo bảo vệ, trong khi các thao tác paste cmd+v thông thường vẫn được bảo vệ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I've been playing with this feature and found that content pasted using Raycast, i.e. retrieved from the clipboard manager and pasted into the frontmost application, doesn't trigger the paste protection alert.
It turns out that paste operations from the Raycast clipboard manager don't send cmd+v so isn't caught as a paste event.
The code snippet below does reliably trigger for paste events both using cmd+v as well as pastes from the Raycast clipboard manager.
Code was generated by Gemini, don't hate me for the use of emojis.
import Foundation
import CoreGraphics
import AppKit
// Virtual Key Code for 'V' is 9
let kVK_ANSI_V: Int64 = 9
func pasteCallback(proxy: CGEventTapProxy, type: CGEventType, event: CGEvent, refcon: UnsafeMutableRawPointer?) -> Unmanaged<CGEvent>? {
guard type == .keyDown else { return Unmanaged.passUnretained(event) }
let keyCode = event.getIntegerValueField(.keyboardEventKeycode)
let flags = event.flags
if keyCode == kVK_ANSI_V && flags.contains(.maskCommand) {
// 1. Get the PID of the process that created this event
// For physical hardware, this is typically 0.
// For Raycast/injected events, this is the PID of the source app.
let sourcePID = event.getIntegerValueField(.eventSourceUnixProcessID)
// 2. Get the PID of the process receiving the event
let targetPID = event.getIntegerValueField(.eventTargetUnixProcessID)
print("\n--- [PASTE EVENT DETECTED] ---")
if sourcePID == 0 {
print("👤 Type: HUMAN (Hardware)")
print(" Action: User pressed physical keys")
} else {
let sourceName = getAppName(pid: Int32(sourcePID))
print("🤖 Type: SYNTHETIC (Injected)")
print(" Source: \(sourceName) (PID: \(sourcePID))")
}
let targetName = getAppName(pid: Int32(targetPID))
print(" Target: \(targetName) (PID: \(targetPID))")
}
return Unmanaged.passUnretained(event)
}
// Helper to turn a PID into an App Name
func getAppName(pid: Int32) -> String {
if let app = NSRunningApplication(processIdentifier: pid) {
return app.localizedName ?? "Unknown App"
}
return "System/Background Process"
}
func run() {
let mask = (1 << CGEventType.keyDown.rawValue)
// Using .cgAnnotatedSessionEventTap is critical to see the PIDs
guard let tap = CGEvent.tapCreate(
tap: .cgAnnotatedSessionEventTap,
place: .headInsertEventTap,
options: .defaultTap,
eventsOfInterest: CGEventMask(mask),
callback: pasteCallback,
userInfo: nil
) else {
print("Error: Accessibility permissions required.")
return
}
let runLoopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, tap, 0)
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, .commonModes)
CGEvent.tapEnable(tap: tap, enable: true)
print("Monitoring source and target of all pastes...")
CFRunLoopRun()
}
run()
I know this is a bit of an edge case and probably is straying into feature creep but thought it was worth mentioning.
- Ngôn ngữ chính
- Objective-C
- Star
- 859
- Fork
- 50
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 objective-see/BlockBlock
-
Typo in installer: “addition protections” → “additional protections”Có thể đã có người làm @Jah-yee đã nhận 6 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 94/100
objective-see/BlockBlock#111 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
objective-see/BlockBlock#110 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
objective-see/BlockBlock#109 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 64/100
objective-see/BlockBlock#108 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
objective-see/BlockBlock#107 ·
Tất cả issue của objective-see/BlockBlock
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Countly/countly-sdk-ios#485 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Missing info Missing repro Platform: iOS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
software-mansion/react-native-reanimated#10908 · 3 bình luận ·
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 72/100
unoplatform/uno#25515 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Missing repro
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
software-mansion/react-native-svg#3082 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày