Skip to content

Commit e8d565c

Browse files
authored
FIX: Access Token Issue (EntraID Auth) (#285)
### Work Item / Issue Reference <!-- IMPORTANT: Please follow the PR template guidelines below. For mssql-python maintainers: Insert your ADO Work Item ID below (e.g. AB#37452) For external contributors: Insert Github Issue number below (e.g. #149) Only one reference is required - either GitHub issue OR ADO Work Item. --> <!-- mssql-python maintainers: ADO Work Item --> > AB#<WORK_ITEM_ID> <!-- External contributors: GitHub Issue --> > GitHub Issue: #286 ------------------------------------------------------------------- ### Summary <!-- Insert your summary of changes below. Minimum 10 characters required. --> Reintroduce Static Buffer as a temporary hotfix, will keep a new task to remove static tokens. <!-- ### PR Title Guide > For feature requests FEAT: (short-description) > For non-feature requests like test case updates, config updates , dependency updates etc CHORE: (short-description) > For Fix requests FIX: (short-description) > For doc update requests DOC: (short-description) > For Formatting, indentation, or styling update STYLE: (short-description) > For Refactor, without any feature changes REFACTOR: (short-description) > For release related changes, without any feature changes RELEASE: #<RELEASE_VERSION> (short-description) ### Contribution Guidelines External contributors: - Create a GitHub issue first: https://github.com/microsoft/mssql-python/issues/new - Link the GitHub issue in the "GitHub Issue" section above - Follow the PR title format and provide a meaningful summary mssql-python maintainers: - Create an ADO Work Item following internal processes - Link the ADO Work Item in the "ADO Work Item" section above - Follow the PR title format and provide a meaningful summary -->
1 parent 7352ab2 commit e8d565c

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

mssql_python/pybind/connection/connection.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ SQLRETURN Connection::setAttribute(SQLINTEGER attribute, py::object value) {
173173
LOG("Setting SQL attribute");
174174
SQLPOINTER ptr = nullptr;
175175
SQLINTEGER length = 0;
176-
std::string buffer; // to hold sensitive data temporarily
176+
static std::string buffer; // to hold sensitive data temporarily
177177

178178
if (py::isinstance<py::int_>(value)) {
179179
int intValue = value.cast<int>();
@@ -196,10 +196,6 @@ SQLRETURN Connection::setAttribute(SQLINTEGER attribute, py::object value) {
196196
LOG("Set attribute successfully");
197197
}
198198

199-
// Zero out sensitive data if used
200-
if (!buffer.empty()) {
201-
std::fill(buffer.begin(), buffer.end(), static_cast<char>(0));
202-
}
203199
return ret;
204200
}
205201

@@ -383,4 +379,4 @@ py::object ConnectionHandle::getInfo(SQLUSMALLINT infoType) const {
383379
ThrowStdException("Connection object is not initialized");
384380
}
385381
return _conn->getInfo(infoType);
386-
}
382+
}

0 commit comments

Comments
 (0)