mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 13:17:08 +00:00
Fix GitHub grant checker not checking the correct ID (#665)
* Remove the need for a grant key * changelog
This commit is contained in:
parent
8071243696
commit
61ede0b97a
1
changelog.d/665.bugfix
Normal file
1
changelog.d/665.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Fix GitHub grant checker applying a different grant ID than the one it checks for.
|
@ -28,7 +28,6 @@ import { PermissionCheckFn } from ".";
|
||||
import { MinimalGitHubIssue, MinimalGitHubRepo } from "../libRs";
|
||||
import Ajv, { JSONSchemaType } from "ajv";
|
||||
import { HookFilter } from "../HookFilter";
|
||||
import { GrantChecker } from "../grants/GrantCheck";
|
||||
import { GitHubGrantChecker } from "../Github/GrantChecker";
|
||||
|
||||
const log = new Logger("GitHubRepoConnection");
|
||||
@ -399,7 +398,7 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
|
||||
);
|
||||
}
|
||||
const stateEventKey = `${validData.org}/${validData.repo}`;
|
||||
await new GrantChecker(as.botIntent, 'github').grantConnection(roomId, this.getGrantKey(validData.org, validData.repo));
|
||||
await new GitHubGrantChecker(as, github, tokenStore).grantConnection(roomId, { org: validData.org, repo: validData.repo });
|
||||
await intent.underlyingClient.sendStateEvent(roomId, this.CanonicalEventType, stateEventKey, validData);
|
||||
return {
|
||||
stateEventContent: validData,
|
||||
@ -1415,10 +1414,6 @@ export class GitHubRepoConnection extends CommandConnection<GitHubRepoConnection
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static getGrantKey(org: string, repo: string) {
|
||||
return `${this.CanonicalEventType}/${org}/${repo}`;
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
Loading…
x
Reference in New Issue
Block a user