Bind task secrets to workspace and name, and stop sending them over plain http
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start with the named keyring and task secret service code, then inspect the key rotation CLI and worker config and task execution paths. Read the existing task secret tests and run them to understand encryption, rotation, and secret delivery. Done means the acceptance criteria pass, including legacy secret compatibility, visible failure for mismatched envelopes, safe warnings for non-loopback HTTP, and the requested documentation and changelog updates.
Written by the indexing model from the issue text.
Description
Problem
A stored task secret should belong to one workspace and one name, and a worker should not receive it over a channel that anyone on the path can read. Three gaps remain.
- The fingerprint key is global. The fingerprint is an HMAC over the value only, with one key derived from the primary key (
server/orcaster_server/task_secrets/keyring.py:113-118,server/orcaster_server/task_secrets/keyring.py:139). Equal values in two workspaces show equal fingerprints. A user who belongs to both can tell that the values match, or test a guess by setting a candidate value in one workspace and comparing. - The ciphertext is not bound to
(workspace_id, name).set_secretencrypts the bare value (server/orcaster_server/task_secrets/service.py:448), andresolve_for_taskdecrypts without checking the workspace or the name (server/orcaster_server/task_secrets/service.py:554). A ciphertext copied to another row by a manual SQL fix or a bad partial restore is delivered to the wrong tasks with no error. - Secrets go over plain http without refusal. The worker accepts any
BASE_URLscheme (client/src/orcaster_worker/config.py:147-151) and nothing checks it before a task with secrets runs. A worker set up with a non-loopbackhttp://URL receives every secret of its tasks in cleartext.
Proposed change
- Fingerprint. Compute the HMAC over
workspace_id || 0x00 || name || 0x00 || value.rotate_allalready recomputes every fingerprint (server/orcaster_server/cli/task_secrets_keys.py:123-157). - Ciphertext. Encrypt a small envelope, for example
{"ws": ..., "name": ..., "v": ...}. Mark the envelope with a version prefix byte that is not valid UTF-8 and that a legacy plaintext cannot produce. Do not use a format column instead: an old server ignores the column and would deliver the envelope text as the secret value, with no error. Never detect the format by trying to parse the plaintext as JSON: a legacy secret whose value is itself a JSON object (even one withws,nameorvkeys) must stay a legacy value. On read, checkwsandname. A mismatch raisesUndecryptableTaskSecrets(server/orcaster_server/task_secrets/service.py:34). Rows written before this change hold the bare value and have no marker, so every reader accepts both forms:resolve_for_task,rotate_alland the ciphertext check inserver/orcaster_server/cli/task_secrets_keys.py:105.rotate_allrewrites legacy rows in the envelope form. - Plain http. On the worker, when
BASE_URLuseshttpand the host is not loopback, log a warning at startup and for each task that carries secrets. In a later release, fail such a task unless an explicit opt-in is set (for exampleORCH_ALLOW_INSECURE_SECRETS=true). Local development URLs such ashttp://host.containers.internal:8000(docs/user-manual.md:531) must keep working, through the opt-in or an allow-list.
Compatibility
- Existing stored secrets keep decrypting: the read path accepts the legacy bare value and the envelope. No task fails with
UndecryptableTaskSecretsafter the upgrade. - Fingerprints of existing rows change only after
rotate_allruns, or when a secret is set again. Legacy rows stay unbound to workspace and name until then. The release note says that fingerprints change once. - Workers with an
https://BASE_URLsee no change. Workers with a non-loopbackhttp://URL only get a warning in the first release. The refusal comes in a later release and the CHANGELOG announces it, with the opt-in. - A downgrade cannot read envelopes: the prefix byte makes the old UTF-8 decode fail, so the old server raises
UndecryptableTaskSecrets(server/orcaster_server/task_secrets/service.py:555) instead of delivering a wrong value. Envelopes are written byrotate_alland also by everyset_secreton the new version, so any secret set or rotated after the upgrade is unreadable after a downgrade. The release note says this and says to keep a database backup before the upgrade.
Acceptance criteria
- Two workspaces that store the same value show different fingerprints (test).
- A ciphertext copied to another workspace or another name is not decrypted, and the delivery fails visibly (test).
- A row written in the legacy bare form still decrypts and is delivered (test).
- A legacy row whose value is a JSON object, including one with
ws,nameandvkeys, still decrypts and is delivered unchanged (test). - With an envelope row, the previous release's read path fails with
UndecryptableTaskSecretsand does not deliver the envelope text (test or documented check). -
rotate_allturns legacy rows into envelopes and recomputes their fingerprints (test). - A worker with a non-loopback
http://BASE_URLlogs a warning that names the risk and never the values (test). Loopback URLs log nothing. - Existing deployments keep working without config changes: stored secrets decrypt and
http://workers still run their tasks in this release. -
client/README.mdanddocs/user-manual.mddocument the opt-in and the planned refusal. - CHANGELOG entry under Unreleased, including the fingerprint change and the planned refusal.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 10
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AInvirion/orcaster
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
enhancement good first issue P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug P2 server
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
bug P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
All issues in AInvirion/orcaster
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
daniel-ospina/tortoise#15308 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
difficulty:easy prio:low type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NatronGitHub/Natron#2405 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Jstar269/nakagawa-recomp#3746 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day