Skip to content
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

"Update UpdateEntity and DeleteEntity to throw InvalidInput error for Malformed Etag" #2062

Merged
merged 51 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
5491eca
"Update, Delete and Merge entities throw InvalidInput error for Malfo…
PrasantJillella Jul 21, 2023
2816f13
Address comments
PrasantJillella Jul 21, 2023
01f3b77
Address comments
PrasantJillella Jul 24, 2023
324e0b3
Minor correction
PrasantJillella Jul 24, 2023
a6c1e6d
Fix build failure
PrasantJillella Jul 31, 2023
5fd3ef1
Moving new tests to bottom of file
PrasantJillella Aug 4, 2023
82ce53a
"Update, Delete and Merge entities throw InvalidInput error for Malfo…
PrasantJillella Jul 21, 2023
ecd18fa
Address comments
PrasantJillella Jul 21, 2023
90c82a8
Address comments
PrasantJillella Jul 24, 2023
e0cb15e
Minor correction
PrasantJillella Jul 24, 2023
a6a3d72
Fix build failure
PrasantJillella Jul 31, 2023
adb0945
Moving new tests to bottom of file
PrasantJillella Aug 4, 2023
62b030c
Merge branch 'MalformedEtag' of https://github.com/PrasantJillella/Az…
PrasantJillella Aug 14, 2023
a387b45
"Update, Delete and Merge entities throw InvalidInput error for Malfo…
PrasantJillella Jul 21, 2023
d3858c8
Address comments
PrasantJillella Jul 21, 2023
5a540d3
Address comments
PrasantJillella Jul 24, 2023
2c981f7
Minor correction
PrasantJillella Jul 24, 2023
810f774
Fix build failure
PrasantJillella Jul 31, 2023
b6ef552
Moving new tests to bottom of file
PrasantJillella Aug 4, 2023
65624cb
Merge branch 'MalformedEtag' of https://github.com/PrasantJillella/Az…
PrasantJillella Aug 18, 2023
8b171ce
Update changeLog with fix information
PrasantJillella Aug 18, 2023
8967638
Merge branch 'Azure:main' into MalformedEtag
PrasantJillella Aug 18, 2023
591ca2b
Update version to 3.25.0 (#2063)
blueww Jul 24, 2023
ed3fe9c
Bump tedious from 16.2.0 to 16.4.0 (#2080)
dependabot[bot] Aug 4, 2023
e7839c0
Bump eslint from 8.45.0 to 8.46.0 (#2081)
dependabot[bot] Aug 4, 2023
e957771
Bump xml2js from 0.6.0 to 0.6.2 (#2075)
dependabot[bot] Aug 4, 2023
b22f623
Add requestId to appendBlock (#2074)
jetuk Aug 4, 2023
ee35c57
Bump tslib from 2.6.0 to 2.6.1 (#2071)
dependabot[bot] Aug 4, 2023
81d67c3
fix: Resolve issues with datetime comparisons in scenarios where micr…
notheotherben Aug 7, 2023
656065b
fix : Resolve issues with empty partition key query not returning any…
garrettbaski Aug 7, 2023
a38a06d
Bump version for hot fix (#2085)
EmmaZhu Aug 7, 2023
753f264
Bump @azure/core-auth from 1.4.0 to 1.5.0 (#2092)
dependabot[bot] Aug 11, 2023
d5296c7
Bump @azure/core-rest-pipeline from 1.11.0 to 1.12.0 (#2093)
dependabot[bot] Aug 11, 2023
d464106
Bump cross-env from 6.0.3 to 7.0.3 (#2094)
dependabot[bot] Aug 11, 2023
5ec699a
Bump @types/validator from 13.7.17 to 13.11.1 (#2091)
dependabot[bot] Aug 11, 2023
b3ce93d
Bump jsonwebtoken and @types/jsonwebtoken (#2098)
dependabot[bot] Aug 14, 2023
9c3e76b
Bump prettier from 3.0.0 to 3.0.1 (#2097)
dependabot[bot] Aug 14, 2023
ac969a0
Bump mysql2 from 3.5.2 to 3.6.0 (#2096)
dependabot[bot] Aug 14, 2023
727ae08
Bump @types/bluebird from 3.5.37 to 3.5.38 (#2105)
dependabot[bot] Aug 15, 2023
e52a8b3
Bump @types/vscode from 1.80.0 to 1.81.0 (#2101)
dependabot[bot] Aug 15, 2023
45d56a2
Bump rcedit from 3.0.1 to 3.1.0 (#2103)
dependabot[bot] Aug 15, 2023
1fab24d
Fix issue #2061, #2064, #2083 (#2087)
blueww Aug 15, 2023
1fb1da2
Updated examples of setting Customized Storage Accounts & Keys in env…
blueww Aug 15, 2023
0f38543
Bump prettier from 3.0.1 to 3.0.2 (#2110)
dependabot[bot] Aug 16, 2023
0d70477
Bump eslint from 8.46.0 to 8.47.0 (#2108)
dependabot[bot] Aug 16, 2023
658246b
Bump lint-staged from 13.2.3 to 14.0.0 (#2106)
dependabot[bot] Aug 16, 2023
843b56d
Bump service version to 2023-08-03 (#2111)
EmmaZhu Aug 16, 2023
15c0714
Bump azure-storage from 2.10.6 to 2.10.7 (#2117)
dependabot[bot] Aug 17, 2023
ec55e25
Fetch latest from main and updated changeLog file accordingly
PrasantJillella Aug 18, 2023
04ff482
Merge branch 'MalformedEtag' of https://github.com/PrasantJillella/Az…
PrasantJillella Aug 18, 2023
d1ee678
"Move change to Upcoming release header"
PrasantJillella Aug 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

## Upcoming Release

Table:
- Fixed the errorCode returned, when malformed Etag is provided for table Update/Delete calls. (issue #2013)

## 2023.08 Version 3.26.0

General:
Expand Down
4 changes: 2 additions & 2 deletions src/table/handlers/TableHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ export default class TableHandler extends BaseHandler implements ITableHandler {
}
if (options?.ifMatch && options.ifMatch !== "*") {
if (isEtagValid(options.ifMatch)) {
throw StorageErrorFactory.getInvalidOperation(context);
throw StorageErrorFactory.getInvalidInput(context);
}
}
// check that key properties are valid
Expand Down Expand Up @@ -544,7 +544,7 @@ export default class TableHandler extends BaseHandler implements ITableHandler {
throw StorageErrorFactory.getPreconditionFailed(context);
}
if (ifMatch !== "*" && isEtagValid(ifMatch)) {
throw StorageErrorFactory.getInvalidOperation(context);
throw StorageErrorFactory.getInvalidInput(context);
}
// currently the props are not coming through as args, so we take them from the table context
await this.metadataStore.deleteTableEntity(
Expand Down
39 changes: 39 additions & 0 deletions tests/table/apis/table.entity.issues.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
TableEntityResult
} from "@azure/data-tables";
import { configLogger } from "../../../src/common/Logger";
import StorageError from "../../../src/table/errors/StorageError";
import TableServer from "../../../src/table/TableServer";
import { getUniqueName } from "../../testutils";
import {
Expand Down Expand Up @@ -416,4 +417,42 @@ describe("table Entity APIs test : Issues", () => {

await tableClient.deleteTable();
});

//from issue #2013
it("Malformed Etag when sent as input throws InvalidInput for table operations, ", async() => {
const partitionKey = createUniquePartitionKey("𤭢PK1");
const malformedEtag = "MalformedEtag";
const rowKey = "𐐷RK1"
const tableClient = createAzureDataTablesClient(
testLocalAzuriteInstance,
tableName
);

await tableClient.createTable();
await tableClient.createEntity({
partitionKey: partitionKey,
rowKey: "𐐷RK1"
});

tableClient.deleteEntity(
partitionKey,
rowKey,
{
etag: malformedEtag
}
).catch((reason) => {
assert.strictEqual(reason.details.errorCode, "InvalidInput");
assert.strictEqual(reason.statusCode, 400);
});

tableClient.updateEntity({
partitionKey: partitionKey,
rowKey: rowKey,
ifMatch: malformedEtag
}).catch((reason) => {
const storageError = reason as StorageError;
assert.strictEqual(storageError.statusCode, "InvalidInput");
assert.strictEqual(storageError.storageErrorCode, 400);
});
});
});
Loading