Skip to content

Commit

Permalink
Initial migration work (#1)
Browse files Browse the repository at this point in the history
* definition update, redundant library removal, renaming setup.py, minor test tweaks from pytest recommendations

* first draft of test workflow

* bumping pyyaml

* pinning python version

* splitting test into its own step

* Update .github/workflows/test.yml

Co-authored-by: roshini-saravanakumar <114094961+roshini-saravanakumar@users.noreply.github.com>

* url update

* classifiers

* addressing comments

* more renaming

* pipeline changes, resetting version

* additional gitignore directories

---------

Co-authored-by: roshini-saravanakumar <114094961+roshini-saravanakumar@users.noreply.github.com>
  • Loading branch information
1 parent 57f4564 commit dd0c32d
Show file tree
Hide file tree
Showing 41 changed files with 106,574 additions and 75,989 deletions.
4 changes: 2 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[run]
source = parliament
omit = parliament/cli.py
source = parliamentarian
omit = parliamentarian/cli.py

[report]
fail_under = 75
40 changes: 21 additions & 19 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,26 @@ on:
types: [created]

jobs:
deploy:

pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest

environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build
run: |
python setup.py sdist bdist_wheel
# retrieve your distributions here
- name: Publish package distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
make setup
- name: Run test
run: |
make test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ venv/
.coverage
htmlcov/
dist/
build/
docs/
.env/
parliament/private_auditors
parliamentarian/private_auditors
tmp/*
.idea/*
.vscode
2 changes: 1 addition & 1 deletion bin/parliament
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ from pathlib import Path
path = Path(os.path.abspath(__file__))
sys.path.append(str(path.parent.parent))

from parliament.cli import main
from parliamentarian.cli import main
main()
2 changes: 1 addition & 1 deletion parliament/__init__.py → parliamentarian/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
This library is a linter for AWS IAM policies.
"""
__version__ = "1.6.2"
__version__ = "1.0.0"

import fnmatch
import functools
Expand Down
4 changes: 2 additions & 2 deletions parliament/cli.py → parliamentarian/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
from os.path import join
from pathlib import Path

from parliament import (
from parliamentarian import (
analyze_policy_string,
enhance_finding,
override_config,
config,
__version__,
)
from parliament.misc import make_list
from parliamentarian.misc import make_list

logger = logging.getLogger(__name__)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import jsoncfg

from parliament import Policy
from parliamentarian import Policy


def get_stmts(policy: Policy) -> Iterable:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections import defaultdict

from parliament import is_arn_match, expand_action
from parliamentarian import is_arn_match, expand_action


def _expand_action(operation):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_single-vs-multi-valued-condition-keys.html
"""
import re
from parliament import Policy
from parliament.misc import make_list
from parliamentarian import Policy
from parliamentarian.misc import make_list


def audit(policy: Policy) -> None:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from parliament import analyze_policy_string
from parliamentarian import analyze_policy_string

S3_STAR_FINDINGS = {"PERMISSIONS_MANAGEMENT_ACTIONS", "RESOURCE_MISMATCH"}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from parliament import analyze_policy_string
from parliamentarian import analyze_policy_string


class TestCredentialsManagement:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from parliament import analyze_policy_string
from parliamentarian import analyze_policy_string


class TestPermissionsManagement:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from parliament import analyze_policy_string
from parliamentarian import analyze_policy_string


class TestPrivilegeEscalation:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from parliament import analyze_policy_string
from parliamentarian import analyze_policy_string


class TestSensitiveAccess:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from parliament import analyze_policy_string
from parliamentarian import analyze_policy_string


class TestSensitiveAccess:
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit dd0c32d

Please sign in to comment.