Paste protection doesn't work with clipboard managers
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
調査の方向性
この issue では、リポジトリ内のファイルやテストが指定されていません。既存のペースト保護イベント処理から始め、報告されている CGEvent.tapCreate と pasteCallback のアプローチと比較してください。Raycast で選択したペーストで保護アラートが発生し、通常の cmd+v によるペーストも引き続き保護されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Objective-C
- スター
- 863
- フォーク
- 50
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
objective-see/BlockBlock のほかの issue
-
Typo in installer: “addition protections” → “additional protections”対応中かも @Jah-yee が 15 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 94/100
objective-see/BlockBlock#111 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
objective-see/BlockBlock#115 ·
-
Unable to add ruleオープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
objective-see/BlockBlock#114 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
objective-see/BlockBlock#110 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
objective-see/BlockBlock#109 · リアクション 2 件 ·
objective-see/BlockBlock の issue をすべて見る
似ている issue
-
bug iOS UI
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
devsoc-unsw/freerooms-mobile#278 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
firebase/firebase-ios-sdk#16950 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
gnustep/libs-base#869 · コメント 3 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
Partial descriptor updates write buffer sizes at the wrong array index with Metal argument buffers対応中かも @prosperkartik が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
KhronosGroup/MoltenVK#2888 ·
メンテナーはふだん 1 日以内に返信