Title: No ES6 Map support? · Issue #138 · msgpack/msgpack-javascript · GitHub
Open Graph Title: No ES6 Map support? · Issue #138 · msgpack/msgpack-javascript
X Title: No ES6 Map support? · Issue #138 · msgpack/msgpack-javascript
Description: If I run the following test program with msgpack-javascript 2.1.0: import { encode, decode } from "@msgpack/msgpack" const map = new Map() map.set("a", 1) map.set("b", 2) map.set("c", 3) const encoded = encode(map,{initialBufferSize:128}...
Open Graph Description: If I run the following test program with msgpack-javascript 2.1.0: import { encode, decode } from "@msgpack/msgpack" const map = new Map() map.set("a", 1) map.set("b", 2) map.set("c", 3) const enco...
X Description: If I run the following test program with msgpack-javascript 2.1.0: import { encode, decode } from "@msgpack/msgpack" const map = new Map() map.set("a", 1) map.set("b",...
Opengraph URL: https://github.com/msgpack/msgpack-javascript/issues/138
X: @github
Domain: Github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"No ES6 Map support?","articleBody":"If I run the following test program with msgpack-javascript 2.1.0:\r\n```\r\nimport { encode, decode } from \"@msgpack/msgpack\"\r\nconst map = new Map()\r\nmap.set(\"a\", 1)\r\nmap.set(\"b\", 2)\r\nmap.set(\"c\", 3)\r\nconst encoded = encode(map,{initialBufferSize:128})\r\nconst decoded = decode(encoded)\r\nconsole.log({map, encoded, decoded})\r\n```\r\nThe output is:\r\n\r\n\u003cimg width=\"380\" alt=\"Screen Shot 2020-10-04 at 11 40 42 PM\" src=\"https://user-images.githubusercontent.com/277318/95038024-16f84900-069b-11eb-8f49-30e91fb5d580.png\"\u003e\r\n\r\nConclusion: Asking msgpack-javascript to encode a Map causes it to encode it as if it were an empty object.\r\n\r\nSupporting Maps in some capacity would be good because if anything it is better to store Maps in msgpack than to store objects. Sometimes deserializing in JavaScript can cause problems or even security flaws if keys overwrite \"special\" javascript objects like `hasOwnProperty` or `__proto__`. [Here is an example of such a problem](https://medium.com/intrinsic/javascript-prototype-poisoning-vulnerabilities-in-the-wild-7bc15347c96). I suspect msgpack-javascript itself will not have any such security flaws, but it is easy for client code to have such security flaws and the security issues can be sidestepped by using Maps instead of objects. ","author":{"url":"https://github.com/mcclure","@type":"Person","name":"mcclure"},"datePublished":"2020-10-05T03:46:04.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/138/msgpack-javascript/issues/138"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a1d602f3-c78a-5c8f-f23f-cdc8149ff937 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 822A:115551:A55EC2:EADCCF:6A633C5C |
| html-safe-nonce | b464207edd1535494bf9b40414dfbfedd471901337b886db22ae99f733e1bc45 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MjJBOjExNTU1MTpBNTVFQzI6RUFEQ0NGOjZBNjMzQzVDIiwidmlzaXRvcl9pZCI6IjE2NjA2Njg0NTk5MDU5MjQxODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 28013fa054d71f978e414b7dd17019972d0a19fe0f85d53ab7a84103968295a9 |
| hovercard-subject-tag | issue:714486879 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/msgpack/msgpack-javascript/138/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7b7bf08a87a6a2cfc06377ea26e4af7c7af5d414a91b0a6c55a95da9b8e49604/msgpack/msgpack-javascript/issues/138 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7b7bf08a87a6a2cfc06377ea26e4af7c7af5d414a91b0a6c55a95da9b8e49604/msgpack/msgpack-javascript/issues/138 |
| og:image:alt | If I run the following test program with msgpack-javascript 2.1.0: import { encode, decode } from "@msgpack/msgpack" const map = new Map() map.set("a", 1) map.set("b", 2) map.set("c", 3) const enco... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mcclure |
| hostname | github.com |
| expected-hostname | github.com |
| None | 59e55daad7174ca59d63c6974d58276ccb5477442e550bebb3c035e1bef11c94 |
| turbo-cache-control | no-preview |
| go-import | github.com/msgpack/msgpack-javascript git https://github.com/msgpack/msgpack-javascript.git |
| octolytics-dimension-user_id | 198264 |
| octolytics-dimension-user_login | msgpack |
| octolytics-dimension-repository_id | 2761854 |
| octolytics-dimension-repository_nwo | msgpack/msgpack-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 2761854 |
| octolytics-dimension-repository_network_root_nwo | msgpack/msgpack-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 990295d92a4cc7b63fbbd83a046217cd7d77d49c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width