Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate creating a postgres user for DB scanning #765

Merged
merged 3 commits into from
Jan 21, 2025

Conversation

aloftus23
Copy link
Contributor

@aloftus23 aloftus23 commented Jan 17, 2025

🗣 Description

Add "Create scan user" to syncdb so the vulnerability scanners can access our schema.

The user will only be created if it doesn't already exist and the name/password are protected in the AWS Systems Manager parameter store.

The user is limited to these permissions:

Database Access:

  • The user can connect to the database.

Schema Access:

  • The user can access the public schema but cannot modify it.

Table Access:

  • The user can query (read) all existing tables in the public schema.
  • The user will also automatically have read access to any new tables created in the public schema in the future.

💭 Motivation and context

Allow scanners to access the database schema.

Created the user locally with syncdb and tested all of the permissions with these commands:
SELECT schema_name FROM information_schema.schemata WHERE schema_name = 'public';
SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';
SELECT * FROM "domain";

🧪 Testing

Passes pre-commit and github checks.

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All future TODOs are captured in issues, which are referenced
    in code comments.
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated
    to reflect the changes in this PR.
  • Tests have been added and/or modified to cover the changes in this PR.
  • All new and existing tests pass.

✅ Pre-merge checklist

  • Revert dependencies to default branches.
  • Finalize version.

✅ Post-merge checklist

  • Create a release.

@aloftus23 aloftus23 self-assigned this Jan 17, 2025
@aloftus23 aloftus23 marked this pull request as ready for review January 17, 2025 14:33
Copy link
Collaborator

@rapidray12 rapidray12 left a comment

Choose a reason for hiding this comment

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

pretty standard stuff. Where is the actual username and password stored?

Copy link
Contributor

@Matthew-Grayson Matthew-Grayson left a comment

Choose a reason for hiding this comment

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

Solid 😎

Copy link
Collaborator

@cduhn17 cduhn17 left a comment

Choose a reason for hiding this comment

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

LGTM - a flexible approach since its environment specific.

@schmelz21 schmelz21 merged commit 54f50b0 into develop Jan 21, 2025
15 checks passed
@schmelz21 schmelz21 deleted the AL-create-pg-scan-user branch January 21, 2025 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants