Password-protected archives can now be scanned, 7z and rar are refused with a clear message, and one broken upload no longer drops a target's other artifacts.
Decision (2026-09-25)
An optional archive password, plus a clear refusal for 7z and rar.
Agent
Unpacking (ingest/archive.rs):
encrypted zip entries are decrypted with the stored password, ZipCrypto and AES alike, within the existing ExtractLimits;
ExtractError tells PasswordRequired and WrongPassword apart from everything else;
ZipCrypto lets about one wrong password in 256 past its header check, so a checksum failure on an encrypted entry also counts as a wrong password;
zip_encryption checks a password against the smallest encrypted entry;
unsupported_format recognises 7z and rar from their leading bytes.
Upload (POST …/artifacts/upload): 7z and rar are refused with 415. An encrypted zip is kept and marked with the fact archive_encrypted.
New endpoint PUT /api/v1/targets/{id}/artifacts/{artifact_id}/archive-password (body {"password": "…"}):
The password is checked against the stored file, then sealed like a git token (auth.method = "archive_password").
The API never returns it, and it is never sent in a URL.
Responses: 204 saved, 422 wrong, 409 not a password-protected zip, 503 when there is no key to seal it with.
Ingest (ingest/mod.rs):
opens the archive with the stored password;
ingest_all now records an IngestFailure per artifact and carries on with the rest.
Classification records each failure as a skipped stage: archive_password_required and archive_password_wrong are their own stage ids, so the dashboard can say what to do; anything else is ingest.
PLC archives: the CODESYS SBOM reads entry names through the raw entry, so a password-protected .projectarchive still lists its libraries (names are never encrypted in a zip). The silent skip is gone.
Dashboard
Wizard:
Every staged archive has an optional "Archiv-Passwort" field.
After an upload that the agent marks as encrypted, the password is checked and saved. A missing or wrong password shows as an upload error for that file, and the first scan does not start.
A 7z/rar upload shows "7z- und RAR-Archive werden nicht unterstützt …".
Target editor: a password-protected archive shows "Passwort fehlt" or "Passwort gesetzt", with a field that checks and saves a new password at once. The editor's own Save never carries credentials.
Scan runs: the two new skipped stages are shown in DE/EN, with the hint where to enter the password.
Checked
cargo fmt --all --check.
clippy with the CI flags for compliance-agent and the dashboard (server, web).
New unit tests: ZipCrypto (a fixture made with zip -P) and AES, each with the right, wrong and missing password; a plain zip needs none; 7z and rar are named; the stored password is used; a 7z upload is refused; one failing artifact doesn't cost the others; the dashboard's password state.
New integration testtests/archive_password.rs against a live Mongo: an encrypted upload is marked, a wrong password gets 422, the right one gets 204 and is never returned, a plain upload gets 409, and a 7z upload gets 415.
Closes #370.
Password-protected archives can now be scanned, 7z and rar are refused with a clear message, and one broken upload no longer drops a target's other artifacts.
## Decision (2026-09-25)
An optional archive password, plus a clear refusal for 7z and rar.
## Agent
- **Unpacking** (`ingest/archive.rs`):
- encrypted zip entries are decrypted with the stored password, ZipCrypto and AES alike, within the existing `ExtractLimits`;
- `ExtractError` tells `PasswordRequired` and `WrongPassword` apart from everything else;
- ZipCrypto lets about one wrong password in 256 past its header check, so a checksum failure on an encrypted entry also counts as a wrong password;
- `zip_encryption` checks a password against the smallest encrypted entry;
- `unsupported_format` recognises 7z and rar from their leading bytes.
- **Upload** (`POST …/artifacts/upload`): 7z and rar are refused with **415**. An encrypted zip is kept and marked with the fact `archive_encrypted`.
- **New endpoint `PUT /api/v1/targets/{id}/artifacts/{artifact_id}/archive-password`** (body `{"password": "…"}`):
- The password is checked against the stored file, then sealed like a git token (`auth.method = "archive_password"`).
- The API never returns it, and it is never sent in a URL.
- Responses: 204 saved, 422 wrong, 409 not a password-protected zip, 503 when there is no key to seal it with.
- **Ingest** (`ingest/mod.rs`):
- opens the archive with the stored password;
- `ingest_all` now records an `IngestFailure` per artifact and carries on with the rest.
- Classification records each failure as a skipped stage: `archive_password_required` and `archive_password_wrong` are their own stage ids, so the dashboard can say what to do; anything else is `ingest`.
- **PLC archives:** the CODESYS SBOM reads entry names through the raw entry, so a password-protected `.projectarchive` still lists its libraries (names are never encrypted in a zip). The silent skip is gone.
## Dashboard
- **Wizard:**
- Every staged archive has an optional "Archiv-Passwort" field.
- After an upload that the agent marks as encrypted, the password is checked and saved. A missing or wrong password shows as an upload error for that file, and the first scan does not start.
- A 7z/rar upload shows "7z- und RAR-Archive werden nicht unterstützt …".
- **Target editor:** a password-protected archive shows "Passwort fehlt" or "Passwort gesetzt", with a field that checks and saves a new password at once. The editor's own Save never carries credentials.
- **Scan runs:** the two new skipped stages are shown in DE/EN, with the hint where to enter the password.
## Checked
- `cargo fmt --all --check`.
- clippy with the CI flags for compliance-agent and the dashboard (`server`, `web`).
- Tests: agent library 433, core 99, dashboard 48 / 32.
- **New unit tests:** ZipCrypto (a fixture made with `zip -P`) and AES, each with the right, wrong and missing password; a plain zip needs none; 7z and rar are named; the stored password is used; a 7z upload is refused; one failing artifact doesn't cost the others; the dashboard's password state.
- **New integration test** `tests/archive_password.rs` against a live Mongo: an encrypted upload is marked, a wrong password gets 422, the right one gets 204 and is never returned, a plain upload gets 409, and a 7z upload gets 415.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
Encrypted zips (ZipCrypto and AES) are decrypted with a password set on
the artifact: the upload marks them, a new endpoint checks the password
against the file and stores it sealed, and the wizard and target editor
ask for it. A missing or wrong password is its own skipped stage. 7z
and rar uploads are refused with 415, one failing artifact no longer
drops the target's others, and a locked CODESYS archive still lists
its libraries.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang
merged commit 80eb7f462c into main2026-09-25 09:59:17 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #370.
Password-protected archives can now be scanned, 7z and rar are refused with a clear message, and one broken upload no longer drops a target's other artifacts.
Decision (2026-09-25)
An optional archive password, plus a clear refusal for 7z and rar.
Agent
ingest/archive.rs):ExtractLimits;ExtractErrortellsPasswordRequiredandWrongPasswordapart from everything else;zip_encryptionchecks a password against the smallest encrypted entry;unsupported_formatrecognises 7z and rar from their leading bytes.POST …/artifacts/upload): 7z and rar are refused with 415. An encrypted zip is kept and marked with the factarchive_encrypted.PUT /api/v1/targets/{id}/artifacts/{artifact_id}/archive-password(body{"password": "…"}):auth.method = "archive_password").ingest/mod.rs):ingest_allnow records anIngestFailureper artifact and carries on with the rest.archive_password_requiredandarchive_password_wrongare their own stage ids, so the dashboard can say what to do; anything else isingest..projectarchivestill lists its libraries (names are never encrypted in a zip). The silent skip is gone.Dashboard
Checked
cargo fmt --all --check.server,web).zip -P) and AES, each with the right, wrong and missing password; a plain zip needs none; 7z and rar are named; the stored password is used; a 7z upload is refused; one failing artifact doesn't cost the others; the dashboard's password state.tests/archive_password.rsagainst a live Mongo: an encrypted upload is marked, a wrong password gets 422, the right one gets 204 and is never returned, a plain upload gets 409, and a 7z upload gets 415.🤖 Generated with Claude Code
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p