mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	test: fixed improper signed_string reconstruction in .verify()
				
					
				
			This commit is contained in:
		| @@ -136,7 +136,7 @@ ActivityPub.verify = async (req) => { | |||||||
| 	// Re-construct signature string | 	// Re-construct signature string | ||||||
| 	const signed_string = headers.split(' ').reduce((memo, cur) => { | 	const signed_string = headers.split(' ').reduce((memo, cur) => { | ||||||
| 		if (cur === '(request-target)') { | 		if (cur === '(request-target)') { | ||||||
| 			memo.push(`${cur}: ${String(req.method).toLowerCase()} ${req.path}`); | 			memo.push(`${cur}: ${String(req.method).toLowerCase()} ${req.baseUrl}${req.path}`); | ||||||
| 		} else if (req.headers.hasOwnProperty(cur)) { | 		} else if (req.headers.hasOwnProperty(cur)) { | ||||||
| 			memo.push(`${cur}: ${req.headers[cur]}`); | 			memo.push(`${cur}: ${req.headers[cur]}`); | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -261,9 +261,11 @@ describe('ActivityPub integration', () => { | |||||||
| 		describe('.verify()', () => { | 		describe('.verify()', () => { | ||||||
| 			let uid; | 			let uid; | ||||||
| 			let username; | 			let username; | ||||||
|  | 			const baseUrl = nconf.get('relative_path'); | ||||||
| 			const mockReqBase = { | 			const mockReqBase = { | ||||||
| 				method: 'GET', | 				method: 'GET', | ||||||
| 				// path: ... | 				// path: ... | ||||||
|  | 				baseUrl, | ||||||
| 				headers: { | 				headers: { | ||||||
| 					// host: ... | 					// host: ... | ||||||
| 					// date: ... | 					// date: ... | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user