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

paymentFlow plugin support #17

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

harshithakharsha
Copy link
Collaborator

Added plugin support to verify field access eligibility from the type.

blocked_field : "enableExternalRiskCheck"
field_access_whitelisted_fns: ["isMerchantEnabledForPaymentFlow", "transformECMerchantAccountToEulerMerchantAccount"]
field_rule_fixes: "Direct access of `enableExternalRiskCheck` field from `MerchantAccount` type is not allowed. Use the `isMerchantEnabledForPaymentFlow` function instead."
whitelisted_line_nos : []
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should not use whitelisting based on line_nos.
Instead, we should use module name and function name in that module

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

line_no based whitelisted added for an edge use case. Currently, we are not using this support and only module and fn name based logic is active.

Nothing -> pure Nothing
Just rule -> pure $ Just (loc1, rule)

L _ (HsApp _ (L loc2 (HsAppType _ (L _ (PatHsWrap (WpCompose (WpCompose (WpCompose (WpEvApp (EvExpr _hasFld)) (WpCompose (WpTyApp _fldType) (WpTyApp tableType))) (WpTyApp (LitTy (StrTyLit fastString)))) (WpTyApp _)) (HsVar _ opr))) _)) _) -> do
Copy link
Collaborator

@piyushgarg-juspay piyushgarg-juspay Aug 5, 2024

Choose a reason for hiding this comment

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

Please verify that patterns are not missed when we are not taking this case in ghc-9 version.
I assume this is for getField and till we are using record-dot-preprocessor, the AST should be like this only for both ghc-8 and ghc-9.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is verified in both the versions and flows are working as intended.

@@ -0,0 +1,60 @@
rules:
- type_name: "MerchantAccount"
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is a public repo, can we remove all these and put a simple non-juspay rule here.

@harshithakharsha harshithakharsha changed the base branch from main to ghc-9.2.8 August 12, 2024 08:37
@harshithakharsha harshithakharsha changed the base branch from ghc-9.2.8 to main August 12, 2024 08:37
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.

3 participants