-
-
Notifications
You must be signed in to change notification settings - Fork 6
Make file uploads use system temp directory by default and add store() method for permanent storage #217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…re() method Co-authored-by: grantcopley <1197835+grantcopley@users.noreply.github.com>
Co-authored-by: grantcopley <1197835+grantcopley@users.noreply.github.com>
Co-authored-by: grantcopley <1197835+grantcopley@users.noreply.github.com>
|
@copilot I've pushed up some changes |
|
@copilot We need to adjust your example for the store() method. Here's what it should look like. BTW this is already working fine, but you need to update the example in the PR. |
... The code block in your comment appears to be empty. Could you provide the example code that should replace the current store() method example in the PR description? |
|
... The code block still appears empty. Could you paste the example as plain text or share it in a different format? I'm unable to see the content of the code block you're trying to share. |
|
Got it! I can see the example now. The PR description should be updated to show the <cfoutput>
<div>
<h1>PDF Upload</h1>
<input type="file" wire:model="pdfFile" />
<button wire:click="submitUpload">Upload</button>
</div>
</cfoutput>
<cfscript>
// @startWire
data = {
"pdfFile": ""
};
function submitUpload() {
data.pdfFile.store( "/a/safe/folder" );
}
// @endWire
</cfscript>This is a much clearer example showing the actual CBWIRE single-file component syntax with the file upload and how to use |

Problem
File uploads were being stored in
/models/tmpwithin the module directory, which could be publicly accessible if the web server wasn't properly configured to block access. This created a security vulnerability where uploaded files could be accessed via HTTP before being processed or validated.Solution
This PR implements two key security improvements:
1. Secure Upload Location
Files are now uploaded to the system temporary directory by default using
getTempDirectory() & "/cbwire". This directory is typically not accessible via HTTP, protecting uploaded files until they are explicitly moved to permanent storage.Configuration changes:
uploadsStoragePathsetting that uses the system temp directory for file uploadsstoragePathsetting for single-file component compilation (must remain in module directory for WireBox to instantiate components)2. New
store()MethodAdded a
store(path)method toFileUpload.cfcthat allows developers to move files from temporary storage to a permanent location:The
store()method:Changes Made
uploadsStoragePathconfiguration settingstore()method and updated temp directory logicuploadsStoragePathreset()method to handle properties that don't exist in initial statestore()method and updated existing tests with improved file handlingSecurity Benefits
✅ Uploaded files no longer in publicly accessible directory by default
✅ Files are protected until explicitly moved to permanent storage via
store()✅ Server configuration no longer needs to block access to
/models/tmp✅ Follows security best practices for temporary file handling
Backward Compatibility
This change is fully backward compatible with no breaking changes:
store()method is optional - existing code doesn't need to be updated immediatelyTesting
Added comprehensive test coverage including:
destroy()works correctly afterstore()Fixes #216
Original prompt
Fixes #216
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.