@sentry/junior-plugin-api 0.158.0 → 0.159.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/dist/egress-policy.d.ts +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -0
- package/package.json +1 -1
- package/src/egress-policy.ts +15 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deny provider egress when a plugin policy does not allow the request.
|
|
3
|
+
*
|
|
4
|
+
* Call from a plugin `grantForEgress` hook before returning a write grant.
|
|
5
|
+
*/
|
|
6
|
+
export declare function enforceEgressPolicy(input: {
|
|
7
|
+
allowed: boolean;
|
|
8
|
+
denialMessage: string;
|
|
9
|
+
}): void;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -666,6 +666,13 @@ var EgressPolicyDenied = class extends Error {
|
|
|
666
666
|
}
|
|
667
667
|
};
|
|
668
668
|
|
|
669
|
+
// src/egress-policy.ts
|
|
670
|
+
function enforceEgressPolicy(input) {
|
|
671
|
+
if (!input.allowed) {
|
|
672
|
+
throw new EgressPolicyDenied(input.denialMessage);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
669
676
|
// src/registration.ts
|
|
670
677
|
var PLUGIN_NAME_RE = /^[a-z][a-z0-9-]*$/;
|
|
671
678
|
var USER_PAGE_ID_RE = /^[a-z][a-z0-9-]*$/;
|
|
@@ -852,6 +859,7 @@ export {
|
|
|
852
859
|
destinationSchema,
|
|
853
860
|
destinationVisibilitySchema,
|
|
854
861
|
dispatchOptionsSchema,
|
|
862
|
+
enforceEgressPolicy,
|
|
855
863
|
getSourceKey,
|
|
856
864
|
identitySchema,
|
|
857
865
|
isPrivateSource,
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EgressPolicyDenied } from "./credentials";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Deny provider egress when a plugin policy does not allow the request.
|
|
5
|
+
*
|
|
6
|
+
* Call from a plugin `grantForEgress` hook before returning a write grant.
|
|
7
|
+
*/
|
|
8
|
+
export function enforceEgressPolicy(input: {
|
|
9
|
+
allowed: boolean;
|
|
10
|
+
denialMessage: string;
|
|
11
|
+
}): void {
|
|
12
|
+
if (!input.allowed) {
|
|
13
|
+
throw new EgressPolicyDenied(input.denialMessage);
|
|
14
|
+
}
|
|
15
|
+
}
|
package/src/index.ts
CHANGED