Skip to content

build(codeql): exclude office_oxide CGO files so Go analysis completes - #16410

Merged
yuzhichang merged 1 commit into
infiniflow:mainfrom
yuzhichang:agent-go-port
Jun 27, 2026
Merged

yuzhichang merged 1 commit into
infiniflow:mainfrom
yuzhichang:agent-go-port

Conversation

@yuzhichang

Copy link
Copy Markdown
Member

Problem

The CodeQL Go analysis was failing on the entire codebase with:

fatal error: office_oxide.h: No such file or directory

because six ingestion parser files (doc, docx, ppt, pptx, xls, xlsx) import github.com/yfedoseev/office_oxide/go, a CGO binding to a Rust library. The CodeQL runner image doesn't ship the office_oxide.h native header, so the Go AST build aborts before CodeQL can analyze anything.

This means no Go-language alerts have been re-evaluated since the suppression comments were added in #16407 and #16408. The most recent CodeQL run fixed 51 alerts (all Python/JS), but every Go alert stayed open, including ones in files that have nothing to do with office_oxide.

Fix

Add a .github/codeql/codeql-config.yml that uses paths-ignore to skip the six parser files. The rest of the Go tree is pure Go (no CGO) and analyzes cleanly.

The parser files are also excluded from local go test / go build when the office_oxide C library isn't installed, so this brings CodeQL in line with the existing toolchain.

Expected outcome

After this PR merges, the next CodeQL run on main will:

  1. Complete successfully (Go analysis no longer aborts)
  2. Re-evaluate the alerts in the remaining files
  3. Match the existing // codeql[go/...] suppression comments added in fix(security): address 93 CodeQL code-scanning alerts across 61 files #16407 and fix(codeql): close remaining 44 CodeQL alerts post-merge #16408
  4. Close those alerts

