Skip to content

Show locked card warning#1388

Open
metsma wants to merge 1 commit intomasterfrom
courier
Open

Show locked card warning#1388
metsma wants to merge 1 commit intomasterfrom
courier

Conversation

@metsma
Copy link
Contributor

@metsma metsma commented Feb 11, 2026

IB-8631

Signed-off-by: Raul Metsma raul@metsma.ee

@metsma metsma force-pushed the courier branch 2 times, most recently from 2a0fe56 to d5cb457 Compare February 18, 2026 11:33
IB-8631

Signed-off-by: Raul Metsma <raul@metsma.ee>
auto changed = info[0xDF2F];
d->locked[QSmartCardData::PinType(type)] = changed && changed.data[0] == 0;
d->locked[QSmartCardData::PinType(type)] = (changed && changed.data[0] == 0);
// FIXME: remove from production

Check notice

Code scanning / CodeQL

FIXME comment Note

FIXME comment: remove from production

Copilot Autofix

AI 1 day ago

In general, the way to fix this issue is to remove the temporary/testing logic associated with the FIXME and rely solely on properly implemented behavior. Here, that means eliminating the environment-variable-based override of the locked state for Pin1Type.

Concretely, in client/QSmartCard.cpp inside THALESCard::updateCounters, we should delete the FIXME comment and the if block that checks PIN1_LOCKED and forcibly sets d->locked[...] = true. The rest of the function already sets locked based on the TLV field 0xDF2F, which is the intended production behavior. No new methods, imports, or definitions are needed; we are only removing code, not adding functionality.

Suggested changeset 1
client/QSmartCard.cpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/client/QSmartCard.cpp b/client/QSmartCard.cpp
--- a/client/QSmartCard.cpp
+++ b/client/QSmartCard.cpp
@@ -481,9 +481,6 @@
 			d->retry[QSmartCardData::PinType(type)] = quint8(retry.data[0]);
 			auto changed = info[0xDF2F];
 			d->locked[QSmartCardData::PinType(type)] = (changed && changed.data[0] == 0);
-			// FIXME: remove from production
-			if (type == QSmartCardData::Pin1Type && qEnvironmentVariableIsSet("PIN1_LOCKED"))
-				d->locked[QSmartCardData::PinType(type)] = true;
 		}
 		else
 			return false;
EOF
@@ -481,9 +481,6 @@
d->retry[QSmartCardData::PinType(type)] = quint8(retry.data[0]);
auto changed = info[0xDF2F];
d->locked[QSmartCardData::PinType(type)] = (changed && changed.data[0] == 0);
// FIXME: remove from production
if (type == QSmartCardData::Pin1Type && qEnvironmentVariableIsSet("PIN1_LOCKED"))
d->locked[QSmartCardData::PinType(type)] = true;
}
else
return false;
Copilot is powered by AI and may make mistakes. Always verify output.
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.

1 participant

Comments