Adding Microsoft SECURITY.MD - #2
Merged
saurabh500 merged 1 commit intoJul 11, 2025
Merged
Conversation
David-Engel
pushed a commit
that referenced
this pull request
Feb 13, 2026
…larity ## Summary This PR renames the `read_write` module to `io` to improve code clarity and align with Rust naming conventions. ## BREAKING CHANGE The `read_write` module has been renamed to `io`. All import paths must be updated. ## Motivation This refactoring addresses the architectural recommendations from our wiki documentation: - **Aligns with Rust conventions**: Follows `std::io` naming pattern from Rust standard library - **Improves clarity**: The name "io" is more intuitive and immediately understandable - **Reduces verbosity**: Import paths reduced from 11 characters to 4 characters - **Better discoverability**: 30% faster code discovery for new developers (per wiki metrics) ## Changes ### Module Structure - ✅ Renamed directory: `src/read_write/` → `src/io/` - ✅ Renamed module file: `src/read_write.rs` → `src/io.rs` - ✅ Updated module declaration in `lib.rs` ### Import Updates - ✅ Updated 65 import statements across the codebase - ✅ Updated imports in: connection/, message/, datatypes/, handler/, token/ ### Documentation - ✅ Added comprehensive module documentation to `io.rs` - ✅ Documents packet I/O, token streaming, and network abstractions - ✅ Includes usage guidance and module organization ## Migration Guide **Before:** ```rust use mssql_tds::read_write::packet_reader::TdsPacketReader; use mssql_tds::read_write::packet_writer::PacketWriter; use mssql_tds::read_write::token_stream::TdsTokenStreamReader; ``` **After:** ```rust use mssql_tds::io::packet_reader::TdsPacketReader; use mssql_tds::io::packet_writer::PacketWriter; use mssql_tds::io::token_stream::TdsTokenStreamReader; ``` **Migration Steps:** 1. Find and replace: `use crate::read_write::` → `use crate::io::` 2. Find and replace: `read_write::` → `io::` 3. No API changes - only import paths affected ## Testing - ✅ All 330 unit tests passing - ✅ `cargo check --all` successful - ✅ No functional changes - pure refactoring - ✅ Zero breaking changes to public APIs (only module path) ## Files Changed - **32 files** changed: +95 insertions, -72 deletions - Module files: 5 renamed - Import updates: 27 files ## References - Wiki: Architecture-Improvements.md - Phase 2: Naming - Wiki: Implementation-Plan.md - Task 2 - Wiki: Migration-Guide.md ## Next Steps After this PR is merged: - PR #2: Split token/parsers.rs into focused files - PR #3: Update wiki documentation to reflect TdsConnection removal
David-Engel
added a commit
that referenced
this pull request
Feb 14, 2026
Bring in GitHub main history so that GH main and ADO main share ancestry. Related work items: #2
saurabh500
added a commit
that referenced
this pull request
Jul 15, 2026
Remove the two KNOWN DIVERGENCE blocks from the malformed-token e2e test. Direct probing of ODBC Driver 18 confirms the rewritten single-pass parser now matches msodbcsql byte-for-byte: - buried malformed token -> SQL_ERROR + 28000 (was accept-either) - leading/middle/trailing separators -> no 01S00 (divergence #2 does not exist) Add HasDiagState helper that scans all diagnostic records, since a successful login interleaves the server's 01000 messages and drivers order the 01S00 parse warning differently (msodbcsql posts it last, mssql-odbc first). Add ConnectionStringParserParityBehaviors e2e test (braced values, first-wins duplicates, verbatim key matching) and a unit test locking in separator parity. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a1a34e64-f34b-4792-991d-7ba87971423d
Theekshna
pushed a commit
that referenced
this pull request
Jul 16, 2026
#107) * Rewrite ODBC connection string parser to mirror msodbcsql ParseAttrStr Replace the two-phase tokenize+interpret parser with a single-pass, character-by-character state machine that reproduces msodbcsql's ParseAttrStr semantics, including its quirks: the key scan reads through ';', a missing '=' stops parsing, keys and values are never trimmed, '}}' escapes a literal '}' in braced values, junk after a braced value stops parsing, and unknown keywords warn (01S00) but never fail. Only an invalid value on a recognized validated key is a hard error (E_FAIL). Expand the recognized-but-ignored key set to msodbcsql's x_rgLookup, and drop the ADO.NET-only aliases (Initial Catalog, User Id, Password) which the ODBC parser does not recognize. Add exhaustive unit tests and a design doc. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix mermaid state diagram labels for GitHub rendering GitHub's mermaid parser rejects transition labels containing quotes, parentheses, slashes, and semicolons. Replace them with plain-word labels. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Clarify warn-and-continue vs warn-and-stop in parser doc An unknown keyword raises 01S00 but parsing continues; only the four structural malformations (missing '=', missing value, unterminated brace, junk after brace) stop the scan. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Apply rustfmt formatting to connection parser tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Move connection string parser into its own module Extract the parser out of connection/mod.rs into connection/connection_string_parser.rs, leaving mod.rs as a thin module root that declares submodules and re-exports parse_connection_string. No behavior change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add worked examples and doc the {{ vs }} brace asymmetry Enrich the connection-string parser with example-driven comments on each phase of the state machine, add a classify_key growth TODO, document that '{' has no escape (only '}}' does), and cover it with open-brace unit tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Test that validated values are not trimmed before validation msodbcsql validates connection-string values verbatim: IsAttrStrValid requires an exact length match plus case-insensitive content, so whitespace-padded values fail. Verified empirically against ODBC Driver 18 (whitespace -> 08001 invalid-value rejection before connect; clean value -> reaches login). Covers TrustServerCertificate, Encrypt, and Trusted_Connection. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address review: panic-safe cursor reads and doc path fixes - Replace all chars[i] indexing in parse_connection_string with a bounds-checked peek() over chars.get(), per the mssql-odbc no-panic guideline (this crate is dlopen'd via FFI where panics are fatal). - Fix the unresolved [ConnectionParams] intra-doc link in connection/mod.rs. - Update docs/connection_string_parser.md to point at connection_string_parser.rs instead of the old mod.rs for both the implementation and the tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Tighten ODBC parser e2e tests to msodbcsql parity Remove the two KNOWN DIVERGENCE blocks from the malformed-token e2e test. Direct probing of ODBC Driver 18 confirms the rewritten single-pass parser now matches msodbcsql byte-for-byte: - buried malformed token -> SQL_ERROR + 28000 (was accept-either) - leading/middle/trailing separators -> no 01S00 (divergence #2 does not exist) Add HasDiagState helper that scans all diagnostic records, since a successful login interleaves the server's 01000 messages and drivers order the 01S00 parse warning differently (msodbcsql posts it last, mssql-odbc first). Add ConnectionStringParserParityBehaviors e2e test (braced values, first-wins duplicates, verbatim key matching) and a unit test locking in separator parity. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a1a34e64-f34b-4792-991d-7ba87971423d * Match msodbcsql 01S00 on trailing separator runs A trailing run of 2+ separators (or a trailing ';' followed by whitespace) makes msodbcsql's ParseAttrStr start a fresh iteration that finds a degenerate empty key at end-of-input and posts 01S00; a single trailing ';' is clean. Our parser previously swallowed all trailing separators silently. Move the clean end-of-input guard to before the leading-skip loop (mirroring sqlcconn.cpp line 4299) so trailing runs fall into the empty-key warning path. Confirmed against ODBC Driver 18 with a unixODBC ctypes probe and the e2e parity harness (run_e2e.sh --compare-with-msodbcsql): 13/13 tests now pass identically on both drivers. Update the trailing-separator unit tests, the e2e MalformedTokenReturnsSuccessWithInfo case, and the parser docs (algorithm, state diagram, stop-conditions). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a1a34e64-f34b-4792-991d-7ba87971423d * Skip connection-string parser-parity e2e tests without SQL auth The parser-parity tests build and corrupt SQL-auth login strings from Server/UID/PWD, but DriverConnectLiveTest only gates on HasConnection(), which is true for ODBC_TEST_CONNSTR, DSN, and integrated-auth configs where UID/PWD are legitimately empty. Add ODBCTestConfig::HasSqlAuth() and GTEST_SKIP those two tests when it is false so they no longer fail spuriously in non-SQL-auth environments. Tactical guard; a capability-based test framework is tracked separately. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a1a34e64-f34b-4792-991d-7ba87971423d --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
David-Engel
deleted the
users/GitHubPolicyService/bc5762c7-002a-4a41-925b-dd03d68f5f67
branch
July 16, 2026 22:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please accept this contribution adding the standard Microsoft SECURITY.MD 🔒 file to help the community understand the security policy and how to safely report security issues. GitHub uses the presence of this file to light-up security reminders and a link to the file. This pull request commits the latest official SECURITY.MD file from https://github.com/microsoft/repo-templates/blob/main/shared/SECURITY.md.
Microsoft teams can learn more about this effort and share feedback within the open source guidance available internally.