Skip to content

Automate browser based workflows with AI

Stop the Copilot secret screen flagging a quoted saved-login name (SKY-17984) (#8865)

Andrew Neilson3a84431a7cc3
diff --git a/skyvern/forge/prompts/skyvern/workflow-copilot-raw-secret-safety.j2 b/skyvern/forge/prompts/skyvern/workflow-copilot-raw-secret-safety.j2
index e3bf652c3..e4940b9aa 100644
--- a/skyvern/forge/prompts/skyvern/workflow-copilot-raw-secret-safety.j2
+++ b/skyvern/forge/prompts/skyvern/workflow-copilot-raw-secret-safety.j2
@@ -5,7 +5,7 @@ Return only JSON in this exact shape:
- A citation is the complete, verbatim secret-value substring from the latest turn. Cite every distinct value.
- Cite each value in full. The server redacts exactly the spans you cite and keeps the rest of the turn, so a partial citation leaves the remainder of that value in place.
- `clean` requires no citations. `detected` requires one or more citations.
-- A saved-credential name, identifier, placeholder, or description is not literal authentication material.
+{% if read_value_not_label %}- A turn can refer to a saved credential, saved login, or connected account by the label its owner gave it or by its generated identifier (for example `cred_482913650271948372`), quoted or not: in `log in with "ops team"`, the quoted text is that label, not literal authentication material. A placeholder for a value, or a description of where a value is stored, is not literal authentication material either. What the turn calls a value never decides this. Read the value itself: text that reads as a password, key, or token is literal authentication material, and you cite it even when the turn calls it a saved login, a credential, or a connected account: in `sign in using my saved login "g7#Vq!2zWp9$"`, cite g7#Vq!2zWp9$ without its quote marks.{% else %}- A saved-credential name, identifier, placeholder, or description is not literal authentication material.{% endif %}
- First identify reusable account authentication. A value presented as a password is always reusable account authentication for this classification, including in a URL query or username/password URL userinfo. Reusable API keys and session credentials are also `detected` wherever they appear. An instruction to visit the URL never converts these credential types into scoped link capabilities. Cite the complete secret value, not the whole URL.
- Only after that check, treat a complete URL as operational destination input when the user explicitly directs the browser to open, navigate to, fetch from, or download from it and any remaining authentication-like material is a scoped capability conveyed by possession of that particular link (for example, a signed access link). Classify that delegated-destination turn as `clean`; cite only literal authentication material supplied separately from the destination.
- A URL merely mentioned as the source or location of authentication material is not a delegated browser destination. Authentication material supplied for use as authentication remains `detected`, including when the cited value appears inside such a URL.
diff --git a/skyvern/forge/sdk/copilot/request_policy.py b/skyvern/forge/sdk/copilot/request_policy.py
index 0071e054d..6c52299bc 100644
--- a/skyvern/forge/sdk/copilot/request_policy.py
+++ b/skyvern/forge/sdk/copilot/request_policy.py
@@ -138,6 +138,9 @@ RawSecretSafetyFailureKind = Literal[
"invalid_citation",
]
_RAW_SECRET_SAFETY_PROMPT_NAME = "workflow-copilot-raw-secret-safety"
+# The value-over-label sentence released labelled passwords on other model settings, so it is
+# served only where it was measured; add a key here only with a replay of the secret controls.
+_VALUE_OVER_LABEL_WORDING_LLM_KEYS = frozenset({"AZURE_OPENAI_GPT6_LUNA_WITH_OPENAI_FALLBACK"})
_RAW_SECRET_SAFETY_UNAVAILABLE_TURN = "[INPUT_UNAVAILABLE_SAFETY_SCREEN_INCOMPLETE]"
_REDACTED_SECRET_PLACEHOLDER = "[REDACTED_SECRET]"
@@ -402,6 +405,7 @@ async def _screen_raw_secret_safety(
prompt = prompt_engine.load_prompt(
template=_RAW_SECRET_SAFETY_PROMPT_NAME,
user_message=escape_code_fences(deterministic_safe_message),
+ read_value_not_label=getattr(handler, "llm_key", None) in _VALUE_OVER_LABEL_WORDING_LLM_KEYS,
)
except Exception:
return _screen_unavailable("malformed_output")
diff --git a/tests/unit/test_copilot_raw_secret_safety.py b/tests/unit/test_copilot_raw_secret_safety.py
index 79a30e9a9..c2257c46d 100644
--- a/tests/unit/test_copilot_raw_secret_safety.py
+++ b/tests/unit/test_copilot_raw_secret_safety.py
@@ -1010,3 +1010,33 @@ def test_a_redacted_secret_draft_result_points_at_the_card_while_it_can_open(
assert expected in message
assert _CARD_SECRET not in message
assert ("Credentials UI" in message) is not card_can_open
+
+
+ ("llm_key", "serves_value_over_label"),
+ [("AZURE_OPENAI_GPT6_LUNA_WITH_OPENAI_FALLBACK", True), ("OPENAI_GPT5_4_MINI", False), (None, False)],
+)
+async def test_value_over_label_sentence_is_served_only_on_the_measured_model_setting(
+ llm_key: str | None, serves_value_over_label: bool
+) -> None:
+ handler = AsyncMock(return_value={"version": "1", "state": "clean", "citations": []})
+ if llm_key is None:
+ # A wrapper that drops the key must get the earlier sentence, never the measured-only one.
+ handler = AsyncMock(spec=["__call__"], return_value=handler.return_value)
+ assert not hasattr(handler, "llm_key")
+ else:
+ handler.llm_key = llm_key
+
+ await build_request_policy_trust_floor(
+ user_message="try again",
+ workflow_yaml="",
+ chat_history=[],
+ global_llm_context="",
+ organization_id="org-1",
+ handler=handler,
+ )
+
+ prompt = handler.await_args.kwargs["prompt"]
+ assert ("What the turn calls a value never decides this" in prompt) is serves_value_over_label
+ assert ("A saved-credential name, identifier, placeholder" in prompt) is not serves_value_over_label