Swift extraction reports ambiguous NSAccessibilityElement for valid PDFKit source
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 15/100
Hướng nghiên cứu
Start with the attached reproduce.sh and run it against the baseline and treatment Swift sources on macOS with the CodeQL bundle. Then read the extractor log entry citing SwiftDiagnosticsConsumer.cpp:62 to see how the 'ambiguous' diagnostic is produced. Done means both variants extract with no swift/diagnostics/extraction-errors notification while the PDFKit behavior cases still pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Swift extraction reports ambiguous NSAccessibilityElement for valid PDFKit source
CodeQL 2.27.2 reports an ambiguous NSAccessibilityElement while extracting a small public Swift file that Apple Swift compiles and runs successfully. An explicit import class AppKit.NSAccessibilityElement leaves the same error. This comparison disproves that import as a remedy on the tested toolchain.
The baseline is the unchanged MIT-licensed Sources/ArgmaxCore/FileUtilities.swift from Argmax OSS Swift (formerly WhisperKit), revision 26577ce3017aae8c9edfd9a0dd17851bd248c731. Its SHA256 is 0578c91c01ab86695a6e56bb898480171c4d879b6eaad8a494fd321b75e98c4a. The treatment adds only this import inside the existing PDFKit guard:
#if os(macOS)
import class AppKit.NSAccessibilityElement
#endif
The tested environment was:
- Xcode 26.6, build 17F113; macOS SDK 26.5.
- Apple Swift 6.3.3:
swiftlang-6.3.3.1.3 clang-2100.1.1.101; driver 1.148.6. - Explicit compile target
arm64-apple-macos13.0, Swift 5 language mode, cross-import overlays enabled.swiftc --versionreports the compiler's default target asarm64-apple-macosx26.0. - CodeQL 2.27.2, official Swift macOS bundle,
codeql-bundle-swift-osx64.tar.zst. - Bundle SHA256:
25a08dfd23997ccf6374b5a70d9aa27a510e027f1b5aed60e1a653f8a3596375. swift/tools/osx64/extractor.realSHA256:680adbee37bdbfc5fe0a4b6d63c45bdae23fcf3bb2210530a7b751b58f319530.
The attachment contains both source variants, the original license, a behavior harness, invented text/PDF fixtures and reproduce.sh. Run it with the verified CodeQL executable and a new output directory:
bash reproduce.sh /absolute/path/to/codeql/codeql /absolute/path/to/new-output
The script preserves the tested compiler arguments, creates a fresh module cache and separate CodeQL database for each variant, then runs codeql/swift-queries:codeql-suites/swift-code-scanning.qls. The attached shell wrapper was checked with Bash syntax validation and ShellCheck. The recorded hosted execution used the equivalent commands in a Python harness; the shell wrapper itself has not been executed end to end.
Expected: both valid sources compile normally and extract without a compiler-error notification.
Actual: ordinary compilation, database creation and analysis all exit zero for both variants. Each SARIF nevertheless contains one swift/diagnostics/extraction-errors notification:
Compiler error in with error message reference to 'NSAccessibilityElement' is ambiguous
Each extractor log also contains this error:
ERRO [extractor/compiler] <invalid loc>:0:0 reference to 'NSAccessibilityElement' is ambiguous (SwiftDiagnosticsConsumer.cpp:62)
| Result | Baseline | Explicit class import |
|---|---|---|
| Apple file/PDF behavior cases passed | 6 | 6 |
| Required source included | 1/1 | 1/1 |
| SARIF extraction errors | 1 | 1 |
| Unresolved AST nodes | 0 | 0 |
| Extracted AST nodes | 532386 | 525362 |
| Successfully extracted lines | 35 | 36 |
The six cases cover UTF-8 text, Latin-1 text, empty and missing files, invalid PDF input, and text/page order in a two-page PDF. Both behavior outputs have SHA256 46668bfa093cbbbb35dd864350e992e0f8bcba65985833195bf455fac47d4735.
The explicit class import preserves the tested behavior but does not resolve the extractor error. Please identify an extractor correction or a supported remedy that clears this reproducible error while preserving PDFKit behavior.
Attachment SHA256: 1e00b9184f9002b0beb26f7488a8922ced3a815aa08a66127681b6178efcefda (6,846 bytes).
- Ngôn ngữ chính
- CodeQL
- Star
- 10.2k
- Fork
- 2.1k
- Merge trung bình
- 2 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 155
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- 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/codeql
-
false-positive javascript
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
github/codeql#22632 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add AlertSuppression.ql for Rust (inline // codeql[...] suppression)Có thể đã có người làm @cnuss đã nhận 193 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
github/codeql#21637 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
false-positive
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
github/codeql#21076 · 3 bình luận · 3 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Rust: extraction succeeds with missing proc-macro output when the project's `rust-version` exceeds the forced toolchainCó thể đã có người làm @paldepind đã nhận 3 ngày trước. Đang mở
github/codeql#22793 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Actions: `uses: $/…` self-repository references are not resolved to local reusable workflows or composite actions (false positives and downgraded severity)Có thể đã có người làm @WilliamBerryiii đã nhận 2 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
github/codeql#22755 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của github/codeql
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
flang:semantics
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
llvm/llvm-project#231051 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug derived types format I/O medium priority semantics
Độ 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
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
webgpu-tools/wesl-rs#329 ·
Maintainer thường phản hồi trong vòng 1 ngày