Skip to content

feat: let an entry point name a project function by its own symbol - #180

Merged
SizzleUnrlsd merged 5 commits into
mainfrom
feat/declared-entry-points
Sep 28, 2026
Merged

SizzleUnrlsd merged 5 commits into
mainfrom
feat/declared-entry-points

Conversation

@SizzleUnrlsd

Copy link
Copy Markdown
Contributor

The engine side of the bare Lambda handler item (CoreTrace-Entreprise/coretrace-python-analyzer-plugins#3): a generic entry point by explicit symbol. Reading SAM templates and serverless.yml belongs to the Enterprise serverless table, which follows.

Summary

  • An EntryPoint may name a project function or class by its own symbol, python.app.handlers.main or python.app.handlers.Worker. function_entry_point matches it after the decorators, the class bases and the registrations, so the function, or every method of the class, receives input as a decorated one does, whatever its parameters are called. The engine infers nothing from a function's name: handler(event, context) without a declaration is nothing, and a test locks that.
  • EntryPoint.inputs limits the parameters that are input to the given positions, after self for a method: a handler's event (inputs=(0,)), not its context. It applies to decorated entry points too, and None keeps every parameter, so existing models are unchanged.
  • A single-file check honours a declared symbol, other processes see it, and a project plugin sees the label.

Verification

  • RED: 6 failures (EntryPoint had no inputs), then two on my own line numbers, fixed in the test.
  • tests/test_declared_entry_points.py: 7 passed. Full suite under Python 3.12.10, regression snapshots included: 1440 passed. ruff check and mypy pass.

A template file the engine cannot read proves nothing about escaping: the flow through render_to_string stays xss, and a template extending or including it is not established to escape either.
escaped_templates read a template file it could not open as empty text, and an empty template escapes everything it renders. Such a file now yields no escaping verdict, like a template the engine cannot find, so the flow stays xss and the templates needing it are not established either.
An EntryPoint naming a project function or class by its symbol makes it an entry point, whatever its parameters are called, and inputs limits the parameters that are input to the given positions: a handler's event, not its context. A function named handler is nothing without a declaration.
function_entry_point now matches the project symbol of a function, or of its class, against the EntryPoint models, after the decorators, the bases and the registrations, so an integration reading a deployment declaration can make a bare Lambda handler an entry point. EntryPoint.inputs limits the parameters that are input to the given positions after self.
@SizzleUnrlsd SizzleUnrlsd added the enhancement New feature or request label Sep 28, 2026
@SizzleUnrlsd SizzleUnrlsd self-assigned this Sep 28, 2026
…-entry-points

Both branches open the Unreleased section of the changelog; it now holds the Precision and the Plugins entries.
@SizzleUnrlsd
SizzleUnrlsd merged commit 85f92d5 into main Sep 28, 2026
10 checks passed
@SizzleUnrlsd
SizzleUnrlsd deleted the feat/declared-entry-points branch September 28, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant