-
Notifications
You must be signed in to change notification settings - Fork 166
Add fixed salt for admin password #1739
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
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| [AppSystemProp.TELEMETRY_MODE]: 'COLLECTOR', | ||
| [AppSystemProp.TELEMETRY_COLLECTOR_URL]: 'https://telemetry.openops.com/save', | ||
| [SharedSystemProp.ENABLE_HOST_VALIDATION]: 'true', | ||
| [AppSystemProp.OPENOPS_ADMIN_PASSWORD_SALT]: '$2b$10$6zuoB5d8Dz9bzV91gpuynO', |
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.
Same default value as in the Tables repository
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.
Pull request overview
This PR implements a fixed salt for admin password hashing to ensure consistent password hashes across deployments. The change introduces a new system property OPENOPS_ADMIN_PASSWORD_SALT and creates dedicated admin user creation/password update methods that use bcrypt with this static salt instead of the standard password hasher.
Key changes:
- Added
OPENOPS_ADMIN_PASSWORD_SALTsystem property with a default bcrypt salt value - Created
createAdminUser()andupdateAdminPassword()methods that use bcrypt with a fixed salt - Removed OpenOps Tables authentication synchronization logic from admin seeding
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/server/shared/src/lib/system/system-prop.ts | Added new system property enum for admin password salt |
| packages/server/shared/src/lib/system/system.ts | Defined default bcrypt salt value for admin password hashing |
| packages/server/api/src/app/user/user-service.ts | Implemented dedicated admin user methods using bcrypt with static salt |
| packages/server/api/src/app/database/seeds/seed-admin.ts | Updated admin seeding to use new admin-specific methods and removed external authentication sync |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile OverviewGreptile SummaryThis PR implements a fixed salt for admin password hashing to maintain password consistency across instances, particularly for authentication with OpenOps Tables. The changes introduce dedicated Key Changes:
Critical Security Concern:
The purpose of salting is defeated when the salt is static and known - bcrypt's strength comes from unique per-password salts. Confidence Score: 1/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Seed as seed-admin
participant UserService as user-service
participant DB as Database
participant System as system config
participant Bcrypt as bcrypt
Note over Seed: upsertAdminUser()
Seed->>UserService: getByOrganizationAndEmail(email)
UserService->>DB: Query user by email
alt User exists
Seed->>UserService: updateAdminPassword(id, newPassword)
UserService->>System: getStaticSalt()
System-->>UserService: $2b$10$6zuoB5d8Dz9bzV91gpuynO
UserService->>Bcrypt: hash(password, staticSalt)
Bcrypt-->>UserService: hashedPassword
UserService->>DB: Update user password
else User doesn't exist
Seed->>UserService: createAdminUser(email, password, ...)
UserService->>System: getStaticSalt()
System-->>UserService: $2b$10$6zuoB5d8Dz9bzV91gpuynO
UserService->>Bcrypt: hash(password, staticSalt)
Bcrypt-->>UserService: hashedPassword
UserService->>UserService: saveUser(newUser)
UserService->>DB: Save new admin user
end
Note over Seed,DB: Password now consistently hashed<br/>with fixed salt for Tables auth
|
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.
4 files reviewed, 3 comments
|



Part of OPS-3201