Skip to content

parser: reject illegal raw identifiers in attribute access & ensure valid paths in generics#497

Merged
Kijewski merged 3 commits intoaskama-rs:masterfrom
Kijewski:6617490908315648
Jun 23, 2025
Merged

parser: reject illegal raw identifiers in attribute access & ensure valid paths in generics#497
Kijewski merged 3 commits intoaskama-rs:masterfrom
Kijewski:6617490908315648

Conversation

@Kijewski
Copy link
Copy Markdown
Member

Makes the parser reject illegal raw identifiers as in:

{{ crate.4 }}
{{ foo::<bar::crate> }}

Resolves issue https://issues.oss-fuzz.com/issues/426835840.

@Kijewski Kijewski added bug Something isn't working fuzzing error A bug found by fuzzing parser Related to the parser labels Jun 23, 2025
Comment thread askama_parser/src/expr.rs
}
Ok(())
}
Expr::Attr(elem, attr) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should really rename this variant into something like Field(Access?).

Copy link
Copy Markdown
Member Author

@Kijewski Kijewski Jun 23, 2025

Choose a reason for hiding this comment

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

Hm, I don't know. It does not have to be a field, e.g. in {{ self.attr() }} the attribute field of self is accessed, which might be a field, a method, or a field accessed through deref.

But "attr" normally means #[attr], so "field" might still be the better term.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AssociatedItem then. 😄

@Kijewski Kijewski merged commit edfa31f into askama-rs:master Jun 23, 2025
42 checks passed
@Kijewski Kijewski deleted the 6617490908315648 branch June 23, 2025 16:31
@Kijewski Kijewski mentioned this pull request Jun 23, 2025
@Kijewski Kijewski changed the title parser: reject illegal raw identifiers in attribute access & ensure valid paths in generics parser: reject illegal raw identifiers in attribute access & ensure valid paths in generics Jul 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fuzzing error A bug found by fuzzing parser Related to the parser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants