Skip to content

SQL User management avoid hardcoding secret #3765

Discussion options

You must be logged in to vote

Is it best to instead change the function to take an additional text input and actually pass the secret to the function via the API call?

That would be pointless, because then your client would define the secret for authentication... and could authenticate as anyone?

Say I have the below code in an SQL file, there doesnt seems to be any way that I can find on online documentation to set the reallyreallyreallyreallyverysafe to an environement variable so that the secret isnt copied to git.

Are you loading this SQL code via psql? If yes, you can use its \getenv command. Only available in PG 15+.

This would leave the secret in the pg_catalog table, because it's persisted with ALTER DATABASE

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@MonkOfTheFeels
Comment options

@wolfgangwalther
Comment options

@MonkOfTheFeels
Comment options

Answer selected by MonkOfTheFeels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants