This repository has been archived by the owner on Sep 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Feat/security update august 2023 #661
Merged
Merged
Changes from all commits
Commits
Show all changes
86 commits
Select commit
Hold shift + click to select a range
b77b0f5
feat: add default price label when creating issue
wannacfuture dcb2f53
feat: minor changes
wannacfuture 624826b
feat: permits row security setup
seprintour d651c9b
fix: add all tables
seprintour 7d4cad6
feat: autopay fix
wannacfuture 785cc64
Merge branch 'development' into feat/autopay-fix
wannacfuture c5d10b6
feat: minor fix
wannacfuture 4f5bc5a
Merge branch 'feat/autopay-fix' of https://github.com/wannacfuture/ub…
wannacfuture 2cf8827
feat: minor fix
wannacfuture 2b163e6
feat: minor fix
wannacfuture a8f257d
Merge branch 'development' into feat/autopay-fix
wannacfuture 5c2bc71
Merge branch 'feat/autopay-fix' of https://github.com/wannacfuture/ub…
wannacfuture 4e0ab40
Update src/configs/strings.ts
wannacfuture 0c11d16
Update src/handlers/comment/handlers/index.ts
wannacfuture 0066ade
Merge branch 'feat/autopay-fix' of https://github.com/wannacfuture/ub…
wannacfuture 71548f5
feat: payment permit fix
wannacfuture 7750730
feat: autopay fix
wannacfuture dc0e4ef
feat: minor fix
wannacfuture 9a6d5de
feat: minor fix
wannacfuture 2203ffb
feat: minor fix
wannacfuture f6ea50c
Update src/configs/strings.ts
wannacfuture 2234351
Update src/handlers/comment/handlers/index.ts
wannacfuture b2ddc81
feat: payment permit fix
wannacfuture fab9755
Merge branch 'feat/autopay-fix' of https://github.com/wannacfuture/ub…
wannacfuture 123ed80
feat: revert parent issue
wannacfuture a8c0089
feat: minor change
wannacfuture 5d8ff92
feat: default config
wannacfuture 20d4bfd
Update src/handlers/comment/handlers/payout.ts
wannacfuture 79779ec
feat: user permission
wannacfuture efe2540
Merge branch 'feat/autopay-fix' of https://github.com/wannacfuture/ub…
wannacfuture 9c4f09b
Update ubiquibot-config-default.json
0x4007 67f6387
feat: import jsonc support
0x4007 dbb7031
feat: jsonc support
0x4007 b388897
fix: load jsonc
0x4007 e243999
fix: other defaults
0x4007 212eddd
fix: use max integer for defaults
0x4007 307ffb0
refactor: ordering of properties
0x4007 3e5d875
feat: full list from mdast
0x4007 691e79d
refactor: comments
0x4007 13a49c4
Merge branch 'development' into feat/autopay-fix
0x4007 e4b3bb2
Update src/handlers/payout/action.ts
0x4007 9999ffc
Update src/handlers/comment/handlers/payout.ts
0x4007 9d586a4
feat: minor fix
wannacfuture ef46849
Merge pull request #579 from wannacfuture/feat/autopay-fix
0x4007 b2ea8e2
Update ubiquibot-config.yml
0x4007 9a6f486
Merge branch 'development' into feat/add-default-price-label
wannacfuture d456927
feat: resolve conflicts
wannacfuture dd9b3f0
feat: fixed minor bugs
wannacfuture 1579293
Update src/configs/strings.ts
wannacfuture f13face
Update src/configs/strings.ts
wannacfuture ddfef0f
Merge branch 'development' into feat/parent-issue-fix
wannacfuture bfee1dd
feat: resolve conflicts
wannacfuture 105547f
Merge pull request #597 from wannacfuture/feat/parent-issue-fix
0x4007 674ada5
feat: slight change
wannacfuture 53a23d3
feat: minor fix
wannacfuture f819542
Merge branch 'development' into feat/parent-issue-fix
wannacfuture 505719f
Merge pull request #596 from ubiquity/pavlovcik-patch-2
0x4007 2abac46
Merge pull request #578 from seprintour/setup-policies
0x4007 1dc05fc
Merge branch 'development' into feat/parent-issue-fix
wannacfuture 182c273
Update src/handlers/pricing/action.ts
wannacfuture 144ed37
Update src/handlers/payout/action.ts
wannacfuture 43194ed
Merge pull request #598 from wannacfuture/feat/parent-issue-fix
0x4007 dfb48b1
Merge pull request #484 from wannacfuture/feat/add-default-price-label
0xcodercrane 7e9c469
fix: make it optional
0xcodercrane c1b218a
chore: make persistSession false
0xcodercrane 82a2e26
chore: any type
0xcodercrane d4d6a8d
fix: query regex
EtherealGlow 6aa91c8
fix: query regex
EtherealGlow 59a6fc7
Update query.ts
EtherealGlow 6268d44
fix: query regex
EtherealGlow a2daa60
fix: query regex
EtherealGlow bb80223
fix: switch back to json and remove strip-json-comments dependency
0x4007 61b4dd0
Merge branch 'development' into pavlovcik-patch-1
0x4007 2e31b3f
Merge pull request #594 from ubiquity/pavlovcik-patch-1
0x4007 24c11e7
Merge pull request #611 from EtherealGlow/development-7
0x4007 d4e2b96
chore: better logging
0xcodercrane 33a17f0
chore: new migration
0xcodercrane e9cfb82
Merge pull request #614 from ubiquity/complete-row-security
0xcodercrane 838e7a4
feat: new policy
0xcodercrane 84657d0
fix: with check
0xcodercrane 2051c1d
fix: insert policy
0xcodercrane 202a831
chore: docs update
0xcodercrane d56a523
chore: revert due to use of service key
0xcodercrane 59825e4
fix: check permission when closing issue (#622)
wannacfuture a3001a9
Merge commit '59825e4d7289a8da87bb3f568d9e69b183c821cf' into HEAD
0x4007 237686b
Update src/adapters/supabase/helpers/client.ts
0x4007 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ export enum IssueCommentCommands { | |
// Access Controls | ||
|
||
ALLOW = "/allow", | ||
AUTOPAY = "/autopay", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -314,6 +314,49 @@ export const removeAssignees = async (issue_number: number, assignees: string[]) | |
} | ||
}; | ||
|
||
export const checkUserPermissionForRepoAndOrg = async (username: string, context: Context): Promise<boolean> => { | ||
const permissionForRepo = await checkUserPermissionForRepo(username, context); | ||
const permissionForOrg = await checkUserPermissionForOrg(username, context); | ||
|
||
return permissionForOrg || permissionForRepo; | ||
}; | ||
|
||
export const checkUserPermissionForRepo = async (username: string, context: Context): Promise<boolean> => { | ||
const logger = getLogger(); | ||
const payload = context.payload as Payload; | ||
|
||
try { | ||
const res = await context.octokit.rest.repos.checkCollaborator({ | ||
owner: payload.repository.owner.login, | ||
repo: payload.repository.name, | ||
username, | ||
}); | ||
|
||
return res.status === 204; | ||
} catch (e: unknown) { | ||
logger.error(`Checking if user permisson for repo failed!, reason: ${e}`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return false; | ||
} | ||
}; | ||
|
||
export const checkUserPermissionForOrg = async (username: string, context: Context): Promise<boolean> => { | ||
const logger = getLogger(); | ||
const payload = context.payload as Payload; | ||
if (!payload.organization) return false; | ||
|
||
try { | ||
const res = await context.octokit.rest.orgs.checkMembershipForUser({ | ||
org: payload.organization.login, | ||
username, | ||
}); | ||
// @ts-expect-error This looks like a bug in octokit. (https://github.com/octokit/rest.js/issues/188) | ||
return res.status === 204; | ||
} catch (e: unknown) { | ||
logger.error(`Checking if user permisson for org failed!, reason: ${e}`); | ||
return false; | ||
} | ||
}; | ||
|
||
export const getUserPermission = async (username: string, context: Context): Promise<string> => { | ||
const logger = getLogger(); | ||
const payload = context.payload as Payload; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
supabase/migrations/20230803154507_setup_permits_policies.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
ALTER TABLE permits ENABLE ROW LEVEL SECURITY; | ||
ALTER TABLE wallets ENABLE ROW LEVEL SECURITY; | ||
ALTER TABLE users ENABLE ROW LEVEL SECURITY; | ||
ALTER TABLE issues ENABLE ROW LEVEL SECURITY; | ||
ALTER TABLE weekly ENABLE ROW LEVEL SECURITY; | ||
ALTER TABLE access ENABLE ROW LEVEL SECURITY; | ||
ALTER TABLE penalty ENABLE ROW LEVEL SECURITY; | ||
ALTER TABLE multiplier ENABLE ROW LEVEL SECURITY; | ||
|
||
CREATE POLICY "Enable read access for frontend" ON "public"."permits" | ||
AS PERMISSIVE FOR SELECT | ||
TO public | ||
USING (true) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just checking for a checklist? This should look for the UI element when GitHub shows that it is a "tracking issue" of other issues?
@wannacfuture bfee1dd rfc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, usually parent issue conatins this string:
- [ ] #issue_number
.and it is checking it via regexp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this achieved the specification. I was concerned about this UI element but perhaps it isn't necessary to implement.