Repository navigation
MM-49-Feature : Delinea Importer: checkout-comment flag - #2572
hpadalkar-ks merged 3 commits into
Conversation
| PLAIN = ( | ||
| (PARAM_AUTO_CHECKOUT, 'false'), | ||
| (PARAM_AUTO_COMMENT, SECRET_ACCESS_COMMENT), | ||
| (PARAM_AUTO_COMMENT, ''), |
There was a problem hiding this comment.
default should not be empty
| self._migrate_thycotic_teams(auth, params) | ||
|
|
||
| checkout_comment = kwargs.get('checkout_comment') | ||
| SecretAccessMode.set_view_comment(checkout_comment) |
There was a problem hiding this comment.
this should be done earlier in the flow
| import_parser.add_argument('--checkout-comment', dest='checkout_comment', action='store', default='Checking out for Keeper Import', | ||
| help='Thycotic/Delinea only: comment to add for secret with auto comment policy') |
There was a problem hiding this comment.
move it to the end of declarations, breaking groupin of keepass
| # Audit comment sent with every secret and secret-field read. | ||
| # Kept outside SecretAccessMode: an Enum class body would treat a plain | ||
| # assignment as another member, and member values are fixed at definition. | ||
| SECRET_ACCESS_COMMENT = 'Checking out for Keeper Import' |
There was a problem hiding this comment.
should be prefixed with DEFAULT_
| # Kept outside SecretAccessMode: an Enum class body would treat a plain | ||
| # assignment as another member, and member values are fixed at definition. | ||
| SECRET_ACCESS_COMMENT = 'Checking out for Keeper Import' | ||
| _secret_access_comment = SECRET_ACCESS_COMMENT |
There was a problem hiding this comment.
let's name it _secret_checkout_comment
| ) | ||
|
|
||
| @classmethod | ||
| def set_view_comment(cls, comment): # type: (Optional[str]) -> None |
There was a problem hiding this comment.
rename to set_checkout_comment
| self.assertEqual(endpoint, f'/v1/secrets/42?{PLAIN_QUERY}') | ||
|
|
||
| def test_checkout_comment_replaces_the_default_on_both_modes(self): | ||
| self.addCleanup(SecretAccessMode.set_view_comment, None) |
There was a problem hiding this comment.
this points to flaw in the flow, if you are having to cleanup before run.
Would a dependency injection work better in code?
There was a problem hiding this comment.
Agreed, that cleanup was a sign of global state. I removed it: the checkout comment is now injected into ThycoticAuth (from --checkout-comment) and passed explicitly to with_secret_access_params. No module state, no cleanup needed in tests.
a9b859e
into
Feature/MM-49-delinea-checkout-flag
Description
Add support for a new
--checkout-commentCLI flag on theimportcommand when importing secrets from Delinea Secret Server (--format=thycotic). This allows users to specify a custom comment that is logged or recorded when checking out/reading secrets in a Delinea environment during import. If--checkout-commentis omitted, it falls back to the default comment (Checking out for Keeper Import).Examples
With a custom checkout comment:
import --format=thycotic https://your-secret-server-hostname --checkout-comment="Test"Without
--checkout-comment(uses default"Checking out for Keeper Import"):