@yadsh/dsh-qa-integrations 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +636 -202
- package/compatibility.json +1 -1
- package/lib/broker.js +468 -9
- package/lib/broker.js.map +1 -1
- package/lib/client/bitrix24.js +67 -5
- package/lib/client/bitrix24.js.map +1 -1
- package/lib/client/card.js +8 -1
- package/lib/client/card.js.map +1 -1
- package/lib/client/confluence.js +98 -129
- package/lib/client/confluence.js.map +1 -1
- package/lib/client/gitlab.js +41 -5
- package/lib/client/gitlab.js.map +1 -1
- package/lib/client/index.js +33 -11
- package/lib/client/index.js.map +1 -1
- package/lib/client/integrations.js +40 -3
- package/lib/client/integrations.js.map +1 -1
- package/lib/client/jira.js +96 -127
- package/lib/client/jira.js.map +1 -1
- package/lib/client/operator-card.js +537 -0
- package/lib/client/operator-card.js.map +1 -0
- package/lib/client/operator-controls.js +232 -0
- package/lib/client/operator-controls.js.map +1 -0
- package/lib/client/provider-card.js +138 -4
- package/lib/client/provider-card.js.map +1 -1
- package/lib/client/styles.js +68 -5
- package/lib/client/styles.js.map +1 -1
- package/lib/client/teamcity.js +31 -4
- package/lib/client/teamcity.js.map +1 -1
- package/lib/client/testit.js +101 -0
- package/lib/client/testit.js.map +1 -0
- package/lib/client/weblate.js +105 -0
- package/lib/client/weblate.js.map +1 -0
- package/lib/client.js +5214 -1054
- package/lib/client.js.map +1 -1
- package/lib/coerce.js +16 -7
- package/lib/coerce.js.map +1 -1
- package/lib/config.js +12 -0
- package/lib/config.js.map +1 -1
- package/lib/errors.js.map +1 -1
- package/lib/index.js +444 -57
- package/lib/index.js.map +1 -1
- package/lib/providers/bitrix24/catalog.js +151 -8
- package/lib/providers/bitrix24/catalog.js.map +1 -1
- package/lib/providers/bitrix24/config.js +87 -13
- package/lib/providers/bitrix24/config.js.map +1 -1
- package/lib/providers/bitrix24/credential-help.js +24 -0
- package/lib/providers/bitrix24/credential-help.js.map +1 -0
- package/lib/providers/bitrix24/index.js +122 -0
- package/lib/providers/bitrix24/index.js.map +1 -1
- package/lib/providers/bitrix24/operations.js +60 -1
- package/lib/providers/bitrix24/operations.js.map +1 -1
- package/lib/providers/bitrix24/tools.js +95 -3
- package/lib/providers/bitrix24/tools.js.map +1 -1
- package/lib/providers/confluence/catalog.js +51 -3
- package/lib/providers/confluence/catalog.js.map +1 -1
- package/lib/providers/confluence/credential-help.js +29 -0
- package/lib/providers/confluence/credential-help.js.map +1 -0
- package/lib/providers/confluence/index.js +302 -35
- package/lib/providers/confluence/index.js.map +1 -1
- package/lib/providers/confluence/operations.js +1 -1
- package/lib/providers/confluence/operations.js.map +1 -1
- package/lib/providers/gitlab/catalog.js +108 -15
- package/lib/providers/gitlab/catalog.js.map +1 -1
- package/lib/providers/gitlab/config.js +11 -3
- package/lib/providers/gitlab/config.js.map +1 -1
- package/lib/providers/gitlab/credential-help.js +33 -0
- package/lib/providers/gitlab/credential-help.js.map +1 -0
- package/lib/providers/gitlab/index.js +337 -6
- package/lib/providers/gitlab/index.js.map +1 -1
- package/lib/providers/jira/catalog.js +73 -3
- package/lib/providers/jira/catalog.js.map +1 -1
- package/lib/providers/jira/credential-help.js +31 -0
- package/lib/providers/jira/credential-help.js.map +1 -0
- package/lib/providers/jira/index.js +275 -12
- package/lib/providers/jira/index.js.map +1 -1
- package/lib/providers/registry.js +4 -0
- package/lib/providers/registry.js.map +1 -1
- package/lib/providers/shared/credential-help.js +29 -0
- package/lib/providers/shared/credential-help.js.map +1 -0
- package/lib/providers/shared/service-boundary.js +44 -0
- package/lib/providers/shared/service-boundary.js.map +1 -0
- package/lib/providers/teamcity/catalog.js +56 -2
- package/lib/providers/teamcity/catalog.js.map +1 -1
- package/lib/providers/teamcity/credential-help.js +25 -0
- package/lib/providers/teamcity/credential-help.js.map +1 -0
- package/lib/providers/teamcity/index.js +254 -2
- package/lib/providers/teamcity/index.js.map +1 -1
- package/lib/providers/testit/attachments.js +131 -0
- package/lib/providers/testit/attachments.js.map +1 -0
- package/lib/providers/testit/catalog.js +302 -0
- package/lib/providers/testit/catalog.js.map +1 -0
- package/lib/providers/testit/config.js +175 -0
- package/lib/providers/testit/config.js.map +1 -0
- package/lib/providers/testit/credential-help.js +29 -0
- package/lib/providers/testit/credential-help.js.map +1 -0
- package/lib/providers/testit/index.js +458 -0
- package/lib/providers/testit/index.js.map +1 -0
- package/lib/providers/testit/operations.js +1070 -0
- package/lib/providers/testit/operations.js.map +1 -0
- package/lib/providers/testit/tools.js +717 -0
- package/lib/providers/testit/tools.js.map +1 -0
- package/lib/providers/testit/transport.js +158 -0
- package/lib/providers/testit/transport.js.map +1 -0
- package/lib/providers/weblate/catalog.js +279 -0
- package/lib/providers/weblate/catalog.js.map +1 -0
- package/lib/providers/weblate/config.js +147 -0
- package/lib/providers/weblate/config.js.map +1 -0
- package/lib/providers/weblate/credential-help.js +26 -0
- package/lib/providers/weblate/credential-help.js.map +1 -0
- package/lib/providers/weblate/index.js +419 -0
- package/lib/providers/weblate/index.js.map +1 -0
- package/lib/providers/weblate/operations.js +703 -0
- package/lib/providers/weblate/operations.js.map +1 -0
- package/lib/providers/weblate/query.js +80 -0
- package/lib/providers/weblate/query.js.map +1 -0
- package/lib/providers/weblate/tools.js +408 -0
- package/lib/providers/weblate/tools.js.map +1 -0
- package/lib/providers/weblate/transport.js +179 -0
- package/lib/providers/weblate/transport.js.map +1 -0
- package/lib/repository.js +197 -13
- package/lib/repository.js.map +1 -1
- package/lib/service-credentials/config.js +179 -0
- package/lib/service-credentials/config.js.map +1 -0
- package/lib/service-credentials/policy.js +92 -0
- package/lib/service-credentials/policy.js.map +1 -0
- package/lib/service-credentials/registry.js +142 -0
- package/lib/service-credentials/registry.js.map +1 -0
- package/lib/service-credentials/state.js +30 -0
- package/lib/service-credentials/state.js.map +1 -0
- package/lib/service-credentials/types.js +20 -0
- package/lib/service-credentials/types.js.map +1 -0
- package/lib/shared/settings.js +8 -13
- package/lib/shared/settings.js.map +1 -1
- package/lib/tools.js +27 -2
- package/lib/tools.js.map +1 -1
- package/lib/typert.host.js +1340 -100
- package/lib/typert.remote-client.d.ts +45 -11
- package/lib/typert.remote-client.js +1101 -38
- package/lib/types/broker.d.ts +79 -5
- package/lib/types/client/bitrix24.d.ts +24 -2
- package/lib/types/client/card.d.ts +3 -1
- package/lib/types/client/confluence.d.ts +19 -3
- package/lib/types/client/gitlab.d.ts +15 -2
- package/lib/types/client/index.d.ts +7 -5
- package/lib/types/client/integrations.d.ts +12 -3
- package/lib/types/client/jira.d.ts +20 -3
- package/lib/types/client/operator-card.d.ts +22 -0
- package/lib/types/client/operator-controls.d.ts +135 -0
- package/lib/types/client/provider-card.d.ts +50 -8
- package/lib/types/client/styles.d.ts +4 -3
- package/lib/types/client/teamcity.d.ts +15 -2
- package/lib/types/client/testit.d.ts +28 -0
- package/lib/types/client/weblate.d.ts +28 -0
- package/lib/types/coerce.d.ts +2 -2
- package/lib/types/config.d.ts +21 -0
- package/lib/types/errors.d.ts +9 -1
- package/lib/types/index.d.ts +183 -18
- package/lib/types/providers/bitrix24/catalog.d.ts +9 -1
- package/lib/types/providers/bitrix24/config.d.ts +23 -22
- package/lib/types/providers/bitrix24/credential-help.d.ts +8 -0
- package/lib/types/providers/bitrix24/index.d.ts +41 -1
- package/lib/types/providers/bitrix24/tools.d.ts +4 -0
- package/lib/types/providers/confluence/catalog.d.ts +11 -3
- package/lib/types/providers/confluence/credential-help.d.ts +9 -0
- package/lib/types/providers/confluence/index.d.ts +66 -7
- package/lib/types/providers/confluence/operations.d.ts +2 -0
- package/lib/types/providers/contract.d.ts +62 -1
- package/lib/types/providers/gitlab/catalog.d.ts +20 -5
- package/lib/types/providers/gitlab/config.d.ts +14 -3
- package/lib/types/providers/gitlab/credential-help.d.ts +9 -0
- package/lib/types/providers/gitlab/index.d.ts +51 -1
- package/lib/types/providers/jira/catalog.d.ts +13 -0
- package/lib/types/providers/jira/credential-help.d.ts +8 -0
- package/lib/types/providers/jira/index.d.ts +53 -1
- package/lib/types/providers/registry.d.ts +2 -0
- package/lib/types/providers/shared/credential-help.d.ts +17 -0
- package/lib/types/providers/shared/service-boundary.d.ts +25 -0
- package/lib/types/providers/teamcity/catalog.d.ts +18 -2
- package/lib/types/providers/teamcity/credential-help.d.ts +8 -0
- package/lib/types/providers/teamcity/index.d.ts +53 -2
- package/lib/types/providers/testit/attachments.d.ts +20 -0
- package/lib/types/providers/testit/catalog.d.ts +87 -0
- package/lib/types/providers/testit/config.d.ts +61 -0
- package/lib/types/providers/testit/credential-help.d.ts +8 -0
- package/lib/types/providers/testit/index.d.ts +119 -0
- package/lib/types/providers/testit/operations.d.ts +95 -0
- package/lib/types/providers/testit/tools.d.ts +15 -0
- package/lib/types/providers/testit/transport.d.ts +67 -0
- package/lib/types/providers/weblate/catalog.d.ts +60 -0
- package/lib/types/providers/weblate/config.d.ts +57 -0
- package/lib/types/providers/weblate/credential-help.d.ts +9 -0
- package/lib/types/providers/weblate/index.d.ts +92 -0
- package/lib/types/providers/weblate/operations.d.ts +77 -0
- package/lib/types/providers/weblate/query.d.ts +37 -0
- package/lib/types/providers/weblate/tools.d.ts +15 -0
- package/lib/types/providers/weblate/transport.d.ts +60 -0
- package/lib/types/repository.d.ts +38 -3
- package/lib/types/service-credentials/config.d.ts +73 -0
- package/lib/types/service-credentials/policy.d.ts +44 -0
- package/lib/types/service-credentials/registry.d.ts +43 -0
- package/lib/types/service-credentials/state.d.ts +14 -0
- package/lib/types/service-credentials/types.d.ts +97 -0
- package/lib/types/shared/settings.d.ts +8 -13
- package/lib/types/tools.d.ts +10 -1
- package/lib/types/types.d.ts +114 -10
- package/package.json +7 -7
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
import { resolveCredentialHelp, } from "@yadsh/dsh-plugin-kit";
|
|
2
|
+
import { IntegrationError } from "../../errors.js";
|
|
3
|
+
import { redactSecrets } from "../../redaction.js";
|
|
4
|
+
import { boundaryHas } from "../../service-credentials/policy.js";
|
|
5
|
+
import { operationCapabilityServiceState } from "../../service-credentials/state.js";
|
|
6
|
+
import { objectOf } from "../shared/account.js";
|
|
7
|
+
import { assertServiceOperationAllowed, serviceBoundaryOf, serviceResourceDenied, } from "../shared/service-boundary.js";
|
|
8
|
+
import { assertReadableSize, attachmentBinaryProblem, attachmentByteLimit, attachmentName, } from "./attachments.js";
|
|
9
|
+
import { TESTIT_CAPABILITY_INFO, TESTIT_OPERATIONS, TESTIT_RESOURCE_KIND, enabledCapabilities, testitOperationCapability, testitOperationMetadata, } from "./catalog.js";
|
|
10
|
+
import { testitInstance, } from "./config.js";
|
|
11
|
+
import { TESTIT_HANDLERS, TESTIT_LIMITS, TESTIT_PROJECTIONS, contentBlock, listLimit, listOffset, } from "./operations.js";
|
|
12
|
+
import { TESTIT_CREDENTIAL_HELP } from "./credential-help.js";
|
|
13
|
+
import { TestitTransport, credentialFromPlaintext, credentialInstance, } from "./transport.js";
|
|
14
|
+
export { credentialFromPlaintext, credentialInstance, } from "./transport.js";
|
|
15
|
+
/**
|
|
16
|
+
* Test IT API tokens are opaque: the platform documents no shape, so the only
|
|
17
|
+
* checks worth making are the ones that catch a paste mistake — a URL instead
|
|
18
|
+
* of a token, or whitespace a copy carried along.
|
|
19
|
+
*/
|
|
20
|
+
const TOKEN_SHAPE = /^\S{16,4096}$/u;
|
|
21
|
+
const URL_LIKE = /^https?:\/\//iu;
|
|
22
|
+
/**
|
|
23
|
+
* Whether one caller-named project stays inside the deployment's boundary.
|
|
24
|
+
* Test IT addresses projects by their id and offers no hierarchy a boundary
|
|
25
|
+
* entry could cover, so the match is the exact identifier the profile lists.
|
|
26
|
+
*/
|
|
27
|
+
export function projectAllowed(boundary, ref) {
|
|
28
|
+
return boundaryHas(boundary, TESTIT_RESOURCE_KIND, ref.trim());
|
|
29
|
+
}
|
|
30
|
+
/** Operations that answer exactly the project the call names. */
|
|
31
|
+
const PROJECT_ADDRESSED = Object.freeze([
|
|
32
|
+
"projects.get",
|
|
33
|
+
"sections.list",
|
|
34
|
+
"workItems.list",
|
|
35
|
+
"testPlans.list",
|
|
36
|
+
"testRuns.list",
|
|
37
|
+
"configurations.list",
|
|
38
|
+
// `autoTests.list` takes the project optionally upstream; service mode does
|
|
39
|
+
// not, because unscoped it would answer with the shared account's whole
|
|
40
|
+
// installation — exactly what the boundary exists to prevent.
|
|
41
|
+
"autoTests.list",
|
|
42
|
+
]);
|
|
43
|
+
/**
|
|
44
|
+
* Operations answered from one object that names its own project. The id alone
|
|
45
|
+
* proves nothing, so the check runs on the fetched answer, before any of it is
|
|
46
|
+
* returned.
|
|
47
|
+
*/
|
|
48
|
+
const SELF_SCOPED_READS = Object.freeze([
|
|
49
|
+
"workItems.get",
|
|
50
|
+
"testPlans.get",
|
|
51
|
+
"testRuns.get",
|
|
52
|
+
"autoTests.get",
|
|
53
|
+
]);
|
|
54
|
+
/** The project an upstream object declares, when it declares one. */
|
|
55
|
+
function projectOf(source) {
|
|
56
|
+
const id = source["projectId"];
|
|
57
|
+
return typeof id === "string" && id !== "" ? id : undefined;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Test IT provider: one Test IT installation per QA user, connected with that
|
|
61
|
+
* user's own API token, or with the deployment's managed read-only credential
|
|
62
|
+
* when the user's binding asks for it.
|
|
63
|
+
*
|
|
64
|
+
* The installation is operator configuration — the connect form only picks from
|
|
65
|
+
* the configured list — so the broker cannot be pointed at a host of the
|
|
66
|
+
* caller's choosing, and the address is re-resolved from config on every call,
|
|
67
|
+
* which makes removing or repointing an instance take effect at once.
|
|
68
|
+
*/
|
|
69
|
+
export class TestitProvider {
|
|
70
|
+
config;
|
|
71
|
+
id = "testit";
|
|
72
|
+
displayName = "Test IT";
|
|
73
|
+
/** What this deployment is willing to expose; Test IT's own rights still apply. */
|
|
74
|
+
capabilities;
|
|
75
|
+
capabilityInfo = TESTIT_CAPABILITY_INFO;
|
|
76
|
+
/** Where the settings card says this provider's credential comes from. */
|
|
77
|
+
credentialHelp;
|
|
78
|
+
/** Overrides the deployment got wrong; reported once at startup, never fatal. */
|
|
79
|
+
credentialHelpProblems;
|
|
80
|
+
transport;
|
|
81
|
+
constructor(config, fetcher = fetch) {
|
|
82
|
+
this.config = config;
|
|
83
|
+
this.transport = new TestitTransport(config, config.testit, fetcher);
|
|
84
|
+
this.capabilities = Object.freeze(enabledCapabilities(config.testit));
|
|
85
|
+
const help = resolveCredentialHelp(TESTIT_CREDENTIAL_HELP, config.credentialHelp["testit"]);
|
|
86
|
+
this.credentialHelp = help.help;
|
|
87
|
+
this.credentialHelpProblems = help.problems;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Keep only the token, tagged with the installation it was minted for. The
|
|
91
|
+
* instance comes from the connect form and from operator config, never from a
|
|
92
|
+
* tool argument, which is what keeps the broker from dialling any host the
|
|
93
|
+
* caller names.
|
|
94
|
+
*/
|
|
95
|
+
parseCredential(raw, options) {
|
|
96
|
+
const token = raw.trim();
|
|
97
|
+
if (!TOKEN_SHAPE.test(token) || URL_LIKE.test(token)) {
|
|
98
|
+
throw new IntegrationError("InvalidCredential", "Use a Test IT API token");
|
|
99
|
+
}
|
|
100
|
+
const instance = this.resolveInstance(options?.["instanceId"]);
|
|
101
|
+
return {
|
|
102
|
+
credential: JSON.stringify({
|
|
103
|
+
instanceId: instance.id,
|
|
104
|
+
token,
|
|
105
|
+
}),
|
|
106
|
+
portal: instance.baseUrl,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
operationCapability(operation) {
|
|
110
|
+
return testitOperationCapability(operation);
|
|
111
|
+
}
|
|
112
|
+
operationMetadata(operation) {
|
|
113
|
+
return testitOperationMetadata(operation);
|
|
114
|
+
}
|
|
115
|
+
/** Every project-scoped read is bounded by the profile's project list. */
|
|
116
|
+
resourceBoundaryKind(operation) {
|
|
117
|
+
return TESTIT_OPERATIONS[operation]?.security.requiresResourceBoundary ===
|
|
118
|
+
true
|
|
119
|
+
? TESTIT_RESOURCE_KIND
|
|
120
|
+
: undefined;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Portal of a configured installation. An empty id means "the only
|
|
124
|
+
* installation", the same rule `parseCredential` applies, so deployment
|
|
125
|
+
* configuration and the connect form name installations alike.
|
|
126
|
+
*/
|
|
127
|
+
instancePortal(instanceId) {
|
|
128
|
+
const instances = this.config.testit.instances;
|
|
129
|
+
const id = instanceId.trim();
|
|
130
|
+
if (id === "") {
|
|
131
|
+
return instances.length === 1 ? instances[0]?.baseUrl : undefined;
|
|
132
|
+
}
|
|
133
|
+
return testitInstance(this.config.testit, id)?.baseUrl;
|
|
134
|
+
}
|
|
135
|
+
capabilityServiceState(capability) {
|
|
136
|
+
return operationCapabilityServiceState(TESTIT_OPERATIONS, capability);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The documented first validation call is the project list: an authorized
|
|
140
|
+
* answer proves the address and the token at once, and an empty project list
|
|
141
|
+
* is a valid authorization result rather than a failure. Test IT API v2 has no
|
|
142
|
+
* endpoint that names the token owner, so no identity is stored — the answer
|
|
143
|
+
* reports what the probe proved and nothing more.
|
|
144
|
+
*/
|
|
145
|
+
async validate(context) {
|
|
146
|
+
const credential = credentialFromPlaintext(context.credential);
|
|
147
|
+
const instance = credentialInstance(this.config.testit, credential);
|
|
148
|
+
const connection = TESTIT_HANDLERS["connection.get"];
|
|
149
|
+
if (connection === undefined) {
|
|
150
|
+
throw new IntegrationError("ProviderUnavailable", "Test IT connection probe is unavailable");
|
|
151
|
+
}
|
|
152
|
+
const probeRequest = connection({}, { flags: this.config.testit });
|
|
153
|
+
const probe = await this.transport.getJson(instance, credential.token, probeRequest.path, probeRequest.query);
|
|
154
|
+
const visible = probe.page?.total ?? (Array.isArray(probe.data) ? probe.data.length : 0);
|
|
155
|
+
return {
|
|
156
|
+
tenantId: instance.baseUrl,
|
|
157
|
+
externalUserId: "",
|
|
158
|
+
displayName: `${instance.label} · Test IT API v2, проектов видно: ${visible}`,
|
|
159
|
+
/**
|
|
160
|
+
* Test IT does not report the permissions of the token it was given, so
|
|
161
|
+
* there is nothing to narrow here: the deployment switches bound what this
|
|
162
|
+
* connection may attempt, and Test IT itself refuses the rest.
|
|
163
|
+
*/
|
|
164
|
+
capabilities: this.capabilities,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Health of the deployment's managed token. Test IT reports neither the
|
|
169
|
+
* scopes of a token nor its owner, so the probe is the same read the personal
|
|
170
|
+
* validation makes — it never changes upstream state — and the answer says
|
|
171
|
+
* what was and was not learned instead of implying an audit it did not
|
|
172
|
+
* perform.
|
|
173
|
+
*/
|
|
174
|
+
async validateServiceCredential(context) {
|
|
175
|
+
const credential = credentialFromPlaintext(context.credential);
|
|
176
|
+
const instance = credentialInstance(this.config.testit, credential);
|
|
177
|
+
try {
|
|
178
|
+
const probe = TESTIT_HANDLERS["connection.get"];
|
|
179
|
+
if (probe === undefined) {
|
|
180
|
+
throw new IntegrationError("ProviderUnavailable", "Test IT connection probe is unavailable");
|
|
181
|
+
}
|
|
182
|
+
const probeRequest = probe({}, { flags: this.config.testit });
|
|
183
|
+
await this.transport.getJson(instance, credential.token, probeRequest.path, probeRequest.query);
|
|
184
|
+
return {
|
|
185
|
+
status: "healthy",
|
|
186
|
+
warnings: [
|
|
187
|
+
"Test IT did not report the token scopes; the local service ceiling still applies",
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
return healthFromFailure(error);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
async execute(context, operation, input) {
|
|
196
|
+
const credential = credentialFromPlaintext(context.credential);
|
|
197
|
+
const instance = credentialInstance(this.config.testit, credential);
|
|
198
|
+
const definition = TESTIT_OPERATIONS[operation];
|
|
199
|
+
const handler = TESTIT_HANDLERS[operation];
|
|
200
|
+
if (definition === undefined || handler === undefined) {
|
|
201
|
+
throw new IntegrationError("InvalidRequest", "Unsupported Test IT operation");
|
|
202
|
+
}
|
|
203
|
+
// Ceiling first, then the boundary: what the operation is decides before
|
|
204
|
+
// where it may read.
|
|
205
|
+
if (context.credentialSource === "service") {
|
|
206
|
+
assertServiceOperationAllowed(definition.security, "This Test IT operation is not available through the service credential");
|
|
207
|
+
}
|
|
208
|
+
const boundary = serviceBoundaryOf(context);
|
|
209
|
+
if (boundary !== undefined &&
|
|
210
|
+
definition.security.requiresResourceBoundary) {
|
|
211
|
+
await this.assertInsideBoundary(operation, input, boundary, instance, credential);
|
|
212
|
+
}
|
|
213
|
+
if (boundary !== undefined && operation === "projects.list") {
|
|
214
|
+
return this.listBoundedProjects(instance, credential, boundary, input);
|
|
215
|
+
}
|
|
216
|
+
const flags = this.config.testit;
|
|
217
|
+
const request = handler(input, { flags });
|
|
218
|
+
if (definition.stream === true) {
|
|
219
|
+
return this.readAttachment(instance, credential, input, request, flags);
|
|
220
|
+
}
|
|
221
|
+
const response = await this.transport.getJson(instance, credential.token, request.path, request.query);
|
|
222
|
+
if (boundary !== undefined &&
|
|
223
|
+
(SELF_SCOPED_READS.includes(operation) || operation === "testResults.get")) {
|
|
224
|
+
await this.assertAnswerInside(operation, response.data, boundary, instance, credential);
|
|
225
|
+
}
|
|
226
|
+
const projection = TESTIT_PROJECTIONS[operation];
|
|
227
|
+
if (projection === undefined)
|
|
228
|
+
return objectOf(response.data);
|
|
229
|
+
const projected = projection(response.data, {
|
|
230
|
+
flags,
|
|
231
|
+
input,
|
|
232
|
+
page: response.page,
|
|
233
|
+
instanceLabel: instance.label,
|
|
234
|
+
baseUrl: instance.baseUrl,
|
|
235
|
+
});
|
|
236
|
+
// A list projection already answered with its envelope; a single-resource
|
|
237
|
+
// answer is wrapped so every tool result has the same object shape.
|
|
238
|
+
return definition.list === undefined ? objectOf(projected) : projected;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Hold one call inside the deployment's boundary. A call addressed by a
|
|
242
|
+
* project must name one the boundary lists; an id-addressed read resolves
|
|
243
|
+
* the project its object lives in first, and only then is answered. The
|
|
244
|
+
* project listing needs no check here: it is built from the allowlist
|
|
245
|
+
* itself, not from whatever the shared account can reach.
|
|
246
|
+
*/
|
|
247
|
+
async assertInsideBoundary(operation, input, boundary, instance, credential) {
|
|
248
|
+
if (operation === "projects.list")
|
|
249
|
+
return;
|
|
250
|
+
if (PROJECT_ADDRESSED.includes(operation)) {
|
|
251
|
+
const project = input["projectId"];
|
|
252
|
+
this.assertProject(boundary, project === undefined ? undefined : String(project).trim());
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (operation === "workItems.history" ||
|
|
256
|
+
operation === "workItems.comments" ||
|
|
257
|
+
operation === "workItems.testResults") {
|
|
258
|
+
this.assertProject(boundary, await this.projectThrough("workItems.get", { workItemId: input["workItemId"] }, instance, credential));
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (operation === "testPlans.summary") {
|
|
262
|
+
this.assertProject(boundary, await this.projectThrough("testPlans.get", { testPlanId: input["testPlanId"] }, instance, credential));
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
if (operation === "testRuns.results") {
|
|
266
|
+
this.assertProject(boundary, await this.projectThrough("testRuns.get", { testRunId: input["testRunId"] }, instance, credential));
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
if (operation === "testResults.attachments") {
|
|
270
|
+
// A test result names no project; the run it belongs to does.
|
|
271
|
+
const result = await this.readFor("testResults.get", input, instance, credential);
|
|
272
|
+
const runId = typeof result["testRunId"] === "string"
|
|
273
|
+
? result["testRunId"]
|
|
274
|
+
: undefined;
|
|
275
|
+
const project = runId === undefined
|
|
276
|
+
? undefined
|
|
277
|
+
: await this.projectThrough("testRuns.get", { testRunId: runId }, instance, credential);
|
|
278
|
+
this.assertProject(boundary, project);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (SELF_SCOPED_READS.includes(operation) ||
|
|
282
|
+
operation === "testResults.get") {
|
|
283
|
+
// Answered from one fetched object that names its project; the check
|
|
284
|
+
// runs on the answer, before any of it is returned.
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
// An operation this provider cannot map to a project is refused rather
|
|
288
|
+
// than answered from the shared account's whole installation.
|
|
289
|
+
throw serviceResourceDenied();
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Hold a fetched answer inside the boundary before it is returned. The
|
|
293
|
+
* object read names its project — directly, or through the run a test
|
|
294
|
+
* result belongs to — and a resource outside the boundary is discarded
|
|
295
|
+
* whole: upstream saw the read, the model never does.
|
|
296
|
+
*/
|
|
297
|
+
async assertAnswerInside(operation, data, boundary, instance, credential) {
|
|
298
|
+
const source = objectOf(data);
|
|
299
|
+
if (operation === "testResults.get") {
|
|
300
|
+
const runId = typeof source["testRunId"] === "string"
|
|
301
|
+
? source["testRunId"]
|
|
302
|
+
: undefined;
|
|
303
|
+
const project = runId === undefined
|
|
304
|
+
? undefined
|
|
305
|
+
: await this.projectThrough("testRuns.get", { testRunId: runId }, instance, credential);
|
|
306
|
+
this.assertProject(boundary, project);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
this.assertProject(boundary, projectOf(source));
|
|
310
|
+
}
|
|
311
|
+
/** Refuse unless the resolved project is one the boundary lists. */
|
|
312
|
+
assertProject(boundary, project) {
|
|
313
|
+
if (project === undefined || !projectAllowed(boundary, project)) {
|
|
314
|
+
throw serviceResourceDenied();
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* One companion read used to locate the project an id-addressed answer
|
|
319
|
+
* belongs to. It goes through the catalog handler of the operation it
|
|
320
|
+
* mirrors, so the id is validated exactly like a direct call's.
|
|
321
|
+
*/
|
|
322
|
+
async readFor(operation, input, instance, credential) {
|
|
323
|
+
const handler = TESTIT_HANDLERS[operation];
|
|
324
|
+
if (handler === undefined) {
|
|
325
|
+
throw new IntegrationError("InvalidRequest", "Unsupported Test IT operation");
|
|
326
|
+
}
|
|
327
|
+
const request = handler(input, { flags: this.config.testit });
|
|
328
|
+
const response = await this.transport.getJson(instance, credential.token, request.path, request.query);
|
|
329
|
+
return objectOf(response.data);
|
|
330
|
+
}
|
|
331
|
+
/** The project of the object one companion read answers. */
|
|
332
|
+
async projectThrough(operation, input, instance, credential) {
|
|
333
|
+
return projectOf(await this.readFor(operation, input, instance, credential));
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* The bounded project listing: a service profile names the projects it
|
|
337
|
+
* covers, so the answer is fetched from that list instead of from whatever
|
|
338
|
+
* the shared account can reach. A project the service token cannot see is
|
|
339
|
+
* reported as unavailable rather than silently dropped, which is what tells
|
|
340
|
+
* the operator their boundary and their token disagree.
|
|
341
|
+
*/
|
|
342
|
+
async listBoundedProjects(instance, credential, boundary, input) {
|
|
343
|
+
const entries = boundary[TESTIT_RESOURCE_KIND] ?? [];
|
|
344
|
+
const collected = [];
|
|
345
|
+
const unavailable = [];
|
|
346
|
+
for (const entry of entries) {
|
|
347
|
+
try {
|
|
348
|
+
const { data } = await this.transport.getJson(instance, credential.token, `/projects/${encodeURIComponent(entry)}`);
|
|
349
|
+
collected.push(data);
|
|
350
|
+
}
|
|
351
|
+
catch (error) {
|
|
352
|
+
if (!recoverableResource(error))
|
|
353
|
+
throw error;
|
|
354
|
+
unavailable.push(entry);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
const flags = this.config.testit;
|
|
358
|
+
// The window is cut here, because the allowlist — not the upstream page —
|
|
359
|
+
// is what this answer pages over; the projection keeps the caller's text
|
|
360
|
+
// filter and the item shape the personal listing answers with.
|
|
361
|
+
const offset = listOffset(input["offset"]);
|
|
362
|
+
const window = collected.slice(offset, offset + listLimit(input["limit"], TESTIT_LIMITS.projects, flags));
|
|
363
|
+
const projection = TESTIT_PROJECTIONS["projects.list"];
|
|
364
|
+
const projected = objectOf(projection === undefined
|
|
365
|
+
? window
|
|
366
|
+
: projection(window, {
|
|
367
|
+
flags,
|
|
368
|
+
input,
|
|
369
|
+
instanceLabel: instance.label,
|
|
370
|
+
baseUrl: instance.baseUrl,
|
|
371
|
+
}));
|
|
372
|
+
return {
|
|
373
|
+
...projected,
|
|
374
|
+
serviceScoped: true,
|
|
375
|
+
...(unavailable.length === 0
|
|
376
|
+
? {}
|
|
377
|
+
: { unavailableResources: unavailable }),
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* One attachment, read as text. Test IT describes the file — its name and its
|
|
382
|
+
* size — before a byte is requested, and this provider trusts that description
|
|
383
|
+
* over anything the caller said: an archive, a screenshot, a document or a key
|
|
384
|
+
* is refused by name, a file bigger than the budget is refused by size, and
|
|
385
|
+
* the body that does come back is bounded, redacted and marked as external
|
|
386
|
+
* content.
|
|
387
|
+
*/
|
|
388
|
+
async readAttachment(instance, credential, input, request, flags) {
|
|
389
|
+
const metadata = await this.transport.getJson(instance, credential.token, `${request.path}/metadata`, {});
|
|
390
|
+
const described = objectOf(metadata.data);
|
|
391
|
+
const attachmentId = String(input["attachmentId"] ?? "");
|
|
392
|
+
const name = attachmentName(described["name"]) || `${attachmentId}`;
|
|
393
|
+
const problem = attachmentBinaryProblem(name);
|
|
394
|
+
if (problem !== undefined) {
|
|
395
|
+
throw new IntegrationError("InvalidRequest", problem);
|
|
396
|
+
}
|
|
397
|
+
const declared = described["size"];
|
|
398
|
+
const declaredBytes = typeof declared === "number" && Number.isFinite(declared)
|
|
399
|
+
? declared
|
|
400
|
+
: undefined;
|
|
401
|
+
const limit = attachmentByteLimit(input["maxBytes"], flags);
|
|
402
|
+
assertReadableSize(declaredBytes, limit);
|
|
403
|
+
const body = await this.transport.getText(instance, credential.token, request.path, limit);
|
|
404
|
+
const text = body.binary ? "" : String(redactSecrets(body.text) ?? "");
|
|
405
|
+
return {
|
|
406
|
+
attachmentId,
|
|
407
|
+
name,
|
|
408
|
+
type: typeof described["type"] === "string" ? described["type"] : null,
|
|
409
|
+
declaredBytes: declaredBytes ?? null,
|
|
410
|
+
downloadedBytes: body.bytes,
|
|
411
|
+
binary: body.binary,
|
|
412
|
+
truncated: body.truncated,
|
|
413
|
+
...(body.binary ? {} : { untrustedContent: contentBlock(text, limit) }),
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
resolveInstance(requested) {
|
|
417
|
+
const flags = this.config.testit;
|
|
418
|
+
const id = requested?.trim();
|
|
419
|
+
if (id !== undefined && id !== "") {
|
|
420
|
+
const instance = flags.instances.find((item) => item.id === id);
|
|
421
|
+
if (instance === undefined) {
|
|
422
|
+
throw new IntegrationError("InvalidCredential", "Unknown Test IT instance");
|
|
423
|
+
}
|
|
424
|
+
return instance;
|
|
425
|
+
}
|
|
426
|
+
const [only] = flags.instances;
|
|
427
|
+
if (only === undefined) {
|
|
428
|
+
throw new IntegrationError("InvalidCredential", "No Test IT instance is configured");
|
|
429
|
+
}
|
|
430
|
+
if (flags.instances.length > 1) {
|
|
431
|
+
throw new IntegrationError("InvalidCredential", "Choose a Test IT instance");
|
|
432
|
+
}
|
|
433
|
+
return only;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
/** A missing or forbidden project inside a boundary is reported, not fatal. */
|
|
437
|
+
function recoverableResource(error) {
|
|
438
|
+
return (error instanceof IntegrationError &&
|
|
439
|
+
(error.code === "ResourceNotFound" ||
|
|
440
|
+
error.code === "ProviderPermissionDenied"));
|
|
441
|
+
}
|
|
442
|
+
/** Map an upstream failure of the probe onto a health status. */
|
|
443
|
+
function healthFromFailure(error) {
|
|
444
|
+
if (!(error instanceof IntegrationError)) {
|
|
445
|
+
return { status: "unreachable" };
|
|
446
|
+
}
|
|
447
|
+
switch (error.code) {
|
|
448
|
+
case "CredentialExpired":
|
|
449
|
+
return { status: "expired" };
|
|
450
|
+
case "CredentialRevoked":
|
|
451
|
+
case "ProviderPermissionDenied":
|
|
452
|
+
return { status: "revoked" };
|
|
453
|
+
default:
|
|
454
|
+
return { status: "unreachable" };
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
export default TestitProvider;
|
|
458
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/providers/testit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AAarF,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EACL,6BAA6B,EAC7B,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,cAAc,GAGf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,UAAU,GAEX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,kBAAkB,GAEnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,uBAAuB,EACvB,kBAAkB,GAEnB,MAAM,gBAAgB,CAAC;AAExB;;;;GAIG;AACH,MAAM,WAAW,GAAG,gBAAgB,CAAC;AACrC,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AAElC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,QAAiC,EACjC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