@via-profit/ability 3.1.0 → 3.2.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/CHANGELOG.md +129 -129
- package/CONTRIBUTING.md +14 -14
- package/LICENSE +21 -21
- package/README.md +1325 -1177
- package/SECURITY.md +33 -33
- package/dist/core/AbilityPolicy.d.ts +8 -13
- package/dist/core/AbilityRule.d.ts +7 -1
- package/dist/core/AbilityRuleSet.d.ts +6 -4
- package/dist/index.js +647 -1002
- package/package.json +73 -76
package/SECURITY.md
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
# Security Policy
|
|
2
|
-
|
|
3
|
-
## Reporting a Vulnerability
|
|
4
|
-
|
|
5
|
-
I take the security of `@via-profit/ability` seriously. If you discover a security vulnerability, please report it responsibly.
|
|
6
|
-
|
|
7
|
-
### How to Report a Vulnerability
|
|
8
|
-
|
|
9
|
-
**Please DO NOT create a public GitHub issue for security vulnerabilities.**
|
|
10
|
-
|
|
11
|
-
Instead, send the details directly to me:
|
|
12
|
-
|
|
13
|
-
- **Email**: [delhsmail@gmail.com](mailto:delhsmail@gmail.com)
|
|
14
|
-
- **Author**: Vasily Novosad
|
|
15
|
-
- **Timezone**: UTC+5 (for coordinating response time)
|
|
16
|
-
|
|
17
|
-
### What to Include
|
|
18
|
-
|
|
19
|
-
To help me address the issue quickly, please include:
|
|
20
|
-
|
|
21
|
-
- Description of the vulnerability
|
|
22
|
-
- Steps to reproduce (if applicable)
|
|
23
|
-
- Potential impact
|
|
24
|
-
- Suggestions for fixing (if any)
|
|
25
|
-
|
|
26
|
-
### Process
|
|
27
|
-
|
|
28
|
-
1. I will acknowledge your report within 48 hours
|
|
29
|
-
2. I will assess the vulnerability
|
|
30
|
-
3. Work on a fix will begin depending on severity
|
|
31
|
-
4. After the fix is released, I will notify you and acknowledge your contribution (if you agree)
|
|
32
|
-
|
|
33
|
-
Thank you for helping keep this project secure!
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Reporting a Vulnerability
|
|
4
|
+
|
|
5
|
+
I take the security of `@via-profit/ability` seriously. If you discover a security vulnerability, please report it responsibly.
|
|
6
|
+
|
|
7
|
+
### How to Report a Vulnerability
|
|
8
|
+
|
|
9
|
+
**Please DO NOT create a public GitHub issue for security vulnerabilities.**
|
|
10
|
+
|
|
11
|
+
Instead, send the details directly to me:
|
|
12
|
+
|
|
13
|
+
- **Email**: [delhsmail@gmail.com](mailto:delhsmail@gmail.com)
|
|
14
|
+
- **Author**: Vasily Novosad
|
|
15
|
+
- **Timezone**: UTC+5 (for coordinating response time)
|
|
16
|
+
|
|
17
|
+
### What to Include
|
|
18
|
+
|
|
19
|
+
To help me address the issue quickly, please include:
|
|
20
|
+
|
|
21
|
+
- Description of the vulnerability
|
|
22
|
+
- Steps to reproduce (if applicable)
|
|
23
|
+
- Potential impact
|
|
24
|
+
- Suggestions for fixing (if any)
|
|
25
|
+
|
|
26
|
+
### Process
|
|
27
|
+
|
|
28
|
+
1. I will acknowledge your report within 48 hours
|
|
29
|
+
2. I will assess the vulnerability
|
|
30
|
+
3. Work on a fix will begin depending on severity
|
|
31
|
+
4. After the fix is released, I will notify you and acknowledge your contribution (if you agree)
|
|
32
|
+
|
|
33
|
+
Thank you for helping keep this project secure!
|
|
@@ -67,18 +67,13 @@ export declare class AbilityPolicy<Resource extends ResourceObject = Record<stri
|
|
|
67
67
|
*/
|
|
68
68
|
check(resource: Resource, environment?: Environment): Promise<AbilityMatch>;
|
|
69
69
|
explain(): AbilityExplain;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*/
|
|
79
|
-
static fromJSON<Resource extends ResourceObject = Record<string, unknown>, Environment = unknown>(config: AbilityPolicyConfig): AbilityPolicy<Resource, Environment>;
|
|
80
|
-
static fromDSL<Resource extends ResourceObject = Record<string, unknown>, Environment = unknown>(dsl: string): AbilityPolicy<Resource, Environment>;
|
|
81
|
-
toJSON(): AbilityPolicyConfig;
|
|
82
|
-
toString(): string;
|
|
70
|
+
copyWith(props: Partial<{
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
permission: string;
|
|
74
|
+
effect: AbilityPolicyEffect;
|
|
75
|
+
compareMethod: AbilityCompare;
|
|
76
|
+
ruleSet: AbilityRuleSet<Resource, Environment>[];
|
|
77
|
+
}>): AbilityPolicy<Resource, Environment>;
|
|
83
78
|
}
|
|
84
79
|
export default AbilityPolicy;
|
|
@@ -61,7 +61,13 @@ export declare class AbilityRule<Resources extends object = object, Environment
|
|
|
61
61
|
*/
|
|
62
62
|
getDotNotationValue<T = unknown>(resource: unknown, desc: string): T | undefined;
|
|
63
63
|
toString(): string;
|
|
64
|
-
|
|
64
|
+
copyWith(props: Partial<{
|
|
65
|
+
id: string | null;
|
|
66
|
+
name: string | null;
|
|
67
|
+
subject: string;
|
|
68
|
+
resource: AbilityRuleConfig['resource'];
|
|
69
|
+
condition: AbilityCondition;
|
|
70
|
+
}>): AbilityRule<Resources, Environment>;
|
|
65
71
|
static equals<Resources extends object = object, Environment = unknown>(subject: string, resource: AbilityRuleConfig['resource']): AbilityRule<Resources, Environment>;
|
|
66
72
|
static notEquals<Resources extends object = object, Environment = unknown>(subject: string, resource: AbilityRuleConfig['resource']): AbilityRule<Resources, Environment>;
|
|
67
73
|
static contains<Resources extends object = object, Environment = unknown>(subject: string, resource: AbilityRuleConfig['resource']): AbilityRule<Resources, Environment>;
|
|
@@ -39,10 +39,12 @@ export declare class AbilityRuleSet<Resources extends ResourceObject = Record<st
|
|
|
39
39
|
addRules(rules: AbilityRule<Resources, Environment>[]): this;
|
|
40
40
|
check(resources: Resources | null, environment?: Environment): Promise<AbilityMatch>;
|
|
41
41
|
toString(): string;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
copyWith(props: Partial<{
|
|
43
|
+
id: string | null;
|
|
44
|
+
name: string | null;
|
|
45
|
+
compareMethod: AbilityCompare;
|
|
46
|
+
rules: AbilityRule<Resources, Environment>[];
|
|
47
|
+
}>): AbilityRuleSet<Resources, Environment>;
|
|
46
48
|
static and(rules: AbilityRule[]): AbilityRuleSet<Record<string, unknown>, unknown>;
|
|
47
49
|
static or(rules: AbilityRule[]): AbilityRuleSet<Record<string, unknown>, unknown>;
|
|
48
50
|
}
|