Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case insensitive username comparison #421

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion signer/tuf_on_ci_sign/_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, path: str):
if not self._config:
raise click.ClickException(f"Settings file {path} not found")
try:
self.name = self._config["settings"]["user-name"]
self.name = self._config["settings"]["user-name"].lower()
if not self.name.startswith("@"):
self.name = f"@{self.name}"
self.push_remote = self._config["settings"]["push-remote"]
Expand Down
2 changes: 1 addition & 1 deletion signer/tuf_on_ci_sign/delegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def verify_signers(response: str) -> list[str]:

signers: list[str] = []
for s in response.split(","):
s = s.strip()
s = s.strip().lower()
if not s.startswith("@"):
s = f"@{s}"

Expand Down
32 changes: 16 additions & 16 deletions tests/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ repo_setup()
signer_setup()
{
USER=$1
SIGNER_DIR="$WORK_DIR/$TEST_NAME/$USER"
SIGNER_DIR="$WORK_DIR/$TEST_NAME/${USER,,}"
SIGNER_GIT="$SIGNER_DIR/git"

mkdir -p $SIGNER_GIT

# initialize softhsm: Make it look like we have HW key attached
echo "directories.tokendir = $SIGNER_DIR/tokens" > "$SIGNER_DIR/softhsm2.conf"
cp -r $SCRIPT_DIR/softhsm/tokens-$USER $SIGNER_DIR/tokens
cp -r "$SCRIPT_DIR/softhsm/tokens-${USER,,}" $SIGNER_DIR/tokens

# clone the test repository
git_clone $SIGNER_GIT $UPSTREAM_GIT "[email protected]" "$USER"
Expand All @@ -123,7 +123,7 @@ signer_init()
USER=$1
EVENT=$2

SIGNER_DIR="$WORK_DIR/$TEST_NAME/$USER"
SIGNER_DIR="$WORK_DIR/$TEST_NAME/${USER,,}"
SIGNER_GIT="$SIGNER_DIR/git"
export SOFTHSM2_CONF="$SIGNER_DIR/softhsm2.conf"

Expand Down Expand Up @@ -153,7 +153,7 @@ signer_add_delegation()
USER1=$1
EVENT=$2

SIGNER_DIR="$WORK_DIR/$TEST_NAME/$USER1"
SIGNER_DIR="$WORK_DIR/$TEST_NAME/${USER1,,}"
SIGNER_GIT="$SIGNER_DIR/git"
export SOFTHSM2_CONF="$SIGNER_DIR/softhsm2.conf"

Expand Down Expand Up @@ -184,7 +184,7 @@ signer_change_root_signer()
USER2=$2
EVENT=$3

SIGNER_DIR="$WORK_DIR/$TEST_NAME/$USER1"
SIGNER_DIR="$WORK_DIR/$TEST_NAME/${USER1,,}"
SIGNER_GIT="$SIGNER_DIR/git"
export SOFTHSM2_CONF="$SIGNER_DIR/softhsm2.conf"

Expand All @@ -211,7 +211,7 @@ signer_init_shorter_snapshot_expiry()
USER=$1
EVENT=$2

SIGNER_DIR="$WORK_DIR/$TEST_NAME/$USER"
SIGNER_DIR="$WORK_DIR/$TEST_NAME/${USER,,}"
SIGNER_GIT="$SIGNER_DIR/git"
export SOFTHSM2_CONF="$SIGNER_DIR/softhsm2.conf"

Expand Down Expand Up @@ -244,7 +244,7 @@ signer_init_offline_roles_in_signing_period()
USER=$1
EVENT=$2

SIGNER_DIR="$WORK_DIR/$TEST_NAME/$USER"
SIGNER_DIR="$WORK_DIR/$TEST_NAME/${USER,,}"
SIGNER_GIT="$SIGNER_DIR/git"
export SOFTHSM2_CONF="$SIGNER_DIR/softhsm2.conf"

Expand Down Expand Up @@ -280,15 +280,15 @@ signer_init_multiuser()
USER=$1
EVENT=$2

SIGNER_DIR="$WORK_DIR/$TEST_NAME/$USER"
SIGNER_DIR="$WORK_DIR/$TEST_NAME/${USER,,}"
SIGNER_GIT="$SIGNER_DIR/git"
export SOFTHSM2_CONF="$SIGNER_DIR/softhsm2.conf"

INPUT=(
"" # Configure root? [enter to continue]
"1" # Configure targets? [1: configure signers]
"1" # Chose offline signer
"@tuf-on-ci-user1, @tuf-on-ci-user2" # Enter signers
"@tuf-on-ci-user1, @tuf-on-ci-User2" # Enter signers
"2" # Enter threshold
"" # Configure targets? [enter to continue]
"1" # Configure online roles? [1: configure key]
Expand All @@ -313,7 +313,7 @@ signer_accept_invite()
USER=$1
EVENT=$2

SIGNER_DIR="$WORK_DIR/$TEST_NAME/$USER"
SIGNER_DIR="$WORK_DIR/$TEST_NAME/${USER,,}"
SIGNER_GIT="$SIGNER_DIR/git"
export SOFTHSM2_CONF="$SIGNER_DIR/softhsm2.conf"

Expand All @@ -339,7 +339,7 @@ signer_sign()

EVENT=$2

SIGNER_DIR="$WORK_DIR/$TEST_NAME/$USER"
SIGNER_DIR="$WORK_DIR/$TEST_NAME/${USER,,}"
SIGNER_GIT="$SIGNER_DIR/git"
export SOFTHSM2_CONF="$SIGNER_DIR/softhsm2.conf"

Expand All @@ -360,7 +360,7 @@ signer_add_targets()
USER=$1
EVENT=$2

SIGNER_DIR="$WORK_DIR/$TEST_NAME/$USER"
SIGNER_DIR="$WORK_DIR/$TEST_NAME/${USER,,}"
SIGNER_GIT="$SIGNER_DIR/git"
export SOFTHSM2_CONF="$SIGNER_DIR/softhsm2.conf"

Expand All @@ -382,7 +382,7 @@ signer_modify_targets()
USER=$1
EVENT=$2

SIGNER_DIR="$WORK_DIR/$TEST_NAME/$USER"
SIGNER_DIR="$WORK_DIR/$TEST_NAME/${USER,,}"
SIGNER_GIT="$SIGNER_DIR/git"
export SOFTHSM2_CONF="$SIGNER_DIR/softhsm2.conf"

Expand All @@ -403,7 +403,7 @@ signer_add_delegated_targets()
USER=$1
EVENT=$2

SIGNER_DIR="$WORK_DIR/$TEST_NAME/$USER"
SIGNER_DIR="$WORK_DIR/$TEST_NAME/${USER,,}"
SIGNER_GIT="$SIGNER_DIR/git"
export SOFTHSM2_CONF="$SIGNER_DIR/softhsm2.conf"

Expand All @@ -427,7 +427,7 @@ non_signer_change_online_delegation()
USER=$1
EVENT=$2

SIGNER_DIR="$WORK_DIR/$TEST_NAME/$USER"
SIGNER_DIR="$WORK_DIR/$TEST_NAME/${USER,,}"
SIGNER_GIT="$SIGNER_DIR/git"
export SOFTHSM2_CONF="$SIGNER_DIR/softhsm2.conf"

Expand Down Expand Up @@ -551,7 +551,7 @@ setup_test() {
mkdir -p $REPO_GIT $UPSTREAM_GIT $PUBLISH_DIR

repo_setup
signer_setup "user1"
signer_setup "User1"
signer_setup "user2"
}

Expand Down