Sample
sinatra 4.2.1: Show that Sinatra does not automatically delete uploaded tempfile after request
Verified sample for gem sinatra 4.2.1: Show that Sinatra does not automatically delete uploaded tempfile after request. The contract ran on ruby 3 · linux…
sha256:642785541c948ed29ed0bfef28fd354b3908b3e42d5b60ff220ab91e5a7a7f29
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 2
- Signing keys that built it
- 2
Declared environment
ruby linux x64 ruby ruby bundler
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| ruby 3 · linux debian/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · rubygems@1 |
2026-08-17 |
| ruby 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · rubygems@1 |
2026-08-18 |
Case
HOW- Goal
- Show that Sinatra does not automatically delete uploaded tempfile after request
- Packages
- Symbols
-
- Sinatra::Base#post
- Rack::Test::UploadedFile
- Environment
- ruby
- Created
- 2026-08-17T02:47:53Z
Contract
- A multipart upload sent with an allowed localhost Host reaches the Sinatra route, and the received tempfile still exists after the request returns.
Files
- Gemfile
- Gemfile.lock
- csx.json
- test/contract.rb
Source
source 'https://rubygems.org'
gem 'sinatra', '4.2.1'
gem 'rack-test', '2.2.0'
GEM
remote: https://rubygems.org/
specs:
base64 (0.3.0)
logger (1.7.0)
mustermann (3.1.1)
rack (3.2.7)
rack-protection (4.2.1)
base64 (>= 0.1.0)
logger (>= 1.6.0)
rack (>= 3.0.0, < 4)
rack-session (2.1.2)
base64 (>= 0.1.0)
rack (>= 3.0.0)
rack-test (2.2.0)
rack (>= 1.3)
sinatra (4.2.1)
logger (>= 1.6.0)
mustermann (~> 3.0)
rack (>= 3.0.0, < 4)
rack-protection (= 4.2.1)
rack-session (>= 2.0.0, < 3)
tilt (~> 2.0)
tilt (2.8.0)
PLATFORMS
ruby
x64-mingw-ucrt
DEPENDENCIES
rack-test (= 2.2.0)
sinatra (= 4.2.1)
CHECKSUMS
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
bundler (4.0.18) sha256=02d9a17429de1847b4e0c9f27a9ee4b20c0a74c0a641b4e77195d6019e3618ac
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
mustermann (3.1.1) sha256=4c6170c7234d5499c345562ba7c7dfe73e1754286dcc1abb053064d66a127198
rack (3.2.7) sha256=93e13e1c24f93556671d85d2d79fa228c3485815c50d7e2f265b5330c6528fb7
rack-protection (4.2.1) sha256=cf6e2842df8c55f5e4d1a4be015e603e19e9bc3a7178bae58949ccbb58558bac
rack-session (2.1.2) sha256=595434f8c0c3473ae7d7ac56ecda6cc6dfd9d37c0b2b5255330aa1576967ffe8
rack-test (2.2.0) sha256=005a36692c306ac0b4a9350355ee080fd09ddef1148a5f8b2ac636c720f5c463
sinatra (4.2.1) sha256=b7aeb9b11d046b552972ade834f1f9be98b185fa8444480688e3627625377080
tilt (2.8.0) sha256=ba472eb2716fe1e04112d6d219a9dae938ec09a6a1e2ad3ecc7922e79bde3721
BUNDLED WITH
4.0.18
{"case":{"believed":"Sinatra automatically removes uploaded file temporary files after the request completes","caseId":"case:sha256:4a183035c75b11ded0bb15404c4d06083538d3496a44ed979aec41f59b29061e","contract":["A multipart upload sent with an allowed localhost Host reaches the Sinatra route, and the received tempfile still exists after the request returns."],"goal":"Show that Sinatra does not automatically delete uploaded tempfile after request","kind":"HOW","packages":["pkg:gem/sinatra@4.2.1","pkg:gem/rack-test@2.2.0"],"schemaVersion":1,"symbols":["Sinatra::Base#post","Rack::Test::UploadedFile"]},"contractCommand":["ruby","test/contract.rb"],"environment":{"arch":"x64","ecosystem":"gem","executionContext":"ruby","language":"ruby","os":"linux","packageManager":"bundler","runtime":"ruby","schemaVersion":1},"license":"MIT-0","packages":["pkg:gem/sinatra@4.2.1","pkg:gem/rack-test@2.2.0"],"schemaVersion":1,"symbols":["Sinatra::Base#post","Rack::Test::UploadedFile"],"verifierAdapter":"rubygems@1"}
require 'sinatra/base'
require 'rack/test'
require 'tempfile'
# Simple Sinatra app that accepts file upload
class UploadApp < Sinatra::Base
post '/upload' do
# params[:file] is a hash with :filename and :tempfile (Tempfile instance)
uploaded = params[:file][:tempfile]
# Store the path in a global for later inspection
$temp_path = uploaded.path
"ok"
end
end
# Rack::Test integration
include Rack::Test::Methods
def app
UploadApp
end
# Create a temporary file to upload
temp = Tempfile.new('sample')
temp.write('hello')
temp.rewind
# Perform the upload request
header 'Host', 'localhost'
post '/upload', { 'file' => Rack::Test::UploadedFile.new(temp.path, 'text/plain') }
raise "upload request failed with status #{last_response.status}" unless last_response.status == 200
raise "upload route did not receive a tempfile" unless $temp_path
# After request, check if the tempfile still exists on the filesystem
if File.exist?($temp_path)
puts 'TEMPFILE EXISTS'
else
raise 'Tempfile was removed after request'
end