source · Rust

Feeds

crates/vak-server/src/feeds.rs
Raw
46.3 KB1,350 lines19 anchorsSnapshot ed4ab258
  1. 1327 }
  2. 1328 }
  3. 1329
  4. 1330 #[test]
  5. 1331 fn feed_scope_permissions_only_tighten() {
  6. 1332 assert!(authorize_feed_scope("workspace", PermissionMode::WorkspaceWrite).is_ok());
  7. 1333 assert!(authorize_feed_scope("workspace", PermissionMode::FullAccess).is_ok());
  8. 1334 assert!(authorize_feed_scope("global", PermissionMode::FullAccess).is_ok());
  9. 1335 assert!(authorize_feed_scope("global", PermissionMode::WorkspaceWrite).is_err());
  10. 1336 assert!(authorize_feed_scope("workspace", PermissionMode::ReadOnly).is_err());
  11. 1337 assert!(authorize_feed_scope("global", PermissionMode::ReadOnly).is_err());
  12. 1338 }
  13. 1339
  14. 1340 #[test]
  15. 1341 fn source_admission_rejects_private_and_malformed_targets() {
  16. 1342 assert!(validate_source_url("https://example.com/feed").is_ok());
  17. 1343 assert!(validate_source_url("not a url").is_err());
  18. 1344 assert!(validate_source_url("file:///tmp/feed").is_err());
  19. 1345 assert!(validate_source_url("http://127.0.0.1/feed").is_err());
  20. 1346 assert!(validate_source_url("http://192.168.1.10/feed").is_err());
  21. 1347 assert!(validate_source_url("http://[::1]/feed").is_err());
  22. 1348 }
  23. 1349}
  24. 1350