Repository navigation
fix(errors): make rejected-value disclosure explicit #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
seonghobae
wants to merge
24
commits into
feat/commercial-postgres-driver-port-b84f0c9
Choose a base branch
from
fix/validation-error-confidentiality-d0a4b30
base: feat/commercial-postgres-driver-port-b84f0c9
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e5aa7a4
test(errors): prove rejected-value confidentiality RED
seonghobae 8fff42d
fix(errors): redact rejected values by default
seonghobae e1d6b84
test(errors): cover explicit bounded diagnostic evidence
seonghobae 23a15c9
test(api): require endpoint validation redaction
seonghobae abfa4c0
test(orchestrator): redact unknown batch selectors
seonghobae ae0713e
test(orchestrator): classify safe token-limit diagnostics
seonghobae 2a4c5bd
fix(orchestrator): expose only bounded numeric limit evidence
seonghobae 6596a79
test(lifecycle): expect redacted callable evidence
seonghobae e2f4abc
test(tenant): redact rejected tenant identities
seonghobae 04063bb
test(tokens): redact oversized record diagnostics
seonghobae 731c5f9
fix(errors): preserve bounded lifecycle sentinel evidence
seonghobae afe5cc8
test(errors): prove bounded numeric evidence policy
seonghobae c9dd77c
fix(errors): bound token-limit diagnostic rendering
seonghobae 7aad177
test(errors): cover integer rendering fallback
seonghobae 71540e1
test(errors): reject hostile safe-value subclasses
seonghobae cb4689f
fix(errors): require exact safe-value strings
seonghobae 3ec0140
fix(privacy): isolate validation error confidentiality on current root
seonghobae 43f381a
fix(privacy): serialize validation confidentiality after driver migra…
seonghobae 5a9685f
test(privacy): assert redacted batch lookup diagnostics
seonghobae 96a1bfc
test(privacy): redact oversized record diagnostics
seonghobae b67ff2d
test(privacy): align rejected-value evidence with fail-closed redaction
seonghobae b8fd11a
test(privacy): redact tenant recorder seam evidence
seonghobae 53b7549
chore(pr202): reconcile privacy child with current postgres parent
seonghobae a5764e9
chore(pr202): reconcile privacy child with current postgres parent
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| """Confidentiality regressions for rejected-value validation evidence.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import pytest | ||
|
|
||
| from pg_llm_batch.exceptions import ValidationError | ||
|
|
||
|
|
||
| def test_default_validation_error_does_not_retain_or_render_rejected_content() -> None: | ||
| """Arbitrary rejected content must stay outside package-owned error evidence.""" | ||
| secret = "credential-shaped-sentinel-7f4a6b89" | ||
|
|
||
| error = ValidationError( | ||
| field="api_key", | ||
| value=secret, | ||
| reason="must satisfy the configured policy", | ||
| ) | ||
|
|
||
| assert secret not in str(error) | ||
| assert secret not in repr(error) | ||
| assert secret not in repr(error.args) | ||
| assert secret not in repr(error.details) | ||
| assert error.details == { | ||
| "field": "api_key", | ||
| "value": "<redacted>", | ||
| "reason": "must satisfy the configured policy", | ||
| } | ||
|
|
||
|
|
||
| def test_default_validation_error_never_calls_rejected_value_repr() -> None: | ||
| """Safe-default construction must not execute caller-controlled rendering.""" | ||
|
|
||
| class HostileRejectedValue: | ||
| def __repr__(self) -> str: | ||
| raise AssertionError("rejected value repr must not run") | ||
|
|
||
| error = ValidationError( | ||
| field="payload", | ||
| value=HostileRejectedValue(), | ||
| reason="must be a supported value", | ||
| ) | ||
|
|
||
| assert str(error) == ( | ||
| "[VALIDATION_ERROR] Invalid value for 'payload' (must be a supported value)" | ||
| ) | ||
| assert error.details["value"] == "<redacted>" | ||
|
|
||
|
|
||
| def test_reviewed_safe_value_is_bounded_explicit_evidence() -> None: | ||
| """Callers may expose only a separately supplied reviewed diagnostic string.""" | ||
| secret = "actual-rejected-secret" | ||
|
|
||
| error = ValidationError( | ||
| field="mode", | ||
| value=secret, | ||
| reason="must name a supported mode", | ||
| safe_value="unsupported-mode", | ||
| ) | ||
|
|
||
| assert secret not in str(error) | ||
| assert secret not in repr(error.details) | ||
| assert error.details["value"] == "unsupported-mode" | ||
| assert str(error) == ( | ||
| "[VALIDATION_ERROR] Invalid value for 'mode': unsupported-mode " | ||
| "(must name a supported mode)" | ||
| ) | ||
|
|
||
|
|
||
| def test_safe_value_rejects_non_string_evidence() -> None: | ||
| """Explicit evidence authority must not reintroduce arbitrary object rendering.""" | ||
| with pytest.raises(TypeError, match="safe_value must be a string or None"): | ||
| ValidationError(field="mode", value="secret", safe_value=1) # type: ignore[arg-type] | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "safe_value", | ||
| ["", "x" * 129, "line\nbreak", "non-ascii-é"], | ||
| ) | ||
| def test_safe_value_rejects_unbounded_or_non_printable_evidence( | ||
| safe_value: str, | ||
| ) -> None: | ||
| """Explicit evidence remains finite, printable ASCII suitable for logs.""" | ||
| with pytest.raises( | ||
| ValueError, | ||
| match="safe_value must contain 1-128 printable ASCII characters", | ||
| ): | ||
| ValidationError(field="mode", value="secret", safe_value=safe_value) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.