Skip to content

Comments

Fix BoxLang crash: expand file paths in $ref values before passing to SwaggerSDK#50

Open
Copilot wants to merge 2 commits intodevelopmentfrom
copilot/fix-cbswagger-file-resolve-error
Open

Fix BoxLang crash: expand file paths in $ref values before passing to SwaggerSDK#50
Copilot wants to merge 2 commits intodevelopmentfrom
copilot/fix-cbswagger-file-resolve-error

Conversation

Copy link

Copilot AI commented Feb 22, 2026

On BoxLang, CFML file functions (fileExists, fileRead) implicitly call expandPath(), but Java's FileInputStream — used by SwaggerSDK to resolve $ref file references — does not. This causes a crash whenever a web-root-relative or double-slash path passes the fileExists() guard but fails in FileInputStream.

fpath = "//resources/api/auth/authenticate.response.yml"
fileExists(fpath)  // true  — BoxLang implicitly expandPath()s
fileRead(fpath)    // ok
createObject("java", "java.io.FileInputStream").init(fpath)            // ERROR
createObject("java", "java.io.FileInputStream").init(expandPath(fpath)) // ok

Changes

  • models/RoutesParser.cfcparseMetadataValue: Apply expandPath() to local file paths (non-HTTP) before returning a $ref struct. Handles:

    • Web-root-relative paths: /includes/resources/schema.json
    • Tilde-prefixed paths: ~/responses/foo.yml (after ~samplesPath/ substitution)
    • Fragment-bearing paths: /schema.json##500 — only the file portion is expanded; the fragment is preserved and re-attached
    • Double-slash paths (the specific BoxLang trigger): //resources/api/auth/foo.yml
  • test-harness/tests/specs/RoutesParserTest.cfc: New spec asserting parseMetadataValue produces absolute expanded paths for all three path forms (web-root-relative, tilde-prefixed, with fragment).

Original prompt

This section details on the original issue you should resolve

<issue_title>crash on boxlang</issue_title>
<issue_description>bx 1.10.1+51
compat-cfml 1.31.0-snapshot
orm 1.4.1-snapshot
cbSwagger 3.1.3+14

cbSwagger throws errors while trying to resolve various file refs we have it trying to find. An issue I see right now is that it passes some paths to FileInputStream which BoxLang understands to exist (maybe by implicitly expandPath'ing the args to fileExists), but which don’t actually exist on disk.

Here is a semi-reproduction of the issue:

fpath = "//resources/api/auth/authenticate.response.yml"
writedump(fileExists(fpath)) // true
writedump(fileRead(fpath)) // ok, no problem
createObject("java", "java.io.FileInputStream").init(fpath) // error: doesn't exist
createObject("java", "java.io.FileInputStream").init(expandPath(fpath)) // ok

In the cbSwagger parser there are a few places where fileExists() serves as a guard and paths that pass that test end up being used to initialize a FileInputStream, which crashes.

see also: https://ortussolutions.atlassian.net/browse/BL-2190</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

lucee@6 ColdBox ^7.0.0 Test Results

16 tests  +1   16 ✅ +1   0s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

lucee@5 ColdBox be Test Results

16 tests  +1   16 ✅ +1   5s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

lucee@6 ColdBox ^8.0.0 Test Results

16 tests  +1   16 ✅ +1   0s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

lucee@5 ColdBox ^7.0.0 Test Results

16 tests  +1   16 ✅ +1   5s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

lucee@6 ColdBox ^6.0.0 Test Results

16 tests  +1   16 ✅ +1   0s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

lucee@5 ColdBox ^6.0.0 Test Results

16 tests  +1   16 ✅ +1   6s ⏱️ -1s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2018 ColdBox ^7.0.0 Test Results

16 tests  +1   16 ✅ +1   0s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2018 ColdBox ^6.0.0 Test Results

16 tests  +1   16 ✅ +1   0s ⏱️ -1s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

boxlang-cfml@1 ColdBox ^7.0.0 Test Results

16 tests  +1   16 ✅ +1   2s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@be ColdBox be Test Results

16 tests  +1   16 ✅ +1   1s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2021 ColdBox ^8.0.0 Test Results

16 tests  +1   16 ✅ +1   0s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2023 ColdBox ^8.0.0 Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2018 ColdBox ^8.0.0 Test Results

16 tests  +1   16 ✅ +1   0s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2025 ColdBox ^6.0.0 Test Results

16 tests  +1   16 ✅ +1   1s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

boxlang-cfml@1 ColdBox ^8.0.0 Test Results

16 tests  +1   16 ✅ +1   2s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2021 ColdBox ^6.0.0 Test Results

16 tests  +1   16 ✅ +1   1s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2021 ColdBox ^7.0.0 Test Results

16 tests  +1   16 ✅ +1   0s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2025 ColdBox be Test Results

16 tests  +1   16 ✅ +1   1s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2021 ColdBox be Test Results

16 tests  +1   16 ✅ +1   0s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

lucee@6 ColdBox be Test Results

16 tests  +1   16 ✅ +1   0s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

lucee@5 ColdBox ^8.0.0 Test Results

16 tests  +1   16 ✅ +1   5s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

lucee@be ColdBox be Test Results

16 tests  +1   16 ✅ +1   0s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

boxlang@1 ColdBox ^8.0.0 Test Results

16 tests  +1    1 ✅ +1   1s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0   14 ❌ ±0   1 🔥 ±0 

For more details on these failures and errors, see this check.

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

boxlang@1 ColdBox be Test Results

16 tests  +1    1 ✅ +1   1s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0   14 ❌ ±0   1 🔥 ±0 

For more details on these failures and errors, see this check.

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2023 ColdBox be Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2018 ColdBox be Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

boxlang@be ColdBox be Test Results

16 tests  +1    1 ✅ +1   1s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0   14 ❌ ±0   1 🔥 ±0 

For more details on these failures and errors, see this check.

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2023 ColdBox ^6.0.0 Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

boxlang-cfml@be ColdBox be Test Results

16 tests  +1   16 ✅ +1   2s ⏱️ -1s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2023 ColdBox ^7.0.0 Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

boxlang-cfml@1 ColdBox ^6.0.0 Test Results

16 tests  +1   16 ✅ +1   3s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

boxlang-cfml@1 ColdBox be Test Results

16 tests  +1   16 ✅ +1   3s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2025 ColdBox ^7.0.0 Test Results

16 tests  +1   16 ✅ +1   1s ⏱️ -1s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 22, 2026

adobe@2025 ColdBox ^8.0.0 Test Results

16 tests  +1   16 ✅ +1   1s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 0e93d4d. ± Comparison against base commit 74b3ec6.

♻️ This comment has been updated with latest results.

…FileInputStream compatibility

Co-authored-by: lmajano <137111+lmajano@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix file resolution error in cbSwagger parser Fix BoxLang crash: expand file paths in $ref values before passing to SwaggerSDK Feb 22, 2026
Copilot AI requested a review from lmajano February 22, 2026 12:34
@jclausen jclausen marked this pull request as ready for review February 22, 2026 19:21
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.

crash on boxlang

2 participants