Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d3e4fae

Browse files
Copilotfengmk2
andauthored
chore(deps): upgrade base-x to v5 (#897)
Addresses #864 - upgrades `base-x` from v3 to v5. ## Breaking Change `base-x` v5 returns `Uint8Array` from `decode()` instead of `Buffer`. The `Buffer.readUInt32BE()` method doesn't exist on `Uint8Array`. ## Changes - **package.json**: `base-x` `^3.0.11` → `^5.0.0` - **app/common/UserUtil.ts**: Use `DataView` to read the CRC32 value from decoded bytes ```typescript // Before (v3 - Buffer) return crcBytes.readUInt32BE(0) === crc32(bytes); // After (v5 - Uint8Array) const dataView = new DataView(crcBytes.buffer, crcBytes.byteOffset, crcBytes.byteLength); return dataView.getUint32(0, false) === crc32(bytes); ``` > [!WARNING] > > <details> > <summary>Firewall rules blocked me from connecting to one or more addresses (expand for details)</summary> > > #### I tried to connect to the following addresses, but was blocked by firewall rules: > > - `https://api.github.com//advisories` > - Triggering command: `/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js` (http block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/cnpm/cnpmcore/settings/copilot/coding_agent) (admins only) > > </details> <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > fix #864, upgrade base-x to v5 </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💡 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: fengmk2 <[email protected]> Co-authored-by: MK (fengmk2) <[email protected]>
1 parent 520238b commit d3e4fae

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/common/UserUtil.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ export function checkToken(token: string, prefix: string): boolean {
2323
try {
2424
const bytes = base62.decode(splits[1]);
2525
const crcBytes = base62.decode(splits[2]);
26-
return crcBytes.readUInt32BE(0) === crc32(bytes);
26+
// base-x v5 returns Uint8Array instead of Buffer, use DataView to read UInt32BE
27+
const dataView = new DataView(crcBytes.buffer, crcBytes.byteOffset, crcBytes.byteLength);
28+
return dataView.getUint32(0, false) === crc32(bytes);
2729
} catch {
2830
return false;
2931
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"@fengmk2/tar": "^6.2.0",
9494
"@node-rs/crc32": "^1.10.6",
9595
"@simplewebauthn/server": "^7.4.0",
96-
"base-x": "^3.0.11",
96+
"base-x": "^5.0.0",
9797
"base64url": "^3.0.1",
9898
"bson-objectid": "^2.0.4",
9999
"dayjs": "^1.11.19",

0 commit comments

Comments
 (0)