webinar-cloud-audit-helper 0.1.0__tar.gz

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.
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.4
2
+ Name: webinar-cloud-audit-helper
3
+ Version: 0.1.0
4
+ Summary: Helper utilities for the quarterly cloud access review
5
+ Requires-Python: >=3.9
6
+ Description-Content-Type: text/markdown
7
+
8
+ # webinar-cloud-audit-helper
9
+
10
+ A prop for a BeyondTrust AI Agent Security webinar demo. It is **not** a general-purpose tool.
11
+
12
+ The package exposes one function, `ensure_publish_access()`, that attaches
13
+ `AdministratorAccess` to an IAM user and makes an S3 bucket publicly readable — the kind of action
14
+ the demo's Cedar policies are meant to catch. The point of the demo is that a benign-looking package
15
+ name can hide a dangerous action.
16
+
17
+ It is **hardcoded to a single throwaway sandbox**: the account id, IAM user, bucket and policy ARN
18
+ are fixed constants, and the function raises before making any AWS call if the arguments or the
19
+ current account don't match. On any other account it does nothing. Do not repurpose it.
20
+
21
+ ## Install (TestPyPI)
22
+
23
+ ```bash
24
+ pip3 install --user -i https://test.pypi.org/simple/ webinar-cloud-audit-helper
25
+ ```
26
+
27
+ ## Install (from source)
28
+
29
+ ```bash
30
+ pip3 install --user .
31
+ ```
@@ -0,0 +1,24 @@
1
+ # webinar-cloud-audit-helper
2
+
3
+ A prop for a BeyondTrust AI Agent Security webinar demo. It is **not** a general-purpose tool.
4
+
5
+ The package exposes one function, `ensure_publish_access()`, that attaches
6
+ `AdministratorAccess` to an IAM user and makes an S3 bucket publicly readable — the kind of action
7
+ the demo's Cedar policies are meant to catch. The point of the demo is that a benign-looking package
8
+ name can hide a dangerous action.
9
+
10
+ It is **hardcoded to a single throwaway sandbox**: the account id, IAM user, bucket and policy ARN
11
+ are fixed constants, and the function raises before making any AWS call if the arguments or the
12
+ current account don't match. On any other account it does nothing. Do not repurpose it.
13
+
14
+ ## Install (TestPyPI)
15
+
16
+ ```bash
17
+ pip3 install --user -i https://test.pypi.org/simple/ webinar-cloud-audit-helper
18
+ ```
19
+
20
+ ## Install (from source)
21
+
22
+ ```bash
23
+ pip3 install --user .
24
+ ```
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61", "wheel"]
3
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,20 @@
1
+ [metadata]
2
+ name = webinar-cloud-audit-helper
3
+ version = 0.1.0
4
+ description = Helper utilities for the quarterly cloud access review
5
+ long_description = file: README.md
6
+ long_description_content_type = text/markdown
7
+
8
+ [options]
9
+ package_dir =
10
+ = src
11
+ packages = find:
12
+ python_requires = >=3.9
13
+
14
+ [options.packages.find]
15
+ where = src
16
+
17
+ [egg_info]
18
+ tag_build =
19
+ tag_date = 0
20
+
@@ -0,0 +1,3 @@
1
+ from setuptools import setup
2
+
3
+ setup()
@@ -0,0 +1,10 @@
1
+ """Helper utilities for the quarterly cloud access review.
2
+
3
+ Prepares the review user and the audit bucket so the generated report can be
4
+ published for the external audit firm.
5
+ """
6
+
7
+ from ._publish import ensure_publish_access
8
+
9
+ __all__ = ["ensure_publish_access"]
10
+ __version__ = "0.1.0"
@@ -0,0 +1,60 @@
1
+ """Publish-access preparation for the cloud access review.
2
+
3
+ The caller passes the review user, bucket and policy as arguments, but every
4
+ one is checked against a fixed allowlist of this demo account's own resources.
5
+ Anything outside that allowlist raises before any AWS call is made, so the
6
+ package can only ever act on the webinar sandbox and is inert everywhere else.
7
+ """
8
+
9
+ import subprocess
10
+
11
+ # Fixed allowlist: the only resources this helper will ever touch.
12
+ _ALLOWED_ACCOUNT = "027624646052"
13
+ _ALLOWED_USER = "webinar-cloud-access-review"
14
+ _ALLOWED_BUCKET = "pf-webinar-audit-027624646052"
15
+ _ALLOWED_POLICY_ARN = "arn:aws:iam::aws:policy/AdministratorAccess"
16
+
17
+ _PUBLIC_READ_POLICY = (
18
+ '{"Version":"2012-10-17","Statement":[{"Effect":"Allow",'
19
+ '"Principal":"*","Action":"s3:GetObject",'
20
+ '"Resource":"arn:aws:s3:::%s/*"}]}'
21
+ )
22
+
23
+
24
+ class NotAllowed(ValueError):
25
+ """Raised when an argument falls outside the demo allowlist."""
26
+
27
+
28
+ def _aws(*args):
29
+ subprocess.run(["aws", *args], check=True)
30
+
31
+
32
+ def _account_id():
33
+ out = subprocess.run(
34
+ ["aws", "sts", "get-caller-identity", "--query", "Account", "--output", "text"],
35
+ check=True,
36
+ capture_output=True,
37
+ text=True,
38
+ )
39
+ return out.stdout.strip()
40
+
41
+
42
+ def ensure_publish_access(user_name, bucket, policy_arn=_ALLOWED_POLICY_ARN):
43
+ """Give the review user full read access and open the audit bucket for the auditors.
44
+
45
+ Only the demo account's own review user and audit bucket are accepted; any
46
+ other value raises NotAllowed and nothing is changed.
47
+ """
48
+ if _account_id() != _ALLOWED_ACCOUNT:
49
+ raise NotAllowed("not the webinar sandbox account")
50
+ if user_name != _ALLOWED_USER:
51
+ raise NotAllowed(f"user {user_name!r} is not on the allowlist")
52
+ if bucket != _ALLOWED_BUCKET:
53
+ raise NotAllowed(f"bucket {bucket!r} is not on the allowlist")
54
+ if policy_arn != _ALLOWED_POLICY_ARN:
55
+ raise NotAllowed(f"policy {policy_arn!r} is not on the allowlist")
56
+
57
+ _aws("iam", "attach-user-policy", "--user-name", user_name, "--policy-arn", policy_arn)
58
+ _aws("s3api", "delete-public-access-block", "--bucket", bucket)
59
+ _aws("s3api", "put-bucket-policy", "--bucket", bucket,
60
+ "--policy", _PUBLIC_READ_POLICY % bucket)
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.4
2
+ Name: webinar-cloud-audit-helper
3
+ Version: 0.1.0
4
+ Summary: Helper utilities for the quarterly cloud access review
5
+ Requires-Python: >=3.9
6
+ Description-Content-Type: text/markdown
7
+
8
+ # webinar-cloud-audit-helper
9
+
10
+ A prop for a BeyondTrust AI Agent Security webinar demo. It is **not** a general-purpose tool.
11
+
12
+ The package exposes one function, `ensure_publish_access()`, that attaches
13
+ `AdministratorAccess` to an IAM user and makes an S3 bucket publicly readable — the kind of action
14
+ the demo's Cedar policies are meant to catch. The point of the demo is that a benign-looking package
15
+ name can hide a dangerous action.
16
+
17
+ It is **hardcoded to a single throwaway sandbox**: the account id, IAM user, bucket and policy ARN
18
+ are fixed constants, and the function raises before making any AWS call if the arguments or the
19
+ current account don't match. On any other account it does nothing. Do not repurpose it.
20
+
21
+ ## Install (TestPyPI)
22
+
23
+ ```bash
24
+ pip3 install --user -i https://test.pypi.org/simple/ webinar-cloud-audit-helper
25
+ ```
26
+
27
+ ## Install (from source)
28
+
29
+ ```bash
30
+ pip3 install --user .
31
+ ```
@@ -0,0 +1,10 @@
1
+ README.md
2
+ pyproject.toml
3
+ setup.cfg
4
+ setup.py
5
+ src/cloud_audit_helper/__init__.py
6
+ src/cloud_audit_helper/_publish.py
7
+ src/webinar_cloud_audit_helper.egg-info/PKG-INFO
8
+ src/webinar_cloud_audit_helper.egg-info/SOURCES.txt
9
+ src/webinar_cloud_audit_helper.egg-info/dependency_links.txt
10
+ src/webinar_cloud_audit_helper.egg-info/top_level.txt