Skip to content

Conversation

@sbchaos
Copy link
Contributor

@sbchaos sbchaos commented Jan 25, 2022

No description provided.

@coveralls
Copy link

coveralls commented Jan 25, 2022

Pull Request Test Coverage Report for Build 1839454157

  • 148 of 166 (89.16%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.4%) to 71.86%

Changes Missing Coverage Covered Lines Changed/Added Lines %
service/errors.go 42 47 89.36%
service/secret_service.go 40 46 86.96%
api/handler/v1beta1/error_helper.go 5 12 41.67%
Totals Coverage Status
Change from base Build 1744278826: 0.4%
Covered Lines: 5143
Relevant Lines: 7157

💛 - Coveralls

@ravisuhag ravisuhag requested review from arinda-arif and kushsharma and removed request for arinda-arif January 25, 2022 22:24
return models.SecretItemInfo{}, err
}

digest := cryptopasta.Hash("secret", cleartext)
Copy link
Member

Choose a reason for hiding this comment

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

As far as I remember, in RFC we mentioned digest should be generated from encrypted secret not plain text otherwise there are chances of exploitation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The question we had was for time, when the app key changes, at that time all the secret digests will change.
The hash function we are using is SHA512 which cannot be easily broken by brute-force attacks.
cc @sravankorumilli

Copy link
Member

@kushsharma kushsharma Jan 27, 2022

Choose a reason for hiding this comment

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

APP_KEY should never change, losing APP_KEY means invalidating all the secrets.

The hash function we are using is SHA512 which cannot be easily broken by brute-force attacks.

What? Yes, it is? The brute force depends on the secret length, short secrets can be broken in less than 10 mins and you don't even need brute force, exploitation will start from a rainbow dictionary attack.

I am really against generating digests from raw passwords.

Copy link
Contributor

Choose a reason for hiding this comment

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

Need to check on the rainbow dictionary attack, but I agree it would be good to generate hashes on the encrypted secrets

return specs, err
if err := repo.db.WithContext(ctx).Preload("Namespace").
Joins("LEFT JOIN namespace ON secret.namespace_id = namespace.id").
Where("secret.project_id = ? and secret.type = 'user'", repo.project.ID).Find(&resources).Error; err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

we should use enum here for secret type instead of hardcoded string user

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will use the enum

@kushsharma kushsharma changed the title feat(optimus): add api to list secrets, cleanup from last PR feat: add api to list secrets Jan 26, 2022
@sravankorumilli sravankorumilli self-requested a review February 14, 2022 05:05
@sravankorumilli sravankorumilli linked an issue Feb 14, 2022 that may be closed by this pull request
3 tasks
@sbchaos sbchaos merged commit 49a76e4 into main Feb 14, 2022
@sbchaos sbchaos deleted the secret-list-api branch February 14, 2022 06:18
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.

User should be able to list all secrets.

5 participants