Skip to content

Commit 3da1488

Browse files
committed
NSOL-6266: fixing path manipulation vulnerability from coverity scan
1 parent ec4367c commit 3da1488

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

netapp_dataops_traditional/netapp_dataops/traditional/gcnv/setup_gcnv_auth.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,13 @@ def setup_gcnv_auth() -> None:
9898

9999
# Step 4: Application Default Credentials
100100
print("\nStep 4/8 Application Default Credentials (browser will open)...")
101-
run(['gcloud', 'auth', 'application-default', 'login'], capture=True)
102-
cloudsdk_config = os.environ.get("CLOUDSDK_CONFIG", os.path.expanduser("~/.config/gcloud"))
103-
adc_file = os.path.join(cloudsdk_config, "application_default_credentials.json")
104-
if os.path.exists(adc_file):
101+
run(['gcloud', 'auth', 'application-default', 'login'])
102+
adc_file = os.path.realpath(os.path.expanduser("~/.config/gcloud/application_default_credentials.json"))
103+
if os.path.isfile(adc_file):
105104
os.chmod(adc_file, 0o600)
106-
print("ADC configured and credentials secured (chmod 600)")
105+
print("ADC configured and credentials secured (chmod 600)")
106+
else:
107+
print("ADC file not found; skipping chmod.")
107108

108109
# Step 5: Create service account
109110
print("\nStep 5/8 Create service account...")

0 commit comments

Comments
 (0)