Skip to content

extract::Options::encrypted_links: Verify / VerifyFirst (UnRAR order) / PlaceUnverified (7-Zip x) for encrypted RAR5 links - #320

Merged
xbmc4lyfe merged 5 commits into
mainfrom
encrypted-links-opt-in
Nov 27, 2026
Merged

xbmc4lyfe merged 5 commits into
mainfrom
encrypted-links-opt-in

Conversation

@xbmc4lyfe

@xbmc4lyfe xbmc4lyfe commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Restores 7-Zip's behaviour for encrypted RAR 5.0 link members as an opt-in, for Prybar's 7z compat mode (regressed by #307).

API (for Prybar)

// zipfast::extract
pub struct Options { /* ... */ pub encrypted_links: EncryptedLinks }

#[non_exhaustive]
pub enum EncryptedLinks {
    #[default] Verify,   // #307: refuse unless the password check value verifies, checked once the link will be placed
    VerifyFirst,         // UnRAR 7.30's order: same check, run before the overwrite/skip and hard-link target decisions
    PlaceUnverified,     // 7-Zip 26.06 x/e: don't check the password for a RAR5 redirection
}

// zipfast::rar5::session::RarSessionOptions — for test_selected, which takes no extract::Options
pub encrypted_links: zipfast::extract::EncryptedLinks,

// zipfast::error::RarPasswordEvidence (non_exhaustive) — new variant
Unverified,  // an encrypted RAR5 redirection placed/tested without its password being checked

Prybar: VerifyFirst in unrar mode, PlaceUnverified in 7z mode, Verify elsewhere. For 7z mode set Options { encrypted_links: EncryptedLinks::PlaceUnverified, .. } (and
RarSessionOptions { encrypted_links: EncryptedLinks::PlaceUnverified, .. } if it tests through RarSession).
Existing literals: add encrypted_links: Default::default().

With PlaceUnverified, an encrypted RAR5 symlink / junction / hard link / file copy is placed (or passes a test) with a
wrong password, with no password, and with no usable check value. No key is derived. The member is reported like any
placed link, RarOutcome::Verified, and its checks.password is RarPasswordEvidence::Unverified (even when the password
was right, because it isn't checked). Progressive sessions report MemberOutcome::Verified/Tested, which carries no
password evidence.

All other link-safety checks still apply: targets that escape the destination (refusal_before_place), hard links or copies
of files this run didn't extract, protected paths, replace_placed_links, and overwrite decisions. RAR 4.x symlinks and
members with data still need their password.

VerifyFirst (requested by Prybar for unrar mode)

UnRAR checks an encrypted link's password before anything else. unrar x -o- -pwrong over links that already exist prints
"Incorrect password" and exits 11. A hard link whose target is missing is reported as a wrong password. Under VerifyFirst, a
password that doesn't verify fails the member as WrongPassword / PasswordRequired /
EncryptedIntegrity(UnverifiableLinkPassword) before the overwrite decision and the link-target checks. On a progressive
session, the session stops with that failure. A password that verifies goes on to the usual skip and target decisions.
Nothing is placed either way. Older revisions are still skipped first. RarSession::test_selected already checked the
password first.

Routes covered

  • extract::run, run_with_password, run_rar_with_outcomes and the checked dispatchers. This includes the early
    "no password" refusal, which now lets such a link through to the link code.
  • RarSession::extract_selected and extract_selected_controlled read Options::encrypted_links.
    test_selected (test_link) reads RarSessionOptions::encrypted_links.
  • Progressive sessions read ProgressiveOptions.extract.encrypted_links. There is no unverifiable-link refusal, and the
    data-less link machine runs without the cipher or the empty-data checksum.

7-Zip 26.06 finding (7zz, macOS arm64, on this PR's test archives)

archive x -p<wrong> x (no -p) t -p<wrong>
symlinks + junction with a check value created, exit 0, "Everything is Ok" same "ERROR: Wrong password" per link, exit 2
same, no check value created, exit 0 same exit 0
hard link + file copy hard link created; copy fails with "Unsupported Method", exit 2 (unrelated to the password) same exit 0
escaping symlink ../outside "Dangerous link path was ignored", exit 2 same wrong password, exit 2

So for x/e, 7-Zip reports no error while creating the link. No error signal is needed, and PlaceUnverified reports it
as Verified. RarPasswordEvidence::Unverified is still exposed so a caller can tell an unchecked link apart. 7z t does
check a check value that is present; this option does not mirror that, and passes such links in a test too.

Tests (tests/rar5_link_password.rs)

  • Unchanged default (Verify): the existing RAR5: encrypted link members are placed only when the password verifies (as UnRAR; was created under a wrong -p) #307 tests.
  • place_unverified_places_encrypted_links_on_the_whole_archive_runner
  • place_unverified_places_encrypted_links_on_a_rar_session (extract and test)
  • place_unverified_places_encrypted_links_on_the_controlled_route
  • place_unverified_places_encrypted_links_on_a_progressive_session (extract and test)
  • a_link_placed_unverified_reports_unverified_evidence
  • place_unverified_still_refuses_a_link_that_escapes (every route)
  • place_unverified_places_encrypted_hard_links_and_copies (including a hard link to a missing source, which is still refused)
  • verify_first_reports_a_wrong_password_before_skipping_an_existing_target: case 1, Verify vs VerifyFirst, on the
    runner, RarSession and progressive. Also covers the right password (still skipped) and no check value.
  • verify_first_reports_a_wrong_password_before_a_missing_hard_link_target: case 2, Verify vs VerifyFirst, with a wrong
    password, no password and the right password (still refused on the target).

Each covers a wrong password, no password, and no check value with the right and a wrong password. Revert check: with the
bypass disabled in link::rar5_link_password, the runner's early refusal and the progressive session, all 7 PlaceUnverified tests
fail and the 15 existing tests pass. With the three VerifyFirst branches disabled, both VerifyFirst tests fail.

Clean-room: written from the RAR5 format notes and 7-Zip's observed behaviour only.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LG44gZ63jJDJGeNcamsGrj

…AR5 links without checking the password (7-Zip's x)

#307 made every route place (or pass in a test) an encrypted RAR 5.0 redirection only when its password check
value verifies the password, as UnRAR does. 7-Zip 26.06 `x` places such links under a wrong password, with none,
and with no check value (exit 0, "Everything is Ok"), and Prybar's 7z mode needs that.

New `extract::Options::encrypted_links: EncryptedLinks` (`Verify`, the default and #307's behaviour, or
`PlaceUnverified`), mirrored for RarSession test runs by `RarSessionOptions::encrypted_links`. With
`PlaceUnverified` the password gate is skipped for RAR5 redirections (no key derived) on extract::run*, RarSession
extract_selected / extract_selected_controlled / test_selected, and progressive sessions; the link is reported as
any placed link (RarOutcome::Verified) with the new evidence RarPasswordEvidence::Unverified. Every other link
check (escaping targets, hard-link sources, protected paths, overwrite decisions) still applies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LG44gZ63jJDJGeNcamsGrj
@xbmc4lyfe

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T03:00:19.543124Z 092827a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 0f6f8cbf1e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…cked before the overwrite and target decisions (UnRAR's order)

For Prybar's unrar mode: `unrar x -o- -pwrong` over links that already exist reports "Incorrect password" (exit 11)
where Verify skipped the existing target, and a hard link with a missing target is reported as the wrong password
where Verify reported the target. VerifyFirst fails such a member as WrongPassword / PasswordRequired /
EncryptedIntegrity(UnverifiableLinkPassword) before those decisions on the whole-archive runner, RarSession
extraction (and the controlled route) and progressive sessions; a verified password goes on to them as usual.
Nothing is placed either way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LG44gZ63jJDJGeNcamsGrj
@xbmc4lyfe xbmc4lyfe changed the title extract::Options::encrypted_links: opt-in to place encrypted RAR5 links without password verification (7-Zip x) extract::Options::encrypted_links: Verify / VerifyFirst (UnRAR order) / PlaceUnverified (7-Zip x) for encrypted RAR5 links Nov 27, 2026
@xbmc4lyfe

Copy link
Copy Markdown
Collaborator Author

@codex review

@xbmc4lyfe

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 42c9c62b40

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/progressive/session.rs Resolved
Comment thread src/progressive/session.rs Resolved
…derives the key once; unchecked link checksums are passed over at the final verdict too

- VerifyFirst's early check keeps the evidence, and the link's data-less member machine then runs without its cipher,
  so the KDF isn't run (and charged to KdfSessionBlocks) a second time.
- PlaceUnverified (and VerifyFirst) clear the part's final checks as well as the machine's, so a link carrying a
  keyed CRC32 or a BLAKE2sp hash isn't failed (DeclaredHashUnavailable) at the verdict.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LG44gZ63jJDJGeNcamsGrj
@xbmc4lyfe

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 092827aed3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@xbmc4lyfe

Copy link
Copy Markdown
Collaborator Author

Local CI (rustyget-x86-a) on the exact head 092827a: fmt, clippy (plain and persistent-partials), workspace tests (plain 288s, persistent-partials 364s) and doctests (both) passed. ALL GATES PASSED @ 092827ae (full). Codex reviewed 092827a with no findings; both earlier threads are fixed with tests and resolved. Branch is up to date with origin/main.

@xbmc4lyfe
xbmc4lyfe merged commit 7d9be1e into main Nov 27, 2026
5 of 7 checks passed
@xbmc4lyfe
xbmc4lyfe deleted the encrypted-links-opt-in branch November 27, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant