Repository navigation
tracked file movement on git - #21
Conversation
Reviewer's Guide by SourceryThis pull request implements tracking of file movements in Git and updates the deployment process. It also introduces several security improvements by removing hardcoded secrets and using environment variables instead. Additionally, it updates the Dockerfile to improve security and maintainability, and modifies the configuration files to reflect these changes. Sequence diagram for the updated image signing processsequenceDiagram
participant A as API
participant GH as GitHub Actions
participant R as Registry
participant S as Signer
A->>A: Load environment variables
A->>GH: Trigger signing workflow
Note over A,GH: Uses GH_ACCESS_TOKEN from env
GH->>R: Pull image
Note over GH,R: Uses INTERMEDIATE_REGISTRY_TOKEN
GH->>S: Sign image
Note over GH,S: Uses COSIGN_PRIVATE_KEY and COSIGN_PASSWORD
S->>R: Push signed image
Class diagram showing configuration structure changesclassDiagram
class Config {
+db: Object
+api: Object
+endpoints: Object
}
class Endpoints {
+admin_users: Array
+builds: Object
}
class Builds {
+gh_action_path: String
+intermediate_registery_format: String
-intermediate_registry_token: String
}
Config --> Endpoints
Endpoints --> Builds
note for Builds "Removed hardcoded token,
now using env variable"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @lvarin - I've reviewed your changes and found some issues that need to be addressed.
Blocking issues:
- Remove access tokens from version control (link)
Overall Comments:
- The removal of requests from requirements.txt may cause issues as it appears to be a needed dependency. Please verify if this removal was intentional.
- Please complete the PR description template by selecting the type of change and filling out the checklist. This helps with tracking and reviewing the changes.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🔴 Security: 1 blocking issue
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
|
||
| COPY --chown=1000:1000 ./ /app | ||
| ##### WORKING DIRECTORY ##### | ||
| WORKDIR /app |
There was a problem hiding this comment.
suggestion (performance): Consider restructuring Dockerfile to optimize layer caching
Move the COPY command after installing dependencies to better utilize Docker layer caching. Copy only requirements.txt first, install dependencies, then copy the rest of the code.
| - name: 'Akash' | ||
| uid: 'akash.saini' | ||
| user_access_token: 'XXXXXXXXXXXXXXXXXXXX' | ||
| user_access_token: 'c42a6d44e3d0' |
There was a problem hiding this comment.
🚨 issue (security): Remove access tokens from version control
Access tokens should not be committed to version control, even if truncated. Use environment variables or a secrets management system instead.
| }""" | ||
| ) % (intermediate_registry_format.split("/", 1)[0], intermediate_registry_token ) | ||
| ) % (intermediate_registry_format.split("/", 1)[0], | ||
| os.getenv("INTERMEDIATE_REGISTRY_TOKEN") ) |
There was a problem hiding this comment.
suggestion: Add fallback handling for environment variables
Consider using os.getenv() with a default value or add explicit error handling for missing environment variables to prevent runtime errors.
| os.getenv("INTERMEDIATE_REGISTRY_TOKEN") ) | |
| os.getenv("INTERMEDIATE_REGISTRY_TOKEN", None)) | |
| if template_config_file.find("None") != -1: | |
| raise EnvironmentError("INTERMEDIATE_REGISTRY_TOKEN environment variable is not set") |
| def trigger_signing_image(dockerhub_token: str, | ||
| image_path: str, pull_tag: str, push_tag: str): | ||
| username, password = base64.b64decode(dockerhub_token).decode('utf-8').split(":") | ||
| url = "https://api.github.com/repos/{}/dispatches".format( |
There was a problem hiding this comment.
issue (code-quality): Replace call to format with f-string [×2] (use-fstring-for-formatting)
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
Checklist:
Summary by Sourcery
Update Docker build process to use a non-root user and improve security by storing secrets as environment variables.
Build:
CI:
Deployment: