Skip to content

Use a least-privilege SQL identity for the app - #73

Merged
mageroni merged 4 commits into
mainfrom
agentic-autofix/fix-code-scanning-alerts
Dec 1, 2026
Merged

mageroni merged 4 commits into
mainfrom
agentic-autofix/fix-code-scanning-alerts

Conversation

@github-agentic-autofix

@github-agentic-autofix github-agentic-autofix AI commented Nov 12, 2026 •

Copy link
Copy Markdown

The app’s database connection used the SQL server administrator login, giving a compromised app broader privileges than needed.

  • Deployment: Use the contained copilotSurveyApp database user and a separate secure sqlApplicationLoginPassword parameter.

  • Provisioning: Document the minimum database permissions required by the app:

    CREATE USER [copilotSurveyApp] WITH PASSWORD = '<application-password>';
    GRANT CREATE TABLE TO [copilotSurveyApp];
    GRANT ALTER ON SCHEMA::dbo TO [copilotSurveyApp];
    GRANT SELECT, INSERT, UPDATE ON SCHEMA::dbo TO [copilotSurveyApp];

Co-authored-by: mageroni <107436170+mageroni@users.noreply.github.com>
@github-agentic-autofix github-agentic-autofix AI changed the title [WIP] Fix code scanning alerts flagged in repository Use a least-privilege SQL identity for the app Nov 12, 2026
GitHub Agentic Autofix finished work on behalf of mageroni November 12, 2026 16:29
@github-agentic-autofix
github-agentic-autofix AI marked this pull request as ready for review November 12, 2026 16:29
Copilot AI adaptive review requested due to automatic review settings November 12, 2026 16:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The README’s SQL provisioning guidance leaves excessive permissions on the runtime identity and omits application-user setup and database-access instructions needed across both deployment paths.

2 open issues
What changed in this PR

This PR separates the Bicep-deployed app’s Azure SQL credentials from the server administrator account, reducing the app’s database privileges.

Changes:

  • Adds a secure application-password parameter and switches the connection string to copilotSurveyApp.
  • Documents manual user provisioning and permissions for table creation and survey reads/writes.
File Description
README.md Documents the contained database user and required permissions.
deployment/​template.bicep Adds separate application credentials and replaces administrator credentials in the app connection string.

Review effort: Max (auto)

Comment thread README.md Resolved
Comment thread README.md Resolved
mageroni and others added 2 commits December 1, 2026 16:18
Clarified SQL user creation and permissions for app deployment.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Updated instructions for managing permissions after table creation.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@mageroni
mageroni merged commit 0b7be73 into main Dec 1, 2026
5 of 6 checks passed
@mageroni
mageroni deleted the agentic-autofix/fix-code-scanning-alerts branch December 1, 2026 22:19
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.

3 participants