Skip to content

host_url option to CLI and Databricks validator#11

Merged
theztefan merged 4 commits into
advanced-security:mainfrom
sean-sinclair:databricks
Apr 22, 2026
Merged

host_url option to CLI and Databricks validator#11
theztefan merged 4 commits into
advanced-security:mainfrom
sean-sinclair:databricks

Conversation

@sean-sinclair

Copy link
Copy Markdown
Contributor

This pull request adds support for validating Databricks Personal Access Tokens, including a new validator, CLI integration, documentation, and comprehensive tests. The main changes are grouped below.

Databricks Token Validation Support:

  • Introduced the DatabricksTokenChecker class in validators/databricks_token.py, which validates Databricks Personal Access Tokens against a specified workspace URL, supporting both CLI flag and environment variable configuration for the host URL.
  • Updated the CLI (cli.py) to accept a new --host-url option, passing it through to validators and ensuring the host URL is available in all relevant commands (check_file, check_github, validate). [1] [2] [3] [4] [5]
  • Modified the Checker base class to accept and handle the host_url parameter, stripping trailing slashes and documenting its usage.

Documentation Updates:

  • Added Databricks token type to the supported secrets table and included example usage and instructions for Databricks token validation in the README.md. [1] [2]

Testing Enhancements:

  • Added tests for the new validator, including host URL configuration, environment variable fallback, and error handling when the host is not set (test_validators.py). Also updated validator metadata tests to include the new Databricks validator. [1] [2] [3]
  • Ensured the new validator is registered and discoverable in the registry tests.

…lidators

- Move --host-url from global CLI group to subcommand-level option on
  validate, check-file, and check-github commands
- Add _create_validator() helper using inspect.signature() to only pass
  kwargs that a validator's __init__ actually accepts, preventing
  breakage for validators that don't need host_url
- Revert host_url from base Checker class - validators that need it
  (e.g. DatabricksTokenChecker) handle it in their own __init__
- Fix README code fence (4 backticks -> 3) and update example to
  reflect --host-url as subcommand option
- Fix f-string in LOG.error to use %s style for consistency

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@theztefan

theztefan commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

@sean-sinclair Thanks for the contribution! Great work! 🎉

I (finally) looked at this! Made small adjustments to actually make the new host_url cli option as sub option to validate only, so it is not blidnly passed to all validators but rather the ones that implemented.

There are current validators that don't implement it and hardcode the hostname (say google API), but also ones that don't really need any hostname as they don't call anything really (example). Keeping it optional and as sub-command option gives us the flexibility we need. 😄

@theztefan theztefan closed this Apr 22, 2026
@theztefan theztefan reopened this Apr 22, 2026
@theztefan theztefan closed this Apr 22, 2026
@theztefan theztefan reopened this Apr 22, 2026
@theztefan theztefan merged commit a7bf87b into advanced-security:main Apr 22, 2026
8 checks passed
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.

2 participants