attestation-service: enable CORS support in restful-as for browser scenarios#185
Merged
jialez0 merged 1 commit intoJun 9, 2026
Merged
Conversation
Collaborator
|
@jialez0 ,您好,您的请求已接收,请耐心等待结果。 |
Collaborator
|
@jialez0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
Add an optional `--allowed_origin` (`-r`) CLI flag to the restful-as binary. When one or more origins are given, a CORS layer is installed that permits POST/GET/OPTIONS with Content-Type/Authorization headers from those origins; this lets browser-based clients (e.g. Open-WebUI) call the attestation REST API across origins. When the flag is not provided (the default), no origins are allowed and behaviour is unchanged. Adapted from confidential-containers/trustee 52a71bbc8037de998465bb5f0f6f4dfb304aef39. `actix-cors` is added as an optional dependency, gated behind the existing `restful-bin` feature. No existing API, config, or default behaviour changes. Signed-off-by: Jiale Zhang <xinjian.zjl@alibaba-inc.com>
685ef39 to
5c9ad24
Compare
Collaborator
|
@jialez0 ,您好,您的请求已接收,请耐心等待结果。 |
Collaborator
|
@jialez0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
吸收上游 confidential-containers/trustee 的 restful-as CORS 支持,便于浏览器类客户端(如 Open-WebUI)跨域调用 attestation REST API。
52a71bbc(Enable CORS support in trustee for browser scenario)改动内容
attestation-service/src/bin/restful-as.rs:新增可选--allowed_origin(-r)CLI 参数与configure_cors();为App挂上 CORS 层,允许指定 origin 的 POST/GET/OPTIONS + Content-Type/Authorization。attestation-service/Cargo.toml:新增可选依赖actix-cors,gated 在已有的restful-binfeature 下。适配说明(相对上游)
restful-as.rs中更完整的App::new()service 链(本 fork 多delete_policy/get_certificate/get_jwks/get_openid_configuration等 service)。actix-cors固定为=0.7.0:0.7.1 会拉入derive_more 2.x(要求 rustc ≥ 1.81),与本 fork 的 1.76 工具链冲突;0.7.0 使用derive_more 0.99,可正常构建。待 MSRV 提升后再 bump。兼容性
--allowed_origin时不允许任何跨域 origin,行为与现状一致。actix-cors为可选依赖,仅在restful-binfeature 下引入。验证
cargo check -p attestation-service --bin restful-as通过(rustc 1.76)。