Skip to content

Task step files: unauthenticated access, and options for an authorized download route ​

Status: Research, 2026-10-15. Nothing here is shipped; this is for review of the findings and the recommended fix sequence. Scope: task step files (customer uploads and author-attached shared files). Other static writers are listed but not designed for.

Paths are repo-relative.

Bottom line ​

  • Anyone who has a task-file reference can download the file. No login, no vendor check and no step check apply anywhere on the path. The random segment in the key is the only protection.
  • That segment is weaker than the brief assumed.
    • New keys carry 128 bits (v<vendor>/<32hex>/<name>).
    • Every file written before ONRAMP-6138 (Aug 2026), and several writers that still bypass store_task_file, carry only 32 bits plus a guessable filename. Those writers include Adobe signed PDFs, key files and feature media, vendor resources, and exports. They use make_unique, which is uuid4()[:8] (app/api/utils/fileSave.py:10-12).
  • The references are not secrets in practice. They go by design to customer webhooks, the v1 integration queue, the Customer API, MCP clients, Salesforce file names, emailed exports, Sentry, Heap and the access logs (see "Where references leak" below).
  • Two problems are bigger than the exposure itself:
    1. Any file type is accepted (test_save_task_file_does_not_enforce_accepted_file_types). Anything that serves /static/task_files inline, same-origin, turns an uploaded .html or .svg into stored XSS on the app origin. Flask's static route does exactly that.
    2. References are client-controlled strings. A fix that checks only "this reference appears on a step I can see" can be bypassed: write another vendor's key into your own answer, then download it through the authorized route.

Exposure by environment ​

