jooby-project / jooby-project/jooby
Should we make SslOptions be more explicit about where it loads certifications?
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 1.8k
- 派生
- 202
- 平均合并
- 2 天 9 小时
- 30 天内合并 PR
- 6
描述
I'm not sure I like the default fallback behavior here:
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.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先阅读第 245 行附近的 SslOptions.java,跟踪当前如何解析证书路径。将 issue 中明确的 classpath 和 file URI 情况与现有的 fallback 行为进行比较,然后确认预期的兼容性规则,并为已达成一致的解析路径添加覆盖。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- security
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100