Avoid logging raw OAuth configuration values - #2740
Avoid logging raw OAuth configuration values#2740Akanksha Jain (jainakanksha-msft) with Copilot wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: jainakanksha-msft <181211853+jainakanksha-msft@users.noreply.github.com>
|
Copilot, Please take this PR the rest of the way before it's ready for human review: Impact analysis — identify what changed (package name, old → new version) from the PR diff/description, search the codebase for where that dependency is actually used, and summarize what could be affected. |
Co-authored-by: jainakanksha-msft <181211853+jainakanksha-msft@users.noreply.github.com>
Done. Summary: Impact analysis: This PR is not a dependency version bump — it's a security/logging fix. It changes 3 log statements in Build/lint: Ran Tests: Added Test suite: Changelog: Added a bullet under Self-rating: 9/10 — correctness, coverage, changelog, and build/lint health are solid; docking one point since the added tests use hand-rolled mocks rather than existing sinon-based tooling (none is used elsewhere in this repo, so this matches existing conventions). Why it matters / risk if not applied: Without this fix, a misconfigured or unrecognized OAuth level would have its raw value written to warning logs, which CodeQL flags as a clear-text logging concern for configuration data. Left unaddressed, this keeps the security alert open and risks leaking internal configuration state into logs. |
|
Copilot , why test paths are like tests**/queue/unit/**QueueTokenAuthenticator.unit.test.ts not something like tests/**queue/authentication/**QueueTokenAuthenticator.unit.test.ts |
|
Copilot, why test paths are like tests**/queue/unit/**QueueTokenAuthenticator.unit.test.ts not something like tests/**queue/authentication/**QueueTokenAuthenticator.unit.test.ts |
Azurite’s tests are organized primarily by service and then by test type. For Queue, unit tests live under
Same rationale here: Azurite currently follows |
|
Copilot , I feel changelog entry is not concise entry, we had added a long story there. plus. |
Co-authored-by: jainakanksha-msft <181211853+jainakanksha-msft@users.noreply.github.com>
Addressed in commit
This gives both branch-level logging validation and overall runtime-path validation. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (2)
tests/queue/oauth.test.ts:597
- This test can pass without actually proving the "Unknown OAuth level" warning was emitted: it only waits for the log file to become non-empty, which might be satisfied by unrelated startup logs. Consider waiting specifically for the "Unknown OAuth level" entry (and asserting it exists) before asserting the raw configured value is absent to avoid false positives/flakiness.
let logContent = "";
for (let i = 0; i < 10; i++) {
if (await fs.pathExists(debugLogFilePath)) {
logContent = await fs.readFile(debugLogFilePath, "utf8");
if (logContent.length > 0) {
break;
}
}
await sleep(100);
}
assert.deepStrictEqual(
logContent.length > 0,
true
);
assert.deepStrictEqual(
logContent.includes(invalidOAuthLevel),
false
);
tests/queue/oauth.test.ts:534
configLogger(true, ...)and the temp log file cleanup aren’t protected by atry/finally. If an assertion throws before the end of the test, debug logging can remain enabled and the temp file may be left behind, potentially impacting subsequent tests.
const debugLogFilePath = "__queue_oauth_unknown_level__.log";
await fs.remove(debugLogFilePath);
configLogger(true, debugLogFilePath);
Copilot check this |
|
Copilot, shouldn't the same approach apply to the blob and table test, with the individual test removed now? |
Copilot check this, Copilot, shouldn't the same approach apply to the blob and table test, with the individual test removed now? |
…orrect approach Co-authored-by: jainakanksha-msft <181211853+jainakanksha-msft@users.noreply.github.com>
Digging into this, Given that, applying "the same approach" to blob/table and removing the individual unit tests would leave this branch untested. Instead, I reverted the queue integration test ( |
|
Copilot, could we please verify the through behaviour too with the logging. |
… level Co-authored-by: jainakanksha-msft <181211853+jainakanksha-msft@users.noreply.github.com>
Fair point — added a second test to each unit test file (blob, queue, table) that runs the actual |
Addresses a CodeQL clear-text logging alert where invalid OAuth configuration values could be written to warning logs during token authentication.
this.oauthvalue from “Unknown OAuth level” warnings.