TierHow /static/task_files/<ref> is servedS3 offloadConfidence
prod, gdpr-prod, dev01Duplo ELB → Caddy (server: Caddy, confirmed by anonymous probe today). The deployed caddy-conf configmap does handle /static/* { file_server } from /var/www (commit 8532bbf7f0e, which checked the configmap on these three tenants). Caddy carries no auth. Open question: is the shared EFS upload volume mounted into the webserver pod at /var/www/static/task_files? Commit 9657d81da17 says every Flask pod mounts it. If the webserver pod does not, local-disk task files 404 in prod and only offloaded files are reachable.Per-vendor DB setting offload_task_files_to_s3 (configuration / vendor_configuration). I could not read it: there is no prod reader entry in ~/.pgpass and no dev or stage creds file on this machine.Serving chain: high. Volume mount and offload values: unknown.
stage, demoSame images. The configmap was not checked in 8532bbf7f0e.UnknownMedium
PR previewsCloudFront /static/* goes to the SPA bucket, which never holds task files, so the result is 404. Local writes fail on the Lambda's read-only filesystem. If offload were on, files would sit at https://<preview domain>/uploads/<key> (OAC bucket, no viewer auth, edge-cached, 14-day expiry).Off by seedHigh
localFlask static_folder (app/api/__init__.py:819) serves inline with no auth. session_validator skips /static/, and the route-policy audit skips static endpoints.Off (no row in the seed)High
hosting-conf/ nginxDead. It is the legacy EC2/uwsgi config and nothing deploys it.n/aHigh

S3 buckets:

  • onrampemailimages, the seed's aws_s3_bucket_name, is not in our AWS account. It lives in us-east-2, not the us-west-2 the seed says.
  • That bucket allows anonymous ListBucket. Its root holds only logos/ (125 keys) and icons/, with no task files. It is still a finding: if task files were ever offloaded to it, the random segment would protect nothing, because anyone can list the keys.
  • Logos and task files share one bucket and one s3_sub_folder_name (app/api/utils/Logo.py:202), so making "the task-file bucket" private would also break logos.

Checks still owed. Each needs Duplo or prod-DB access I don't have here:

  1. Per tenant, the webserver deployment's volumes and volumeMounts, plus the caddy-conf configmap. This settles whether prod serves local task files at all, and with what Content-Type and Cache-Control.
  2. On the prod replica: SELECT setting, value FROM configuration WHERE setting IN ('offload_task_files_to_s3','aws_s3_bucket_name','s3_sub_folder_name','aws_region'), plus a count of vendor_configuration overrides for the offload setting.
  3. If any vendor offloads: the configured bucket's public-access block, policy and anonymous ListBucket behaviour.
GapWhereWhy it matters to the fix
/upload_files checks only login_requiredapp/api/task_step/routes.py:264-278Any portal customer can write arbitrary bytes, of any type, under their vendor's prefix. Combined with inline serving, that is the stored-XSS path.
Answer writers accept any reference stringupdate_step_meta writes the client's answers wholesale (routes.py:231-240). answer_step__db_add_flush does the same.This is the reference-forgery bypass above. task_file_reference_escapes_root runs on none of these paths.
/file/download/<id> is vendor-scoped onlydownload_file_controller.py:38 (it is also on the allowlist)Every portal user of a vendor can fetch every File row, across customer accounts, including DocuSign signed PDFs. Vendor scope alone is the same mistake in a new route.
DocuSign signed PDFs also sit under the static rootABS_TASK_FILES_FOLDER/docusign_signed/<vendor>/<8hex>-signed-agreement.pdf (docusign/documents.py:127)The authenticated route exists, but the file is also reachable at the static URL.
References are copied across steps, projects and tenantscopy_steps_from_task__db_add_flush deep-copies step_configuration for project creation, task duplication, playbook-update apply and template installs (which cross tenants). Global or_form_template rows have vendor_id NULL.One file has many legitimate referrers, some in other vendors. "Key prefix equals my vendor" is wrong in both directions.
window.open(fullLink) without noopenerUploadedResource.vue:128 (portal), :118 (org)Reverse tabnabbing from user-hosted content, and the page leaks as Referer.
crm-broker fetches anonymously over the public URLcrm-broker/src/crm_broker/task_files.py:52If the static path closes before the broker moves, Salesforce file automation breaks. It is a separate deployable, so the contract must hold in both directions for one release.
Side finding, out of scope: plaintext DB credentials in SQS messagesapp/api/utils/sqs_helper.py:170-176ONRAMP_DATABASE_HOST/USER/PASSWORD ride in every v1 integration queue message. This is unrelated to task files; it is proposed as a separate follow-up.

Where references leak ​

To third parties (any of these defeats a secret URL):

ChannelWhat carries the referenceShape
Event webhooks (customer URL)EventSubtaskDTO.configuration, .action_response and .clear_action_response (event/mappers/types/subtask_mappers.py:26-29), plus task subtasks_answers. Also the legacy webhooks/helpers.py:530,535.Local key, S3 URL, built file_url
v1 integration queueget_integration_data.py:208 (raw response) and :222-246 (https://<domain>/static/task_files/<ref>)Local key, S3 URL, full URL
Customer APIsubtask_api_response_dto.py:50,52, which returns the raw configuration and action_response. The proxy also stores responses unredacted in or_api_request_log.response_body.Local key, S3 URL
MCPget_task_step_questions and answer_task_step return the raw answers (task/v2/mappers.py:206,234). The ACTIVITY tool returns summaries.Local key, S3 URL
Salesforcecrm-broker uses the full reference as ContentVersion PathOnClient and as the filename (adapters/salesforce.py:424-426)Local key, readable by anyone in the customer's org
Emailed exportsbulk_projects "Subtasks" sheet and the responses export, attached and sent to free-form cc_emails. The export file itself sits at /static/exports/<8hex>-…, also unauthenticated.Local key, S3 URL, file_url
Sentry (backend and browser)Request bodies and URLs (backend), and resource spans and fetch breadcrumbs (browser). Only emails are scrubbed.Local key
Heap (prod)Default autocapture of <a href> clicks on download links. This is inferred, not observed.Local key

Internal durable stores: activity feed friendly_summary (activity_history/helpers.py:308-310), automation history, or_file_review.file_ref, gunicorn and Caddy access logs (which feed OpenSearch), and webhook history.

Checked, nothing found: customer and internal email templates, Slack, CRM field sync, the SQL tool (columns are Internal), and onramp-agents. No SPA route puts a file path in the page URL, so the Referer only leaks through the window.open above. There is no global Referrer-Policy, so the browser default strict-origin-when-cross-origin applies.

Consequence for the design: most egress is machine-to-machine and the receiver downloads the file later, without a session. Webhook consumers, integration-queue Lambdas, the broker, export recipients and Customer API callers all fetch by URL today. A session-only route silently breaks every one of them. They need a capability (signed, expiring) URL or an API-key-authenticated route, not a cookie.

What any fix has to satisfy ​

  1. Vendor bound. The step is loaded with vendor == get_current_user_vendor_id(), and a foreign step is a 404. Reuse project_scope_by_step and the route-policy harness. Per .claude/rules/backend-models.md, cross-vendor coverage goes through route_policy_harness.py, with a vendor 0 fixture.
  2. Account and visibility bound for portal users. PortalService.assert_project_readable, gate_project_id and assert_task_portal_visible (map refusals to 404). This is the file_review controller's exact sequence (file_review/controllers/file_review_controller.py:33-56). Vendor scope alone repeats the /file/download gap.
  3. Reference membership. The reference appears on that step's step_configuration (shared files) or action_response (uploads). This is a pure function over plain dicts, covering every shape: file[n], link[n], url* and answer*, form fileUpload arrays (including inside LIST and TABLE rows, see get_form_files), and fileDownload config.files. Tested with literals, no DB.
  4. Provenance. The stored file belongs to the step's vendor, or is a known shared origin such as a template-installed file. This is what stops reference forgery. It needs a ledger (option B below); key prefixes can't prove it for legacy names or template copies.
  5. Safe delivery.
    • Local disk: always Content-Disposition: attachment, X-Content-Type-Options: nosniff, Content-Security-Policy: sandbox, and Cache-Control: private, no-store.
    • S3: a short-lived presigned GET with ResponseContentDisposition=attachment, returned as a 302. Presigning runs on a Pulumi-owned role the app assumes (configuration.md), not the static keys in ConfigValue.
  6. New endpoint style. RouteDTO with ResourceRoutePolicy(..., portal_reachable=True), with a playbook_scope_by_step fallback for playbook steps. Do not use @blueprint.route.
  7. Deploy skew. The old bundle keeps building /static/task_files/... for hours after a deploy, and the broker lags too. So the static path can close only a release after every reader has moved.

Options ​

A. Step-scoped session route, references unchanged ​

GET /api/task-steps/<step_uuid>/files?ref=<reference> runs checks 1–3 and 5 above.

  • Every legacy shape is accepted as an identifier: local key, 8-hex name, and S3 URL. An S3 URL is parsed back to a key only when its host and bucket match config; foreign hosts are refused. /file/download/<id> refs are handed to that route.

  • Readers stop building /static/task_files/<ref> and build this URL from one helper.

  • For: no data migration, because stored references stay as they are. It is the smallest change, and it closes anonymous access once the static path is shut.

  • Against: it does nothing about forgery (check 4), and it does nothing for machine consumers, which have no session.

B. Task-file ledger table (in addition to A) ​

A new or_task_files table holds id, uuid, vendor_id, storage_key, storage_system, uploaded_by, created_at, plus an origin_vendor_id for template copies.

  • store_task_file writes a row.

  • The download route requires the row's vendor to equal the step's vendor, or the step to be a known copy of that origin.

  • Answer writers reject a reference with no row for the caller's vendor. That closes forgery going forward, and /upload_files gets a step-scoped policy at the same time.

  • Backfill:

    • v<id>/… keys and <sub_folder>/v<id>/… URLs map directly.
    • A legacy flat name referenced by exactly one vendor's steps is assigned to that vendor.
    • A legacy name referenced by several vendors is a template copy or a pre-6138 S3 name collision. Those go to a review list and must not be guessed.
    • The backfill reads step_configuration, action_response, their old_* copies, feature_media_and_key_files and vendor_resource.resource_location.
  • For: it is the only option that makes check 4 hold, and it gives an id that signed links and the API can carry.

  • Against: a migration plus a backfill over large JSON columns, and an ambiguous-row review.

An HMAC-signed URL encodes (vendor_id, step_uuid, ref, exp). The key comes from SSM, not an env var. It is minted where references leave the app: webhook and event mappers, get_integration_data, exports, Customer API DTOs, form_utils.get_values_in_order_with_labels, and the broker trigger.

  • The route verifies the signature and expiry, then serves the file exactly as A does. Session checks are skipped, because the signature is the authorization decision, made at mint time by code that already had vendor scope.

  • Webhook and queue links need a TTL long enough for consumer retries (days). In-app links don't use this.

  • Following the DTO rules, each egress DTO adds a signed-URL field beside the raw reference for a release before the raw one is dropped or emptied.

  • For: it keeps every integration working. It also turns today's permanent bearer URLs into ones that expire.

  • Against: a link is still a bearer token until it expires, and existing webhook history and exports keep their old (dead, once static closes) URLs.

  • Caddy forward_auth to Flask on /static/task_files/*: the edge config lives in a Duplo configmap outside review, it doesn't fix S3 links, and it can't do the step check without the step.
  • Making the S3 objects private and presigning on render: this alone leaves local disk open, and logos share the prefix.

Recommendation: A + B + C, in that build order, with B's write-side guard landing before the static path closes. A alone is tempting because it needs no data migration. But it ships a route whose authorization depends on client-written strings, and it breaks every integration the day the static path shuts.

Migration path (one instance per PR, expand then contract) ​

  1. Hardening that changes no access, and can ship now. One PR each:
    • Flask's static handler serves task_files/* as an attachment with nosniff and CSP sandbox (and the matching header block in the Caddy configmap, coordinated with whoever owns Duplo).
    • noopener,noreferrer on the two window.open calls.
    • Sentry before_send and before_breadcrumb URL scrubbing for /static/task_files/ and the bucket host.
  2. Route (A). The pure membership resolver and its literal-value tests. The route, with the route-policy harness covering: two vendors, vendor 0, two customer accounts in one vendor, a Not-on-Portal task, a reference not on the step, and every legacy shape. A presign helper on an assumed Pulumi-owned role. No reader changes.
  3. Ledger (B). The model and migration, with store_task_file writing rows. Then a backfill (cross_tenant(reason=…)), with ambiguous names written to a report, not guessed. Then the route requires provenance.
  4. Write guard. Answer and config writers reject references without a ledger row for the vendor. /upload_files moves to a RouteDTO with project_scope_by_step and an is_task_workable_by_user check.
  5. Readers move.
    • One frontend helper replaces urlFor('task_files/…'), downloadFile, UploadedResource, VideoEmbed, FeatureMedia, ProjectResourceList, ProjectHome and ProjectResponsesV2.
    • Server builders move too: form_utils, get_integration_data, get_project_file_and_links.
    • This also fixes today's broken /static/task_files/https://… URLs.
  6. Signed egress (C). Add the signed-URL fields to webhook, queue, export, Customer API and MCP payloads, keeping the raw fields for a release.
  7. Broker. crm-broker fetches through a service-authenticated internal endpoint, and Flask keeps serving the old path until the broker release is confirmed on every tier. Stop sending the full key as the Salesforce PathOnClient; send the display name.
  8. Contract.
    • Close /static/task_files in Flask and the Caddy configmap.
    • Move ABS_TASK_FILES_FOLDER off the static root: a one-time move on each tenant's EFS volume, or deny the prefix at both layers.
    • Drop the raw references from the egress DTOs a release after step 6.
    • Give task files their own private S3 prefix, separate from logos.
    • Move DocuSign PDFs out of the static root.
  9. Separate issue, not in this PR series. Sweep the other make_unique static writers (key files and feature media, vendor resources, /static/exports) onto the same route or an equivalent one, and give /file/download the step and account checks. Per CLAUDE.md, the inventory goes in an issue, not into a PR description.

Internal documentation — gated behind Cloudflare Access.