forked from mtusi2026/mtusi2026lab2
feat: lab2 done
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
meta {
|
||||
name: X-User-Id cannot spoof the session owner
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/api/v1/users/me
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
headers {
|
||||
Authorization: Bearer {{token}}
|
||||
X-User-Id: {{secondUserId}}
|
||||
}
|
||||
|
||||
docs {
|
||||
Владелец запроса определяется только токеном: X-User-Id с ID другого
|
||||
пользователя игнорируется, ответ содержит владельца сессии.
|
||||
}
|
||||
|
||||
tests {
|
||||
test("200 ok", function() {
|
||||
expect(res.status).to.equal(200);
|
||||
});
|
||||
|
||||
test("вернулся владелец сессии, а не подставленный ID", function() {
|
||||
expect(res.body.id).to.equal(bru.getVar("userId"));
|
||||
expect(res.body.id).to.not.equal(bru.getVar("secondUserId"));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user