(&self, cert: Option<CertInfo>)
| 757 | |
| 758 | impl 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 | |
| 781 | struct AppInfo { |
no test coverage detected