fix: validate prompt and working paths before setup - #142
Open
sylvesterkaczmarek wants to merge 3 commits into
Open
fix: validate prompt and working paths before setup#142sylvesterkaczmarek wants to merge 3 commits into
sylvesterkaczmarek wants to merge 3 commits into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validate local path inputs immediately after Node setup so missing
prompt-fileor invalidworking-directoryvalues fail before proxy startup and irreversible host changes.Fixes #141.
Problem
prompt-fileis not read until the finalrun-codex-exechelper starts, andworking-directoryis not meaningfully checked until Codex is invoked.That ordering means a simple path typo can be reported only after the action has already performed setup that may include:
drop-sudostep.For example:
currently reaches
readFile(prompt.path, "utf8")near the end of the action, after those setup steps.Fix
Add a dependency-free filesystem preflight immediately after Node setup.
It validates:
prompt-fileexists, is not a directory, and is readable by the action process;working-directory(inputorgithub.workspace) exists and is a directory.Whitespace-only
prompt-fileremains equivalent to an empty value, matching the action's existing input normalization behavior.The existing runtime checks remain in place, so races or filesystem changes after preflight still fail normally.
Scope
This intentionally does not preflight
output-schema-fileoroutput-file: those paths are consumed by Codex and can have different ownership/relative-path semantics underunprivileged-userand--cd. This PR only validates paths whose interpretation is unambiguous at the composite-action boundary.Regression coverage
Added six Node-stdlib tests covering:
Validation
main(c385816875cc2fc8e033ed9d1cba96f8c331210e);src/change, so the checked-indist/main.jsbundle remains valid.Risk
Low. These invalid paths already fail today. The change moves deterministic filesystem failures earlier, before the action mutates runner state.