Skip to content

command to retreive token#124

Open
pigam wants to merge 4 commits into
git-pkgs:mainfrom
pigam:main
Open

command to retreive token#124
pigam wants to merge 4 commits into
git-pkgs:mainfrom
pigam:main

Conversation

@pigam

@pigam pigam commented Jun 16, 2026

Copy link
Copy Markdown

closes #67

Instead of storing a token in plain text, a config entry can now reference a shell command prefixed with !. The command is executed at runtime and its stdout is used as the token, enabling integration with password managers such as rbw or pass.

forge auth login gains a Ctrl+E shortcut at the token prompt to enter a command interactively.

forge auth status displays the command.

@hramrach

Copy link
Copy Markdown

It would be nice to have an option to specify hostname or URL in the key command, and use the same command for all forges.

Some password databases come organized like that.

@pigam

pigam commented Jun 16, 2026

Copy link
Copy Markdown
Author

It would be nice to have an option to specify hostname or URL in the key command, and use the same command for all forges.

Some password databases come organized like that.

Can you give an example of what you want ?

For the moment :
token = value or token = !command. You want to add interpolation of other variables in the command, or is it something else ?
An example of what you image would be great !

@hramrach

Copy link
Copy Markdown

eg. in here

https://github.com/openSUSE/kernel-source/blob/b572de5eb963a125f55515c346881fd1e05caaf6/scripts/python/obsapi/obsapi.py#L121

You can see subprocess.check_output(['secret-tool', 'lookup', 'service', host, 'username', self.user])

That is same command used for every forge, and looked up by the 'service' tag. The 'host' argument is the host name of the forge.

This is a database that is arbitrarily created like this by another tool, the secret-tool is generic tagged storage that does not itself interpret the tags in any way.

@hramrach

Copy link
Copy Markdown

Your solution still makes it possible (hopefully) to manually configure for each forge something like

token = !secret-tool lookup service github.com type token

or somesuch but does not provide the option to configure such command globally replacing the 'github.com' with the hostname of the forge.

@pigam

pigam commented Jun 17, 2026

Copy link
Copy Markdown
Author

the command has now the environment FORGE_DOMAIN set to the domain, thanks @hramrach for the idea !

so your example can be written as:

token = !secret-tool lookup service $FORGE_DOMAIN type token

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.

feat: execute command to retrieve token

2 participants