Skip to content
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

UI allowlist #410

Merged
merged 76 commits into from
Oct 15, 2024
Merged

UI allowlist #410

merged 76 commits into from
Oct 15, 2024

Conversation

Lucianosc
Copy link
Contributor

No description provided.

@Lucianosc Lucianosc self-assigned this Sep 9, 2024
Copy link

vercel bot commented Sep 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gardens-v2 ✅ Ready (Inspect) Visit Preview 💬 1 unresolved
✅ 8 resolved
Oct 15, 2024 1:38am

@Lucianosc Lucianosc linked an issue Sep 9, 2024 that may be closed by this pull request
4 tasks
@Corantin Corantin changed the base branch from dev to allowlist-feature September 9, 2024 18:35
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great that there are no obvious logic or security issues in the code you reviewed! However, "no news is not always good news", especially when it comes to security and complex logic.

Here's why you shouldn't stop there and some things to consider:

  • Implicit vulnerabilities: Absence of code changes doesn't mean there were no vulnerabilities to begin with. Existing code could still harbor hidden logic flaws or security holes.
  • Changed context: Even if the code itself remained unchanged, the environment it operates in might have changed. New dependencies, updated libraries, or even changes in user behavior can introduce vulnerabilities.
  • Incomplete review: Perhaps you missed something. Reviewing code for logic and security issues requires focus and a methodical approach. It's easy to overlook things, especially in unfamiliar codebases.

Instead of saying "no relevant changes," consider these alternatives:

  • "No obvious logic or security issues found." This acknowledges the possibility of hidden issues.
  • "Recommend further analysis of [specific area] based on potential risks." If you have concerns about certain parts of the code, even without direct changes, highlight them.
  • "Suggest a follow-up review after [event]." This could be after a dependency update, a change in user workflow, or any event that might impact the code's logic or security.

Remember: Security and robust logic are ongoing processes. Don't be afraid to dig deeper, ask questions, and advocate for thoroughness.

</details>

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great that there are no logical or security-sensitive issues found in the code changes! This usually means one of two things:
  1. The changes are focused on aspects outside the scope of logic and security: Perhaps the modifications are related to UI/UX, documentation, refactoring for readability, or adding new tests.
  2. The codebase already has a high standard: The existing code might be well-structured and secure, and the changes introduced are minimal and carefully implemented, not requiring further scrutiny in these specific areas.

Even though no issues were found, it's still valuable to:

  • Review the context of the changes: Understand the overall purpose and impact of the modifications, even if they aren't directly related to logic or security.
  • Consider potential edge cases: Think about any unintended consequences or unexpected interactions that might arise from the changes, even if they seem minor.
  • Encourage good practices: Acknowledge the clean code and commend the developers for maintaining high standards.

Remember, a thorough code review goes beyond just finding bugs – it's about ensuring the overall quality, maintainability, and security of the codebase.

</details>

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great that there are no obvious logic or security issues in the code you reviewed! 🎉 However, "no news" isn't always "good news" when it comes to security and logic. Here's what you can do:

Consider these possibilities and adjust your response accordingly:

  • Scope: Were you only looking at a small part of the codebase? If so, mention that your review was limited and there might be issues elsewhere.
  • Complexity: Is the code you reviewed particularly complex or critical? If so, even without finding issues, it might be worth recommending a more thorough review from a security expert.
  • Context: Are there any known vulnerabilities in libraries or frameworks used by the project? Even if the code itself is fine, outdated dependencies could pose a risk.
  • Changes over time: Have there been significant changes to the codebase recently? New features and refactoring can introduce subtle vulnerabilities.

Instead of saying "no issues found," you could say:

  • "My review of the logic and security-sensitive sections of [specific files/modules] didn't reveal any immediate concerns. However, a broader security audit might be beneficial, especially considering [mention context, complexity, or recent changes]."
  • "While I didn't find any logic flaws or vulnerabilities in the code sections I reviewed, I recommend double-checking dependencies for known security issues and considering a more comprehensive security assessment for critical parts of the application."

Remember: It's better to err on the side of caution when it comes to security. Even if you didn't find anything, acknowledging potential limitations and recommending further steps demonstrates your diligence and commitment to secure coding practices.

</details>

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great that you didn't find any logic or security-related issues in the code! This usually means one of two things:
  1. The code is well-written and secure: This is the ideal scenario! It means the developers have done a good job considering potential issues and implementing best practices.
  2. The code changes are minimal and don't touch critical areas: It's possible the changes were focused on styling, refactoring, or other non-functional aspects.

Even if you didn't find anything specific to comment on, it's still good practice to leave a brief message indicating you've reviewed the code and didn't find any issues. This helps with tracking and shows you've been thorough.

For example, you could say:

  • "Looks good to me! I didn't spot any logic or security concerns in this change."
  • "This change doesn't seem to introduce any new logic or security risks. Approving."

Remember, code reviews are a collaborative process. Even if you don't have direct feedback, your acknowledgement and approval are still valuable contributions.

</details>

