phasehq / console

Application secrets and configuration management for developers.
https://phase.dev
Other
454 stars 24 forks source link

Print the name of the service token in application access logs #114

Closed nimish-ks closed 2 months ago

nimish-ks commented 10 months ago

Is your feature request related to a problem?

Currently all log events created by Service Tokens are displayed as 🔑 Service token which makes it hard to trace access.

image

Describe the solution you'd like

  1. Display the name of the actual Service Token used to access secrets in the logs
  2. Provide a link to similar to View this secret to view the Service Token in the App > Service Tokens screen

image

Dhoni77 commented 10 months ago

Hi @nimish-ks I would like to work on this

nimish-ks commented 10 months ago

@Dhoni77 All yours! Feel free to reach out to us on slack if you need any help / additional context -- https://slack.phase.dev

rohan-chaturvedi commented 10 months ago

@Dhoni77 Here's some more context on implementing this: The SecretEvent model is what we use to track CRUD changes to Secrets: https://github.com/phasehq/console/blob/f63640b21400d2b2305cd359f8f05abdf9082f74/backend/api/models.py#L309

As you can see, there's a user foreign key. If this user key is null, we assume this event was created by a service token. Instead, we need to create an additional, nullable 'token' foreign key for the Service Token model: https://github.com/phasehq/console/blob/f63640b21400d2b2305cd359f8f05abdf9082f74/backend/api/models.py#L243

Then, we'll need to handle the following:

As Nimish, said, feel free to join our Slack if you'd like any more context or have any questions!

nishaaannnt commented 2 months ago

Hello, @rohan-chaturvedi , we would like to work on this issue under Fosshack 2024. Me and my teammate @viku3150 are well versed with the tech stack and the codebase and hence would like to take this forward. Please assign us for the same. Thank you.

nishaaannnt commented 2 months ago
Screenshot 2024-07-27 at 1 55 14 PM

@nimish-ks @rohan-chaturvedi Done. Was trying to recreate the issue and found it done. Also got it verified on call with @nimish-ks

rohan-chaturvedi commented 2 months ago

Screenshot 2024-07-27 at 1 55 14 PM @nimish-ks @rohan-chaturvedi Done. Was trying to recreate the issue and found it done. Also got it verified on call with @nimish-ks

Great!