Skip to content

feat(as/policy): add query_artifact_server with AS-level artifact server config - #220

Merged
jialez0 merged 1 commit into
openanolis:mainfrom
Xynnn007:feat-artifact-server
Aug 20, 2026
Merged

feat(as/policy): add query_artifact_server with AS-level artifact server config#220
jialez0 merged 1 commit into
openanolis:mainfrom
Xynnn007:feat-artifact-server

Conversation

@Xynnn007

Copy link
Copy Markdown
Collaborator

Summary

  • Add query_artifact_server policy builtin (feature policy-artifact-server)
  • Configure Artifact Server URL once on AS Config (artifact_server_address)

@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,您的请求已接收,请耐心等待结果。

@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

@Xynnn007
Xynnn007 force-pushed the feat-artifact-server branch from 4f647d3 to 9536350 Compare August 19, 2026 02:39
@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,您的请求已接收,请耐心等待结果。

@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

@jialez0 jialez0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

few comments..

Comment thread Cargo.lock
Comment thread Cargo.lock Outdated
Comment thread Cargo.lock Outdated
};

let mut query_extensions = vec![];
#[cfg(feature = "policy-rvps")]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

原本这里往下的动态策略查询功能,都是被policy-rvps控制开关的,这个主要是赖堃那边需要通过关闭fs feature把这个功能关掉(FYI @imlk0 )来集成进TNG,现在tokio::task::spawn_blocking语句块从policy-rvps控制域里提出来了,这样即使关闭policy-rvps也会要求运行在tokio runtime里,建议还是都放到policy-rvps控制域里,另外也可以考虑把policy-artifact-server也放到fs feature里,能让TNG一并关掉。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@imlk0 麻烦评估下TNG是否考虑集成这个PR的参考值服务接入功能,如果需要接入,那就不放到fs feature里了

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

核心还是tokio::task::spawn_blocking做成和policy-artifact-server垂直的吧?我提出来了

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Xynnn007 这里的关键问题是rego的extension特性强依赖于tokio::task::spawn_blocking,但是tokio::task::spawn_blocking在wasm32 browser是不可用的(需要依赖web worker特性,限制比较大),我建议当前pr先改成:

  • #[cfg(any(feature = "policy-rvps", feature = "policy-artifact-server")] 才在tokio::task::spawn_blocking里运行evaluate_sync()
  • #[cfg(not(any(feature = "policy-rvps", feature = "policy-artifact-server"))] 直接运行evaluate_sync()

@imlk0 imlk0 Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

未来我们可能需要切换到RegoVM的方案 microsoft/regorus#730 。上游CoCo社区的曾经也讨论过这个问题 microsoft/regorus#363

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

未来我们可能需要切换到RegoVM的方案 microsoft/regorus#730 。上游CoCo社区的曾经也讨论过这个问题 microsoft/regorus#363

update:#225

.collect::<Vec<Measurement>>();
let resolve_request =
artifact_resolve_sdk::ResolveRequest::new(ReleaseManifest::new(measurements));
let res = client.resolve(&resolve_request).is_ok();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这里 is_ok() 会直接把“度量值不存在/已撤销”和“超时、网络错误、5xx、响应解析失败”等等全部转换成 false,是否应该把完整查询情况也一并抛出或返回给策略?

另外这个判定方法,只要服务端返回一个200,就会判定为true,是否有需要进一步解析返回值内容?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

度量值撤销、不存在都算false,单独把网络访问、超时等这种 非解析错误按错误报出来

Comment thread attestation-service/src/policy_engine/opa/mod.rs Outdated
Comment thread attestation-service/src/config.rs
Comment thread attestation-service/src/policy_engine/opa/mod.rs Outdated
@Xynnn007
Xynnn007 force-pushed the feat-artifact-server branch from 9536350 to 9fcd7a0 Compare August 19, 2026 03:36
@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,您的请求已接收,请耐心等待结果。

@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

@Xynnn007
Xynnn007 requested a review from jialez0 August 19, 2026 03:41
@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,您的请求已接收,请耐心等待结果。

@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

@Xynnn007
Xynnn007 force-pushed the feat-artifact-server branch from 9fcd7a0 to 5fbc411 Compare August 19, 2026 03:51
@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,您的请求已接收,请耐心等待结果。

@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

@Xynnn007
Xynnn007 force-pushed the feat-artifact-server branch from 5fbc411 to 6b43998 Compare August 19, 2026 04:07
@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,您的请求已接收,请耐心等待结果。

@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

@Xynnn007
Xynnn007 force-pushed the feat-artifact-server branch from 6b43998 to 2ef3e48 Compare August 19, 2026 04:28
@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,您的请求已接收,请耐心等待结果。

@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

@Xynnn007

Copy link
Copy Markdown
Collaborator Author

@jialez0 @imlk0 fixed all the errors. PTAL

Comment thread attestation-service/src/policy_engine/opa/mod.rs Outdated
Comment thread attestation-service/src/policy_engine/opa/mod.rs Outdated
Comment thread attestation-service/src/policy_engine/opa/in_memory.rs
…ver config

Policies can resolve evidence measurements against Artifact Server. The
URL is set once on AS Config (default https://attest-pre.aliyuncs.com)
and passed into the policy engine.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@Xynnn007
Xynnn007 force-pushed the feat-artifact-server branch from 2ef3e48 to 30ac7b6 Compare August 19, 2026 07:30
@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,您的请求已接收,请耐心等待结果。

@ostest-bot

Copy link
Copy Markdown

@Xynnn007 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

@Xynnn007

Copy link
Copy Markdown
Collaborator Author

@jialez0 The CI passes. PTAL

@jialez0 jialez0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Tks

@jialez0
jialez0 merged commit 72973d4 into openanolis:main Aug 20, 2026
11 checks passed
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.

4 participants