MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / validate

Method validate

dstack-util/src/system_setup.rs:759–778  ·  view source on GitHub ↗
(&self, cert: Option<CertInfo>)

Source from the content-addressed store, hash-verified

757
758impl AppIdValidator {
759 fn validate(&self, cert: Option<CertInfo>) -> Result<()> {
760 if self.allowed_app_id == "any" {
761 return Ok(());
762 }
763 let Some(cert) = cert else {
764 bail!("Missing TLS certificate info");
765 };
766 let Some(app_id) = cert.app_id else {
767 bail!("Missing app id");
768 };
769 let app_id = hex::encode(app_id);
770 if !self
771 .allowed_app_id
772 .to_lowercase()
773 .contains(&app_id.to_lowercase())
774 {
775 bail!("Invalid dstack-gateway app id: {app_id}");
776 }
777 Ok(())
778 }
779}
780
781struct AppInfo {

Callers 1

create_gateway_clientMethod · 0.45

Calls 2

encodeFunction · 0.85
containsMethod · 0.80

Tested by

no test coverage detected