v0.3.7-pre.008-fix.003
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-backfill-desk/tests/desktop_security.rs
|
||||
// version: 8
|
||||
// version: 9
|
||||
|
||||
//! Security and dependency-boundary checks for the Backfill Desk scaffold.
|
||||
|
||||
@@ -11,6 +11,19 @@ fn app_root() -> std::path::PathBuf {
|
||||
return std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
}
|
||||
|
||||
fn struct_source<'a>(source: &'a str, marker: &str) -> &'a str {
|
||||
let start = match source.find(marker) {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => return "",
|
||||
};
|
||||
let tail = &source[start..];
|
||||
let end = match tail.find("\n}") {
|
||||
std::option::Option::Some(value) => value + 2,
|
||||
std::option::Option::None => return "",
|
||||
};
|
||||
return &tail[..end];
|
||||
}
|
||||
|
||||
fn collect_files(directory: &std::path::Path, extension: &str, files: &mut std::vec::Vec<std::path::PathBuf>) {
|
||||
let entries = std::fs::read_dir(directory);
|
||||
let entries = match entries {
|
||||
@@ -166,14 +179,8 @@ fn pre_006_frontend_receives_only_safe_http_route_metadata_and_no_endpoint_mater
|
||||
fn pre_007_request_mapping_keeps_network_endpoint_and_payload_secrets_backend_owned() {
|
||||
let root = app_root();
|
||||
let dto = read_text(root.join("src/dto_backfill.rs").as_path());
|
||||
let request_start = dto.find("pub(crate) struct BackfillStartRequestDto");
|
||||
let preview_start = dto.find("pub(crate) struct BackfillRequestPreviewDto");
|
||||
assert!(request_start.is_some());
|
||||
assert!(preview_start.is_some());
|
||||
let request_source = match (request_start, preview_start) {
|
||||
(std::option::Option::Some(start), std::option::Option::Some(end)) if start < end => &dto[start..end],
|
||||
_ => "",
|
||||
};
|
||||
let request_source = struct_source(dto.as_str(), "pub(crate) struct BackfillStartRequestDto");
|
||||
assert!(!request_source.is_empty());
|
||||
for forbidden in [
|
||||
"pub(crate) network:",
|
||||
"pub(crate) provider",
|
||||
@@ -209,14 +216,8 @@ fn pre_007_request_mapping_keeps_network_endpoint_and_payload_secrets_backend_ow
|
||||
fn pre_008_start_surface_keeps_payload_and_physical_resources_backend_owned() {
|
||||
let root = app_root();
|
||||
let dto = read_text(root.join("src/dto_backfill.rs").as_path());
|
||||
let response_start = dto.find("pub(crate) struct BackfillStartResponseDto");
|
||||
let preview_start = dto.find("pub(crate) struct BackfillRequestPreviewDto");
|
||||
assert!(response_start.is_some());
|
||||
assert!(preview_start.is_some());
|
||||
let response_source = match (response_start, preview_start) {
|
||||
(std::option::Option::Some(start), std::option::Option::Some(end)) if start < end => &dto[start..end],
|
||||
_ => "",
|
||||
};
|
||||
let response_source = struct_source(dto.as_str(), "pub(crate) struct BackfillStartResponseDto");
|
||||
assert!(!response_source.is_empty());
|
||||
assert!(response_source.contains("pub(crate) job_id: String"));
|
||||
assert!(response_source.contains("pub(crate) state: String"));
|
||||
for forbidden in ["address", "signature", "provider", "endpoint", "url", "credential", "token", "network"] {
|
||||
|
||||
Reference in New Issue
Block a user