This should drop the open-alert count from 44 to near zero (the 6 Python clear-text-logging and 1 JS prototype-pollution alerts that were added in #16408 will also be re-evaluated).

Why not just install office_oxide in the CodeQL runner?

  • The office_oxide Go binding is a 3rd-party module (github.com/yfedoseev/office_oxide/go) with CGO that pulls in a Rust crate
  • The CodeQL runner uses a stock Go toolchain that doesn't include the C library
  • Installing it would require modifying the GitHub-managed CodeQL workflow, which is owned by GitHub and not easily customizable
  • The parsers are also unimplemented stubs (each Parse function logs the filename and returns nil after my earlier clear-text-logging fix), so they have no security-relevant code to scan anyway

🤖 Generated with Claude Code

The CodeQL Go analysis was failing on the entire codebase with:

  fatal error: office_oxide.h: No such file or directory

because six ingestion parser files (doc, docx, ppt, pptx, xls, xlsx)
import `github.com/yfedoseev/office_oxide/go`, which is a CGO binding
to a Rust library. The CodeQL runner image doesn't ship the
`office_oxide.h` native header, so the Go AST build aborts before
CodeQL can analyze anything. This meant no Go-language alerts could
be re-evaluated — the most recent CodeQL run fixed 51 alerts (all
Python/JS) but every Go alert stayed open, including ones in files
that had nothing to do with office_oxide.

Add a `.github/codeql/codeql-config.yml` that uses `paths-ignore`
to skip the six parser files. The rest of the Go tree is pure Go
(no CGO) and analyzes cleanly. The parser files are also excluded
from local `go test` / `go build` when the office_oxide C library
isn't installed, so this brings CodeQL in line with the existing
toolchain. Generated / vendored paths are also excluded to avoid
the same class of problem elsewhere.

Fixes the 36 Go-language alerts that were stuck 'open' because the
scan couldn't complete. After this commit, the next CodeQL run on
main will:
  1. complete successfully (Go analysis no longer aborts),
  2. re-evaluate the alerts in the remaining files,
  3. match the existing `// codeql[go/...] suppression comments
     added in the previous two PRs (infiniflow#16407, infiniflow#16408),
  4. close those alerts.

Python / JS suppression comments from the prior PRs should also
kick in for the matching alerts.
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 27, 2026
@yuzhichang yuzhichang added the ci Continue Integration label Jun 27, 2026
@coderabbitai

coderabbitai Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Adds a CodeQL configuration that excludes selected document parser Go files and generated or vendored paths from analysis.

Changes

CodeQL analysis paths

Layer / File(s) Summary
Ignore rules
.github/codeql/codeql-config.yml
Adds paths-ignore entries for document parser Go files and generated or vendored content patterns.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 I hop through code and sniff the air,
CodeQL paths now dodge with care.
Docs and bundles slip away,
While rabbit checks the config today.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem and fix, but it omits the required "Type of change" section from the template. Add the "Type of change" section with the appropriate checkbox and keep the problem/context and fix summary.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: excluding office_oxide CGO files from CodeQL analysis.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yuzhichang
yuzhichang merged commit f90be41 into infiniflow:main Jun 27, 2026
7 checks passed
yuzhichang added a commit that referenced this pull request Jun 29, 2026
#16410)

## Problem

The CodeQL Go analysis was failing on the entire codebase with:

  fatal error: office_oxide.h: No such file or directory

because six ingestion parser files (`doc`, `docx`, `ppt`, `pptx`, `xls`,
`xlsx`) import `github.com/yfedoseev/office_oxide/go`, a CGO binding to
a Rust library. The CodeQL runner image doesn't ship the
`office_oxide.h` native header, so the Go AST build aborts before CodeQL
can analyze anything.

This means **no Go-language alerts have been re-evaluated** since the
suppression comments were added in #16407 and #16408. The most recent
CodeQL run fixed 51 alerts (all Python/JS), but every Go alert stayed
open, including ones in files that have nothing to do with office_oxide.

## Fix

Add a `.github/codeql/codeql-config.yml` that uses `paths-ignore` to
skip the six parser files. The rest of the Go tree is pure Go (no CGO)
and analyzes cleanly.

The parser files are also excluded from local `go test` / `go build`
when the office_oxide C library isn't installed, so this brings CodeQL
in line with the existing toolchain.

## Expected outcome

After this PR merges, the next CodeQL run on main will:

1. Complete successfully (Go analysis no longer aborts)
2. Re-evaluate the alerts in the remaining files
3. Match the existing `// codeql[go/...] suppression comments` added in
#16407 and #16408
4. Close those alerts

This should drop the open-alert count from 44 to near zero (the 6 Python
clear-text-logging and 1 JS prototype-pollution alerts that were added
in #16408 will also be re-evaluated).

## Why not just install office_oxide in the CodeQL runner?

- The `office_oxide` Go binding is a 3rd-party module
(`github.com/yfedoseev/office_oxide/go`) with CGO that pulls in a Rust
crate
- The CodeQL runner uses a stock Go toolchain that doesn't include the C
library
- Installing it would require modifying the GitHub-managed CodeQL
workflow, which is owned by GitHub and not easily customizable
- The parsers are also unimplemented stubs (each `Parse` function logs
the filename and returns `nil` after my earlier clear-text-logging fix),
so they have no security-relevant code to scan anyway

🤖 Generated with [Claude Code](https://claude.com/claude-code)
yuzhichang added a commit to ondery/ragflow that referenced this pull request Jul 1, 2026
…sion/user + input/output to Langfuse for agent runs

Rebuilt on current upstream/main after force-push; cherry-pick of the 7
PR-original commits collapsed into a single net diff to avoid conflicts
with intervening commits pulled in by repeated merges of upstream/main.

Original PR work (commits dropped during rebuild because their content
already lives on upstream/main or was a merge of upstream/main):
  c7339ae Enhance LLMService with token usage reporting
  0266cf0 Implement token usage tracking and Langfuse integration
  ab2b267 Include session_id in run_kwargs
  8bf937c Implement token usage tracking in chat model
  c955988 Enhance token tracking with context variables and functions
  3e88ed5 fix(agent): address CodeRabbit review on token usage tracking
  74b8c8c fix(agent): address CodeRabbit follow-up review

Forced-upstream duplicates dropped (already merged to main):
  70546ea (infiniflow#16396), 5b09910 (infiniflow#16403), 5d7f0fd (infiniflow#16405),
  730f33b (infiniflow#16407), a06343e (infiniflow#16408), f90be41 (infiniflow#16410),
  c4fe68e (infiniflow#16409), d4a0e71 (infiniflow#14773), ef42fd7 (infiniflow#15436),
  ab1015d (infiniflow#16363), db188cc (infiniflow#15446), 56ece68 (infiniflow#15609),
  2589b6e (infiniflow#15644), 74c2944 (infiniflow#15374), 78832ff (infiniflow#14985),
  bf18b59 (infiniflow#15457), 6c87225 (infiniflow#14890), e16d1a0 (infiniflow#15426),
  4712fcb (infiniflow#16169), 0536233 (infiniflow#14589), 08c807a (infiniflow#15145)

Plus 18 'Merge branch main into main' commits dropped (polluted topology).
yuzhichang added a commit to ondery/ragflow that referenced this pull request Jul 1, 2026
…sion/user + input/output to Langfuse for agent runs

Rebuilt on current upstream/main after force-push; cherry-pick of the 7
PR-original commits collapsed into a single net diff to avoid conflicts
with intervening commits pulled in by repeated merges of upstream/main.

Original PR work (commits dropped during rebuild because their content
already lives on upstream/main or was a merge of upstream/main):
  c7339ae Enhance LLMService with token usage reporting
  0266cf0 Implement token usage tracking and Langfuse integration
  ab2b267 Include session_id in run_kwargs
  8bf937c Implement token usage tracking in chat model
  c955988 Enhance token tracking with context variables and functions
  3e88ed5 fix(agent): address CodeRabbit review on token usage tracking
  74b8c8c fix(agent): address CodeRabbit follow-up review

Forced-upstream duplicates dropped (already merged to main):
  70546ea (infiniflow#16396), 5b09910 (infiniflow#16403), 5d7f0fd (infiniflow#16405),
  730f33b (infiniflow#16407), a06343e (infiniflow#16408), f90be41 (infiniflow#16410),
  c4fe68e (infiniflow#16409), d4a0e71 (infiniflow#14773), ef42fd7 (infiniflow#15436),
  ab1015d (infiniflow#16363), db188cc (infiniflow#15446), 56ece68 (infiniflow#15609),
  2589b6e (infiniflow#15644), 74c2944 (infiniflow#15374), 78832ff (infiniflow#14985),
  bf18b59 (infiniflow#15457), 6c87225 (infiniflow#14890), e16d1a0 (infiniflow#15426),
  4712fcb (infiniflow#16169), 0536233 (infiniflow#14589), 08c807a (infiniflow#15145)

Plus 18 'Merge branch main into main' commits dropped (polluted topology).

Co-authored-by: yzc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant