Merge pull request #440 from codecov/2.0.2-token-fixes

2.0.2 token fixes
This commit is contained in:
Tom Hu 2021-07-23 07:48:24 -07:00 committed by GitHub
commit 51d810878b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 38 deletions

View file

@ -1,3 +1,9 @@
## 2.0.2
### Fixes
- Underlying uploader fixes issues with tokens not being sent properly for users seeing
`Error!: Error: Error uploading to https://codecov.io: Error: Error uploading to Codecov: Error: Not Found`
- #440 fix: Validation ordering
## 2.0.1 ## 2.0.1
### Fixes ### Fixes
- #424 fix: Issue in building all deep dependencies - #424 fix: Issue in building all deep dependencies

27
dist/index.js vendored
View file

@ -12849,7 +12849,7 @@ var core = __nccwpck_require__(2186);
// EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js // EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js
var github = __nccwpck_require__(5438); var github = __nccwpck_require__(5438);
;// CONCATENATED MODULE: ./package.json ;// CONCATENATED MODULE: ./package.json
const package_namespaceObject = {"i8":"2.0.1"}; const package_namespaceObject = {"i8":"2.0.2"};
;// CONCATENATED MODULE: ./src/buildExec.ts ;// CONCATENATED MODULE: ./src/buildExec.ts
@ -13061,22 +13061,23 @@ const verify = (filename) => __awaiter(void 0, void 0, void 0, function* () {
else { else {
setFailure('Codecov: Error validating SHASUM signature', true); setFailure('Codecov: Error validating SHASUM signature', true);
} }
// Verify uploader const calculateHash = (filename) => __awaiter(void 0, void 0, void 0, function* () {
const uploaderSha = external_crypto_.createHash(`sha256`);
const stream = external_fs_.createReadStream(filename); const stream = external_fs_.createReadStream(filename);
yield stream const uploaderSha = external_crypto_.createHash(`sha256`);
.on('data', (data) => { stream.pipe(uploaderSha);
uploaderSha.update(data); return new Promise((resolve, reject) => {
}).on('end', () => __awaiter(void 0, void 0, void 0, function* () { stream.on('end', () => resolve(`${uploaderSha.digest('hex')} ${uploaderName}`));
const hash = `${uploaderSha.digest('hex')} ${uploaderName}`; stream.on('error', reject);
if (hash !== shasum) { });
setFailure('Codecov: Uploader shasum does not match ' + });
`uploader hash: ${hash}, public hash: ${shasum}`, true); const hash = yield calculateHash(filename);
if (hash === shasum) {
core.info(`==> Uploader SHASUM verified (${hash})`);
} }
else { else {
core.info('==> Uploader SHASUM verified'); setFailure('Codecov: Uploader shasum does not match -- ' +
`uploader hash: ${hash}, public hash: ${shasum}`, true);
} }
}));
} }
catch (err) { catch (err) {
setFailure(`Codecov: Error validating uploader: ${err.message}`, true); setFailure(`Codecov: Error validating uploader: ${err.message}`, true);

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{ {
"name": "codecov-action", "name": "codecov-action",
"version": "2.0.1", "version": "2.0.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View file

@ -1,6 +1,6 @@
{ {
"name": "codecov-action", "name": "codecov-action",
"version": "2.0.1", "version": "2.0.2",
"description": "Upload coverage reports to Codecov from GitHub Actions", "description": "Upload coverage reports to Codecov from GitHub Actions",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View file

@ -44,24 +44,29 @@ const verify = async (filename: string) => {
setFailure('Codecov: Error validating SHASUM signature', true); setFailure('Codecov: Error validating SHASUM signature', true);
} }
// Verify uploader const calculateHash = async (filename: string) => {
const uploaderSha = crypto.createHash(`sha256`);
const stream = fs.createReadStream(filename); const stream = fs.createReadStream(filename);
await stream const uploaderSha = crypto.createHash(`sha256`);
.on('data', (data) => { stream.pipe(uploaderSha);
uploaderSha.update(data);
}).on('end', async () => { return new Promise((resolve, reject) => {
const hash = `${uploaderSha.digest('hex')} ${uploaderName}`; stream.on('end', () => resolve(
if (hash !== shasum) { `${uploaderSha.digest('hex')} ${uploaderName}`,
));
stream.on('error', reject);
});
};
const hash = await calculateHash(filename);
if (hash === shasum) {
core.info(`==> Uploader SHASUM verified (${hash})`);
} else {
setFailure( setFailure(
'Codecov: Uploader shasum does not match ' + 'Codecov: Uploader shasum does not match -- ' +
`uploader hash: ${hash}, public hash: ${shasum}`, `uploader hash: ${hash}, public hash: ${shasum}`,
true, true,
); );
} else {
core.info('==> Uploader SHASUM verified');
} }
});
} catch (err) { } catch (err) {
setFailure(`Codecov: Error validating uploader: ${err.message}`, true); setFailure(`Codecov: Error validating uploader: ${err.message}`, true);
} }