mirror of
https://github.com/outline/outline.git
synced 2026-11-22 22:02:35 +03:00
chore: Consistent policy checks in integration callbacks (#14221)
This commit is contained in:
1 parent
45bf9e290c
commit
cf578accf9
8 files changed
+79
-4
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { buildUser } from "@server/test/factories";
|
||||
import { buildUser, buildViewer } from "@server/test/factories";
|
||||
import { getTestServer } from "@server/test/support";
|
||||
import { SetupAction } from "./schema";
|
||||
|
||||
@@ -74,4 +74,21 @@ describe("#github.callback", () => {
|
||||
);
|
||||
expect(res.status).toEqual(400);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["member", buildUser],
|
||||
["viewer", buildViewer],
|
||||
])("should not allow a %s to create an integration", async (_, build) => {
|
||||
const user = await build();
|
||||
const state = JSON.stringify({ teamId: user.teamId, nonce: "nonce" });
|
||||
const res = await server.get(
|
||||
`/api/github.callback?state=${encodeURIComponent(state)}&code=123&setup_action=${SetupAction.install}&installation_id=1`,
|
||||
user,
|
||||
{
|
||||
redirect: "manual",
|
||||
headers: { Cookie: "githubOAuthNonce=nonce" },
|
||||
}
|
||||
);
|
||||
expect(res.status).toEqual(403);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user