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

WIP: recursive type unrolling prototype #4125

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented Jun 27, 2024

Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

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

Spot checking, this makes sense.

@@ -69993,7 +69993,7 @@ export namespace wafv2 {
/**
* The part of a web request that you want AWS WAF to inspect. See Field to Match below for details.
*/
fieldToMatch?: pulumi.Input<inputs.wafv2.RuleGroupRuleStatementByteMatchStatementFieldToMatch>;
fieldToMatch?: pulumi.Input<inputs.wafv2.RuleGroupRuleStatementXssMatchStatementFieldToMatch>;
Copy link
Member

Choose a reason for hiding this comment

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

Is this just better shortening? It sounds like it should be RuleGroupRuleStatementMatchStatementFieldToMatch, since the rule statement appears in types nested from multiple properties of RuleGroupRuleStatement.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah ugh, shorter token heuristic picked this. I'd like to try to give it a better name.

@t0yv0
Copy link
Member Author

t0yv0 commented Jun 28, 2024

Couple of problems here.

tfgen is non-deterministic with substitutions like this one:

  •    sqliMatchStatement?: pulumi.Input<inputs.wafv2.RuleGroupRuleStatementRegexMatchStatement>;
    
  •    sqliMatchStatement?: pulumi.Input<inputs.wafv2.RuleGroupRuleStatementSizeConstraintStatement>;
    

These two types should not be have been picked for rewrite I suspect, and it's strange that one or the other is picked, I'd expect A<B or B<A on these.

     export interface RuleGroupRuleStatementRegexMatchStatement {
        /**
         * The part of a web request that you want AWS WAF to inspect. See Field to Match below for details.
         */
        fieldToMatch?: pulumi.Input<inputs.wafv2.RuleGroupRuleStatementRegexMatchStatementFieldToMatch>;
        /**
         * The string representing the regular expression. **Note:** The fixed quota for the maximum number of characters in each regex pattern is 200, which can't be changed. See [AWS WAF quotas](https://docs.aws.amazon.com/waf/latest/developerguide/limits.html) for details.
         */
        regexString: pulumi.Input<string>;
        /**
         * Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.
         * At least one required.
         * See Text Transformation below for details.
         */
        textTransformations: pulumi.Input<pulumi.Input<inputs.wafv2.RuleGroupRuleStatementRegexMatchStatementTextTransformation>[]>;
    }


    export interface RuleGroupRuleStatementSizeConstraintStatement {
        /**
         * The operator to use to compare the request part to the size setting. Valid values include: `EQ`, `NE`, `LE`, `LT`, `GE`, or `GT`.
         */
        comparisonOperator: pulumi.Input<string>;
        /**
         * The part of a web request that you want AWS WAF to inspect. See Field to Match below for details.
         */
        fieldToMatch?: pulumi.Input<inputs.wafv2.RuleGroupRuleStatementSizeConstraintStatementFieldToMatch>;
        /**
         * The size, in bytes, to compare to the request part, after any transformations. Valid values are integers between 0 and 21474836480, inclusive.
         */
        size: pulumi.Input<number>;
        /**
         * Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.
         * At least one required.
         * See Text Transformation below for details.
         */
        textTransformations: pulumi.Input<pulumi.Input<inputs.wafv2.RuleGroupRuleStatementSizeConstraintStatementTextTransformation>[]>;
    }

With

    export interface RuleGroupRuleStatementSqliMatchStatement {
        /**
         * The part of a web request that you want AWS WAF to inspect. See Field to Match below for details.
         */
        fieldToMatch?: pulumi.Input<inputs.wafv2.RuleGroupRuleStatementSqliMatchStatementFieldToMatch>;
        /**
         * Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.
         * At least one required.
         * See Text Transformation below for details.
         */
        textTransformations: pulumi.Input<pulumi.Input<inputs.wafv2.RuleGroupRuleStatementSqliMatchStatementTextTransformation>[]>;
    }

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.

2 participants