Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Password zip is inconsisent

オープン
#873 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
csharp, postgresql

調査の方向性

提供されている CreateBackup メソッド、特に ZipOutputStream.Password と AESKeySize から始め、7zip を使って 98 文字と 99 文字のパスワードでの挙動を再現します。生成されたアーカイブの挙動を比較し、長いパスワードが機能すべきかどうかを判断します。挙動を再現でき、結果が修正されるか明確に文書化されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

*no response* bug
Describe the bug

Only passwords with length up to 98 seem to work, if i use 99 and i even copy/paste the password directly unzipping the archive using 7zip does not work. how come?

Seems a bit random and not sure if it would be safe for db backups in this case.

private static async Task CreateBackup(string zipFile, string pgDumpArgs)
{
    ProcessStartInfo processInfo = new()
    {
        FileName = @"C:\Program Files\PostgreSQL\16\bin\pg_dump.exe",
        Arguments = pgDumpArgs,
        RedirectStandardOutput = true,
        RedirectStandardError = true, // Capture error output
        UseShellExecute = false,
        CreateNoWindow = true
    };

    using Process process = Process.Start(processInfo);
    if (process == null)
    {
        Console.WriteLine("Failed to start pg_dump process.");
        return;
    }

    using (FileStream fsOut = File.Create(zipFile))
    using (ZipOutputStream zipStream = new(fsOut))
    {
        zipStream.SetLevel(3); // 0-9, 9 being the highest level of compression
        zipStream.Password = "z4KpjH+}H9H*g3K3Jb-9}M^jnMN^-!Zs+8UZ3sfxWg5T~@ZHJ:Eoz!AFNMwdf!g_2QpX#)}4WKwHLL%C?s1BB*wx%:cia0j=m7.W";
        zipStream.UseZip64 = UseZip64.On; // Set to AsNeeded if you need Zip64

        ZipEntry newEntry = new ZipEntry($"backup_{DateTime.Now:yyyyMMdd_HHmmss}.backup")
        {
            DateTime = DateTime.Now,
            AESKeySize = 256 // AES-256 encryption
        };

        zipStream.PutNextEntry(newEntry);

        var outputTask = process.StandardOutput.BaseStream.CopyToAsync(zipStream);
        var errorTask = process.StandardError.ReadToEndAsync();

        await Task.WhenAll(outputTask, errorTask);
        zipStream.CloseEntry();

        string errorOutput = await errorTask;

        if (!string.IsNullOrEmpty(errorOutput))
        {
            Console.WriteLine($"pg_dump reported the following errors:\n{errorOutput}");
        }
    }

    await process.WaitForExitAsync();

    if (process.ExitCode != 0)
    {
        Console.WriteLine($"pg_dump failed with exit code {process.ExitCode}");
    }
    else
    {
        Console.WriteLine($"{zipFile} Database backup successfully completed.");
    }
}
Reproduction Code

No response

Steps to reproduce

zip zip

Expected behavior

work

Operating System

Windows

Framework Version

Other

Tags

No response

Additional context

No response

主要言語
C#
スター
3.9k
フォーク
1k
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

icsharpcode/SharpZipLib のほかの issue

icsharpcode/SharpZipLib の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。