- Improved handling of onChange events in FormAddressInput and FormInput
- Removed unnecessary code and dependencies from FormAddressInput
- Enhanced debouncing logic for address validation in FormAddressInput
- Updated suffix prop type to ReactNode in FormInput
- Simplified tribunal address handling logic in PoolForm
- Replaced useState with useDebounce in FormAddressInput component
- Added readOnly prop to FormCheckBox and removed register function from props
- Simplified onChange handlers across multiple form components
- Removed unnecessary useEffects and useMemo hooks in FormInput component
- Updated the way values are set in PoolEditForm and PoolForm components
- Introduced a new cron job in the Vercel configuration
- The cron job is scheduled to run every 15 minutes
- Updated the dailyJob route to validate an API key from request headers before proceeding
- Unauthorized requests will receive a 401 response
- Included CRON_API_KEY in environment variables for turbo.json
- Moved chain-specific variables inside the function scope
- Renamed route file to accept chain as a parameter
- Updated `updateScores` and `updateScoresOnChain` functions to take chain as an argument
- Added new cron jobs for different chains in vercel.json
- Replaced "x-api-key" with "Authorization" in header retrieval
- Changed environment variable from "CRON_API_KEY" to "CRON_SECRET"
- Adjusted unauthorized response for invalid keys
The frequency of the daily-job in the passport-oracles API has been modified.

- The job's schedule was previously set to run every minute.
- It is now configured to run every 15 minutes.
- Renamed the `dailyJob` route to support different chains
- Moved chain-specific variables inside the `updateScoresOnChain` function
- Changed `GET` method to `POST` and added authorization check
- Added new cron jobs in vercel.json for different chains
- Included 'CRON_SECRET' in environment variables in turbo.json

:alarm_clock: Updated job schedule frequency

The frequency of the daily-job in the passport-oracles API has been updated.

- The job was previously running every minute, but it's now set to run every 15 minutes. This change should help reduce server load and improve overall performance.

:lock: Added unauthorized access logging

- Enhanced security by adding a console error log for unauthorized attempts to access the dailyJob route.
- The log includes details such as the request URL and chain parameter.

:alarm_clock: Updated cron job configurations

- Added POST method to all scheduled jobs
- No changes in the schedule timings, they remain at every 15 minutes
- This update ensures that the correct HTTP method is used when these jobs are triggered

:recycle: Refactor code to support multiple chains

- Renamed routes to include chain parameter
- Moved chain-specific variables inside functions, allowing them to use the new chain parameter
- Replaced local URLs with Vercel URL for fetching scores and passport data
- Removed unused environment variables (CHAIN_ID, HOST, PORT)
- Added authorization check in POST methods using CRON_SECRET environment variable
- Updated cron jobs in vercel.json to remove method specification

:sparkles: Added chain ID to API endpoints

- Imported `useChainIdFromPath` hook in CheckPassport, PoolForm and SubmitPassport components
- Updated the WRITE_SCORER_URI and fetch URL for addStrategy to include `chainFromPath`
- This allows the application to dynamically use the correct chain ID based on the current path

Fix paths

:truck: Standardize route naming

Renamed several routes to follow a consistent kebab-case naming convention. This change improves readability and consistency across the codebase.

- Changed 'addStrategy' to 'add-strategy'
- Renamed 'dailyJob' to 'daily-job'
- Updated 'writeScore' to 'write-score'
- Altered 'signMessage' to 'sign-message'
- Modified 'submitPassport' to 'submit-passport'

Also updated references in components where these routes were used.

:recycle: Improved URL handling and response messages

- Modified the way URLs are constructed to handle both production and development environments
- Enhanced response message to provide more accurate status of score updates
- Added multi-chain support in daily job route
- Removed redundant API endpoint declaration
- Changed POST request to GET in passport-oracle route
- Enhanced error handling for unauthorized requests
- Added console logs for debugging in CheckPassport component
- Improved form validation logic in AllowListInput and FormInput components
- Updated UI layout and added placeholder option in FormSelect component
- Modified PoolEditForm by removing exportAddresses function, updating labels, and adjusting layout
- Adjusted the way sybil resistance options are handled in PoolForm component
- Updated chain configuration
- Replaced `CV_PERCENTAGE_SCALE` with `CV_PASSPORT_THRESHOLD_SCALE` for better score calculation
- Enhanced CheckPassport component to handle fetching state and added more hooks for contract interactions
- Adjusted form width in PoolEditForm and
- Modified the 'strategy' prop type to include 'sybilScorer'
- Passed the entire 'strategy' object instead of just 'id' to CheckPassport component
- Updated error messages to prompt users to report bugs
- Simplified contract write operations by directly passing arguments instead of creating a separate data object
- Replaced specific variable names with more generic ones for better code readability
- Added additional checks and error handling in the passport submission process
- Adjusted score calculation methods according to the updated CV_PASSPORT_THRESHOLD_SCALE constant
- Moved `truncateString` function to a utility file for reusability
- Added null check before setting default values in PoolEditForm
- Reordered some logic blocks in PoolHeader for better flow
- Removed unnecessary console log from useCheckAllowList hook
- Added `shortenAddress` function to text utilities
@Corantin Corantin merged commit eaf327d into allowlist-feature Oct 15, 2024
2 of 3 checks passed
@Corantin Corantin deleted the ui-allowlist branch October 15, 2024 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI Allowlist
3 participants