jooby-project / jooby-project/jooby

Should we make SslOptions be more explicit about where it loads certifications?

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

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

主要言語
Java
スター
1.8k
フォーク
202
平均マージ
2日 9時間
マージ済み PR(30日)
6

説明

I'm not sure I like the default fallback behavior here:

https://github.com/jooby-project/jooby/blob/e9b889d593f630182b0c28db50e24c0d65215d35/jooby/src/main/java/io/jooby/SslOptions.java#L245

Instead I recommend something more like:

     static InputStream getResource(
            String path)
            throws FileNotFoundException, IOException {

        URI uri = URI.create(path);

        /*
         * Explicit
         */
        if ("classpath".equals(uri.getScheme())) {
            var classpath = uri.getPath();
            if (classpath == null) {
                throw new FileNotFoundException(path);
            }
            return getClasspathResource(classpath);
        }
        if ("file".equals(uri.getScheme())) {
            return Files.newInputStream(Path.of(uri));

        }
        /*
         * Implicit
         */
        Path filepath = Paths.get(path);
        if (Files.exists(filepath)) {
            // absolute file:
            return Files.newInputStream(filepath);

        }
        // Maybe do not do this
        return getClasspathResource(path);
    }

This is where classpath:/// and file:/// can be explicitly used and then if that is not used we do the original behavior with the eventual goal of not doing the classpath unless it has the classpath uri schema.

The reason is assume I package a certification in the classpath. It works normally. Then someone adds a classpath on the filesystem when I go deploy. It now overrides the classpath one.

Now I admit this is unlikely and if this was not certs I could care less but I think we should not go around sniffing for certs. It also seems more inline with how we no longer use the service loader. That is less implicit behavior.

Otherwise I mostly don't care but just think this is the right thing to do.

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

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

調査の方向性

まず245行目付近の SslOptions.java を読み、証明書パスが現在どのように解決されているかをたどります。issue に記載されている明示的な classpath と file URI のケースを既存のフォールバック動作と比較し、そのうえで想定される互換性ルールを確認し、合意した解決パスのカバレッジを追加します。

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

評価

技術スタック
java
領域
security
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

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

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