Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneeszack

Relationships

#3852 credentials-sensitive-field misses .meta({ sensitive: true }) when deno fmt wraps the object over lines

Opened by reset · 10/23/2026· Shipped 10/23/2026

On swamp 20261020.024627.0-sha.26dc044f (macOS 27), a secret-looking field marked sensitive is still flagged when the .meta() object is long enough for deno fmt to break it. ~/.swamp/deno/deno fmt turns

apiKey: z.string().meta({ sensitive: true, description: "The API key issued to the game owner, found under the game admin page." }),

into

  apiKey: z.string().meta({
    sensitive: true,
    description:
      "The API key issued to the game owner, found under the game admin page.",
  }),

and swamp extension quality and push --dry-run then report credentials-sensitive-field on the apiKey line: Field on line "apiKey: z.string().meta({" looks like a secret but is not marked .meta({ sensitive: true }).

The rule in src/domain/extensions/extension_review_rules.ts is line based: it tests MARKED_SENSITIVE (/(?:^|[^\w$])["']?sensitive["']?\s*:\s*true\b/) against the field's line, then scans following lines only while they match /^\s+\./ (a continuation of the method chain). The wrapped form's next line is sensitive: true,, which does not start with ., so the scan stops and the field is reported.

Expected: a field whose .meta() call contains sensitive: true is not reported, however deno fmt lays the call out. Actual: the marker is found only on the field's line or on .-prefixed continuation lines; fmt --check is a push gate, so the author cannot keep it on one line.

Steps to reproduce:

  1. In an extension's global arguments schema, write the one-line apiKey field above with a description long enough to exceed 80 columns.
  2. swamp extension fmt manifest.yaml (or deno fmt) wraps it as shown.
  3. swamp extension quality manifest.yaml --json lists the credentials-sensitive-field warning on that field.

#601 (shipped) handled .meta() on a chain continuation line, #1044 numeric and alias types, #2952 token counts, #3019 word boundaries and reference names; none handles a wrapped object literal. Workaround: .meta({ sensitive: true }).describe("..."), which keeps the marker on the field's line.

Suggestion: when the field line opens a .meta({ (or any unclosed call), continue the scan until the bracket depth returns to zero, or evaluate the rule on the parsed expression.

02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 8 MOREREVIEW+ 17 MOREPR_LINKED+ 2 MORESESSION_SUMMARIZED

Shipped

10/23/2026, 6:49:45 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
zack assigned zack10/23/2026, 5:31:58 PM
Editable. Press Enter to edit.

reset commented 10/23/2026, 6:01:26 PM

A second gap in the same rule, in the other direction: it misses a webhook URL that isn't marked sensitive.

The secret stems are password|passwd|secret|token|api_?key|access_?key|credential|private_?key, so a field named webhookUrl never matches. A Discord or Slack webhook URL carries its token in the path, and anyone holding it can post as the webhook.

const GlobalArgsSchema = z.object({
  webhookUrl: z.string().min(1).describe("Discord webhook URL"),
});

On swamp 20261020.024627.0, swamp extension quality manifest.yaml --json reports no credentials-sensitive-field finding for that field. Rename it webhookToken, with nothing else changed, and the rule flags it: Field on line "webhookToken: z.string().min(1).describe(" looks like a secret but is not marked .meta({ sensitive: true }).

Adding webhook (or webhook_?url) to the stems would cover it. It can't be a reference the way secretName is, so no new reference suffix is needed.

zack commented 10/23/2026, 6:49:47 PM

Thanks @reset for reporting this! We shipped: Make credentials-sensitive-field decide whether a secret-looking field is marked from the field's own syntax-tree value expression, using the Babel parse that extension_source_ast.ts already provides for the extension rules, so a .meta({ sensitive: true, ... }) object that deno fmt wraps over several lines is recognised. The search follows the field's call chain and checks only the direct properties of object-literal arguments, so nested fields' metadata never counts. The existing line checks run first and are unchanged; the source is parsed lazily, once, only when a candidate field is unmarked on its own line; a source that does not parse, or a line with no matching field node, keeps today's dot-continuation scan. Doc comments, example tests and a property test cover the wrapped layouts and the boundaries.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.