-
Notifications
You must be signed in to change notification settings - Fork 2
align with main #166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tigpt
wants to merge
18
commits into
ios26-ready-for-app-store
Choose a base branch
from
main
base: ios26-ready-for-app-store
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
align with main #166
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f86db69
Fix security, logic, and resource management bugs across CloudFront, …
cursoragent bb9de39
Merge pull request #154 from AWSary/cursor/fix-three-bugs-in-the-code…
tigpt 3e1eed6
Implement Sentry
tigpt b12a1ef
add copy description to Glosary Detail View
tigpt 658e50f
Merge branch 'main' of https://github.com/AWSary/AWSary-iOS
tigpt 36f94bf
enable text selection on markdown
tigpt ba943f4
adapt sentry for dev
tigpt 99a3c49
Remove Sentry integration
tigpt 50bb94a
Merge pull request #161 from AWSary/codex/remove-sentry-from-awsary-c…
tigpt 8812006
Add repository agent guidance
tigpt 5ce8b8e
Document third-party SDK guidance
tigpt eb5f04e
Merge pull request #162 from AWSary/codex/create-agents.md-for-projec…
tigpt 1cba0f5
Add iOS CI build and test workflow
tigpt 74249c7
Add iOS unit test target
tigpt 07fa160
Add iOS CI build and test workflow (#164)
tigpt 92c419e
Merge pull request #165 from AWSary/codex/fix-ci-error-for-awsary-scheme
tigpt 53ac4fb
Revert "Merge pull request #165 from AWSary/codex/fix-ci-error-for-aw…
tigpt 2b50cc8
Revert "Merge pull request #161 from AWSary/codex/remove-sentry-from-…
tigpt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: iOS CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| name: Build and Test (iOS) | ||
| runs-on: macos-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Xcode | ||
| uses: maxim-lobanov/setup-xcode@v1 | ||
| with: | ||
| xcode-version: latest-stable | ||
|
|
||
| - name: Build and test | ||
| run: | | ||
| xcodebuild \ | ||
| -project ios/awsary.xcodeproj \ | ||
| -scheme "awsary (iOS)" \ | ||
| -destination "platform=iOS Simulator,name=iPhone 14" \ | ||
| clean test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # AGENTS | ||
|
|
||
| ## Scope | ||
| This guidance applies to the entire repository unless a nested `AGENTS.md` overrides it. | ||
|
|
||
| ## Project overview | ||
| This repository contains multiple components (e.g., iOS app, website, Terraform, utilities). Verify which directory you are working in before making changes. | ||
|
|
||
| ## General workflow | ||
| - Favor small, targeted changes that align with existing patterns. | ||
| - Run relevant tests or linters for the area you changed when feasible. | ||
| - Document any skipped tests and the reason. | ||
|
|
||
| ## Coding conventions | ||
| - Prefer clear, descriptive names consistent with surrounding code. | ||
| - Keep formatting consistent with existing files in each subproject. | ||
| - Avoid introducing new dependencies without justification. | ||
| - Prefer native Swift and SwiftUI with Apple public APIs. Only suggest third-party code when necessary or with significant advantages, and ask a human before adding any external SDK or codebase. | ||
|
|
||
| ## iOS (Swift/Xcode) | ||
| - Follow existing Swift style and naming conventions. | ||
| - Use `@MainActor` or concurrency annotations consistently with neighboring code. | ||
| - Avoid force-unwrapping unless the codebase already uses it and it is safe. | ||
|
|
||
| ## Web (website) | ||
| - Follow existing linting/formatting rules. | ||
| - Keep accessibility in mind (labels, semantics, contrast). | ||
|
|
||
| ## Infrastructure (terraform) | ||
| - Use existing module patterns and naming conventions. | ||
| - Keep variables and outputs documented. | ||
|
|
||
| ## PR/commit notes | ||
| - Summarize user-visible changes. | ||
| - Call out any migrations, configuration changes, or manual steps. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| # Bug Fixes Summary | ||
|
|
||
| ## Overview | ||
| This document summarizes the 3 critical bugs identified and fixed in the AWSary codebase, including security vulnerabilities, logic errors, and resource management issues. | ||
|
|
||
| ## Bug #1: Security Vulnerability in CloudFront Configuration | ||
| **Severity:** HIGH | ||
| **Type:** Security Vulnerability | ||
| **Location:** `terraform/cloudfront_cdn.tf` line 51 | ||
|
|
||
| ### Description | ||
| The CloudFront distribution was configured to allow both HTTP and HTTPS traffic (`viewer_protocol_policy = "allow-all"`), which exposes user data to potential interception and violates security best practices. | ||
|
|
||
| ### Impact | ||
| - Sensitive data could be transmitted over unencrypted HTTP connections | ||
| - Vulnerability to man-in-the-middle attacks | ||
| - Non-compliance with security standards requiring HTTPS | ||
|
|
||
| ### Fix Applied | ||
| Changed `viewer_protocol_policy` from `"allow-all"` to `"redirect-to-https"` to ensure all HTTP traffic is automatically redirected to HTTPS. | ||
|
|
||
| ```diff | ||
| - viewer_protocol_policy = "allow-all" | ||
| + viewer_protocol_policy = "redirect-to-https" | ||
| ``` | ||
|
|
||
| ## Bug #2: Logic Error in OpenAI Script | ||
| **Severity:** MEDIUM | ||
| **Type:** Logic Error | ||
| **Location:** `utils/open_ai.py` lines 18-19 | ||
|
|
||
| ### Description | ||
| The script contained a typo in the key name `shortDesctiption` instead of `shortDescription`, causing the logic to fail when checking if an OpenAI description already exists. | ||
|
|
||
| ### Impact | ||
| - Script would crash or behave unexpectedly when accessing non-existent key | ||
| - Logic condition `if "#" not in item['shortDesctiption']` would always fail | ||
| - Potential KeyError exceptions | ||
| - Inefficient processing of already-processed items | ||
|
|
||
| ### Fix Applied | ||
| 1. Fixed the typo: `shortDesctiption` → `shortDescription` | ||
| 2. Added safe key access using `item.get('shortDescription', '')` to prevent KeyError | ||
| 3. Fixed typo in print statement: `OpenAIn` → `OpenAI` | ||
|
|
||
| ```diff | ||
| - if "#" not in item['shortDesctiption'] : | ||
| - print("Checking OpenAIn for : " + item['name']) | ||
| - item['shortDesctiption'] = chat_completion.choices[0].message.content | ||
| + if "#" not in item.get('shortDescription', '') : | ||
| + print("Checking OpenAI for : " + item['name']) | ||
| + item['shortDescription'] = chat_completion.choices[0].message.content | ||
| ``` | ||
|
|
||
| ## Bug #3: Resource Management Bug in Polly Script | ||
| **Severity:** MEDIUM | ||
| **Type:** Resource Management / Memory Leak | ||
| **Location:** `utils/polly.py` line 14 | ||
|
|
||
| ### Description | ||
| The script opened file handles without using proper context management (`with` statement), which could cause resource leaks or file corruption if exceptions occurred. | ||
|
|
||
| ### Impact | ||
| - File handles could remain open if exceptions occur | ||
| - Potential resource exhaustion on systems with limited file descriptors | ||
| - Risk of file corruption or incomplete writes | ||
| - Poor adherence to Python best practices | ||
|
|
||
| ### Fix Applied | ||
| Replaced manual file opening/closing with context manager (`with` statement) to ensure proper resource cleanup. | ||
|
|
||
| ```diff | ||
| - file = open('speech/' + item['name'].replace(' ','_') + '_Brian_' + 'en-GB' + '.mp3', 'wb') | ||
| - file.write(response['AudioStream'].read()) | ||
| - file.close() | ||
| + filename = 'speech/' + item['name'].replace(' ','_') + '_Brian_' + 'en-GB' + '.mp3' | ||
| + with open(filename, 'wb') as file: | ||
| + file.write(response['AudioStream'].read()) | ||
| ``` | ||
|
|
||
| ## Additional Observations | ||
| During the codebase review, several other potential improvements were identified: | ||
|
|
||
| 1. **OpenAI API Version**: The script uses the deprecated `openai.ChatCompletion.create()` API format (pre-v1.0) | ||
| 2. **API Key Security**: Hardcoded placeholder API key in the code | ||
| 3. **Error Handling**: Missing try-catch blocks for API calls and file operations | ||
| 4. **DynamoDB Pagination**: Scripts don't handle pagination for large DynamoDB tables | ||
|
|
||
| ## Recommendations | ||
| 1. Implement comprehensive error handling throughout the Python scripts | ||
| 2. Update OpenAI API calls to use the current v1.0+ format | ||
| 3. Move API keys to environment variables or secure configuration | ||
| 4. Add pagination support for DynamoDB scan operations | ||
| 5. Implement logging for better debugging and monitoring | ||
| 6. Add input validation for all user-provided data | ||
|
|
||
| ## Conclusion | ||
| The three bugs fixed represent significant improvements to the codebase's security, reliability, and maintainability. The CloudFront security fix is particularly critical as it prevents potential data exposure through unencrypted connections. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .sentryclirc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Development Sentry configuration committed for production build
Medium Severity
Sentry SDK is configured with
options.debug = trueandoptions.environment = "dev"while production settings are commented out. Additionally,tracesSampleRateandsessionSampleRateare set to1.0(100%), which the comments note should be adjusted for production. This configuration will cause verbose debug logging in production builds, report all events as "dev" environment in Sentry dashboards, and incur higher costs from 100% sampling.Additional Locations (1)
ios/AWSary/AWSaryApp.swift#L33-L34