Skip to content

Commit 4002237

Browse files
authored
Merge pull request #5 from A3S-Lab/codex/runtime-registry-secret-20260720
feat(contract): type registry credential Secrets
2 parents 866bd1a + cfaac63 commit 4002237

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

docs/deep-test-plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ schema review; snapshot acceptance is never automatic.
198198
| --- | --- |
199199
| `SPEC-PROCESS-*` | Entrypoint fallback, command/argument counts and sizes, working directory, environment names/values, and deterministic map order |
200200
| `SPEC-MOUNT-*` | Artifact, volume, and tmpfs sources; read-only behavior; zero/overflow size; duplicate names and targets; cross-kind collisions |
201-
| `SPEC-SECRET-*` | Opaque references, environment/file targets, file modes, duplicate names/targets, collision with process environment and mounts, and non-disclosure |
201+
| `SPEC-SECRET-*` | Opaque references, environment/file/registry-credential targets, file modes, duplicate names/targets, collision with process environment and mounts, and non-disclosure |
202202
| `SPEC-NET-*` | None/outbound/service modes, TCP/UDP, zero port, duplicate name/socket, 64-port boundary, and service-only publication |
203203
| `SPEC-HEALTH-*` | HTTP/TCP/command probes, named-port binding, status ranges, path validation, timing relationships, start period, and thresholds |
204204
| `SPEC-RESOURCE-*` | CPU, memory, PIDs, optional ephemeral storage, Task timeout, zero values, numeric maxima, and provider conversion overflow |

src/contract/process.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pub(crate) fn validate_environment_name(value: &str) -> Result<(), String> {
6161
pub enum SecretTarget {
6262
Environment { variable: String },
6363
File { path: String, mode: u32 },
64+
RegistryCredential,
6465
}
6566

6667
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
@@ -86,6 +87,7 @@ impl SecretReference {
8687
}
8788
Ok(())
8889
}
90+
SecretTarget::RegistryCredential => Ok(()),
8991
}
9092
}
9193
}

src/contract/unit.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,4 +427,26 @@ mod tests {
427427
};
428428
assert!(service.validate().is_err());
429429
}
430+
431+
#[test]
432+
fn registry_credential_is_a_typed_unique_secret_target() {
433+
let mut service = service();
434+
service.secrets.push(SecretReference {
435+
name: "registry".into(),
436+
reference: "secret://registry/7".into(),
437+
target: super::super::SecretTarget::RegistryCredential,
438+
});
439+
service.validate().expect("registry credential");
440+
assert_eq!(
441+
serde_json::to_value(&service.secrets[0].target).expect("target JSON"),
442+
serde_json::json!({"kind": "registry_credential"})
443+
);
444+
445+
service.secrets.push(SecretReference {
446+
name: "other-registry".into(),
447+
reference: "secret://registry/8".into(),
448+
target: super::super::SecretTarget::RegistryCredential,
449+
});
450+
assert!(service.validate().is_err());
451+
}
430452
}

0 commit comments

Comments
 (0)