Skip to content

[K9CODESEC-3103] Add static Go reachability analysis - #197

Open
jbcibois-ddhq wants to merge 16 commits into
mainfrom
jb.cibois/K9CODESEC-3103
Open

[K9CODESEC-3103] Add static Go reachability analysis#197
jbcibois-ddhq wants to merge 16 commits into
mainfrom
jb.cibois/K9CODESEC-3103

Conversation

@jbcibois-ddhq

@jbcibois-ddhq jbcibois-ddhq commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds static Go reachability analysis mirroring the existing Java detector: tree-sitter parses import aliases and call sites, matching pkg.Func(...) calls against vulnerable-symbol advisories.
  • Generalizes the reachability detector pool (pkg/reachability/reachability.go) to support multiple languages, keyed off file extension.
  • Fixes a pre-existing bug in pkg/reachability/utils.go where the language key was hardcoded to "java" for every PURL, regardless of ecosystem — Go (and any future language) results would have been mis-routed even with a working detector in place.
  • Exact import-path matching only (no prefix/submodule matching); dot/blank imports are out of scope, matching Java's non-goals.

Notes for reviewers

  • The Go vulnerable-symbol shape ({type: "function", value: <module path>, name: <func>}) matches the existing Java convention but is not yet confirmed against the backend contract — flagging for confirmation before merge.
  • ./scripts/run_lints.sh reports one residual finding (SA5011 in pkg/extractor/python/parse-pyproject-toml-artifact_test.go) — confirmed pre-existing on main, unrelated to this change.

Follow-ups

The review flagged two different issues that are not high priority and will be taken care of in new PRs:

Test plan

  • ./scripts/run_tests.sh — all packages pass
  • ./scripts/run_lints.sh — clean except the pre-existing unrelated finding noted above
  • ./scripts/build.sh — builds cleanly
  • ./scripts/run_formatters.sh — no diffs
  • New unit tests for import alias resolution, call-site matching, and PURL-based language routing
  • New end-to-end test (Test_PerformReachabilityAnalysis_Go) covering the full pipeline
  • In-app testing, see screenshot below
image image

@jbcibois-ddhq
jbcibois-ddhq requested a review from a team as a code owner July 8, 2026 09:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9a8872aa0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/reachability/codefile/golang.go
Comment thread pkg/reachability/codefile/golang.go
@jbcibois-ddhq
jbcibois-ddhq force-pushed the jb.cibois/K9CODESEC-3103 branch from f9a8872 to 140ff7f Compare July 8, 2026 09:30
@datadog-official

This comment has been minimized.

@jbcibois-ddhq

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 140ff7f503

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/reachability/codefile/golang.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c948e585ec

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/reachability/codefile/golang.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1e2db28c33

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/reachability/codefile/golang.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 61ec6d619f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/reachability/reachability.go Outdated
@jbcibois-ddhq
jbcibois-ddhq force-pushed the jb.cibois/K9CODESEC-3103 branch from 61ec6d6 to dabaf49 Compare July 15, 2026 08:38

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dabaf49fb0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/reachability/codefile/golang.go
Codex flagged that _ and . imports fell through to defaultIdentifierForModulePath, which could collide with an unrelated import resolving to the same default alias and produce a false-positive reachability match.
Codex flagged that github.com/redis/go-redis/v9 (package name "redis") was defaulting to "go-redis", missing reachability for that convention. Go identifiers can't contain hyphens, so any hyphenated last segment is never the real package name; strip the common go- repo-naming prefix.
@jbcibois-ddhq
jbcibois-ddhq force-pushed the jb.cibois/K9CODESEC-3103 branch from dabaf49 to 17febdc Compare July 15, 2026 09:36

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 17febdca5f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/reachability/codefile/golang.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34c3d6596c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/reachability/codefile/golang.go
@jbcibois-ddhq jbcibois-ddhq changed the title Add static Go reachability analysis [K9CODESEC-3103] Add static Go reachability analysis Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants