Compare commits

...

3 commits

Author SHA1 Message Date
575a23ba50 bump: version 1.0.0rc1 → 1.0.0 2026-06-21 18:15:16 +02:00
d28970852e fix: rougail dependencies 2026-06-21 18:14:48 +02:00
cbb3d091dd fix: black 2026-06-21 17:07:35 +02:00
5 changed files with 79 additions and 238 deletions

View file

@ -1,199 +1,44 @@
## 1.0.0rc1 (2026-06-16)
### Fix
- remove old structural dependency
## 0.1.0a32 (2026-06-11)
### Fix
- doc
## 0.1.0a31 (2026-05-04)
## 1.0.0 (2026-06-21)
### Feat
- multi layers
## 0.1.0a30 (2026-01-21)
### Fix
- transfert part a secretmanager in rougail
## 0.1.0a29 (2025-12-30)
### Fix
- update tests
## 0.1.0a28 (2025-12-23)
### Feat
- improvment + Calculation with hidden
## 0.1.0a27 (2025-12-22)
### Feat
- use Calculation
- doc
## 0.1.0a26 (2025-11-21)
### Fix
- ExtentionError => ExtensionError
## 0.1.0a25 (2025-11-06)
### Fix
- disable config if bitwarden is not selected
## 0.1.0a24 (2025-10-16)
### Fix
- path is uncalculated
## 0.1.0a23 (2025-10-16)
### Feat
- update rougail-structural-bitwarden
## 0.1.0a22 (2025-10-10)
### Feat
- use user_datas to load datas
## 0.1.0a21 (2025-06-20)
### Feat
- update rougail-structural-bitwarden package version
## 0.1.0a20 (2025-05-12)
### Fix
- black
## 0.1.0a19 (2025-05-02)
### Fix
- do not force use_data usage
## 0.1.0a18 (2025-04-09)
### Fix
- version
## 0.1.0a17 (2025-04-09)
### Fix
- better error message
## 0.1.0a16 (2025-04-04)
### Fix
- with ROUGAIL_BITWARDEN_MOCK_ENABLE variable, unix_user and password are different
## 0.1.0a15 (2025-03-19)
### Fix
- support item without username
## 0.1.0a14 (2025-03-19)
### Feat
- port to rougail secret_manager
- same behavour between bw et rbw
## 0.1.0a13 (2025-02-19)
### Fix
- MOCK
## 0.1.0a12 (2025-02-19)
### Fix
- MOCK
## 0.1.0a11 (2025-02-19)
### Fix
- if mock is active, do not search rbw or bw
## 0.1.0a10 (2025-02-17)
### Fix
- support hidden attribut
## 0.1.0a9 (2025-02-17)
### Fix
- support hidden attribut
## 0.1.0a8 (2025-02-17)
### Fix
- update structural plugin version
## 0.1.0a7 (2025-02-17)
### Feat
- support rbw and bw command line
## 0.1.0a6 (2025-02-13)
### Fix
- bitwarden key could be an invalid username/secret
## 0.1.0a5 (2025-02-13)
### Fix
- structural load
## 0.1.0a4 (2025-02-13)
### Fix
- structural version
## 0.1.0a2 (2025-02-13)
### Fix
- separate user-data and structural
## 0.1.0a1 (2025-02-12)
### Fix
- many improvment
## 0.1.0a0 (2025-02-05)
### Feat
- first version
### Fix
- rougail dependencies
- black
- remove old structural dependency
- doc
- transfert part a secretmanager in rougail
- update tests
- ExtentionError => ExtensionError
- disable config if bitwarden is not selected
- path is uncalculated
- black
- do not force use_data usage
- version
- better error message
- with ROUGAIL_BITWARDEN_MOCK_ENABLE variable, unix_user and password are different
- support item without username
- MOCK
- MOCK
- if mock is active, do not search rbw or bw
- support hidden attribut
- support hidden attribut
- update structural plugin version
- bitwarden key could be an invalid username/secret
- structural load
- structural version
- separate user-data and structural
- many improvment

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail.user_data_bitwarden"
version = "1.0.0rc1"
version = "1.0.0"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "Rougail user_data Bitwarden"
@ -24,8 +24,7 @@ classifiers = [
]
dependencies = [
"rougail >= 1.1,<2",
# "rougail-structural-bitwarden == 0.1.0a6",
"rougail >= 1.2.0,<2",
]
[project.urls]

View file

@ -1 +1 @@
__version__ = "1.0.0rc1"
__version__ = "1.0.0"

View file

@ -8,25 +8,26 @@ This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
from rougail.error import DictConsistencyError
from rougail.annotator.variable import Walk
class Annotator(Walk):
"""Annotate for bitwarden"""
level = 90
def __init__(
self,
objectspace,

View file

@ -32,11 +32,16 @@ from .i18n import _
class FakeBW:
def get_key(
self,
key_bitwarden: str,
leader: bool,
):
return [{'name': key_bitwarden, 'login': {'username': "example_login", 'password': "Ex4mpL3_P4ssw0rD"}}]
self,
key_bitwarden: str,
leader: bool,
):
return [
{
"name": key_bitwarden,
"login": {"username": "example_login", "password": "Ex4mpL3_P4ssw0rD"},
}
]
class RBW:
@ -48,10 +53,10 @@ class RBW:
return cpe.returncode == 0
def get_key(
self,
key_bitwarden: str,
leader: bool,
):
self,
key_bitwarden: str,
leader: bool,
):
keys = []
items = run_commandline(["rbw", "search", key_bitwarden]).strip()
if items:
@ -72,9 +77,7 @@ class RBW:
datas = []
for key in sorted(keys):
data = loads(
run_commandline(
["rbw", "get", key, "--raw", "--ignorecase"]
).strip()
run_commandline(["rbw", "get", key, "--raw", "--ignorecase"]).strip()
)
datas.append({"name": key, "login": data["data"]})
return datas
@ -97,10 +100,10 @@ class BW:
return False
def get_key(
self,
key_bitwarden: str,
*args,
):
self,
key_bitwarden: str,
*args,
):
return loads(
run_commandline(
["bw", "list", "items", "--search", key_bitwarden, "--nointeraction"]
@ -143,9 +146,10 @@ class RougailUserDataBitwarden:
self.errors = []
self.warnings = []
self.cache = {}
self.commands = {'rbw': RBW(),
'bw': BW(),
}
self.commands = {
"rbw": RBW(),
"bw": BW(),
}
def run(self):
values = {}
@ -153,13 +157,13 @@ class RougailUserDataBitwarden:
self.set_passwords(self.config.unrestraint, values)
return [
{
"source": 'Bitwarden',
"source": "Bitwarden",
"errors": self.errors,
"warnings": self.warnings,
"values": values,
"options": {
"secret_manager": True,
}
},
}
]
@ -186,7 +190,11 @@ class RougailUserDataBitwarden:
if option.isoptiondescription():
self.set_passwords(option, values)
elif option.information.get("bitwarden", False):
values[option.path(uncalculated=True)] = (set_password, self.cache, self.command)
values[option.path(uncalculated=True)] = (
set_password,
self.cache,
self.command,
)
def set_password(cache, command, *, option):
@ -195,9 +203,7 @@ def set_password(cache, command, *, option):
if leader:
key = key[0]
if not isinstance(key, str):
raise ConfigError(
_('the default value must be the Bitwarden item name')
)
raise ConfigError(_("the default value must be the Bitwarden item name"))
if key in cache:
data = cache[key]
if option.isfollower():
@ -208,27 +214,21 @@ def set_password(cache, command, *, option):
data = command.get_key(key, leader)
except Exception as exc:
raise ConfigError(
_(
'cannot execute the "{0}" commandline from Bitwarden: {1}'
).format(command, exc)
_('cannot execute the "{0}" commandline from Bitwarden: {1}').format(
command, exc
)
)
cache[key] = data.copy()
if not data:
raise ConfigError(
_('item "{0}" in Bitwarden is not found').format(
key
)
)
raise ConfigError(_('item "{0}" in Bitwarden is not found').format(key))
type_ = option.information.get("type")
if leader:
return [
get_value(key, type_, d) for d in data
]
return [get_value(key, type_, d) for d in data]
if len(data) != 1:
raise ConfigError(
_(
'several items found with name "{0}" in Bitwarden: "{1}"'
).format(key, '", "'.join([d["name"] for d in data]))
_('several items found with name "{0}" in Bitwarden: "{1}"').format(
key, '", "'.join([d["name"] for d in data])
)
)
return get_value(key, type_, data[0])
@ -241,9 +241,7 @@ def get_value(key_bitwarden: str, type_: str, data: dict) -> str:
value = data["login"]["username"]
except Exception as exc:
raise ConfigError(
_('unexpected datas "{0}" from Bitwarden: {1}').format(
key_bitwarden, exc
)
_('unexpected datas "{0}" from Bitwarden: {1}').format(key_bitwarden, exc)
)
if value is None:
if type_ == "secret":
@ -251,8 +249,6 @@ def get_value(key_bitwarden: str, type_: str, data: dict) -> str:
else:
bw_type = _("username")
raise ConfigError(
_('item "{0}" in Bitwarden has no {1}').format(
key_bitwarden, bw_type
)
_('item "{0}" in Bitwarden has no {1}').format(key_bitwarden, bw_type)
)
return value