nginx / nginx/njs

Phase Declarative Syntax for js_set

Open
#475 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

answered discussion njs question
Dominant language
C
Stars
1.6k
Forks
239
Avg merge
2d 9h
Merged PRs (30d)
10

Description

Are there any plans to modify js_set to allow specific phase declaration? Right now js_set sort of intelligently chooses its phase based on where you use the variable which is nice but if you need to use the variable in a way that has access to data that is only available at specific processing phases, there is no way to do that. For example, if we want to use a variable that can allow/deny access to a location based on the contents of the request body in a POST, this is not possible with js_set. It's only possible with js_content due to the availability of the content in the phase. If there was a way to specify that a variable must be run at an appropriate phase where the request body is available (for example), this would/should solve that.

It could be something like:
Default:
js_set module.function (picks the phase automatically like it does now)

Or declaritive:
js_set module.function access (where the phase needed is named)

Of course, if there is just some way to allow js_set variables to have access to the request body (even if that must be declarative too) that would also solve the current problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue concerns js_set and js_content phase behavior in the nginx JavaScript module; start by tracing how js_set selects a phase and when request-body data becomes available. Determine the expected behavior for declarative phase selection or request-body access, then verify that POST-based access decisions can run in the required phase.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nginx
Domain
authorization, backend, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.