[Bug] Security diff scan silently excludes Perl source files (.cgi, .pl, .pm, .t)
Summary
Codex Security plugin 0.1.32 silently excludes Perl source files (.cgi, .pl, .pm, .t) from the automatic file inventory used by security diff scans.
The root cause is a fixed extension allowlist (TEXT_CODE_EXTENSIONS) that does not include these Perl-related extensions.
In a real-world repository containing Perl CGI applications, the plugin identified only 1 out of 21 changed files as in scope.
This creates a potentially significant security coverage gap because changed executable source files may be omitted from automated security reviews without an explicit warning.
Environment
Plugin: Codex Security 0.1.32
OS: AlmaLinux 9.8 on WSL2
Git repository: Private repository containing Perl CGI applications
Scan mode:
diffDiff type:
rangeScope: Repository root (
.)Encoding: Mixed UTF-8, EUC-JP, and ASCII
Steps to Reproduce
Create a Git repository containing Perl source files with extensions such as
.cgi,.pl,.pm, and.t.Modify and commit these files.
Run a Codex Security diff scan against the relevant Git revision range.
Inspect the generated file inventory:
artifacts/02_discovery/in_scope_files.txtCompare the inventory against the changed files reported by Git:
git diff --name-only <base> <head>Observe that Perl source files are missing from the automatic inventory.
Actual Behavior
In the affected repository, Git identified 21 changed files:
File type | Changed files | Automatic inventory -- | -- | -- .cgi | 12 | 0 .pl | 6 | 0 .t | 1 | 0 *.min.js | 1 | 0 Other .js | 1 | 1 Total | 21 | 1The generated inventory contained only:
www/js/admin_header.js
The Perl files were excluded regardless of whether their contents were UTF-8, EUC-JP, or ASCII.
The exclusion of *.min.js and files under tests/ is separate from the Perl extension issue.
Root Cause
The investigation identified the following implementation:
File: scripts/rank_preview.py
The TEXT_CODE_EXTENSIONS allowlist includes extensions such as .js, .py, .rb, .php, and .sh, but does not include:
.cgi
.pl
.pm
.t
File: scripts/generate_in_scope_files.py
The inventory generator filters files using a condition equivalent to:
not path_is_diff_excluded(...)
and path.suffix.lower() in TEXT_CODE_EXTENSIONS
As a result, Perl source files are excluded before their contents are examined.
The Git diff operation itself correctly identifies the changed files.
Additional investigation confirmed that:
Git correctly detected all 21 changed files.
The files were recognized as text by Git.
The repository scope was correct.
File permissions did not cause the exclusions.
Character encoding did not cause the exclusions.
The same result was reproduced from the relevant Git revisions.
The observed behavior is deterministic and directly explained by the extension allowlist.
Expected Behavior
Changed Perl source files should be included in the automatic security diff inventory.
At minimum, Codex Security should explicitly warn users when executable source files are excluded because their extensions are unsupported or unrecognized.
The documented behavior of reviewing changed source files should not silently omit an entire application language.
Security Impact
This behavior can create a false sense of security when reviewing changes to Perl applications.
For example, a repository containing only Perl CGI files may produce an empty or incomplete automatic inventory even though executable application code has changed.
Potential consequences include:
Missing security-relevant changes in Perl CGI applications.
Incomplete security reviews without clear coverage warnings.
Users incorrectly assuming that all changed source files were analyzed.
Security regressions remaining undetected.
In this case, the omission was identified during the scan, and the affected Perl files were subsequently reviewed manually.
However, relying on manual detection of missing files is not a reliable long-term solution.
Suggested Fix
Add Perl-related extensions to
TEXT_CODE_EXTENSIONS:".cgi", ".pl", ".pm", ".t",Consider supporting source-code detection beyond filename extensions, particularly for CGI scripts that may use arbitrary extensions or shebang-based language identification.
Report excluded changed files and their exclusion reasons in scan results.
Add regression tests covering repositories containing Perl source files, including mixed-encoding repositories.
Consider warning users when the automatic inventory contains significantly fewer source files than the Git diff.
Additional Notes
The investigation was performed against the installed Codex Security plugin 0.1.32.
No plugin files were modified.
The issue was identified through inspection of the installed plugin implementation, generated scan artifacts, and Git revision comparisons.
This report concerns automatic file discovery and scan coverage, not the underlying model's ability to analyze Perl code.
Codex was able to analyze the excluded Perl source files when they were explicitly included in the review.
Thanks for the update. I tried to verify the fix against the same revision range that originally reproduced this issue.
I recreated the original test condition in a clean Git worktree:
- Original base:
ab329f3fb3c325f12735f82e2623c53c2dc9a4e0 - Original head:
21a5c624e4f555096011a0c8786d86e10c7bac13
The worktree was clean and detached at the original head commit.
I then verified the standalone Codex Security CLI environment:
- Codex Security CLI:
0.8.2 - Bundled plugin:
0.1.95 - Bundled Codex runtime:
0.165.0 - Default model:
gpt-5.6-sol - Default reasoning effort:
xhigh
codex-security info --json confirmed those versions.
I also ran a dry-run against the original revision range:
npx @openai/codex-security scan . \
--diff ab329f3fb3c325f12735f82e2623c53c2dc9a4e0 \
--dry-run \
--json
The dry-run completed successfully and resolved the expected revision range:
base: ab329f3fb3c325f12735f82e2623c53c2dc9a4e0
head: 21a5c624e4f555096011a0c8786d86e10c7bac13
However, I have not been able to run the actual scan.
With stored ChatGPT authentication, the CLI reports:
The stored ChatGPT credentials cannot access the configured model.
Use an account or API key with model access.
I then created a new OpenAI API project, purchased API credits, created an API key, and retried using:
--auth api-key
The CLI then reports:
The API key from OPENAI_API_KEY cannot access the configured model.
Retry with '--auth chatgpt' or use an API key with model access.
To make sure the API key itself and the configured model were valid, I queried the model endpoint directly using the same API key:
GET /v1/models/gpt-5.6-sol
This succeeded and returned:
{
"id": "gpt-5.6-sol",
"object": "model",
"owned_by": "system"
}
So the API key is valid and the API project can access the gpt-5.6-sol model metadata, but Codex Security still rejects the credentials before the scan begins.
For comparison, I can use Codex Security through the ChatGPT desktop plugin with Daybreak Blue access, but the standalone CLI appears to require separate access or provisioning that my current ChatGPT account/API project does not have.
Because the actual 0.8.2 scan cannot start, I have not yet been able to verify whether the original Perl files are now correctly included in the automatic diff inventory.
The original regression case remains available, and I would be happy to rerun the exact same base/head range if there is another supported authentication method or access configuration I should use.
Thanks for preserving the exact regression range. I checked the current CLI reference: scan authentication is documented as ChatGPT or API key, and some cybersecurity requests require Trusted Access for Cyber. I don't see another documented authentication mode for this scan.
One separate setting may be relevant: Daybreak defaults off for standalone scans with Codex 0.163.0 and later. The CLI docs show opting in with --codex daybreak=true. Since your runtime is 0.165.0, if your ChatGPT account/workspace has the required Cyber access, could you try the same revision range with ChatGPT auth and that override?
npx @openai/codex-security scan . \
--diff ab329f3fb3c325f12735f82e2623c53c2dc9a4e0 \
--auth chatgpt \
--codex daybreak=true
The flag won't grant account access by itself. If the request still fails, a maintainer would need to confirm whether this account/workspace is enabled for the required access.
I tried the exact command you suggested:
npx @openai/codex-security scan . \
--diff ab329f3fb3c325f12735f82e2623c53c2dc9a4e0 \
--auth chatgpt \
--codex daybreak=true
Unfortunately, it still fails immediately with:
The stored ChatGPT credentials cannot access the configured model.
Use an account or API key with model access.
So enabling the Daybreak toggle did not change the result.
At this point, it looks like the ChatGPT account/workspace may not have the access required by the standalone Codex Security CLI, even though Codex Security with Daybreak Blue is available through the ChatGPT desktop plugin.
If possible, could a maintainer confirm whether this account/workspace needs separate provisioning or entitlement for the standalone CLI?
Thanks for preserving the original revision range and trying the scan again. I checked the inventory helper bundled with CLI 0.8.2 against main at 0ea991c1 on a two-commit fixture with eight changed files. Both wrote the same seven text paths, including all four Perl extensions, an EUC-JP file, and a filename with a space. Both skipped the binary .pm control. The full inventory test file also passed.
I’m closing the inventory bug as fixed by #1347, with regression coverage in #2109. I could verify file selection without model access. The access error you hit when rerunning the full scan on your original range is still unverified.
I reproduced both model-access messages on 0.8.2 by making the plugin cache read-only. The quickest check on your version is to repeat just the installer step. Run this in the same shell after the failed scan has exited. It uses the scanner’s existing cache and makes no model request.
state="${CODEX_SECURITY_STATE_DIR:-${CODEX_HOME:-$HOME/.codex}/state/plugins/codex-security}"
CODEX_HOME="$state/codex-home" npx --yes @openai/[email protected] \
plugin add --json codex-security@codex-security-sdk
- If you see
failed to create plugin cache directory: Permission denied, you’ve reproduced the local cache failure. Check write access to the plugin cache under$state/codex-home/plugins. - If it returns an
installedPath, installation works now. If the original run has a scan ID, inspect its saved error withnpx @openai/[email protected] scans show <scan-id> --json | jq -r '.failureMessage'. Otherwise, rerun your last scan with--verbose. Thescan.output_readyline means plugin setup succeeded on that run. A provider error explicitly denying the selected model points to model access. A bareforbiddenis inconclusive.
If it’s still unclear, please reply with just the failing step and the short error phrase or code. The proposed diagnostic fix is in #2247.
No repository change is needed for this trigger. It provides environment-specific diagnostic steps for the reporter to run after their failed scan; reproducing them in this separate checkout would not validate the reporter’s cache permissions or credentials.
No commit was created and, as required when there are no code changes, no pull request was opened.
Checks
- ✅
git status --short --branch— confirmed the working tree is clean on branchwork.
I ran the suggested installer command using Codex 0.165.0.
It failed with:
Error: plugin `codex-security` was not found in marketplace `codex-security-sdk`
Additional checks showed:
plugin marketplace list: No plugin marketplaces in scope.plugin list --json: HTTP 401 (token_revoked) when fetching the remote plugin catalog.$state/codex-home/pluginsdoes not exist.$stateand$state/codex-homeexist and are owned by the current user.
The installer did not reach the expected installedPath result or reproduce the cache permission error.
I have not modified permissions, cleared caches, or reauthenticated.