Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
DATABASE_URL=postgres://postgres:docker@localhost:5432/config?sslmode=disable # Sample format (unused ENV variable)
PORT=8080
# CASBIN_DATABASE_URL=postgres://postgres:docker@localhost:5432/config?sslmode=disable # Sample format (unused ENV variable)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n --hidden \
  -g '!**/node_modules/**' \
  -g '!**/dist/**' \
  -g '!**/target/**' \
  '\bCASBIN_DATABASE_URL\b|\bCASBIN_DB_(USER|PASSWORD|HOST|NAME|POOL_SIZE)\b|\bCASBIN_POLICY_REFRESH_INTERVAL\b|\bROOT_ADMIN_EMAIL\b'

Repository: juspay/superposition

Length of output: 1032


🏁 Script executed:

sed -n '375,450p' crates/service_utils/src/middlewares/auth_z/casbin.rs

Repository: juspay/superposition

Length of output: 2608


🏁 Script executed:

rg -n 'fn get_database_url' crates/service_utils/src/middlewares/auth_z/

Repository: juspay/superposition

Length of output: 46


🏁 Script executed:

rg -n 'fn get_database_url' --type rust

Repository: juspay/superposition

Length of output: 134


🏁 Script executed:

sed -n '36,100p' crates/service_utils/src/db/utils.rs

Repository: juspay/superposition

Length of output: 1516


Remove CASBIN_DATABASE_URL from line 3.

The code uses individual CASBIN_DB_USER, CASBIN_DB_PASSWORD, CASBIN_DB_HOST, and CASBIN_DB_NAME environment variables (constructed via get_database_url() in crates/service_utils/src/db/utils.rs). CASBIN_DATABASE_URL has no consumers in the codebase and is already labeled as unused; remove it to prevent deployment confusion.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.env.example at line 3, Remove the unused CASBIN_DATABASE_URL entry from the
example env file to avoid confusion; update .env.example by deleting the
commented CASBIN_DATABASE_URL line and ensure consumers rely on the individual
vars CASBIN_DB_USER, CASBIN_DB_PASSWORD, CASBIN_DB_HOST, and CASBIN_DB_NAME (as
used by get_database_url() in crates/service_utils/src/db/utils.rs).

RUST_LOG=debug
AWS_ACCESS_KEY_ID=test
AWS_SECRET_ACCESS_KEY=test
Expand Down Expand Up @@ -36,6 +37,15 @@ AUTH_PROVIDER=DISABLED
# OIDC_ORG_TOKEN_ENDPOINT_FORMAT="http://localhost:8081/realms/<organisation>/protocol/openid-connect/token"
# OIDC_ORG_ISSUER_ENDPOINT_FORMAT="http://localhost:8081/realms/<organisation>"
AUTH_Z_PROVIDER=DISABLED
### Env(s) for Casbin AuthZ
# AUTH_Z_PROVIDER=CASBIN
# CASBIN_DB_USER=postgres
# CASBIN_DB_PASSWORD=docker
# CASBIN_DB_HOST=localhost:5432
# CASBIN_DB_NAME=config
# CASBIN_DB_POOL_SIZE=3
# CASBIN_POLICY_REFRESH_INTERVAL=60 # in seconds, default is 60 seconds
# ROOT_ADMIN_EMAIL=user@superposition.io
Comment on lines +40 to +48
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Need a follow up PR documenting the casbin setup in docusaurus

WORKER_ID=1
# MASTER_ENCRYPTION_KEY - add this for enabling secrets in local
REDIS_URL="http://localhost:6379"
Expand All @@ -50,7 +60,8 @@ REDIS_KEY_TTL=604800
#
# DB_PASSWORD
# SUPERPOSITION_TOKEN
# OIDC_CLIENT_SECRET - if using OIDC as auth provider
# OIDC_CLIENT_SECRET - if using OIDC as authn provider
# CASBIN_DB_PASSWORD - if using CASBIN as authz provider
# MASTER_ENCRYPTION_KEY - for using secrets
# PREVIOUS_MASTER_ENCRYPTION_KEY - needed for rotating secrets
#
Expand All @@ -59,4 +70,4 @@ REDIS_KEY_TTL=604800
#
## for local development, they already have a default value,
## to override, you can set them directly in .env file
#################################################
#################################################
Loading
Loading