Skip to content

Conversation

@dhruv-droid-r2
Copy link
Contributor

No description provided.

@sidPhoenix17 sidPhoenix17 self-requested a review March 4, 2025 14:08
class Meta:
constraints = [
models.UniqueConstraint(
fields=['key', 'account', 'is_active'],
Copy link
Contributor

Choose a reason for hiding this comment

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

uniqueness should not be on 'is_active' column
Remove this
At the time of creation always check if an 'active' key with the same name exists and return an error if it does
At the time of deletion set the key name to '{key}#inactive#{timestamp}' and is_active to false. But only allow the person who has created the key to change the state or the value

return value[:2] + "••••••" + value[-2:]


def _secret_to_proto(secret: Secret) -> SecretProto:
Copy link
Contributor

@droid-mohit droid-mohit Mar 12, 2025

Choose a reason for hiding this comment

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

move this to mode class and make it a property

is_active=secret.is_active
)

def _secret_to_proto_partial(secret: Secret) -> SecretProto:
Copy link
Contributor

Choose a reason for hiding this comment

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

move this to mode class and make it a property

secret_id = list(secret_ids)[0]

try:
secret = Secret.objects.get(id=secret_id, account=account, is_active=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

make a crud layer for secrets model

try:
secret = Secret.objects.get(id=secret_id, account=account, is_active=True)
try:
secrets_update_processor.update(secret, update_secret_ops)
Copy link
Contributor

Choose a reason for hiding this comment

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

updated_secrets should be returned by the update processor

Copy link
Contributor

@droid-mohit droid-mohit left a comment

Choose a reason for hiding this comment

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

Secret updates should be allowed only to the creator. The update processor currently doesnt take care of this. Handle this.

@dhruv-droid-r2
Copy link
Contributor Author

@droid-mohit
Made the following changes:

  • CRUD processor added for secrets
  • move to_proto to model method
  • removal of to_proto_partial in favour of adding param to to_proto
  • Strict ownership checks for updation
  • Show masked secret in get only to creating user, else secret value field is not even shown

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.

4 participants