Skip to content

Conversation

@aishkan
Copy link
Contributor

@aishkan aishkan commented Oct 22, 2025

💐

/cc @zendesk/wattle

Description

Add validation for scopes attribute for secure param.
Validations added are as follows

  • scopes can be nil
  • scopes can't be empty []
  • scopes can only be present when secure true is set on the attribute
  • The validation of scope is based on validate_scopes_for_secure_parameter passed in param

References

https://zendesk.atlassian.net/browse/APPS-7700

Risks

  • [RUNTIME] Can this change affect apps rendering for a user? No
  • [ low] Can break app validations

@aishkan aishkan changed the title Add validation for scopes attribute for secure param [APPS-7700] Add validation for scopes attribute for secure param Oct 22, 2025
@aishkan aishkan marked this pull request as ready for review October 22, 2025 22:14
@aishkan aishkan requested a review from a team as a code owner October 22, 2025 22:14
Copilot AI review requested due to automatic review settings October 22, 2025 22:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds validation for the scopes attribute on secure parameters in app manifests. The validation ensures scopes are only used with secure parameters, cannot be empty arrays, and contain only valid scope values from a predefined list.

Key Changes:

  • Added validate_scopes_for_secure_parameter flag to control scope validation
  • Implemented three validation rules: scopes require secure=true, scopes cannot be empty, and scopes must be from allowed values
  • Added comprehensive test coverage for all validation scenarios

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/zendesk_apps_support/validations/manifest.rb Implements scope validation logic with three new error checks and adds SECURE_PARAM_SCOPES constant
lib/zendesk_apps_support/manifest/parameter.rb Adds scopes to parameter attributes to support reading scope configuration
spec/validations/manifest_spec.rb Adds comprehensive test coverage for scope validation scenarios including edge cases
config/locales/translations/zendesk_apps_support.yml Adds translation keys for three new validation error messages
config/locales/en.yml Adds English text for the three new validation error messages

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from 1fc8a24 to c5c1530 Compare October 27, 2025 23:24
Copilot AI review requested due to automatic review settings October 28, 2025 01:04
@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from c5c1530 to eaa1381 Compare October 28, 2025 01:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from eaa1381 to 1a093cb Compare October 28, 2025 01:12
Copilot AI review requested due to automatic review settings October 28, 2025 01:24
@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from 1a093cb to 7f2d771 Compare October 28, 2025 01:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from 7f2d771 to 8adf80d Compare October 28, 2025 01:30
Copilot AI review requested due to automatic review settings October 28, 2025 03:45
@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from 8adf80d to d50c805 Compare October 28, 2025 03:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from d50c805 to 866fd65 Compare October 29, 2025 00:11
next if parameter.scopes.nil?

errors << ValidationError.new(:field_contains_invalid_attributes,
field: "parameters.[name=#{parameter.name}]",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the notation without . is closer to the array notation for JSON objects. Adding " as well to indicate it's a value might help.

This is kind of a hybrid between a JSON path and XPATH notation 😄. What do you reckon?

Suggested change
field: "parameters.[name=#{parameter.name}]",
field: "parameters[name=\"#{parameter.name}\"]",

Copilot AI review requested due to automatic review settings October 29, 2025 04:11
@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from 866fd65 to a40095b Compare October 29, 2025 04:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from a40095b to 9835af9 Compare October 29, 2025 04:13
Copilot AI review requested due to automatic review settings October 29, 2025 04:26
@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from 9835af9 to acdef7c Compare October 29, 2025 04:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from acdef7c to 99670c9 Compare October 29, 2025 04:32
Copilot AI review requested due to automatic review settings October 29, 2025 04:59
@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from 99670c9 to 07d926b Compare October 29, 2025 04:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from 16d174a to 3878082 Compare October 31, 2025 01:03
Copilot AI review requested due to automatic review settings October 31, 2025 02:16
@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from 3878082 to 04bdf10 Compare October 31, 2025 02:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

spec/validations/manifest_spec.rb:10

  • Corrected spelling of 'default ocale' to 'default locale'.
      'defaultLocale' => 'default ocale',

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aishkan aishkan force-pushed the aishkan/secure-settings-scope branch from 04bdf10 to bf1777a Compare October 31, 2025 03:06
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.

4 participants