prefer-context-authz

prefer-context-authz is a cursor rule for Cursor from atlassian/forge-skills. It costs 1,331 tokens per session, scanned A, original, Apache-2.0.

A coding rule for Forge functions that says information already supplied in a validated context object should be used there instead of being copied into the function’s input data.

In plain words
What is it for?
Use it when designing or reviewing Forge function and resolver arguments, especially for values such as the signed-in user’s account ID.
Why use it?
It avoids duplicating trusted information in an unvalidated payload and reduces the need for the app to validate it again.

Cursor rule for Cursor ✓ vendor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it when designing or reviewing Forge function and resolver arguments, especially for values such as the signed-in user’s account ID.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/atlassian/forge-skills/prefer-context-authz
About the project

Atlassian Forge Skills supports Atlassian Forge, a platform for building and deploying apps that extend products such as Jira and Confluence. Its skills and MCP-backed tools help coding agents create Forge apps, review them before deployment, optimize usage, troubleshoot failures, and work with Forge APIs and the Atlassian Design System.

atlassian/forge-skills · 35 stars · on GitHub · developer.atlassian.com

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/atlassian/forge-skills

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for prefer-context-authz

README.md
[![agentmods](https://agentmods.dev/badge/rules/atlassian/forge-skills/prefer-context-authz/github.svg)](https://agentmods.dev/rules/atlassian/forge-skills/prefer-context-authz)
Your own site
<a href="https://agentmods.dev/rules/atlassian/forge-skills/prefer-context-authz"><img src="https://agentmods.dev/badge/rules/atlassian/forge-skills/prefer-context-authz/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for prefer-context-authz

Your own site · 80×15
<a href="https://agentmods.dev/rules/atlassian/forge-skills/prefer-context-authz"><img src="https://agentmods.dev/badge/rules/atlassian/forge-skills/prefer-context-authz.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,331 This file is loaded in full into every session.
When invoked 1,331 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01331 $0.01331
Opus 5.5 $0.00532 $0.00532
Sonnet 5.5 $0.00266 $0.00266
Haiku 4.5 $0.00133 $0.00133

Measured 20d ago against content hash 3eb9a2cfb122, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

prefer-context-authz scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 20d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/forge-security-review/assets/security-rules/forge-authn-authz/prefer-context-authz.mdc · 154 lines

How it starts

The opening of the file, as written. The whole thing — 154 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context

  • This rule uses terms which may have more up-to-date explanations from the Forge MCP server
  • Forge functions may be distinguished from other JS functions by:
    • Being exported, and furthermore,
    • Being named under modules.functions.[].handler, as the last name in a .-separated chain
  • Forge functions receive two arguments: a module-specific payload, and an object containing contextual information for the function invocation. Call the latter one the "context object." See the signature described under "Forge Function Signature"
  • There are also forge resolver functions, which appear as the second argument of foo.define() calls, where foo is a variable constructed from a @forge/resolver Resolver object.
  • Forge resolver functions have a signature described under "Resolver Function Signature" in this rule, with a context object of type Context, and a payload named payload.
  • The context object is validated in full by the Forge platform. Some apps use an anti-pattern of passing information avilable in this object (commonly accountId) explicitly through the payload object instead. Since the latter is not validated, the app must validate it iself, but this may result in incorrect validation or even absent validation, and should be avoided.

Resolver Function Signature

type Context = {
  accountId?: string;
  accountType?: 'licensed' | 'unlicensed' | 'customer' | 'anonymous';
  cloudId?: string;
  workspaceId?: string;
  localId: string;
  installContext: string;
  environmentId: string;
  environmentType: string;
  extension: {
    config?: { [key: string]: any } // defined for macro extensions
    [key: string]: any;
  },
  installation?: {
    ari: {
      installationId: string;
      toString: () => string;
    },
    contexts: [
      {
        cloudId?: string,
        workspaceId?: string,
        toString: () => string
      }
    ]
  }
};

function define(
  functionKey: string,
  // IMPORTANT: this parameter receives the resolver dunction definition
  cb: (request: {
    payload: { [key in number | string]: any;},
    context: Context
  }) => Promise<{ [key: string]: any } | string | void> | { [key: string]: any } | string | void,
): this

Forge Function Signature

// The type of the context object
export type Context = {
  installContext: string;
  principal?: Principal;
  license?: License;
  installation?: Installation;
  workspaceId?: string;
}

export type Principal = {
  accountId: string;
}

export type License = {
  isActive: boolean;
  billingPeriod?: string | null;
  capabilitySet?: string | null;
  ccpEntitlementId?: string | null;
  ccpEntitlementSlug?: string | null;
  isEvaluation?: boolean | null;
  subscriptionEndDate?: string | null;
  supportEntitlementNumber?: string | null;
  trialEndDate?: string | null;
  type?: string | null;
};

export type Installation = {
  ari: InstallationAri;
  contexts: ContextAri[];
}

export type InstallationAri = {
    installationId: string;
    toString: () => string;
};

export type ContextAri = {
  cloudId?: string;
  workspaceId?: string;
  toString: () => string;
}

// IMPORTANT: This is the forge function
export const handler = (payload, context: Context) => {
  // Does something
}

Scope & Signals

  • Manifest location of interest: modules.functions.[].handler
  • Any resolver functions defined by .define() calls on a variable of type Resolver
  • Risk indicators:
    • The payload object contains fields that are identical or likely contain the same information as fields available in the context object. Note that the fields available in this object will depend on whether it is a resolver function or not

Detection Process

1. Extract all forge function `handler` keys from the manifest
2. Extract all `resolver` keys present, at any depth, under the `modules` key in the manifest
3. Treat all functions identified by (1) as forge functions, and all from (2) as resolver functions
4. Find the definition of each function in the source code
5. Check, as thoroughly as you can, how each of these functions use their payload objects. Look for field names or
   accesses which are likely to contain information similar to the context fields available for that type of function
   a. Pay closer attention to fields which are eventually passed to `asApp()` endpoint calls
6. If any likely such use is found, flag the function for review

Read the full file on GitHub · 154 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 20d ago Changed · +5 lines · +126 tokens per session 3eb9a2cfb122
  2. 3mo ago First seen · 149 lines · 1,205 tokens per session scan A 1423a7fa4a52

Subscribe to this mod's changes

prefer-context-authz is a cursor rule published in the GitHub repository atlassian/forge-skills (35 stars, last pushed 4d ago), licensed Apache-2.0. It adds 1,331 tokens to every session, about $0.0053 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

prefer-context-authz compared with cursor rules from other repositories

prefer-context-authz next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
prefer-context-authzatlassian/forge-skillsCursor rule354d agoApache-2.0A1,331Cursor
ponytailDietrichGebert/ponytailCursor rule201k8d agoMITA604Cursor
angular-20angular/angularCursor rule102k4d agoMITA0Cursor
dev-standardapache/supersetCursor rule76ktodayApache-2.0A1,147Cursor
prefer-assertions-over-defensive-checksprisma/ormCursor rule48ktodayApache-2.0A0Cursor
prefer-direct-imports-over-module-mocksprisma/ormCursor rule48ktodayApache-2.0A0Cursor
shared-plane-packagesprisma/ormCursor rule48ktodayApache-2.0A0Cursor