Skip to content

Fix 7 bugs in configuration.py#130

Open
luke-hagar-sp wants to merge 1 commit intomainfrom
fix/cross-sdk-bug-fixes
Open

Fix 7 bugs in configuration.py#130
luke-hagar-sp wants to merge 1 commit intomainfrom
fix/cross-sdk-bug-fixes

Conversation

@luke-hagar-sp
Copy link
Contributor

Summary

Cross-SDK audit identified 7 bugs in sailpoint/configuration.py, ranging from critical (auth errors silently swallowed, SSL verification impossible to disable) to low (dead code, naming conventions).

Bug Fixes

High

P1: verify_ssl=False impossible to set

  • sailpoint/configuration.py L47: The check configurationParams.verify_ssl if configurationParams and configurationParams.verify_ssl else True treats False as falsy, falling through to True. SSL verification could never be disabled.
  • sailpoint/configuration.py L85: self.verify_ssl = True unconditionally overwrote the value set on L47.
  • Fix: Changed to is not None check and removed the unconditional overwrite.

P2: get_access_token swallows auth errors, returns None

  • sailpoint/configuration.py L221-222: except Exception as e: print(...) caught the deliberately raised 401/error exceptions from lines 215-219, so authentication failures were silently swallowed and None was returned as the access token.
  • Fix: Narrowed catch to except urllib3.exceptions.HTTPError as e: to only catch connection-level errors, letting auth errors propagate.

Medium

P3: KeyError on malformed config.json

  • sailpoint/configuration.py L176-178: Direct dict access data["BaseURL"] throws KeyError if the key is missing from config.json.
  • Fix: Changed to data.get("BaseURL") (same for ClientId, ClientSecret).

Low

P4: @classmethod methods use self instead of cls

  • sailpoint/configuration.py L137, L149, L170, L184: Four @classmethod-decorated methods used self as their first parameter instead of cls. While Python doesn't enforce this, it's incorrect by convention and confusing.
  • Fix: Changed self to cls in all four methods.

P5: str(None) + "/oauth/token" produces "None/oauth/token"

  • sailpoint/configuration.py L165: When config.base_url is None, str(config.base_url) + "/oauth/token" produces the string "None/oauth/token".
  • Fix: Guarded with (config.base_url + "/oauth/token") if config.base_url else None.

P6: Bare string no-op ("File is present")

  • sailpoint/configuration.py L173: The expression ("File is present") evaluates to a string but does nothing (not a function call, not assigned).
  • Fix: Removed.

P7: Duplicate userAuth block in auth_settings()

Verification

  • python -m py_compile sailpoint/configuration.py passes clean
  • urllib3 import error when running full import is a pre-existing env issue (missing dependency), unrelated to changes

Test plan

  • Verify Configuration(ConfigurationParams(verify_ssl=False)) correctly sets verify_ssl to False
  • Verify auth errors (401) from get_access_token propagate instead of being swallowed
  • Test with a malformed config.json (missing keys) to confirm no KeyError
  • Verify config loading from environment variables still works

🤖 Generated with Claude Code

- Fix verify_ssl=False impossible to set (falsy check + unconditional overwrite)
- Narrow exception catch to urllib3.exceptions.HTTPError so auth errors propagate
- Use dict.get() to prevent KeyError on malformed config.json
- Fix @classmethod methods using self instead of cls
- Guard token_url construction against None base_url
- Remove bare string no-op ("File is present")
- Remove duplicate userAuth block in auth_settings()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@luke-hagar-sp luke-hagar-sp force-pushed the fix/cross-sdk-bug-fixes branch from e61f2ad to 7686315 Compare March 5, 2026 18:38
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.

1 participant