Skip to content

Conversation

@jirhiker
Copy link
Member

Why

This PR addresses the following problem / context:

  • Use bullet points here

How

Implementation summary - the following was changed / added / removed:

  • Use bullet points here

Notes

Any special considerations, workarounds, or follow-up work to note?

  • Use bullet points here

Copilot AI review requested due to automatic review settings January 17, 2026 20:34
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@jirhiker jirhiker merged commit 6240860 into staging Jan 17, 2026
5 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses SQL injection vulnerabilities in the database initialization code by properly quoting role names when granting permissions.

Changes:

  • Added double-quote wrapping for role names in the GRANT statement to prevent SQL injection
  • Introduced a quoted variable to store the properly formatted role name

return
for member in members:
safe_member = member.replace("'", "''")
quoted = f'"{safe_member}"'
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The quoting implementation is incomplete. While double quotes are added, the variable is used inside a single-quoted SQL string, meaning the double quotes will be treated as literal characters rather than SQL delimiters. The quoted variable should be used in a formatted part of the SQL string (outside the single quotes), or the string interpolation should be restructured to properly insert the quoted identifier.

Copilot uses AI. Check for mistakes.
BEGIN
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = '{safe_member}') THEN
EXECUTE 'GRANT app_read TO {safe_member}';
EXECUTE 'GRANT app_read TO {quoted}';
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The {quoted} placeholder is inside a single-quoted string and will not be interpolated. It will be treated as the literal text '{quoted}' in the SQL command. This needs to be part of a formatted string (f-string) or use proper concatenation to insert the actual value of the quoted variable.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants