diff options
Diffstat (limited to 'server/tests/api/activitypub')
-rw-r--r-- | server/tests/api/activitypub/security.ts | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts index 8bde54a40..26b4545ac 100644 --- a/server/tests/api/activitypub/security.ts +++ b/server/tests/api/activitypub/security.ts | |||
@@ -79,9 +79,9 @@ describe('Test ActivityPub security', function () { | |||
79 | Digest: buildDigest({ hello: 'coucou' }) | 79 | Digest: buildDigest({ hello: 'coucou' }) |
80 | } | 80 | } |
81 | 81 | ||
82 | const { response } = await makePOSTAPRequest(url, body, baseHttpSignature(), headers) | 82 | const { statusCode } = await makePOSTAPRequest(url, body, baseHttpSignature(), headers) |
83 | 83 | ||
84 | expect(response.statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) | 84 | expect(statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) |
85 | }) | 85 | }) |
86 | 86 | ||
87 | it('Should fail with an invalid date', async function () { | 87 | it('Should fail with an invalid date', async function () { |
@@ -89,9 +89,9 @@ describe('Test ActivityPub security', function () { | |||
89 | const headers = buildGlobalHeaders(body) | 89 | const headers = buildGlobalHeaders(body) |
90 | headers['date'] = 'Wed, 21 Oct 2015 07:28:00 GMT' | 90 | headers['date'] = 'Wed, 21 Oct 2015 07:28:00 GMT' |
91 | 91 | ||
92 | const { response } = await makePOSTAPRequest(url, body, baseHttpSignature(), headers) | 92 | const { statusCode } = await makePOSTAPRequest(url, body, baseHttpSignature(), headers) |
93 | 93 | ||
94 | expect(response.statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) | 94 | expect(statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) |
95 | }) | 95 | }) |
96 | 96 | ||
97 | it('Should fail with bad keys', async function () { | 97 | it('Should fail with bad keys', async function () { |
@@ -101,9 +101,9 @@ describe('Test ActivityPub security', function () { | |||
101 | const body = activityPubContextify(getAnnounceWithoutContext(servers[1])) | 101 | const body = activityPubContextify(getAnnounceWithoutContext(servers[1])) |
102 | const headers = buildGlobalHeaders(body) | 102 | const headers = buildGlobalHeaders(body) |
103 | 103 | ||
104 | const { response } = await makePOSTAPRequest(url, body, baseHttpSignature(), headers) | 104 | const { statusCode } = await makePOSTAPRequest(url, body, baseHttpSignature(), headers) |
105 | 105 | ||
106 | expect(response.statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) | 106 | expect(statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) |
107 | }) | 107 | }) |
108 | 108 | ||
109 | it('Should reject requests without appropriate signed headers', async function () { | 109 | it('Should reject requests without appropriate signed headers', async function () { |
@@ -123,8 +123,8 @@ describe('Test ActivityPub security', function () { | |||
123 | for (const badHeaders of badHeadersMatrix) { | 123 | for (const badHeaders of badHeadersMatrix) { |
124 | signatureOptions.headers = badHeaders | 124 | signatureOptions.headers = badHeaders |
125 | 125 | ||
126 | const { response } = await makePOSTAPRequest(url, body, signatureOptions, headers) | 126 | const { statusCode } = await makePOSTAPRequest(url, body, signatureOptions, headers) |
127 | expect(response.statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) | 127 | expect(statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) |
128 | } | 128 | } |
129 | }) | 129 | }) |
130 | 130 | ||
@@ -132,9 +132,9 @@ describe('Test ActivityPub security', function () { | |||
132 | const body = activityPubContextify(getAnnounceWithoutContext(servers[1])) | 132 | const body = activityPubContextify(getAnnounceWithoutContext(servers[1])) |
133 | const headers = buildGlobalHeaders(body) | 133 | const headers = buildGlobalHeaders(body) |
134 | 134 | ||
135 | const { response } = await makePOSTAPRequest(url, body, baseHttpSignature(), headers) | 135 | const { statusCode } = await makePOSTAPRequest(url, body, baseHttpSignature(), headers) |
136 | 136 | ||
137 | expect(response.statusCode).to.equal(HttpStatusCode.NO_CONTENT_204) | 137 | expect(statusCode).to.equal(HttpStatusCode.NO_CONTENT_204) |
138 | }) | 138 | }) |
139 | 139 | ||
140 | it('Should refresh the actor keys', async function () { | 140 | it('Should refresh the actor keys', async function () { |
@@ -150,9 +150,9 @@ describe('Test ActivityPub security', function () { | |||
150 | const body = activityPubContextify(getAnnounceWithoutContext(servers[1])) | 150 | const body = activityPubContextify(getAnnounceWithoutContext(servers[1])) |
151 | const headers = buildGlobalHeaders(body) | 151 | const headers = buildGlobalHeaders(body) |
152 | 152 | ||
153 | const { response } = await makePOSTAPRequest(url, body, baseHttpSignature(), headers) | 153 | const { statusCode } = await makePOSTAPRequest(url, body, baseHttpSignature(), headers) |
154 | 154 | ||
155 | expect(response.statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) | 155 | expect(statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) |
156 | }) | 156 | }) |
157 | }) | 157 | }) |
158 | 158 | ||
@@ -183,9 +183,9 @@ describe('Test ActivityPub security', function () { | |||
183 | 183 | ||
184 | const headers = buildGlobalHeaders(signedBody) | 184 | const headers = buildGlobalHeaders(signedBody) |
185 | 185 | ||
186 | const { response } = await makePOSTAPRequest(url, signedBody, baseHttpSignature(), headers) | 186 | const { statusCode } = await makePOSTAPRequest(url, signedBody, baseHttpSignature(), headers) |
187 | 187 | ||
188 | expect(response.statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) | 188 | expect(statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) |
189 | }) | 189 | }) |
190 | 190 | ||
191 | it('Should fail with an altered body', async function () { | 191 | it('Should fail with an altered body', async function () { |
@@ -204,9 +204,9 @@ describe('Test ActivityPub security', function () { | |||
204 | 204 | ||
205 | const headers = buildGlobalHeaders(signedBody) | 205 | const headers = buildGlobalHeaders(signedBody) |
206 | 206 | ||
207 | const { response } = await makePOSTAPRequest(url, signedBody, baseHttpSignature(), headers) | 207 | const { statusCode } = await makePOSTAPRequest(url, signedBody, baseHttpSignature(), headers) |
208 | 208 | ||
209 | expect(response.statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) | 209 | expect(statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) |
210 | }) | 210 | }) |
211 | 211 | ||
212 | it('Should succeed with a valid signature', async function () { | 212 | it('Should succeed with a valid signature', async function () { |
@@ -220,9 +220,9 @@ describe('Test ActivityPub security', function () { | |||
220 | 220 | ||
221 | const headers = buildGlobalHeaders(signedBody) | 221 | const headers = buildGlobalHeaders(signedBody) |
222 | 222 | ||
223 | const { response } = await makePOSTAPRequest(url, signedBody, baseHttpSignature(), headers) | 223 | const { statusCode } = await makePOSTAPRequest(url, signedBody, baseHttpSignature(), headers) |
224 | 224 | ||
225 | expect(response.statusCode).to.equal(HttpStatusCode.NO_CONTENT_204) | 225 | expect(statusCode).to.equal(HttpStatusCode.NO_CONTENT_204) |
226 | }) | 226 | }) |
227 | 227 | ||
228 | it('Should refresh the actor keys', async function () { | 228 | it('Should refresh the actor keys', async function () { |
@@ -243,9 +243,9 @@ describe('Test ActivityPub security', function () { | |||
243 | 243 | ||
244 | const headers = buildGlobalHeaders(signedBody) | 244 | const headers = buildGlobalHeaders(signedBody) |
245 | 245 | ||
246 | const { response } = await makePOSTAPRequest(url, signedBody, baseHttpSignature(), headers) | 246 | const { statusCode } = await makePOSTAPRequest(url, signedBody, baseHttpSignature(), headers) |
247 | 247 | ||
248 | expect(response.statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) | 248 | expect(statusCode).to.equal(HttpStatusCode.FORBIDDEN_403) |
249 | }) | 249 | }) |
250 | }) | 250 | }) |
251 | 251 | ||