diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-23 13:55:34 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-23 13:55:34 +0000 |
| commit | 2ce9b2831e3af536f31491344abdf4b897f67a69 (patch) | |
| tree | 7836686c56ed087ac3be533e1e529de668fac406 /grasp-audit/src | |
| parent | a996defa7efd75dd9f1bbe921b6f49ac697672a0 (diff) | |
audit: updated grasp01 line refs to reflect purgatory insertion
Diffstat (limited to 'grasp-audit/src')
| -rw-r--r-- | grasp-audit/src/result.rs | 6 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/cors.rs | 8 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/git_clone.rs | 40 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/nip11_document.rs | 8 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/push_authorization.rs | 168 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/repository_creation.rs | 28 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/spec_requirements.rs | 28 |
7 files changed, 143 insertions, 143 deletions
diff --git a/grasp-audit/src/result.rs b/grasp-audit/src/result.rs index f296633..4e0e1b1 100644 --- a/grasp-audit/src/result.rs +++ b/grasp-audit/src/result.rs | |||
| @@ -327,15 +327,15 @@ mod tests { | |||
| 327 | #[test] | 327 | #[test] |
| 328 | fn test_parse_spec_lines_single() { | 328 | fn test_parse_spec_lines_single() { |
| 329 | assert_eq!(parse_spec_lines("GRASP-01:nostr-relay:7"), vec![7]); | 329 | assert_eq!(parse_spec_lines("GRASP-01:nostr-relay:7"), vec![7]); |
| 330 | assert_eq!(parse_spec_lines("GRASP-01:git-http:28"), vec![28]); | 330 | assert_eq!(parse_spec_lines("GRASP-01:git-http:34"), vec![34]); |
| 331 | } | 331 | } |
| 332 | 332 | ||
| 333 | #[test] | 333 | #[test] |
| 334 | fn test_parse_spec_lines_range() { | 334 | fn test_parse_spec_lines_range() { |
| 335 | assert_eq!(parse_spec_lines("GRASP-01:nostr-relay:7-9"), vec![7, 8, 9]); | 335 | assert_eq!(parse_spec_lines("GRASP-01:nostr-relay:7-9"), vec![7, 8, 9]); |
| 336 | assert_eq!( | 336 | assert_eq!( |
| 337 | parse_spec_lines("GRASP-01:cors:44-47"), | 337 | parse_spec_lines("GRASP-01:cors:50-53"), |
| 338 | vec![44, 45, 46, 47] | 338 | vec![50, 51, 52, 53] |
| 339 | ); | 339 | ); |
| 340 | } | 340 | } |
| 341 | 341 | ||
diff --git a/grasp-audit/src/specs/grasp01/cors.rs b/grasp-audit/src/specs/grasp01/cors.rs index 409f2d3..f8b5f3b 100644 --- a/grasp-audit/src/specs/grasp01/cors.rs +++ b/grasp-audit/src/specs/grasp01/cors.rs | |||
| @@ -44,7 +44,7 @@ impl CorsTests { | |||
| 44 | pub async fn test_cors_allow_origin(_client: &AuditClient, relay_domain: &str) -> TestResult { | 44 | pub async fn test_cors_allow_origin(_client: &AuditClient, relay_domain: &str) -> TestResult { |
| 45 | TestResult::new( | 45 | TestResult::new( |
| 46 | "cors_allow_origin", | 46 | "cors_allow_origin", |
| 47 | "GRASP-01:git-http:cors:44", | 47 | "GRASP-01:git-http:cors:50", |
| 48 | "Access-Control-Allow-Origin: * on all responses", | 48 | "Access-Control-Allow-Origin: * on all responses", |
| 49 | ) | 49 | ) |
| 50 | .run(|| { | 50 | .run(|| { |
| @@ -90,7 +90,7 @@ impl CorsTests { | |||
| 90 | pub async fn test_cors_allow_methods(_client: &AuditClient, relay_domain: &str) -> TestResult { | 90 | pub async fn test_cors_allow_methods(_client: &AuditClient, relay_domain: &str) -> TestResult { |
| 91 | TestResult::new( | 91 | TestResult::new( |
| 92 | "cors_allow_methods", | 92 | "cors_allow_methods", |
| 93 | "GRASP-01:git-http:cors:45", | 93 | "GRASP-01:git-http:cors:51", |
| 94 | "Access-Control-Allow-Methods: GET, POST on all responses", | 94 | "Access-Control-Allow-Methods: GET, POST on all responses", |
| 95 | ) | 95 | ) |
| 96 | .run(|| { | 96 | .run(|| { |
| @@ -134,7 +134,7 @@ impl CorsTests { | |||
| 134 | pub async fn test_cors_allow_headers(_client: &AuditClient, relay_domain: &str) -> TestResult { | 134 | pub async fn test_cors_allow_headers(_client: &AuditClient, relay_domain: &str) -> TestResult { |
| 135 | TestResult::new( | 135 | TestResult::new( |
| 136 | "cors_allow_headers", | 136 | "cors_allow_headers", |
| 137 | "GRASP-01:git-http:cors:46", | 137 | "GRASP-01:git-http:cors:52", |
| 138 | "Access-Control-Allow-Headers: Content-Type on all responses", | 138 | "Access-Control-Allow-Headers: Content-Type on all responses", |
| 139 | ) | 139 | ) |
| 140 | .run(|| { | 140 | .run(|| { |
| @@ -181,7 +181,7 @@ impl CorsTests { | |||
| 181 | ) -> TestResult { | 181 | ) -> TestResult { |
| 182 | TestResult::new( | 182 | TestResult::new( |
| 183 | "cors_options_preflight", | 183 | "cors_options_preflight", |
| 184 | "GRASP-01:git-http:cors:47", | 184 | "GRASP-01:git-http:cors:53", |
| 185 | "OPTIONS requests return 204 No Content", | 185 | "OPTIONS requests return 204 No Content", |
| 186 | ) | 186 | ) |
| 187 | .run(|| { | 187 | .run(|| { |
diff --git a/grasp-audit/src/specs/grasp01/git_clone.rs b/grasp-audit/src/specs/grasp01/git_clone.rs index 3d81964..e162558 100644 --- a/grasp-audit/src/specs/grasp01/git_clone.rs +++ b/grasp-audit/src/specs/grasp01/git_clone.rs | |||
| @@ -53,7 +53,7 @@ impl GitCloneTests { | |||
| 53 | Err(e) => { | 53 | Err(e) => { |
| 54 | return TestResult::new( | 54 | return TestResult::new( |
| 55 | test_name, | 55 | test_name, |
| 56 | "GRASP-01:git-http:28", | 56 | "GRASP-01:git-http:34", |
| 57 | "Repository must be cloneable via Git HTTP backend", | 57 | "Repository must be cloneable via Git HTTP backend", |
| 58 | ) | 58 | ) |
| 59 | .fail(format!("Failed to create repo fixture: {}", e)) | 59 | .fail(format!("Failed to create repo fixture: {}", e)) |
| @@ -86,7 +86,7 @@ impl GitCloneTests { | |||
| 86 | Err(e) => { | 86 | Err(e) => { |
| 87 | return TestResult::new( | 87 | return TestResult::new( |
| 88 | test_name, | 88 | test_name, |
| 89 | "GRASP-01:git-http:28", | 89 | "GRASP-01:git-http:34", |
| 90 | "Repository must be cloneable via Git HTTP backend", | 90 | "Repository must be cloneable via Git HTTP backend", |
| 91 | ) | 91 | ) |
| 92 | .fail(format!("Failed to convert pubkey to npub: {}", e)) | 92 | .fail(format!("Failed to convert pubkey to npub: {}", e)) |
| @@ -121,7 +121,7 @@ impl GitCloneTests { | |||
| 121 | cleanup(); | 121 | cleanup(); |
| 122 | return TestResult::new( | 122 | return TestResult::new( |
| 123 | test_name, | 123 | test_name, |
| 124 | "GRASP-01:git-http:28", | 124 | "GRASP-01:git-http:34", |
| 125 | "Repository must be cloneable via Git HTTP backend", | 125 | "Repository must be cloneable via Git HTTP backend", |
| 126 | ) | 126 | ) |
| 127 | .fail(format!("Failed to execute git clone: {}", e)); | 127 | .fail(format!("Failed to execute git clone: {}", e)); |
| @@ -133,7 +133,7 @@ impl GitCloneTests { | |||
| 133 | let stderr = String::from_utf8_lossy(&output.stderr); | 133 | let stderr = String::from_utf8_lossy(&output.stderr); |
| 134 | return TestResult::new( | 134 | return TestResult::new( |
| 135 | test_name, | 135 | test_name, |
| 136 | "GRASP-01:git-http:28", | 136 | "GRASP-01:git-http:34", |
| 137 | "Repository must be cloneable via Git HTTP backend", | 137 | "Repository must be cloneable via Git HTTP backend", |
| 138 | ) | 138 | ) |
| 139 | .fail(format!("Git clone failed: {}", stderr)); | 139 | .fail(format!("Git clone failed: {}", stderr)); |
| @@ -144,7 +144,7 @@ impl GitCloneTests { | |||
| 144 | cleanup(); | 144 | cleanup(); |
| 145 | return TestResult::new( | 145 | return TestResult::new( |
| 146 | test_name, | 146 | test_name, |
| 147 | "GRASP-01:git-http:28", | 147 | "GRASP-01:git-http:34", |
| 148 | "Repository must be cloneable via Git HTTP backend", | 148 | "Repository must be cloneable via Git HTTP backend", |
| 149 | ) | 149 | ) |
| 150 | .fail("Cloned repository missing .git directory"); | 150 | .fail("Cloned repository missing .git directory"); |
| @@ -153,7 +153,7 @@ impl GitCloneTests { | |||
| 153 | cleanup(); | 153 | cleanup(); |
| 154 | TestResult::new( | 154 | TestResult::new( |
| 155 | test_name, | 155 | test_name, |
| 156 | "GRASP-01:git-http:28", | 156 | "GRASP-01:git-http:34", |
| 157 | "Repository must be cloneable via Git HTTP backend", | 157 | "Repository must be cloneable via Git HTTP backend", |
| 158 | ) | 158 | ) |
| 159 | .pass() | 159 | .pass() |
| @@ -175,7 +175,7 @@ impl GitCloneTests { | |||
| 175 | Err(e) => { | 175 | Err(e) => { |
| 176 | return TestResult::new( | 176 | return TestResult::new( |
| 177 | test_name, | 177 | test_name, |
| 178 | "GRASP-01:git-http:28", | 178 | "GRASP-01:git-http:34", |
| 179 | "Clone URL must follow correct format", | 179 | "Clone URL must follow correct format", |
| 180 | ) | 180 | ) |
| 181 | .fail(format!("Failed to create repo fixture: {}", e)) | 181 | .fail(format!("Failed to create repo fixture: {}", e)) |
| @@ -203,7 +203,7 @@ impl GitCloneTests { | |||
| 203 | if !valid_url.contains(&npub) { | 203 | if !valid_url.contains(&npub) { |
| 204 | return TestResult::new( | 204 | return TestResult::new( |
| 205 | test_name, | 205 | test_name, |
| 206 | "GRASP-01:git-http:28", | 206 | "GRASP-01:git-http:34", |
| 207 | "Clone URL must follow correct format", | 207 | "Clone URL must follow correct format", |
| 208 | ) | 208 | ) |
| 209 | .fail("URL missing npub"); | 209 | .fail("URL missing npub"); |
| @@ -212,7 +212,7 @@ impl GitCloneTests { | |||
| 212 | if !valid_url.contains(&format!("{}.git", repo_id)) { | 212 | if !valid_url.contains(&format!("{}.git", repo_id)) { |
| 213 | return TestResult::new( | 213 | return TestResult::new( |
| 214 | test_name, | 214 | test_name, |
| 215 | "GRASP-01:git-http:28", | 215 | "GRASP-01:git-http:34", |
| 216 | "Clone URL must follow correct format", | 216 | "Clone URL must follow correct format", |
| 217 | ) | 217 | ) |
| 218 | .fail("URL missing repository identifier"); | 218 | .fail("URL missing repository identifier"); |
| @@ -241,7 +241,7 @@ impl GitCloneTests { | |||
| 241 | if output.status.success() { | 241 | if output.status.success() { |
| 242 | return TestResult::new( | 242 | return TestResult::new( |
| 243 | test_name, | 243 | test_name, |
| 244 | "GRASP-01:git-http:28", | 244 | "GRASP-01:git-http:34", |
| 245 | "Clone URL must follow correct format", | 245 | "Clone URL must follow correct format", |
| 246 | ) | 246 | ) |
| 247 | .fail("Invalid URL was accepted (should have been rejected)"); | 247 | .fail("Invalid URL was accepted (should have been rejected)"); |
| @@ -249,7 +249,7 @@ impl GitCloneTests { | |||
| 249 | 249 | ||
| 250 | TestResult::new( | 250 | TestResult::new( |
| 251 | test_name, | 251 | test_name, |
| 252 | "GRASP-01:git-http:28", | 252 | "GRASP-01:git-http:34", |
| 253 | "Clone URL must follow correct format", | 253 | "Clone URL must follow correct format", |
| 254 | ) | 254 | ) |
| 255 | .pass() | 255 | .pass() |
| @@ -278,7 +278,7 @@ impl GitCloneTests { | |||
| 278 | Err(e) => { | 278 | Err(e) => { |
| 279 | return TestResult::new( | 279 | return TestResult::new( |
| 280 | test_name, | 280 | test_name, |
| 281 | "GRASP-01:git-http:36", | 281 | "GRASP-01:git-http:42", |
| 282 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 282 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 283 | ) | 283 | ) |
| 284 | .fail(format!("Failed to create repo fixture: {}", e)) | 284 | .fail(format!("Failed to create repo fixture: {}", e)) |
| @@ -299,7 +299,7 @@ impl GitCloneTests { | |||
| 299 | None => { | 299 | None => { |
| 300 | return TestResult::new( | 300 | return TestResult::new( |
| 301 | test_name, | 301 | test_name, |
| 302 | "GRASP-01:git-http:36", | 302 | "GRASP-01:git-http:42", |
| 303 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 303 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 304 | ) | 304 | ) |
| 305 | .fail("Repository announcement missing d tag") | 305 | .fail("Repository announcement missing d tag") |
| @@ -311,7 +311,7 @@ impl GitCloneTests { | |||
| 311 | Err(e) => { | 311 | Err(e) => { |
| 312 | return TestResult::new( | 312 | return TestResult::new( |
| 313 | test_name, | 313 | test_name, |
| 314 | "GRASP-01:git-http:36", | 314 | "GRASP-01:git-http:42", |
| 315 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 315 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 316 | ) | 316 | ) |
| 317 | .fail(format!("Failed to convert pubkey to npub: {}", e)) | 317 | .fail(format!("Failed to convert pubkey to npub: {}", e)) |
| @@ -331,7 +331,7 @@ impl GitCloneTests { | |||
| 331 | Err(e) => { | 331 | Err(e) => { |
| 332 | return TestResult::new( | 332 | return TestResult::new( |
| 333 | test_name, | 333 | test_name, |
| 334 | "GRASP-01:git-http:36", | 334 | "GRASP-01:git-http:42", |
| 335 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 335 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 336 | ) | 336 | ) |
| 337 | .fail(format!("HTTP request failed: {}", e)) | 337 | .fail(format!("HTTP request failed: {}", e)) |
| @@ -341,7 +341,7 @@ impl GitCloneTests { | |||
| 341 | if !response.status().is_success() { | 341 | if !response.status().is_success() { |
| 342 | return TestResult::new( | 342 | return TestResult::new( |
| 343 | test_name, | 343 | test_name, |
| 344 | "GRASP-01:git-http:36", | 344 | "GRASP-01:git-http:42", |
| 345 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 345 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 346 | ) | 346 | ) |
| 347 | .fail(format!( | 347 | .fail(format!( |
| @@ -356,7 +356,7 @@ impl GitCloneTests { | |||
| 356 | Err(e) => { | 356 | Err(e) => { |
| 357 | return TestResult::new( | 357 | return TestResult::new( |
| 358 | test_name, | 358 | test_name, |
| 359 | "GRASP-01:git-http:36", | 359 | "GRASP-01:git-http:42", |
| 360 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 360 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 361 | ) | 361 | ) |
| 362 | .fail(format!("Failed to read response body: {}", e)) | 362 | .fail(format!("Failed to read response body: {}", e)) |
| @@ -370,7 +370,7 @@ impl GitCloneTests { | |||
| 370 | if !has_allow_reachable { | 370 | if !has_allow_reachable { |
| 371 | return TestResult::new( | 371 | return TestResult::new( |
| 372 | test_name, | 372 | test_name, |
| 373 | "GRASP-01:git-http:36", | 373 | "GRASP-01:git-http:42", |
| 374 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 374 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 375 | ) | 375 | ) |
| 376 | .fail("Missing capability: allow-reachable-sha1-in-want"); | 376 | .fail("Missing capability: allow-reachable-sha1-in-want"); |
| @@ -379,7 +379,7 @@ impl GitCloneTests { | |||
| 379 | if !has_allow_tip { | 379 | if !has_allow_tip { |
| 380 | return TestResult::new( | 380 | return TestResult::new( |
| 381 | test_name, | 381 | test_name, |
| 382 | "GRASP-01:git-http:36", | 382 | "GRASP-01:git-http:42", |
| 383 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 383 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 384 | ) | 384 | ) |
| 385 | .fail("Missing capability: allow-tip-sha1-in-want"); | 385 | .fail("Missing capability: allow-tip-sha1-in-want"); |
| @@ -387,7 +387,7 @@ impl GitCloneTests { | |||
| 387 | 387 | ||
| 388 | TestResult::new( | 388 | TestResult::new( |
| 389 | test_name, | 389 | test_name, |
| 390 | "GRASP-01:git-http:36", | 390 | "GRASP-01:git-http:42", |
| 391 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 391 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 392 | ) | 392 | ) |
| 393 | .pass() | 393 | .pass() |
diff --git a/grasp-audit/src/specs/grasp01/nip11_document.rs b/grasp-audit/src/specs/grasp01/nip11_document.rs index f4ca7b4..19ceace 100644 --- a/grasp-audit/src/specs/grasp01/nip11_document.rs +++ b/grasp-audit/src/specs/grasp01/nip11_document.rs | |||
| @@ -37,7 +37,7 @@ impl Nip11DocumentTests { | |||
| 37 | pub async fn test_nip11_document_exists(client: &AuditClient) -> TestResult { | 37 | pub async fn test_nip11_document_exists(client: &AuditClient) -> TestResult { |
| 38 | TestResult::new( | 38 | TestResult::new( |
| 39 | "nip11_document_exists", | 39 | "nip11_document_exists", |
| 40 | "GRASP-01:nostr-relay:20", | 40 | "GRASP-01:nostr-relay:26", |
| 41 | "Serve NIP-11 relay information document", | 41 | "Serve NIP-11 relay information document", |
| 42 | ) | 42 | ) |
| 43 | .run(|| async { | 43 | .run(|| async { |
| @@ -96,7 +96,7 @@ impl Nip11DocumentTests { | |||
| 96 | pub async fn test_nip11_supported_grasps_field(client: &AuditClient) -> TestResult { | 96 | pub async fn test_nip11_supported_grasps_field(client: &AuditClient) -> TestResult { |
| 97 | TestResult::new( | 97 | TestResult::new( |
| 98 | "nip11_supported_grasps_field", | 98 | "nip11_supported_grasps_field", |
| 99 | "GRASP-01:nostr-relay:22", | 99 | "GRASP-01:nostr-relay:28", |
| 100 | "NIP-11 document includes supported_grasps field with GRASP-01", | 100 | "NIP-11 document includes supported_grasps field with GRASP-01", |
| 101 | ) | 101 | ) |
| 102 | .run(|| async { | 102 | .run(|| async { |
| @@ -172,7 +172,7 @@ impl Nip11DocumentTests { | |||
| 172 | pub async fn test_nip11_repo_acceptance_criteria_field(client: &AuditClient) -> TestResult { | 172 | pub async fn test_nip11_repo_acceptance_criteria_field(client: &AuditClient) -> TestResult { |
| 173 | TestResult::new( | 173 | TestResult::new( |
| 174 | "nip11_repo_acceptance_criteria_field", | 174 | "nip11_repo_acceptance_criteria_field", |
| 175 | "GRASP-01:nostr-relay:23", | 175 | "GRASP-01:nostr-relay:29", |
| 176 | "NIP-11 document includes repo_acceptance_criteria field", | 176 | "NIP-11 document includes repo_acceptance_criteria field", |
| 177 | ) | 177 | ) |
| 178 | .run(|| async { | 178 | .run(|| async { |
| @@ -227,7 +227,7 @@ impl Nip11DocumentTests { | |||
| 227 | pub async fn test_nip11_curation_field(client: &AuditClient) -> TestResult { | 227 | pub async fn test_nip11_curation_field(client: &AuditClient) -> TestResult { |
| 228 | TestResult::new( | 228 | TestResult::new( |
| 229 | "nip11_curation_field", | 229 | "nip11_curation_field", |
| 230 | "GRASP-01:nostr-relay:24", | 230 | "GRASP-01:nostr-relay:30", |
| 231 | "NIP-11 curation field present if curated, absent otherwise", | 231 | "NIP-11 curation field present if curated, absent otherwise", |
| 232 | ) | 232 | ) |
| 233 | .run(|| async { | 233 | .run(|| async { |
diff --git a/grasp-audit/src/specs/grasp01/push_authorization.rs b/grasp-audit/src/specs/grasp01/push_authorization.rs index 25738d1..4f21e70 100644 --- a/grasp-audit/src/specs/grasp01/push_authorization.rs +++ b/grasp-audit/src/specs/grasp01/push_authorization.rs | |||
| @@ -409,7 +409,7 @@ impl PushAuthorizationTests { | |||
| 409 | Err(e) => { | 409 | Err(e) => { |
| 410 | return TestResult::new( | 410 | return TestResult::new( |
| 411 | test_name, | 411 | test_name, |
| 412 | "GRASP-01:git-http:30", | 412 | "GRASP-01:git-http:36", |
| 413 | "Push rejected without state event", | 413 | "Push rejected without state event", |
| 414 | ) | 414 | ) |
| 415 | .fail(format!("Failed to create repo: {}", e)) | 415 | .fail(format!("Failed to create repo: {}", e)) |
| @@ -433,7 +433,7 @@ impl PushAuthorizationTests { | |||
| 433 | Err(e) => { | 433 | Err(e) => { |
| 434 | return TestResult::new( | 434 | return TestResult::new( |
| 435 | test_name, | 435 | test_name, |
| 436 | "GRASP-01:git-http:30", | 436 | "GRASP-01:git-http:36", |
| 437 | "Push rejected without state event", | 437 | "Push rejected without state event", |
| 438 | ) | 438 | ) |
| 439 | .fail(&e) | 439 | .fail(&e) |
| @@ -447,7 +447,7 @@ impl PushAuthorizationTests { | |||
| 447 | cleanup(); | 447 | cleanup(); |
| 448 | return TestResult::new( | 448 | return TestResult::new( |
| 449 | test_name, | 449 | test_name, |
| 450 | "GRASP-01:git-http:30", | 450 | "GRASP-01:git-http:36", |
| 451 | "Push rejected without state event", | 451 | "Push rejected without state event", |
| 452 | ) | 452 | ) |
| 453 | .fail(&e); | 453 | .fail(&e); |
| @@ -460,19 +460,19 @@ impl PushAuthorizationTests { | |||
| 460 | match push_result { | 460 | match push_result { |
| 461 | Ok(false) => TestResult::new( | 461 | Ok(false) => TestResult::new( |
| 462 | test_name, | 462 | test_name, |
| 463 | "GRASP-01:git-http:30", | 463 | "GRASP-01:git-http:36", |
| 464 | "Push rejected without state event", | 464 | "Push rejected without state event", |
| 465 | ) | 465 | ) |
| 466 | .pass(), | 466 | .pass(), |
| 467 | Ok(true) => TestResult::new( | 467 | Ok(true) => TestResult::new( |
| 468 | test_name, | 468 | test_name, |
| 469 | "GRASP-01:git-http:30", | 469 | "GRASP-01:git-http:36", |
| 470 | "Push rejected without state event", | 470 | "Push rejected without state event", |
| 471 | ) | 471 | ) |
| 472 | .fail("Push accepted but should be rejected"), | 472 | .fail("Push accepted but should be rejected"), |
| 473 | Err(e) => TestResult::new( | 473 | Err(e) => TestResult::new( |
| 474 | test_name, | 474 | test_name, |
| 475 | "GRASP-01:git-http:30", | 475 | "GRASP-01:git-http:36", |
| 476 | "Push rejected without state event", | 476 | "Push rejected without state event", |
| 477 | ) | 477 | ) |
| 478 | .fail(&e), | 478 | .fail(&e), |
| @@ -504,13 +504,13 @@ impl PushAuthorizationTests { | |||
| 504 | match ctx.get_fixture(FixtureKind::OwnerStateDataPushed).await { | 504 | match ctx.get_fixture(FixtureKind::OwnerStateDataPushed).await { |
| 505 | Ok(_state_event) => TestResult::new( | 505 | Ok(_state_event) => TestResult::new( |
| 506 | test_name, | 506 | test_name, |
| 507 | "GRASP-01:git-http:30", | 507 | "GRASP-01:git-http:36", |
| 508 | "Push authorized with matching state", | 508 | "Push authorized with matching state", |
| 509 | ) | 509 | ) |
| 510 | .pass(), | 510 | .pass(), |
| 511 | Err(e) => TestResult::new( | 511 | Err(e) => TestResult::new( |
| 512 | test_name, | 512 | test_name, |
| 513 | "GRASP-01:git-http:30", | 513 | "GRASP-01:git-http:36", |
| 514 | "Push authorized with matching state", | 514 | "Push authorized with matching state", |
| 515 | ) | 515 | ) |
| 516 | .fail(format!("{}", e)), | 516 | .fail(format!("{}", e)), |
| @@ -552,7 +552,7 @@ impl PushAuthorizationTests { | |||
| 552 | Err(e) => { | 552 | Err(e) => { |
| 553 | return TestResult::new( | 553 | return TestResult::new( |
| 554 | test_name, | 554 | test_name, |
| 555 | "GRASP-01:git-http:30", | 555 | "GRASP-01:git-http:36", |
| 556 | "Push rejected when commit not in state event", | 556 | "Push rejected when commit not in state event", |
| 557 | ) | 557 | ) |
| 558 | .fail(format!("Failed to create RepoState fixture: {}", e)); | 558 | .fail(format!("Failed to create RepoState fixture: {}", e)); |
| @@ -572,7 +572,7 @@ impl PushAuthorizationTests { | |||
| 572 | None => { | 572 | None => { |
| 573 | return TestResult::new( | 573 | return TestResult::new( |
| 574 | test_name, | 574 | test_name, |
| 575 | "GRASP-01:git-http:30", | 575 | "GRASP-01:git-http:36", |
| 576 | "Push rejected when commit not in state event", | 576 | "Push rejected when commit not in state event", |
| 577 | ) | 577 | ) |
| 578 | .fail("Missing repo_id in state event"); | 578 | .fail("Missing repo_id in state event"); |
| @@ -584,7 +584,7 @@ impl PushAuthorizationTests { | |||
| 584 | Err(e) => { | 584 | Err(e) => { |
| 585 | return TestResult::new( | 585 | return TestResult::new( |
| 586 | test_name, | 586 | test_name, |
| 587 | "GRASP-01:git-http:30", | 587 | "GRASP-01:git-http:36", |
| 588 | "Push rejected when commit not in state event", | 588 | "Push rejected when commit not in state event", |
| 589 | ) | 589 | ) |
| 590 | .fail(format!("Failed to convert pubkey to bech32: {}", e)); | 590 | .fail(format!("Failed to convert pubkey to bech32: {}", e)); |
| @@ -600,7 +600,7 @@ impl PushAuthorizationTests { | |||
| 600 | Err(e) => { | 600 | Err(e) => { |
| 601 | return TestResult::new( | 601 | return TestResult::new( |
| 602 | test_name, | 602 | test_name, |
| 603 | "GRASP-01:git-http:30", | 603 | "GRASP-01:git-http:36", |
| 604 | "Push rejected when commit not in state event", | 604 | "Push rejected when commit not in state event", |
| 605 | ) | 605 | ) |
| 606 | .fail(format!("Failed to clone repo: {}", e)); | 606 | .fail(format!("Failed to clone repo: {}", e)); |
| @@ -623,7 +623,7 @@ impl PushAuthorizationTests { | |||
| 623 | cleanup(); | 623 | cleanup(); |
| 624 | return TestResult::new( | 624 | return TestResult::new( |
| 625 | test_name, | 625 | test_name, |
| 626 | "GRASP-01:git-http:30", | 626 | "GRASP-01:git-http:36", |
| 627 | "Push rejected when commit not in state event", | 627 | "Push rejected when commit not in state event", |
| 628 | ) | 628 | ) |
| 629 | .fail(format!("Failed to create/checkout main branch: {}", e)); | 629 | .fail(format!("Failed to create/checkout main branch: {}", e)); |
| @@ -632,7 +632,7 @@ impl PushAuthorizationTests { | |||
| 632 | cleanup(); | 632 | cleanup(); |
| 633 | return TestResult::new( | 633 | return TestResult::new( |
| 634 | test_name, | 634 | test_name, |
| 635 | "GRASP-01:git-http:30", | 635 | "GRASP-01:git-http:36", |
| 636 | "Push rejected when commit not in state event", | 636 | "Push rejected when commit not in state event", |
| 637 | ) | 637 | ) |
| 638 | .fail(format!( | 638 | .fail(format!( |
| @@ -649,7 +649,7 @@ impl PushAuthorizationTests { | |||
| 649 | cleanup(); | 649 | cleanup(); |
| 650 | return TestResult::new( | 650 | return TestResult::new( |
| 651 | test_name, | 651 | test_name, |
| 652 | "GRASP-01:git-http:30", | 652 | "GRASP-01:git-http:36", |
| 653 | "Push rejected when commit not in state event", | 653 | "Push rejected when commit not in state event", |
| 654 | ) | 654 | ) |
| 655 | .fail(format!("Failed to create wrong commit: {}", e)); | 655 | .fail(format!("Failed to create wrong commit: {}", e)); |
| @@ -663,10 +663,10 @@ impl PushAuthorizationTests { | |||
| 663 | cleanup(); | 663 | cleanup(); |
| 664 | 664 | ||
| 665 | match push_result { | 665 | match push_result { |
| 666 | Ok(false) => TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected when commit not in state event").pass(), | 666 | Ok(false) => TestResult::new(test_name, "GRASP-01:git-http:36", "Push rejected when commit not in state event").pass(), |
| 667 | Ok(true) => TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected when commit not in state event") | 667 | Ok(true) => TestResult::new(test_name, "GRASP-01:git-http:36", "Push rejected when commit not in state event") |
| 668 | .fail("Push accepted but should be rejected. The pushed commit is not in the state event."), | 668 | .fail("Push accepted but should be rejected. The pushed commit is not in the state event."), |
| 669 | Err(e) => TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected when commit not in state event").fail(&e), | 669 | Err(e) => TestResult::new(test_name, "GRASP-01:git-http:36", "Push rejected when commit not in state event").fail(&e), |
| 670 | } | 670 | } |
| 671 | } | 671 | } |
| 672 | 672 | ||
| @@ -701,13 +701,13 @@ impl PushAuthorizationTests { | |||
| 701 | { | 701 | { |
| 702 | Ok(_maintainer_state_event) => TestResult::new( | 702 | Ok(_maintainer_state_event) => TestResult::new( |
| 703 | test_name, | 703 | test_name, |
| 704 | "GRASP-01:git-http:30", | 704 | "GRASP-01:git-http:36", |
| 705 | "Push authorized by maintainer state event only (no announcement)", | 705 | "Push authorized by maintainer state event only (no announcement)", |
| 706 | ) | 706 | ) |
| 707 | .pass(), | 707 | .pass(), |
| 708 | Err(e) => TestResult::new( | 708 | Err(e) => TestResult::new( |
| 709 | test_name, | 709 | test_name, |
| 710 | "GRASP-01:git-http:30", | 710 | "GRASP-01:git-http:36", |
| 711 | "Push authorized by maintainer state event only (no announcement)", | 711 | "Push authorized by maintainer state event only (no announcement)", |
| 712 | ) | 712 | ) |
| 713 | .fail(format!("{}", e)), | 713 | .fail(format!("{}", e)), |
| @@ -744,13 +744,13 @@ impl PushAuthorizationTests { | |||
| 744 | { | 744 | { |
| 745 | Ok(_recursive_maintainer_state_event) => TestResult::new( | 745 | Ok(_recursive_maintainer_state_event) => TestResult::new( |
| 746 | test_name, | 746 | test_name, |
| 747 | "GRASP-01:git-http:30", | 747 | "GRASP-01:git-http:36", |
| 748 | "Push authorized by recursive maintainer state event", | 748 | "Push authorized by recursive maintainer state event", |
| 749 | ) | 749 | ) |
| 750 | .pass(), | 750 | .pass(), |
| 751 | Err(e) => TestResult::new( | 751 | Err(e) => TestResult::new( |
| 752 | test_name, | 752 | test_name, |
| 753 | "GRASP-01:git-http:30", | 753 | "GRASP-01:git-http:36", |
| 754 | "Push authorized by recursive maintainer state event", | 754 | "Push authorized by recursive maintainer state event", |
| 755 | ) | 755 | ) |
| 756 | .fail(format!("{}", e)), | 756 | .fail(format!("{}", e)), |
| @@ -794,7 +794,7 @@ impl PushAuthorizationTests { | |||
| 794 | Err(e) => { | 794 | Err(e) => { |
| 795 | return TestResult::new( | 795 | return TestResult::new( |
| 796 | test_name, | 796 | test_name, |
| 797 | "GRASP-01:git-http:30", | 797 | "GRASP-01:git-http:36", |
| 798 | "Non-maintainer state events ignored", | 798 | "Non-maintainer state events ignored", |
| 799 | ) | 799 | ) |
| 800 | .fail(format!("Failed to get OwnerStateDataPushed fixture: {}", e)); | 800 | .fail(format!("Failed to get OwnerStateDataPushed fixture: {}", e)); |
| @@ -812,7 +812,7 @@ impl PushAuthorizationTests { | |||
| 812 | None => { | 812 | None => { |
| 813 | return TestResult::new( | 813 | return TestResult::new( |
| 814 | test_name, | 814 | test_name, |
| 815 | "GRASP-01:git-http:30", | 815 | "GRASP-01:git-http:36", |
| 816 | "Non-maintainer state events ignored", | 816 | "Non-maintainer state events ignored", |
| 817 | ) | 817 | ) |
| 818 | .fail("Missing repo_id in state event"); | 818 | .fail("Missing repo_id in state event"); |
| @@ -824,7 +824,7 @@ impl PushAuthorizationTests { | |||
| 824 | Err(e) => { | 824 | Err(e) => { |
| 825 | return TestResult::new( | 825 | return TestResult::new( |
| 826 | test_name, | 826 | test_name, |
| 827 | "GRASP-01:git-http:30", | 827 | "GRASP-01:git-http:36", |
| 828 | "Non-maintainer state events ignored", | 828 | "Non-maintainer state events ignored", |
| 829 | ) | 829 | ) |
| 830 | .fail(format!("Failed to convert pubkey to bech32: {}", e)); | 830 | .fail(format!("Failed to convert pubkey to bech32: {}", e)); |
| @@ -839,7 +839,7 @@ impl PushAuthorizationTests { | |||
| 839 | Err(e) => { | 839 | Err(e) => { |
| 840 | return TestResult::new( | 840 | return TestResult::new( |
| 841 | test_name, | 841 | test_name, |
| 842 | "GRASP-01:git-http:30", | 842 | "GRASP-01:git-http:36", |
| 843 | "Non-maintainer state events ignored", | 843 | "Non-maintainer state events ignored", |
| 844 | ) | 844 | ) |
| 845 | .fail(format!("Failed to clone repo: {}", e)); | 845 | .fail(format!("Failed to clone repo: {}", e)); |
| @@ -861,7 +861,7 @@ impl PushAuthorizationTests { | |||
| 861 | cleanup(); | 861 | cleanup(); |
| 862 | return TestResult::new( | 862 | return TestResult::new( |
| 863 | test_name, | 863 | test_name, |
| 864 | "GRASP-01:git-http:30", | 864 | "GRASP-01:git-http:36", |
| 865 | "Non-maintainer state events ignored", | 865 | "Non-maintainer state events ignored", |
| 866 | ) | 866 | ) |
| 867 | .fail(format!("Failed to create commit: {}", e)); | 867 | .fail(format!("Failed to create commit: {}", e)); |
| @@ -887,7 +887,7 @@ impl PushAuthorizationTests { | |||
| 887 | cleanup(); | 887 | cleanup(); |
| 888 | return TestResult::new( | 888 | return TestResult::new( |
| 889 | test_name, | 889 | test_name, |
| 890 | "GRASP-01:git-http:30", | 890 | "GRASP-01:git-http:36", |
| 891 | "Non-maintainer state events ignored", | 891 | "Non-maintainer state events ignored", |
| 892 | ) | 892 | ) |
| 893 | .fail(format!("Failed to build rogue state event: {}", e)); | 893 | .fail(format!("Failed to build rogue state event: {}", e)); |
| @@ -899,7 +899,7 @@ impl PushAuthorizationTests { | |||
| 899 | cleanup(); | 899 | cleanup(); |
| 900 | return TestResult::new( | 900 | return TestResult::new( |
| 901 | test_name, | 901 | test_name, |
| 902 | "GRASP-01:git-http:30", | 902 | "GRASP-01:git-http:36", |
| 903 | "Non-maintainer state events ignored", | 903 | "Non-maintainer state events ignored", |
| 904 | ) | 904 | ) |
| 905 | .fail(format!("Failed to send rogue state event: {}", e)); | 905 | .fail(format!("Failed to send rogue state event: {}", e)); |
| @@ -916,8 +916,8 @@ impl PushAuthorizationTests { | |||
| 916 | cleanup(); | 916 | cleanup(); |
| 917 | 917 | ||
| 918 | match push_result { | 918 | match push_result { |
| 919 | Ok(false) => TestResult::new(test_name, "GRASP-01:git-http:30", "Non-maintainer state events ignored").pass(), | 919 | Ok(false) => TestResult::new(test_name, "GRASP-01:git-http:36", "Non-maintainer state events ignored").pass(), |
| 920 | Ok(true) => TestResult::new(test_name, "GRASP-01:git-http:30", "Non-maintainer state events ignored") | 920 | Ok(true) => TestResult::new(test_name, "GRASP-01:git-http:36", "Non-maintainer state events ignored") |
| 921 | .fail(format!( | 921 | .fail(format!( |
| 922 | "Push accepted but should be rejected. A non-maintainer (pubkey: {}) published \ | 922 | "Push accepted but should be rejected. A non-maintainer (pubkey: {}) published \ |
| 923 | a state event announcing commit {}, but the push was accepted. The relay should \ | 923 | a state event announcing commit {}, but the push was accepted. The relay should \ |
| @@ -926,7 +926,7 @@ impl PushAuthorizationTests { | |||
| 926 | new_commit, | 926 | new_commit, |
| 927 | client.public_key() | 927 | client.public_key() |
| 928 | )), | 928 | )), |
| 929 | Err(e) => TestResult::new(test_name, "GRASP-01:git-http:30", "Non-maintainer state events ignored").fail(&e), | 929 | Err(e) => TestResult::new(test_name, "GRASP-01:git-http:36", "Non-maintainer state events ignored").fail(&e), |
| 930 | } | 930 | } |
| 931 | } | 931 | } |
| 932 | 932 | ||
| @@ -957,7 +957,7 @@ impl PushAuthorizationTests { | |||
| 957 | Err(e) => { | 957 | Err(e) => { |
| 958 | return TestResult::new( | 958 | return TestResult::new( |
| 959 | test_name, | 959 | test_name, |
| 960 | "GRASP-01:git-http:34", | 960 | "GRASP-01:git-http:40", |
| 961 | "Push to refs/nostr/<invalid-event-id> rejected", | 961 | "Push to refs/nostr/<invalid-event-id> rejected", |
| 962 | ) | 962 | ) |
| 963 | .fail(format!("Failed to create repo: {}", e)); | 963 | .fail(format!("Failed to create repo: {}", e)); |
| @@ -983,7 +983,7 @@ impl PushAuthorizationTests { | |||
| 983 | Err(e) => { | 983 | Err(e) => { |
| 984 | return TestResult::new( | 984 | return TestResult::new( |
| 985 | test_name, | 985 | test_name, |
| 986 | "GRASP-01:git-http:34", | 986 | "GRASP-01:git-http:40", |
| 987 | "Push to refs/nostr/<invalid-event-id> rejected", | 987 | "Push to refs/nostr/<invalid-event-id> rejected", |
| 988 | ) | 988 | ) |
| 989 | .fail(&e); | 989 | .fail(&e); |
| @@ -998,7 +998,7 @@ impl PushAuthorizationTests { | |||
| 998 | cleanup(); | 998 | cleanup(); |
| 999 | return TestResult::new( | 999 | return TestResult::new( |
| 1000 | test_name, | 1000 | test_name, |
| 1001 | "GRASP-01:git-http:34", | 1001 | "GRASP-01:git-http:40", |
| 1002 | "Push to refs/nostr/<invalid-event-id> rejected", | 1002 | "Push to refs/nostr/<invalid-event-id> rejected", |
| 1003 | ) | 1003 | ) |
| 1004 | .fail(&e); | 1004 | .fail(&e); |
| @@ -1017,13 +1017,13 @@ impl PushAuthorizationTests { | |||
| 1017 | match push_result { | 1017 | match push_result { |
| 1018 | Ok(false) => TestResult::new( | 1018 | Ok(false) => TestResult::new( |
| 1019 | test_name, | 1019 | test_name, |
| 1020 | "GRASP-01:git-http:34", | 1020 | "GRASP-01:git-http:40", |
| 1021 | "Push to refs/nostr/<invalid-event-id> rejected", | 1021 | "Push to refs/nostr/<invalid-event-id> rejected", |
| 1022 | ) | 1022 | ) |
| 1023 | .pass(), | 1023 | .pass(), |
| 1024 | Ok(true) => TestResult::new( | 1024 | Ok(true) => TestResult::new( |
| 1025 | test_name, | 1025 | test_name, |
| 1026 | "GRASP-01:git-http:34", | 1026 | "GRASP-01:git-http:40", |
| 1027 | "Push to refs/nostr/<invalid-event-id> rejected", | 1027 | "Push to refs/nostr/<invalid-event-id> rejected", |
| 1028 | ) | 1028 | ) |
| 1029 | .fail(format!( | 1029 | .fail(format!( |
| @@ -1034,7 +1034,7 @@ impl PushAuthorizationTests { | |||
| 1034 | )), | 1034 | )), |
| 1035 | Err(e) => TestResult::new( | 1035 | Err(e) => TestResult::new( |
| 1036 | test_name, | 1036 | test_name, |
| 1037 | "GRASP-01:git-http:34", | 1037 | "GRASP-01:git-http:40", |
| 1038 | "Push to refs/nostr/<invalid-event-id> rejected", | 1038 | "Push to refs/nostr/<invalid-event-id> rejected", |
| 1039 | ) | 1039 | ) |
| 1040 | .fail(format!("Push error: {}", e)), | 1040 | .fail(format!("Push error: {}", e)), |
| @@ -1068,9 +1068,9 @@ impl PushAuthorizationTests { | |||
| 1068 | .get_fixture(FixtureKind::PRWrongCommitPushedBeforeEvent) | 1068 | .get_fixture(FixtureKind::PRWrongCommitPushedBeforeEvent) |
| 1069 | .await | 1069 | .await |
| 1070 | { | 1070 | { |
| 1071 | Ok(_pr_event) => TestResult::new(test_name, "GRASP-01:git-http:34", desc).pass(), | 1071 | Ok(_pr_event) => TestResult::new(test_name, "GRASP-01:git-http:40", desc).pass(), |
| 1072 | Err(e) => { | 1072 | Err(e) => { |
| 1073 | TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(format!("{}", e)) | 1073 | TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(format!("{}", e)) |
| 1074 | } | 1074 | } |
| 1075 | } | 1075 | } |
| 1076 | } | 1076 | } |
| @@ -1097,7 +1097,7 @@ impl PushAuthorizationTests { | |||
| 1097 | { | 1097 | { |
| 1098 | Ok(e) => e, | 1098 | Ok(e) => e, |
| 1099 | Err(e) => { | 1099 | Err(e) => { |
| 1100 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc) | 1100 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc) |
| 1101 | .fail(format!("{}", e)); | 1101 | .fail(format!("{}", e)); |
| 1102 | } | 1102 | } |
| 1103 | }; | 1103 | }; |
| @@ -1108,7 +1108,7 @@ impl PushAuthorizationTests { | |||
| 1108 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 1108 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { |
| 1109 | Ok(r) => r, | 1109 | Ok(r) => r, |
| 1110 | Err(e) => { | 1110 | Err(e) => { |
| 1111 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc) | 1111 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc) |
| 1112 | .fail(format!("{}", e)); | 1112 | .fail(format!("{}", e)); |
| 1113 | } | 1113 | } |
| 1114 | }; | 1114 | }; |
| @@ -1124,7 +1124,7 @@ impl PushAuthorizationTests { | |||
| 1124 | let owner_npub = match repo.pubkey.to_bech32() { | 1124 | let owner_npub = match repo.pubkey.to_bech32() { |
| 1125 | Ok(n) => n, | 1125 | Ok(n) => n, |
| 1126 | Err(e) => { | 1126 | Err(e) => { |
| 1127 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc) | 1127 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc) |
| 1128 | .fail(format!("Failed to get owner npub: {}", e)); | 1128 | .fail(format!("Failed to get owner npub: {}", e)); |
| 1129 | } | 1129 | } |
| 1130 | }; | 1130 | }; |
| @@ -1133,7 +1133,7 @@ impl PushAuthorizationTests { | |||
| 1133 | let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) { | 1133 | let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) { |
| 1134 | Ok(p) => p, | 1134 | Ok(p) => p, |
| 1135 | Err(e) => { | 1135 | Err(e) => { |
| 1136 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); | 1136 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e); |
| 1137 | } | 1137 | } |
| 1138 | }; | 1138 | }; |
| 1139 | 1139 | ||
| @@ -1143,7 +1143,7 @@ impl PushAuthorizationTests { | |||
| 1143 | Ok(exists) => exists, | 1143 | Ok(exists) => exists, |
| 1144 | Err(e) => { | 1144 | Err(e) => { |
| 1145 | let _ = fs::remove_dir_all(&clone_path); | 1145 | let _ = fs::remove_dir_all(&clone_path); |
| 1146 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); | 1146 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e); |
| 1147 | } | 1147 | } |
| 1148 | }; | 1148 | }; |
| 1149 | 1149 | ||
| @@ -1151,13 +1151,13 @@ impl PushAuthorizationTests { | |||
| 1151 | 1151 | ||
| 1152 | // Ref should be deleted since the pushed commit doesn't match the PR event's `c` tag | 1152 | // Ref should be deleted since the pushed commit doesn't match the PR event's `c` tag |
| 1153 | if refs_exist { | 1153 | if refs_exist { |
| 1154 | TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(format!( | 1154 | TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(format!( |
| 1155 | "Expected refs/nostr/{} to be deleted when PR event published with non-matching commit, \ | 1155 | "Expected refs/nostr/{} to be deleted when PR event published with non-matching commit, \ |
| 1156 | but the ref still exists. The relay should delete refs that don't match the event's `c` tag.", | 1156 | but the ref still exists. The relay should delete refs that don't match the event's `c` tag.", |
| 1157 | pr_event_id | 1157 | pr_event_id |
| 1158 | )) | 1158 | )) |
| 1159 | } else { | 1159 | } else { |
| 1160 | TestResult::new(test_name, "GRASP-01:git-http:34", desc).pass() | 1160 | TestResult::new(test_name, "GRASP-01:git-http:40", desc).pass() |
| 1161 | } | 1161 | } |
| 1162 | } | 1162 | } |
| 1163 | 1163 | ||
| @@ -1183,7 +1183,7 @@ impl PushAuthorizationTests { | |||
| 1183 | { | 1183 | { |
| 1184 | Ok(e) => e, | 1184 | Ok(e) => e, |
| 1185 | Err(e) => { | 1185 | Err(e) => { |
| 1186 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc) | 1186 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc) |
| 1187 | .fail(format!("{}", e)); | 1187 | .fail(format!("{}", e)); |
| 1188 | } | 1188 | } |
| 1189 | }; | 1189 | }; |
| @@ -1194,7 +1194,7 @@ impl PushAuthorizationTests { | |||
| 1194 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 1194 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { |
| 1195 | Ok(r) => r, | 1195 | Ok(r) => r, |
| 1196 | Err(e) => { | 1196 | Err(e) => { |
| 1197 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc) | 1197 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc) |
| 1198 | .fail(format!("{}", e)); | 1198 | .fail(format!("{}", e)); |
| 1199 | } | 1199 | } |
| 1200 | }; | 1200 | }; |
| @@ -1210,7 +1210,7 @@ impl PushAuthorizationTests { | |||
| 1210 | let owner_npub = match repo.pubkey.to_bech32() { | 1210 | let owner_npub = match repo.pubkey.to_bech32() { |
| 1211 | Ok(n) => n, | 1211 | Ok(n) => n, |
| 1212 | Err(e) => { | 1212 | Err(e) => { |
| 1213 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc) | 1213 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc) |
| 1214 | .fail(format!("Failed to get owner npub: {}", e)); | 1214 | .fail(format!("Failed to get owner npub: {}", e)); |
| 1215 | } | 1215 | } |
| 1216 | }; | 1216 | }; |
| @@ -1219,7 +1219,7 @@ impl PushAuthorizationTests { | |||
| 1219 | let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) { | 1219 | let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) { |
| 1220 | Ok(p) => p, | 1220 | Ok(p) => p, |
| 1221 | Err(e) => { | 1221 | Err(e) => { |
| 1222 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); | 1222 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e); |
| 1223 | } | 1223 | } |
| 1224 | }; | 1224 | }; |
| 1225 | 1225 | ||
| @@ -1227,7 +1227,7 @@ impl PushAuthorizationTests { | |||
| 1227 | if let Err(e) = create_deterministic_commit_with_variant(&clone_path, CommitVariant::Owner) | 1227 | if let Err(e) = create_deterministic_commit_with_variant(&clone_path, CommitVariant::Owner) |
| 1228 | { | 1228 | { |
| 1229 | let _ = fs::remove_dir_all(&clone_path); | 1229 | let _ = fs::remove_dir_all(&clone_path); |
| 1230 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); | 1230 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e); |
| 1231 | } | 1231 | } |
| 1232 | 1232 | ||
| 1233 | // Try to push with wrong commit (should be rejected since PR event exists) | 1233 | // Try to push with wrong commit (should be rejected since PR event exists) |
| @@ -1235,7 +1235,7 @@ impl PushAuthorizationTests { | |||
| 1235 | Ok(success) => success, | 1235 | Ok(success) => success, |
| 1236 | Err(e) => { | 1236 | Err(e) => { |
| 1237 | let _ = fs::remove_dir_all(&clone_path); | 1237 | let _ = fs::remove_dir_all(&clone_path); |
| 1238 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); | 1238 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e); |
| 1239 | } | 1239 | } |
| 1240 | }; | 1240 | }; |
| 1241 | 1241 | ||
| @@ -1243,11 +1243,11 @@ impl PushAuthorizationTests { | |||
| 1243 | 1243 | ||
| 1244 | // Should REJECT - PR event exists with different commit hash | 1244 | // Should REJECT - PR event exists with different commit hash |
| 1245 | if push_succeeded { | 1245 | if push_succeeded { |
| 1246 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc) | 1246 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc) |
| 1247 | .fail("Push accepted (expected rejection due to commit hash mismatch)"); | 1247 | .fail("Push accepted (expected rejection due to commit hash mismatch)"); |
| 1248 | } | 1248 | } |
| 1249 | 1249 | ||
| 1250 | TestResult::new(test_name, "GRASP-01:git-http:34", desc).pass() | 1250 | TestResult::new(test_name, "GRASP-01:git-http:40", desc).pass() |
| 1251 | } | 1251 | } |
| 1252 | 1252 | ||
| 1253 | /// Test 4: Push correct commit to refs/nostr/<pr-event-id> AFTER PR event exists | 1253 | /// Test 4: Push correct commit to refs/nostr/<pr-event-id> AFTER PR event exists |
| @@ -1272,7 +1272,7 @@ impl PushAuthorizationTests { | |||
| 1272 | { | 1272 | { |
| 1273 | Ok(e) => e, | 1273 | Ok(e) => e, |
| 1274 | Err(e) => { | 1274 | Err(e) => { |
| 1275 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc) | 1275 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc) |
| 1276 | .fail(format!("{}", e)); | 1276 | .fail(format!("{}", e)); |
| 1277 | } | 1277 | } |
| 1278 | }; | 1278 | }; |
| @@ -1283,7 +1283,7 @@ impl PushAuthorizationTests { | |||
| 1283 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 1283 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { |
| 1284 | Ok(r) => r, | 1284 | Ok(r) => r, |
| 1285 | Err(e) => { | 1285 | Err(e) => { |
| 1286 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc) | 1286 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc) |
| 1287 | .fail(format!("{}", e)); | 1287 | .fail(format!("{}", e)); |
| 1288 | } | 1288 | } |
| 1289 | }; | 1289 | }; |
| @@ -1299,7 +1299,7 @@ impl PushAuthorizationTests { | |||
| 1299 | let owner_npub = match repo.pubkey.to_bech32() { | 1299 | let owner_npub = match repo.pubkey.to_bech32() { |
| 1300 | Ok(n) => n, | 1300 | Ok(n) => n, |
| 1301 | Err(e) => { | 1301 | Err(e) => { |
| 1302 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc) | 1302 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc) |
| 1303 | .fail(format!("Failed to get owner npub: {}", e)); | 1303 | .fail(format!("Failed to get owner npub: {}", e)); |
| 1304 | } | 1304 | } |
| 1305 | }; | 1305 | }; |
| @@ -1308,14 +1308,14 @@ impl PushAuthorizationTests { | |||
| 1308 | let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) { | 1308 | let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) { |
| 1309 | Ok(p) => p, | 1309 | Ok(p) => p, |
| 1310 | Err(e) => { | 1310 | Err(e) => { |
| 1311 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); | 1311 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e); |
| 1312 | } | 1312 | } |
| 1313 | }; | 1313 | }; |
| 1314 | 1314 | ||
| 1315 | // Create the CORRECT PR test commit (the one expected by PR event) | 1315 | // Create the CORRECT PR test commit (the one expected by PR event) |
| 1316 | if let Err(e) = reset_to_correct_pr_commit(&clone_path) { | 1316 | if let Err(e) = reset_to_correct_pr_commit(&clone_path) { |
| 1317 | let _ = fs::remove_dir_all(&clone_path); | 1317 | let _ = fs::remove_dir_all(&clone_path); |
| 1318 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); | 1318 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e); |
| 1319 | } | 1319 | } |
| 1320 | 1320 | ||
| 1321 | // Push correct commit (should succeed) | 1321 | // Push correct commit (should succeed) |
| @@ -1323,7 +1323,7 @@ impl PushAuthorizationTests { | |||
| 1323 | Ok(success) => success, | 1323 | Ok(success) => success, |
| 1324 | Err(e) => { | 1324 | Err(e) => { |
| 1325 | let _ = fs::remove_dir_all(&clone_path); | 1325 | let _ = fs::remove_dir_all(&clone_path); |
| 1326 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); | 1326 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e); |
| 1327 | } | 1327 | } |
| 1328 | }; | 1328 | }; |
| 1329 | 1329 | ||
| @@ -1331,11 +1331,11 @@ impl PushAuthorizationTests { | |||
| 1331 | 1331 | ||
| 1332 | // Should ACCEPT - commit matches PR event's c tag | 1332 | // Should ACCEPT - commit matches PR event's c tag |
| 1333 | if !push_succeeded { | 1333 | if !push_succeeded { |
| 1334 | return TestResult::new(test_name, "GRASP-01:git-http:34", desc) | 1334 | return TestResult::new(test_name, "GRASP-01:git-http:40", desc) |
| 1335 | .fail("Push rejected (expected acceptance since commit matches PR event)"); | 1335 | .fail("Push rejected (expected acceptance since commit matches PR event)"); |
| 1336 | } | 1336 | } |
| 1337 | 1337 | ||
| 1338 | TestResult::new(test_name, "GRASP-01:git-http:34", desc).pass() | 1338 | TestResult::new(test_name, "GRASP-01:git-http:40", desc).pass() |
| 1339 | } | 1339 | } |
| 1340 | 1340 | ||
| 1341 | /// Test that HEAD is set after a state event is published with an existing commit | 1341 | /// Test that HEAD is set after a state event is published with an existing commit |
| @@ -1372,7 +1372,7 @@ impl PushAuthorizationTests { | |||
| 1372 | { | 1372 | { |
| 1373 | Ok(e) => e, | 1373 | Ok(e) => e, |
| 1374 | Err(e) => { | 1374 | Err(e) => { |
| 1375 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc).fail(format!( | 1375 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc).fail(format!( |
| 1376 | "Failed to create HeadSetToDevelopBranch fixture: {}", | 1376 | "Failed to create HeadSetToDevelopBranch fixture: {}", |
| 1377 | e | 1377 | e |
| 1378 | )); | 1378 | )); |
| @@ -1385,7 +1385,7 @@ impl PushAuthorizationTests { | |||
| 1385 | let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 1385 | let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { |
| 1386 | Ok(e) => e, | 1386 | Ok(e) => e, |
| 1387 | Err(e) => { | 1387 | Err(e) => { |
| 1388 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1388 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1389 | .fail(format!("Failed to get ValidRepo fixture: {}", e)); | 1389 | .fail(format!("Failed to get ValidRepo fixture: {}", e)); |
| 1390 | } | 1390 | } |
| 1391 | }; | 1391 | }; |
| @@ -1398,7 +1398,7 @@ impl PushAuthorizationTests { | |||
| 1398 | { | 1398 | { |
| 1399 | Some(id) => id.to_string(), | 1399 | Some(id) => id.to_string(), |
| 1400 | None => { | 1400 | None => { |
| 1401 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1401 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1402 | .fail("Missing repo_id in ValidRepo"); | 1402 | .fail("Missing repo_id in ValidRepo"); |
| 1403 | } | 1403 | } |
| 1404 | }; | 1404 | }; |
| @@ -1406,7 +1406,7 @@ impl PushAuthorizationTests { | |||
| 1406 | let npub = match valid_repo.pubkey.to_bech32() { | 1406 | let npub = match valid_repo.pubkey.to_bech32() { |
| 1407 | Ok(n) => n, | 1407 | Ok(n) => n, |
| 1408 | Err(e) => { | 1408 | Err(e) => { |
| 1409 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1409 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1410 | .fail(format!("Failed to convert pubkey to bech32: {}", e)); | 1410 | .fail(format!("Failed to convert pubkey to bech32: {}", e)); |
| 1411 | } | 1411 | } |
| 1412 | }; | 1412 | }; |
| @@ -1418,16 +1418,16 @@ impl PushAuthorizationTests { | |||
| 1418 | match get_default_branch_from_info_refs(relay_domain, &npub, &repo_id).await { | 1418 | match get_default_branch_from_info_refs(relay_domain, &npub, &repo_id).await { |
| 1419 | Ok(branch) => branch, | 1419 | Ok(branch) => branch, |
| 1420 | Err(e) => { | 1420 | Err(e) => { |
| 1421 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1421 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1422 | .fail(format!("Failed to get default branch: {}", e)); | 1422 | .fail(format!("Failed to get default branch: {}", e)); |
| 1423 | } | 1423 | } |
| 1424 | }; | 1424 | }; |
| 1425 | 1425 | ||
| 1426 | // Verify HEAD points to refs/heads/develop | 1426 | // Verify HEAD points to refs/heads/develop |
| 1427 | if default_branch == "refs/heads/develop" { | 1427 | if default_branch == "refs/heads/develop" { |
| 1428 | TestResult::new(test_name, "GRASP-01:git-http:32", desc).pass() | 1428 | TestResult::new(test_name, "GRASP-01:git-http:38", desc).pass() |
| 1429 | } else { | 1429 | } else { |
| 1430 | TestResult::new(test_name, "GRASP-01:git-http:32", desc).fail(format!( | 1430 | TestResult::new(test_name, "GRASP-01:git-http:38", desc).fail(format!( |
| 1431 | "Expected HEAD to point to 'refs/heads/develop' but got '{}'. \ | 1431 | "Expected HEAD to point to 'refs/heads/develop' but got '{}'. \ |
| 1432 | GRASP-01 requires: 'MUST set repository HEAD per repository state announcement \ | 1432 | GRASP-01 requires: 'MUST set repository HEAD per repository state announcement \ |
| 1433 | as soon as the git data related to that branch has been received.'", | 1433 | as soon as the git data related to that branch has been received.'", |
| @@ -1476,7 +1476,7 @@ impl PushAuthorizationTests { | |||
| 1476 | let _develop_state = match ctx.get_fixture(FixtureKind::HeadSetToDevelopBranch).await { | 1476 | let _develop_state = match ctx.get_fixture(FixtureKind::HeadSetToDevelopBranch).await { |
| 1477 | Ok(e) => e, | 1477 | Ok(e) => e, |
| 1478 | Err(e) => { | 1478 | Err(e) => { |
| 1479 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc).fail(format!( | 1479 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc).fail(format!( |
| 1480 | "Failed to create HeadSetToDevelopBranch fixture: {}", | 1480 | "Failed to create HeadSetToDevelopBranch fixture: {}", |
| 1481 | e | 1481 | e |
| 1482 | )); | 1482 | )); |
| @@ -1489,7 +1489,7 @@ impl PushAuthorizationTests { | |||
| 1489 | let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 1489 | let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { |
| 1490 | Ok(e) => e, | 1490 | Ok(e) => e, |
| 1491 | Err(e) => { | 1491 | Err(e) => { |
| 1492 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1492 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1493 | .fail(format!("Failed to get ValidRepo fixture: {}", e)); | 1493 | .fail(format!("Failed to get ValidRepo fixture: {}", e)); |
| 1494 | } | 1494 | } |
| 1495 | }; | 1495 | }; |
| @@ -1502,7 +1502,7 @@ impl PushAuthorizationTests { | |||
| 1502 | { | 1502 | { |
| 1503 | Some(id) => id.to_string(), | 1503 | Some(id) => id.to_string(), |
| 1504 | None => { | 1504 | None => { |
| 1505 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1505 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1506 | .fail("Missing repo_id in ValidRepo"); | 1506 | .fail("Missing repo_id in ValidRepo"); |
| 1507 | } | 1507 | } |
| 1508 | }; | 1508 | }; |
| @@ -1510,7 +1510,7 @@ impl PushAuthorizationTests { | |||
| 1510 | let npub = match valid_repo.pubkey.to_bech32() { | 1510 | let npub = match valid_repo.pubkey.to_bech32() { |
| 1511 | Ok(n) => n, | 1511 | Ok(n) => n, |
| 1512 | Err(e) => { | 1512 | Err(e) => { |
| 1513 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1513 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1514 | .fail(format!("Failed to convert pubkey to bech32: {}", e)); | 1514 | .fail(format!("Failed to convert pubkey to bech32: {}", e)); |
| 1515 | } | 1515 | } |
| 1516 | }; | 1516 | }; |
| @@ -1521,7 +1521,7 @@ impl PushAuthorizationTests { | |||
| 1521 | let clone_path = match clone_repo(relay_domain, &npub, &repo_id) { | 1521 | let clone_path = match clone_repo(relay_domain, &npub, &repo_id) { |
| 1522 | Ok(path) => path, | 1522 | Ok(path) => path, |
| 1523 | Err(e) => { | 1523 | Err(e) => { |
| 1524 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1524 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1525 | .fail(format!("Failed to clone repo: {}", e)); | 1525 | .fail(format!("Failed to clone repo: {}", e)); |
| 1526 | } | 1526 | } |
| 1527 | }; | 1527 | }; |
| @@ -1536,7 +1536,7 @@ impl PushAuthorizationTests { | |||
| 1536 | 1536 | ||
| 1537 | if let Err(e) = output { | 1537 | if let Err(e) = output { |
| 1538 | let _ = fs::remove_dir_all(&clone_path); | 1538 | let _ = fs::remove_dir_all(&clone_path); |
| 1539 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1539 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1540 | .fail(format!("Failed to create develop1 branch: {}", e)); | 1540 | .fail(format!("Failed to create develop1 branch: {}", e)); |
| 1541 | } | 1541 | } |
| 1542 | 1542 | ||
| @@ -1545,7 +1545,7 @@ impl PushAuthorizationTests { | |||
| 1545 | Ok(hash) => hash, | 1545 | Ok(hash) => hash, |
| 1546 | Err(e) => { | 1546 | Err(e) => { |
| 1547 | let _ = fs::remove_dir_all(&clone_path); | 1547 | let _ = fs::remove_dir_all(&clone_path); |
| 1548 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1548 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1549 | .fail(format!("Failed to create commit: {}", e)); | 1549 | .fail(format!("Failed to create commit: {}", e)); |
| 1550 | } | 1550 | } |
| 1551 | }; | 1551 | }; |
| @@ -1570,7 +1570,7 @@ impl PushAuthorizationTests { | |||
| 1570 | Ok(e) => e, | 1570 | Ok(e) => e, |
| 1571 | Err(e) => { | 1571 | Err(e) => { |
| 1572 | let _ = fs::remove_dir_all(&clone_path); | 1572 | let _ = fs::remove_dir_all(&clone_path); |
| 1573 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1573 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1574 | .fail(format!("Failed to build state event: {}", e)); | 1574 | .fail(format!("Failed to build state event: {}", e)); |
| 1575 | } | 1575 | } |
| 1576 | }; | 1576 | }; |
| @@ -1578,7 +1578,7 @@ impl PushAuthorizationTests { | |||
| 1578 | // Send the state event (commit doesn't exist on relay yet) | 1578 | // Send the state event (commit doesn't exist on relay yet) |
| 1579 | if let Err(e) = client.send_event(state_event).await { | 1579 | if let Err(e) = client.send_event(state_event).await { |
| 1580 | let _ = fs::remove_dir_all(&clone_path); | 1580 | let _ = fs::remove_dir_all(&clone_path); |
| 1581 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1581 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1582 | .fail(format!("Failed to send state event: {}", e)); | 1582 | .fail(format!("Failed to send state event: {}", e)); |
| 1583 | } | 1583 | } |
| 1584 | 1584 | ||
| @@ -1591,11 +1591,11 @@ impl PushAuthorizationTests { | |||
| 1591 | match push_result { | 1591 | match push_result { |
| 1592 | Ok(true) => { /* Push succeeded, continue to verify */ } | 1592 | Ok(true) => { /* Push succeeded, continue to verify */ } |
| 1593 | Ok(false) => { | 1593 | Ok(false) => { |
| 1594 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1594 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1595 | .fail("Push to refs/heads/develop1 was rejected"); | 1595 | .fail("Push to refs/heads/develop1 was rejected"); |
| 1596 | } | 1596 | } |
| 1597 | Err(e) => { | 1597 | Err(e) => { |
| 1598 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1598 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1599 | .fail(format!("Failed to push develop1 branch: {}", e)); | 1599 | .fail(format!("Failed to push develop1 branch: {}", e)); |
| 1600 | } | 1600 | } |
| 1601 | } | 1601 | } |
| @@ -1608,16 +1608,16 @@ impl PushAuthorizationTests { | |||
| 1608 | match get_default_branch_from_info_refs(relay_domain, &npub, &repo_id).await { | 1608 | match get_default_branch_from_info_refs(relay_domain, &npub, &repo_id).await { |
| 1609 | Ok(branch) => branch, | 1609 | Ok(branch) => branch, |
| 1610 | Err(e) => { | 1610 | Err(e) => { |
| 1611 | return TestResult::new(test_name, "GRASP-01:git-http:32", desc) | 1611 | return TestResult::new(test_name, "GRASP-01:git-http:38", desc) |
| 1612 | .fail(format!("Failed to get default branch: {}", e)); | 1612 | .fail(format!("Failed to get default branch: {}", e)); |
| 1613 | } | 1613 | } |
| 1614 | }; | 1614 | }; |
| 1615 | 1615 | ||
| 1616 | // Verify HEAD points to refs/heads/develop1 | 1616 | // Verify HEAD points to refs/heads/develop1 |
| 1617 | if default_branch == "refs/heads/develop1" { | 1617 | if default_branch == "refs/heads/develop1" { |
| 1618 | TestResult::new(test_name, "GRASP-01:git-http:32", desc).pass() | 1618 | TestResult::new(test_name, "GRASP-01:git-http:38", desc).pass() |
| 1619 | } else { | 1619 | } else { |
| 1620 | TestResult::new(test_name, "GRASP-01:git-http:32", desc).fail(format!( | 1620 | TestResult::new(test_name, "GRASP-01:git-http:38", desc).fail(format!( |
| 1621 | "Expected HEAD to point to 'refs/heads/develop1' but got '{}'. \ | 1621 | "Expected HEAD to point to 'refs/heads/develop1' but got '{}'. \ |
| 1622 | GRASP-01 requires: 'MUST set repository HEAD per repository state announcement \ | 1622 | GRASP-01 requires: 'MUST set repository HEAD per repository state announcement \ |
| 1623 | as soon as the git data related to that branch has been received.'", | 1623 | as soon as the git data related to that branch has been received.'", |
diff --git a/grasp-audit/src/specs/grasp01/repository_creation.rs b/grasp-audit/src/specs/grasp01/repository_creation.rs index a99b0d2..2eddb97 100644 --- a/grasp-audit/src/specs/grasp01/repository_creation.rs +++ b/grasp-audit/src/specs/grasp01/repository_creation.rs | |||
| @@ -55,7 +55,7 @@ impl RepositoryCreationTests { | |||
| 55 | Err(e) => { | 55 | Err(e) => { |
| 56 | return TestResult::new( | 56 | return TestResult::new( |
| 57 | test_name, | 57 | test_name, |
| 58 | "GRASP-01:git-http:28", | 58 | "GRASP-01:git-http:34", |
| 59 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", | 59 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", |
| 60 | ) | 60 | ) |
| 61 | .fail(format!("Failed to create repo fixture: {}", e)) | 61 | .fail(format!("Failed to create repo fixture: {}", e)) |
| @@ -76,7 +76,7 @@ impl RepositoryCreationTests { | |||
| 76 | None => { | 76 | None => { |
| 77 | return TestResult::new( | 77 | return TestResult::new( |
| 78 | test_name, | 78 | test_name, |
| 79 | "GRASP-01:git-http:28", | 79 | "GRASP-01:git-http:34", |
| 80 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", | 80 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", |
| 81 | ) | 81 | ) |
| 82 | .fail("Repository announcement missing d tag") | 82 | .fail("Repository announcement missing d tag") |
| @@ -88,7 +88,7 @@ impl RepositoryCreationTests { | |||
| 88 | Err(e) => { | 88 | Err(e) => { |
| 89 | return TestResult::new( | 89 | return TestResult::new( |
| 90 | test_name, | 90 | test_name, |
| 91 | "GRASP-01:git-http:28", | 91 | "GRASP-01:git-http:34", |
| 92 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", | 92 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", |
| 93 | ) | 93 | ) |
| 94 | .fail(format!("Failed to convert pubkey to npub: {}", e)) | 94 | .fail(format!("Failed to convert pubkey to npub: {}", e)) |
| @@ -99,7 +99,7 @@ impl RepositoryCreationTests { | |||
| 99 | if let Err(e) = check_repo_accessible_via_http(relay_domain, &npub, &repo_id).await { | 99 | if let Err(e) = check_repo_accessible_via_http(relay_domain, &npub, &repo_id).await { |
| 100 | return TestResult::new( | 100 | return TestResult::new( |
| 101 | test_name, | 101 | test_name, |
| 102 | "GRASP-01:git-http:28", | 102 | "GRASP-01:git-http:34", |
| 103 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", | 103 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", |
| 104 | ) | 104 | ) |
| 105 | .fail(format!("Repository not accessible via HTTP: {}", e)); | 105 | .fail(format!("Repository not accessible via HTTP: {}", e)); |
| @@ -107,7 +107,7 @@ impl RepositoryCreationTests { | |||
| 107 | 107 | ||
| 108 | TestResult::new( | 108 | TestResult::new( |
| 109 | test_name, | 109 | test_name, |
| 110 | "GRASP-01:git-http:28", | 110 | "GRASP-01:git-http:34", |
| 111 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", | 111 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", |
| 112 | ) | 112 | ) |
| 113 | .pass() | 113 | .pass() |
| @@ -135,7 +135,7 @@ impl RepositoryCreationTests { | |||
| 135 | Err(e) => { | 135 | Err(e) => { |
| 136 | return TestResult::new( | 136 | return TestResult::new( |
| 137 | test_name, | 137 | test_name, |
| 138 | "GRASP-01:git-http:38", | 138 | "GRASP-01:git-http:44", |
| 139 | "Relay SHOULD serve a webpage for existing repositories", | 139 | "Relay SHOULD serve a webpage for existing repositories", |
| 140 | ) | 140 | ) |
| 141 | .fail(format!("Failed to create repo fixture: {}", e)) | 141 | .fail(format!("Failed to create repo fixture: {}", e)) |
| @@ -156,7 +156,7 @@ impl RepositoryCreationTests { | |||
| 156 | None => { | 156 | None => { |
| 157 | return TestResult::new( | 157 | return TestResult::new( |
| 158 | test_name, | 158 | test_name, |
| 159 | "GRASP-01:git-http:38", | 159 | "GRASP-01:git-http:44", |
| 160 | "Relay SHOULD serve a webpage for existing repositories", | 160 | "Relay SHOULD serve a webpage for existing repositories", |
| 161 | ) | 161 | ) |
| 162 | .fail("Repository announcement missing d tag") | 162 | .fail("Repository announcement missing d tag") |
| @@ -168,7 +168,7 @@ impl RepositoryCreationTests { | |||
| 168 | Err(e) => { | 168 | Err(e) => { |
| 169 | return TestResult::new( | 169 | return TestResult::new( |
| 170 | test_name, | 170 | test_name, |
| 171 | "GRASP-01:git-http:38", | 171 | "GRASP-01:git-http:44", |
| 172 | "Relay SHOULD serve a webpage for existing repositories", | 172 | "Relay SHOULD serve a webpage for existing repositories", |
| 173 | ) | 173 | ) |
| 174 | .fail(format!("Failed to convert pubkey to npub: {}", e)) | 174 | .fail(format!("Failed to convert pubkey to npub: {}", e)) |
| @@ -179,7 +179,7 @@ impl RepositoryCreationTests { | |||
| 179 | if let Err(e) = check_webpage_served(relay_domain, &npub, &repo_id).await { | 179 | if let Err(e) = check_webpage_served(relay_domain, &npub, &repo_id).await { |
| 180 | return TestResult::new( | 180 | return TestResult::new( |
| 181 | test_name, | 181 | test_name, |
| 182 | "GRASP-01:git-http:38", | 182 | "GRASP-01:git-http:44", |
| 183 | "Relay SHOULD serve a webpage for existing repositories", | 183 | "Relay SHOULD serve a webpage for existing repositories", |
| 184 | ) | 184 | ) |
| 185 | .fail(format!("Webpage not served: {}", e)); | 185 | .fail(format!("Webpage not served: {}", e)); |
| @@ -187,7 +187,7 @@ impl RepositoryCreationTests { | |||
| 187 | 187 | ||
| 188 | TestResult::new( | 188 | TestResult::new( |
| 189 | test_name, | 189 | test_name, |
| 190 | "GRASP-01:git-http:38", | 190 | "GRASP-01:git-http:44", |
| 191 | "Relay SHOULD serve a webpage for existing repositories", | 191 | "Relay SHOULD serve a webpage for existing repositories", |
| 192 | ) | 192 | ) |
| 193 | .pass() | 193 | .pass() |
| @@ -214,7 +214,7 @@ impl RepositoryCreationTests { | |||
| 214 | Err(e) => { | 214 | Err(e) => { |
| 215 | return TestResult::new( | 215 | return TestResult::new( |
| 216 | test_name, | 216 | test_name, |
| 217 | "GRASP-01:git-http:38", | 217 | "GRASP-01:git-http:44", |
| 218 | "Relay SHOULD return 404 for repositories it doesn't host", | 218 | "Relay SHOULD return 404 for repositories it doesn't host", |
| 219 | ) | 219 | ) |
| 220 | .fail(format!("Failed to create repo fixture: {}", e)) | 220 | .fail(format!("Failed to create repo fixture: {}", e)) |
| @@ -226,7 +226,7 @@ impl RepositoryCreationTests { | |||
| 226 | Err(e) => { | 226 | Err(e) => { |
| 227 | return TestResult::new( | 227 | return TestResult::new( |
| 228 | test_name, | 228 | test_name, |
| 229 | "GRASP-01:git-http:38", | 229 | "GRASP-01:git-http:44", |
| 230 | "Relay SHOULD return 404 for repositories it doesn't host", | 230 | "Relay SHOULD return 404 for repositories it doesn't host", |
| 231 | ) | 231 | ) |
| 232 | .fail(format!("Failed to convert pubkey to npub: {}", e)) | 232 | .fail(format!("Failed to convert pubkey to npub: {}", e)) |
| @@ -239,7 +239,7 @@ impl RepositoryCreationTests { | |||
| 239 | if let Err(e) = check_404_for_nonexistent_repo(relay_domain, &npub, fake_repo_id).await { | 239 | if let Err(e) = check_404_for_nonexistent_repo(relay_domain, &npub, fake_repo_id).await { |
| 240 | return TestResult::new( | 240 | return TestResult::new( |
| 241 | test_name, | 241 | test_name, |
| 242 | "GRASP-01:git-http:38", | 242 | "GRASP-01:git-http:44", |
| 243 | "Relay SHOULD return 404 for repositories it doesn't host", | 243 | "Relay SHOULD return 404 for repositories it doesn't host", |
| 244 | ) | 244 | ) |
| 245 | .fail(format!("Expected 404, got: {}", e)); | 245 | .fail(format!("Expected 404, got: {}", e)); |
| @@ -247,7 +247,7 @@ impl RepositoryCreationTests { | |||
| 247 | 247 | ||
| 248 | TestResult::new( | 248 | TestResult::new( |
| 249 | test_name, | 249 | test_name, |
| 250 | "GRASP-01:git-http:38", | 250 | "GRASP-01:git-http:44", |
| 251 | "Relay SHOULD return 404 for repositories it doesn't host", | 251 | "Relay SHOULD return 404 for repositories it doesn't host", |
| 252 | ) | 252 | ) |
| 253 | .pass() | 253 | .pass() |
diff --git a/grasp-audit/src/specs/grasp01/spec_requirements.rs b/grasp-audit/src/specs/grasp01/spec_requirements.rs index 9a833d8..71b2d69 100644 --- a/grasp-audit/src/specs/grasp01/spec_requirements.rs +++ b/grasp-audit/src/specs/grasp01/spec_requirements.rs | |||
| @@ -71,87 +71,87 @@ pub const GRASP_01_REQUIREMENTS: &[SpecRequirement] = &[ | |||
| 71 | level: RequirementLevel::May, | 71 | level: RequirementLevel::May, |
| 72 | }, | 72 | }, |
| 73 | SpecRequirement { | 73 | SpecRequirement { |
| 74 | line: 20, | 74 | line: 26, |
| 75 | section: "Nostr Relay", | 75 | section: "Nostr Relay", |
| 76 | text: "MUST serve a NIP-11 document", | 76 | text: "MUST serve a NIP-11 document", |
| 77 | level: RequirementLevel::Must, | 77 | level: RequirementLevel::Must, |
| 78 | }, | 78 | }, |
| 79 | SpecRequirement { | 79 | SpecRequirement { |
| 80 | line: 22, | 80 | line: 28, |
| 81 | section: "Nostr Relay", | 81 | section: "Nostr Relay", |
| 82 | text: "MUST list each supported GRASP under `supported_grasps` in format `GRASP-XX` eg `GRASP-01` as a string array", | 82 | text: "MUST list each supported GRASP under `supported_grasps` in format `GRASP-XX` eg `GRASP-01` as a string array", |
| 83 | level: RequirementLevel::Must, | 83 | level: RequirementLevel::Must, |
| 84 | }, | 84 | }, |
| 85 | SpecRequirement { | 85 | SpecRequirement { |
| 86 | line: 23, | 86 | line: 29, |
| 87 | section: "Nostr Relay", | 87 | section: "Nostr Relay", |
| 88 | text: "MUST list repository acceptance criteria under `repo_acceptance_criteria` as a human readable string", | 88 | text: "MUST list repository acceptance criteria under `repo_acceptance_criteria` as a human readable string", |
| 89 | level: RequirementLevel::Must, | 89 | level: RequirementLevel::Must, |
| 90 | }, | 90 | }, |
| 91 | SpecRequirement { | 91 | SpecRequirement { |
| 92 | line: 24, | 92 | line: 30, |
| 93 | section: "Nostr Relay", | 93 | section: "Nostr Relay", |
| 94 | text: "MUST list brief summary of curation policy under `curation` if events are curated beyond generic SPAM prevention; otherwise `curation` MUST be omitted", | 94 | text: "MUST list brief summary of curation policy under `curation` if events are curated beyond generic SPAM prevention; otherwise `curation` MUST be omitted", |
| 95 | level: RequirementLevel::Must, | 95 | level: RequirementLevel::Must, |
| 96 | }, | 96 | }, |
| 97 | // Git Smart HTTP Service section | 97 | // Git Smart HTTP Service section |
| 98 | SpecRequirement { | 98 | SpecRequirement { |
| 99 | line: 28, | 99 | line: 34, |
| 100 | section: "Git Smart HTTP Service", | 100 | section: "Git Smart HTTP Service", |
| 101 | text: "MUST serve a git repository via an unauthenticated git smart http service at `/<npub>/<identifier>.git` for each accepted git repository announcement.", | 101 | text: "MUST serve a git repository via an unauthenticated git smart http service at `/<npub>/<identifier>.git` for each accepted git repository announcement.", |
| 102 | level: RequirementLevel::Must, | 102 | level: RequirementLevel::Must, |
| 103 | }, | 103 | }, |
| 104 | SpecRequirement { | 104 | SpecRequirement { |
| 105 | line: 30, | 105 | line: 36, |
| 106 | section: "Git Smart HTTP Service", | 106 | section: "Git Smart HTTP Service", |
| 107 | text: "MUST accept pushes via this service that match the latest repo state announcement on the relay, respecting the recursive maintainer set.", | 107 | text: "MUST accept pushes via this service that match the latest repo state announcement on the relay, respecting the recursive maintainer set.", |
| 108 | level: RequirementLevel::Must, | 108 | level: RequirementLevel::Must, |
| 109 | }, | 109 | }, |
| 110 | SpecRequirement { | 110 | SpecRequirement { |
| 111 | line: 32, | 111 | line: 38, |
| 112 | section: "Git Smart HTTP Service", | 112 | section: "Git Smart HTTP Service", |
| 113 | text: "MUST set repository HEAD per repo state announcement as soon as the git data related to that branch has been received.", | 113 | text: "MUST set repository HEAD per repo state announcement as soon as the git data related to that branch has been received.", |
| 114 | level: RequirementLevel::Must, | 114 | level: RequirementLevel::Must, |
| 115 | }, | 115 | }, |
| 116 | SpecRequirement { | 116 | SpecRequirement { |
| 117 | line: 34, | 117 | line: 40, |
| 118 | section: "Git Smart HTTP Service", | 118 | section: "Git Smart HTTP Service", |
| 119 | text: "MUST accept pushes via this service to `refs/nostr/<event-id>` but SHOULD reject if event exists on relay listing a different tip and MAY reject based on criteria such as size, SPAM prevention, etc. SHOULD delete and MAY garbage collect these refs if no corresponding git PR event or git PR update event, with a `c` tag that matches the ref tip, is accepted by relay within 20 minutes.", | 119 | text: "MUST accept pushes via this service to `refs/nostr/<event-id>` but SHOULD reject if event exists on relay listing a different tip and MAY reject based on criteria such as size, SPAM prevention, etc. SHOULD delete and MAY garbage collect these refs if no corresponding git PR event or git PR update event, with a `c` tag that matches the ref tip, is accepted by relay within 20 minutes.", |
| 120 | level: RequirementLevel::Must, | 120 | level: RequirementLevel::Must, |
| 121 | }, | 121 | }, |
| 122 | SpecRequirement { | 122 | SpecRequirement { |
| 123 | line: 36, | 123 | line: 42, |
| 124 | section: "Git Smart HTTP Service", | 124 | section: "Git Smart HTTP Service", |
| 125 | text: "MUST include `allow-reachable-sha1-in-want` and `allow-tip-sha1-in-want` in advertisement and serve available oids.", | 125 | text: "MUST include `allow-reachable-sha1-in-want` and `allow-tip-sha1-in-want` in advertisement and serve available oids.", |
| 126 | level: RequirementLevel::Must, | 126 | level: RequirementLevel::Must, |
| 127 | }, | 127 | }, |
| 128 | SpecRequirement { | 128 | SpecRequirement { |
| 129 | line: 38, | 129 | line: 44, |
| 130 | section: "Git Smart HTTP Service", | 130 | section: "Git Smart HTTP Service", |
| 131 | text: "SHOULD serve a webpage at the same endpoint linking to git nostr client(s) to browse the repository and a 404 page for repositories it doesn't host.", | 131 | text: "SHOULD serve a webpage at the same endpoint linking to git nostr client(s) to browse the repository and a 404 page for repositories it doesn't host.", |
| 132 | level: RequirementLevel::Should, | 132 | level: RequirementLevel::Should, |
| 133 | }, | 133 | }, |
| 134 | // CORS Support section | 134 | // CORS Support section |
| 135 | SpecRequirement { | 135 | SpecRequirement { |
| 136 | line: 44, | 136 | line: 50, |
| 137 | section: "CORS Support", | 137 | section: "CORS Support", |
| 138 | text: "Set `Access-Control-Allow-Origin: *` on ALL responses", | 138 | text: "Set `Access-Control-Allow-Origin: *` on ALL responses", |
| 139 | level: RequirementLevel::Must, | 139 | level: RequirementLevel::Must, |
| 140 | }, | 140 | }, |
| 141 | SpecRequirement { | 141 | SpecRequirement { |
| 142 | line: 45, | 142 | line: 51, |
| 143 | section: "CORS Support", | 143 | section: "CORS Support", |
| 144 | text: "Set `Access-Control-Allow-Methods: GET, POST` on ALL responses", | 144 | text: "Set `Access-Control-Allow-Methods: GET, POST` on ALL responses", |
| 145 | level: RequirementLevel::Must, | 145 | level: RequirementLevel::Must, |
| 146 | }, | 146 | }, |
| 147 | SpecRequirement { | 147 | SpecRequirement { |
| 148 | line: 46, | 148 | line: 52, |
| 149 | section: "CORS Support", | 149 | section: "CORS Support", |
| 150 | text: "Set `Access-Control-Allow-Headers: Content-Type` on ALL responses", | 150 | text: "Set `Access-Control-Allow-Headers: Content-Type` on ALL responses", |
| 151 | level: RequirementLevel::Must, | 151 | level: RequirementLevel::Must, |
| 152 | }, | 152 | }, |
| 153 | SpecRequirement { | 153 | SpecRequirement { |
| 154 | line: 47, | 154 | line: 53, |
| 155 | section: "CORS Support", | 155 | section: "CORS Support", |
| 156 | text: "Respond to OPTIONS requests with 204 No Content", | 156 | text: "Respond to OPTIONS requests with 204 No Content", |
| 157 | level: RequirementLevel::Must, | 157 | level: RequirementLevel::Must, |