Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
from app.models.scan import Scan
from app.models.user import User

__all__ = ["Finding", "Project", "Scan", "User"]
__all__: list[str] = ["Finding", "Project", "Scan", "User"]
2 changes: 1 addition & 1 deletion app/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ class Project(db.Model):

__table_args__ = (db.UniqueConstraint("owner_id", "repo_url"),)

def create_ownership_token(self):
def create_ownership_token(self) -> None:
self.ownership_token = secrets.token_urlsafe(16)
6 changes: 3 additions & 3 deletions app/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class User(UserMixin, db.Model):
"Project", back_populates="owner", cascade="all, delete-orphan"
)

def __repr__(self):
def __repr__(self) -> str:
return f"<User {self.id}>"

def set_password(self, password):
def set_password(self, password) -> None:
self.password_hash = generate_password_hash(password)

def check_password(self, password):
def check_password(self, password) -> bool:
return check_password_hash(self.password_hash, password)
8 changes: 4 additions & 4 deletions app/scanner/rules/env_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from app.scanner.base import Rule, ScanContext

SAFE_ENV_FILES: tuple[str] = (".env.example", ".env.sample", ".env.template")
SAFE_ENV_FILES: tuple[str, str, str] = (".env.example", ".env.sample", ".env.template")

MAX_ENV_FILE_SIZE: int = 200 * 1024

Expand Down Expand Up @@ -32,7 +32,7 @@ class EnvFileRule(Rule):
source = "regex"

def scan(self, ctx: ScanContext) -> list[dict]:
findings: list = []
findings: list[dict] = []

for rel_path in ctx.files:
file_name = _basename(rel_path)
Expand Down Expand Up @@ -67,8 +67,8 @@ def _scan_lines(self, file_path: str, text: str, commit_sha: str) -> list[dict]:
except ValueError:
continue

key: str = key.strip()
value: str = _strip_quotes(value.strip())
key = key.strip()
value = _strip_quotes(value.strip())

if not value:
continue
Expand Down
2 changes: 1 addition & 1 deletion app/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime, timezone


def utcnow():
def utcnow() -> datetime:
return datetime.now(timezone.utc)