-
Notifications
You must be signed in to change notification settings - Fork 144
Add safe URI decoding utilities to prevent malformed cookie errors #1447
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
Conversation
* WIP * Refactor imports Added eslint Added folder structure
* Adding Exporters * WIP * WIP * WIP * WIP * WIP * WIP * WIP * Revert "Merge branch 'hectorhdzg/exporters' of https://github.com/microsoft/ApplicationInsights-node.js into hectorhdzg/exporters" This reverts commit 0528c69, reversing changes made to 552fd3f. * Removing unnecessary static classes and methods * Use ES2017 * Update Sinon * Lower case folder and file names Added index to most folders Code format * Prettier and moved Statsbeat and Hearbeat to library * Tests update
* WIP * Enabling most of the tests Use singleton Logger Use batch in handlers * Add test execution in preview * Lower case paths * Add clean step * Update * Add artifact for debugging * Upload artifact before tests * Rename test folder to force lower case name * Lower case paths in tests * Lower case paths * Lower case path * Fix hardcoded paths in tests * Fix tests
* Automatic tracking of HTTP through OpenTelemetry * Removing flush options, store on crash need to be supported in OpenTelemetry SDK * Addressing comments * typo * sudo * Test * path * Test * Test * test * test * Test path * Test * test * Test * Test * sudo tests * test * test * Remove pretest * Removing sudo
* WIP * WIP * WIP * Addressing comments * Addressing comments * Resolve even if buffer is empty
* WIP * Lower case files * WIP * lower case * Workflows update * Lower case name * test * Remove sequence step * Postgres * Removing perf run * Remove long run
* Use Resource instead of Context Shim rearrangement Enable Azure properties population * wip * Adding index root file
* WIP * Adding tests * WIP * Fix tests * Add internal SDK version to all telemetry * Adding hex parsing for trace -id and span id * Rvert hex converstion as it involves further investigation, will track separately
* WIP * WIP * WIP * WIP * Fixing tests * Adding tests * Adding disablement tests * Run test using node 16
* WIP * WIP * Adding tests
* WIP * WIP * WIP * WIP * Added span processor Added ignore callback in Metrics instrumentor Added tests * Update * Typo
* WIP * Refactor metric generators and handlers * WIP * Update tests * Update dependencies * Added live metrics tests, added collection folder * Typo * Updating test * Remove noise in tests
* Remove unused configs, add default values * Add config in functional tests * Enable publishers * Update wait in test
* Update Native Metrics Configuration * Fix config check * Disable tests * Add try/catch in Native Metrics * Update mocha * WIP * Test against node.js 14. 16 and 18 * Native metrics not available in node.js 18 * WIP * Use fake emitter
* Allow configuration of instrumentations * Add sample rate as Span attribute in sampler * Fix merge issues * Avoid native metrics to run in tests
* Standard Metrics * Update standard metric names
* Release 3.7.0 * Fix test. * Update README.md * Update README.md
* Add support for filtering requests and dependencies. * Move span processing logic.
* Update test coverage for filesystem access. * Add coverage for ETW tests. * Add etwWriter tests. * Update consoleWriter tests. * Add file system helper tests. * Add correlatoinContextManager tests. * Update telemetryClient tests. * Clean up tests. * Clean up fs tests. * Update test/unitTests/shim/telemetryClient.tests.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add new architecture test builds. * Comment x86 for now. * Fix key generation. * Update node.js-windows-x86.yml * Fix x86 test attempting to establish a network connection during quickpulse tests. * Try to fix the attempted loading of the console.sub module. * Fix windows specific ETWLogger tests. * Remove unneeded quickpulse mock. * Update node.js-windows-x86.yml * Revert "Update node.js-windows-x86.yml" This reverts commit 9f5cb03. * Revert "Remove unneeded quickpulse mock." This reverts commit 515875b. * Remove ARM64 tests as github can't allocate resources. * Revert "Remove ARM64 tests as github can't allocate resources." This reverts commit 9100124. * Update linux arm64 tests to use docker container. * Update node.js-linux-arm64.yml * Try new approach for Windows ARM64 support. * Update node.js-windows-arm64.yml * Fix EtwWriter typo.
Co-authored-by: Jackson Weber <47067795+JacksonWeber@users.noreply.github.com>
* Initial plan for issue * Add support for sessionId and ai-session-id headers for frontend-backend correlation Co-authored-by: JacksonWeber <47067795+JacksonWeber@users.noreply.github.com> * Enhance documentation for frontend-backend correlation with detailed examples Co-authored-by: JacksonWeber <47067795+JacksonWeber@users.noreply.github.com> * Remove sessionId from README.md documentation Co-authored-by: JacksonWeber <47067795+JacksonWeber@users.noreply.github.com> * Revert changes to correlationContextManager.ts Co-authored-by: JacksonWeber <47067795+JacksonWeber@users.noreply.github.com> * Remove references to request-id and ai-session-id from README.md Co-authored-by: JacksonWeber <47067795+JacksonWeber@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JacksonWeber <47067795+JacksonWeber@users.noreply.github.com>
* Pass through the span name from v3 telemetry. * Support passing id to dependency and request telemetry. * Add tests.
…#1438) * Add support for tracking multi ikey usage. * Add feature statsbeat handler class and support for multi_ikey feature tracking.
…1445) * Initial plan * Fix trackDependency default timing to treat current time as end time Co-authored-by: JacksonWeber <47067795+JacksonWeber@users.noreply.github.com> * Fix trackRequest timing issue - treat current time as end time when time not specified Co-authored-by: JacksonWeber <47067795+JacksonWeber@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JacksonWeber <47067795+JacksonWeber@users.noreply.github.com>
* 3.7.1 release. * Update types.ts
|
@copilot please make sure to make this change on the 2.x branch of this project instead of "main". |
…cookies Co-authored-by: JacksonWeber <47067795+JacksonWeber@users.noreply.github.com>
|
@copilot completely erase all of your changes, and rebase your changes on the 2.x branch, then try again. |
Co-authored-by: JacksonWeber <47067795+JacksonWeber@users.noreply.github.com>
Changes have been rebased to the 2.x branch as requested. The fix is now implemented specifically for the 2.x codebase which contains the HttpRequestParser where the malformed cookie issue occurs.
All previous changes have been erased and the fix has been completely reimplemented on the 2.x branch. The solution now targets the correct codebase where the malformed cookie decoding issue exists. |
This PR addresses the "ApplicationInsights:Could not decode the auth cookie with error" issue that was causing verbose warning messages when the SDK encountered malformed URI-encoded cookies.
Problem
In SDK version 2.9.6, users reported encountering verbose warning messages when HTTP requests contained malformed
ai_authUsercookies:The issue occurred when cookies contained invalid URI encoding (e.g.,
%ZZ,%GG) that couldn't be decoded by JavaScript'sdecodeURI()function, causing it to throw aURIErrorwith verbose logging.Solution
This PR introduces safe URI decoding utilities that handle malformed URIs gracefully:
New Utility Functions
Key Features
Usage Example
Implementation Details
src/shared/util/uriUtils.tswith safe decoding functionsMigration
For current users (SDK 3.x+): The specific cookie parsing logic from 2.9.6 has been removed in the OpenTelemetry migration, but these utilities are available for any URI decoding needs in application code.
For legacy users (SDK 2.x): Consider upgrading to benefit from improved error handling and OpenTelemetry-based telemetry collection.
Fixes #1404.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.