Repository navigation
fix: HAR exports are always redacted and risky tools ask in the window - #28
Merged
Merged
Conversation
…export formnet mcp keeps relying on the MCP host's tool approval and now also asks the person in FormNET's own window before clear_flows, set_interception, set_passthrough and export_har act. The question is held by internal/approval and served at /api/approvals with approval.asked and approval.done on the stream; it waits two minutes, is refused at once when no window listens, and changes nothing unless the person allows it. export_har always redacts: include_secrets is gone and refused by name, the tool never asks for secrets=1, and it keeps an export only when the server reports what it redacted. HAR exports now redact secret headers, every cookie, query and URL fields, URL passwords and form and JSON body fields with secret names, replace each value with [redacted], and list what was redacted in the log comment, each entry's comment and the X-Formnet-Redacted trailer.
…nd non-UTF-8 bodies in HAR exports A name written as one word, such as accesstoken or X-CSRFToken, is now secret when its last word ends in token, secret, password, passwd, apikey or sessionid. A cookie with a value and no name reads [redacted]. A URL's whole user part is redacted, ending at the last @, since a user name alone is often a token. Form-encoded and JSON bodies are redacted by content type even when they are not valid UTF-8. The README no longer says the other MCP tools redact more than the four credential headers.
…ames in HAR exports - Find a URL's user part with url.Parse and replace all of it, a user name alone included; scheme-relative URLs are covered, and a URL that does not parse is cut at the last @ before the path that follows it. - Replace query fields without a name (a value alone or =value) and list them as "(no name)", as a cookie with an empty name now is. - In error notes, decode query field names before checking them and take out each secret value both as written and decoded. - Decode JSON string escapes in member names when reading JSON that does not parse throughout.
…parts in HAR error notes - Read a URL whose slashes after the scheme are written as backslashes as having an authority, and find its user part without url.Parse, which reads such a URL as having none. - Treat a query field whose name decodes to spaces only as a field without a name. - Take the URL's user part, user name and password out of error notes in every spelling, besides the secret query values.
…ds as a query - Treat the text before a colon as a scheme only when it is a letter followed by letters, digits, + - or ., as RFC 3986 defines one. - When url.Parse finds no user part in a URL with an authority, or reads it as opaque, cut the user part at the last @ before the path instead, so one holding a ? or # before its @ is still redacted, in the URL and in error notes. - Read a query or form field's name decoded and trimmed in one place, so a blank name counts as no name and names are listed without surrounding spaces.
…user part - Skip spaces and control characters before the address, and ignore tabs and line breaks inside the scheme and between the slashes, so such an address still has its user part redacted in the URL and in error notes. - Note the change in the changelog.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Tests
How to ship