Skip to content

A committed credential in source is a quoted literal, and the unquoted form is a config rule of its own - #201

Merged
HackingGate merged 1 commit into
mainfrom
a-committed-credential-in-source-is-a-quoted-literal-and-the-unquoted-form-is-a-config-rule
Sep 20, 2026
Merged

HackingGate merged 1 commit into
mainfrom
a-committed-credential-in-source-is-a-quoted-literal-and-the-unquoted-form-is-a-config-rule

Conversation

@HackingGate

Copy link
Copy Markdown
Owner

The value class of no-committed-auth-key-values holds the dot, the underscore and the colon, and its opening quote was optional, so a field access, a method chain or a call after password: or token = was read as a committed credential. Consumers disabled the rule, shadowed it with a copy that excluded Rust, or rewrote it to require the quote and kept the unquoted form for their config files under a second id.

The bundled set now carries that split.

  • no-committed-auth-key-values requires the value half to open with a quote: [=:]\s*["'][A-Za-z0-9_./+=:@-]{16,}. Scope unchanged (files.include = ["."], same excludes).
  • no-committed-auth-key-values-in-config keeps the optional quote and is scoped by files.glob to *.env, .env*, *.ini, *.cfg, *.conf, *.properties, *.yml, *.yaml, *.toml, *.json, *.xml, with the same excludes.

Corpus: the source rule lets through password: modem_config.password.clone(), let token = raw.trim_start_matches('v'), token = debs_mod.resolve_token(), token = probe_output.strip(), a :: path and a ? call, and still refuses password: "hunter2hunter2hunter2" and token = 'abcdef0123456789abcd'. The config rule refuses TOKEN=abcdef0123456789abcd in a .env and the unquoted and quoted forms in an .ini, and the same unquoted line in a .rs is allowed. The corpus completeness count is now by distinct rule rather than by case, since a glob-scoped rule needs a case per path it must and must not select.

sets.lock.json regenerated; the set table in docs/REFERENCE.md states the split. uphold's own tree is clean under both rules (checked with a temporary policy inheriting credentials, since this tree does not inherit it); no fixture needed an exclude change.

Closes #196

@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 1205d6b8-c4a3-4af6-864b-720694094a95

📥 Commits

Reviewing files that changed from the base of the PR and between 310ebab and c437a34.

📒 Files selected for processing (4)
  • docs/REFERENCE.md
  • policy/base/credentials.toml
  • policy/base/sets.lock.json
  • tests/base_set_corpus.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

codecov-commenter commented Sep 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.63%. Comparing base (310ebab) to head (c437a34).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #201   +/-   ##
=======================================
  Coverage   93.63%   93.63%           
=======================================
  Files          44       44           
  Lines       17057    17057           
=======================================
  Hits        15971    15971           
  Misses       1086     1086           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…d form is a config rule of its own

The value class of no-committed-auth-key-values holds the dot, the
underscore and the colon, and its opening quote was optional, so a field
access, a method chain or a call after `password:` or `token =` was read
as a committed credential. Consumers disabled the rule, shadowed it with
a copy that excluded Rust, or rewrote it to require the quote and kept
the unquoted form for their config files under a second id.

The bundled set now carries that split. The source rule requires the
value half to open with a quote, so an expression is never sixteen
characters of the class. A new no-committed-auth-key-values-in-config
keeps the optional quote and is scoped by glob to the shapes where the
text after the separator is the value itself: env files, INI, cfg, conf,
properties, YAML, TOML, JSON and XML. Both keep the same excludes, and
the source rule also excludes every shape the config rule selects, so
the two selections are disjoint and a quoted value in a YAML file is
one finding and not two.

The corpus holds the expressions the source rule lets through and the
quoted literals it still refuses, and the config rule's unquoted line in
a .env and an .ini beside the same line allowed in a .rs. Its
completeness count is now by rule rather than by case, because a rule
scoped by glob needs a case per path it must and must not select. The
set table in docs/REFERENCE.md states the split.

Closes #196
@HackingGate
HackingGate force-pushed the a-committed-credential-in-source-is-a-quoted-literal-and-the-unquoted-form-is-a-config-rule branch from 0854f5c to c437a34 Compare September 20, 2026 06:42
@HackingGate
HackingGate merged commit 48077f3 into main Sep 20, 2026
11 checks passed
@HackingGate
HackingGate deleted the a-committed-credential-in-source-is-a-quoted-literal-and-the-unquoted-form-is-a-config-rule branch September 20, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no-committed-auth-key-values reads an expression as a committed credential

2 participants