- Timestamp:
- 08/08/2026 09:03:48 PM (4 weeks ago)
- Branches:
- main
- Children:
- a4b903a
- Parents:
- 29eb745
- git-author:
- Robin <roboburr@…> (08/08/2026 09:03:46 PM)
- git-committer:
- roboburr <roboburr@…> (08/08/2026 09:03:48 PM)
- Location:
- test
- Files:
-
- 2 edited
-
gated-propose-c2s.test.js (modified) (1 diff)
-
ssrf-allowlist.test.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
test/gated-propose-c2s.test.js
r29eb745 rdc0da72 61 61 }); 62 62 63 test('een Offer dat GEEN gate-voorstel is wordt niet stilletjes geslikt', async () => { 63 test('een Offer dat GEEN gate-voorstel is wordt NIET geclaimd', async () => { 64 // WAS: dit gaf 400 unsupported_offer, en dat was fout. Deze tak claimde elke 65 // Offer, dus ook de adoptie-handshake -- Barts honderd aanbiedingen liepen er 66 // meteen op stuk. Alleen claimen wat je herkent. 64 67 const uit = await AP.ingestOutboxActivity(site(), user, { type: 'Offer', object: { type: 'Note', content: 'hoi' } }); 65 assert.equal(uit.status, 400); 66 assert.equal(uit.error, 'unsupported_offer'); 68 assert.notEqual(uit && uit.error, 'unsupported_offer'); 69 }); 70 71 test('en een adoptie-Offer komt bij de handshake terecht', async () => { 72 // De regressie die Bart ving, als toets. Een Relationship-offer hoort NOOIT 73 // door de gate-tak afgevangen te worden. 74 const uit = await AP.ingestOutboxActivity(site(), user, { 75 type: 'Offer', to: [KIND], 76 object: { type: 'Relationship', subject: KIND, object: 'https://oma.test/ap/users/oma', relationship: 'shaer:Guardian' }, 77 }); 78 assert.notEqual(uit && uit.error, 'unsupported_offer'); 67 79 }); 68 80 -
test/ssrf-allowlist.test.js
r29eb745 rdc0da72 12 12 13 13 process.env.DATABASE_PATH = ':memory:'; 14 process.env.AP_ALLOW_HOSTS = '[::1]:3060'; 14 // Een poort waar met opzet NIETS op luistert. Eerst stond hier 3060, en toen de 15 // testkudde daar ging draaien slaagde de fetch en viel de toets om -- een toets 16 // die afhangt van wat er toevallig draait, bewijst niets. 17 process.env.AP_ALLOW_HOSTS = '[::1]:59321'; 15 18 const AP = await import('../src/services/ActivityPubService.js'); 16 19 … … 25 28 // niets op 3060, dus we verwachten een VERBINDINGSfout -- het bewijs is dat 26 29 // het geen ssrf-fout is. 27 const fout = await faalt('http://[::1]: 3060/u/w001');28 assert.ok(fout, 'er is wel degelijk een fout, want er luistert niets');30 const fout = await faalt('http://[::1]:59321/niets'); 31 assert.ok(fout, 'er is wel een fout, want er luistert niets op die poort'); 29 32 assert.ok(!String(fout).startsWith('ssrf-'), `door de poort, maar kreeg: ${fout}`); 30 33 }); … … 32 35 test('een adres dat NIET op de lijst staat blijft geweigerd', async () => { 33 36 // Zelfde machine, andere poort. Zou dit doorlaten, dan is de lijst een vlag. 34 assert.equal(await faalt('http://[::1]:306 1/u/w001'), 'ssrf-blocked-ip');37 assert.equal(await faalt('http://[::1]:3060/u/w001'), 'ssrf-blocked-ip'); 35 38 }); 36 39 37 40 test('en 127.0.0.1 evenmin, ook al is het dezelfde machine', async () => { 38 41 // De lijst opent een HOST:POORT, geen begrip van "lokaal". 39 assert.equal(await faalt('http://127.0.0.1: 3060/u/w001'), 'ssrf-blocked-ip');42 assert.equal(await faalt('http://127.0.0.1:59321/niets'), 'ssrf-blocked-ip'); 40 43 }); 41 44 … … 52 55 const mod = await import(`../src/services/ActivityPubService.js?leeg=${Date.now()}`); 53 56 let fout = null; 54 try { await mod.safeFetch('http://[::1]: 3060/u/w001'); } catch (e) { fout = e.message; }57 try { await mod.safeFetch('http://[::1]:59321/niets'); } catch (e) { fout = e.message; } 55 58 assert.equal(fout, 'ssrf-blocked-ip'); 56 59 process.env.AP_ALLOW_HOSTS = eerder;
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)