Skip to content
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

Fix attachment export truncating file names #646

Closed
wants to merge 570 commits into from
Closed

Conversation

skius
Copy link

@skius skius commented Jan 15, 2023

Fixes the export of attachments by including the full file name in the output path instead of truncating at the first whitespace.

Bob Copeland and others added 30 commits October 10, 2016 14:26
Similarly to account_is_group, add a function that documents the
special url format denoting secure note types rather than open-coding
the comparison.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
It was reported that editing a secure note to rename it doesn't work,
while it does work for accounts.  The reason is we only apply name
changes only if the user had specified `--name`.  But this is a
historical limitation, e.g. when using the "any" edit type it makes
sense to retain username edits, so just do it always since we
always have a copy of the original account name in any case.

Fixes lastpass#106.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
I stumbled across a segfault doing 'lpass ls -l' -- it's possible for
an account not to have an mtime at all, so don't crash in this case.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
There is more than one implementation now for a simple string
buffer object (string + allocated size + used length), so
standardize on the implementation in blob.c.

Add append_char (used by import) and append_str (to be used later)
to round out the common operations we will need.

This also fixes an off-by-one in append_char.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
We occasionally get requests to add new fields to ls output
or somehow customize what stuff gets shown to make things
better for humans or for screen scrapers.

Rather than trying to accomodate everyone's use case, add
a new format library like printf, so that you can (eventually)
do things like

    ./lpass ls --format='%N %i %u'

or
    ./lpass show --format='%fN'

...or whatever.  I haven't really settled on the right format
strings to use so this is still a WIP, but currently it can
handle generating the existing (non-color) ls format.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
The format string only needs to be created once instead of in
a loop, and using xasprintf simplifies things a bit, so do that.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
This drops a bit of code duplication by using the same format
string for both color-less and tree mode output.  The only
difference in the format string between the two is whether the
fullname or short acpcount name is used; we can go ahead and
embed the terminal color codes which will simply get stripped
in terminal_printf.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
This adds the ability to supply a custom format string to ls.
This might be useful for certain scripting tasks; e.g. you can
save a sed/awk pipeline when grabbing an id by doing:

    lpass ls --format=%i account-name

Signed-off-by: Bob Copeland <copeland@lastpass.com>
This adds some infrastructure useful for cmd-show:

 - You can use '/' after % to include a slash only if the expansion
   of the rest of the placeholder is non-empty
 - group and shared folder name gained their own placeholders

Thus showing a path-like representation of a name can be done
like "%/S%/g%Nf".

Also, format_field function was added which formats a name/value pair
("%fn", "%fv" resp.).  It also takes an account so that it can format
any of the existing account fields as needed.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
This adds the ability to specify the field format used with command-show
using "--format", and the title format with "--title-format".

Just as a fairly contrived example, you can get almost-json like this:

echo "{"; \
./lpass show --title-format='    "title": "%/S%/g%Ns",' \
    --format='    "%fn": "%fv",' foo; \
echo "}"

Signed-off-by: Bob Copeland <copeland@lastpass.com>
Group the placeholders by type of object being printed (so "%aX" for
account).  This reduces pollution of the top-level namespace a bit
so that we can use more natural characters.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
This uses the new format string infrastructure to display
just fieldnames in a subshell so that the fields in a specific
account can be tab-completed.  In order for lpass to know which
account is being queried, you have to specify account name first,
like:

    lpass show foo --field [tab]

There's a slight annoyance that title cannot go away completely,
so post-process with egrep to drop those.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
$(wildcard) does not guarantee a sorted list, which causes
also a non-deterministic order while linking the binary.
To support reproducible building, the list is explicitely sorted.

Signed-off-by: Reiner Herrmann <reiner@reiner-h.de>
Builds with CMake would link against the wrong (apple-supplied)
version of openssl; make sure we use the one installed by brew.

Pass -DOPENSSL_INCLUDE_DIR to use something else.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
Add the install-doc target to install the manpage which was present
in the original Makefile but missing here.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
"cmake ." in order to get a Makefile for make.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
Signed-off-by: Bob Copeland <copeland@lastpass.com>
This is needed on some Linux platforms for error-free build.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
If we can determine the destination directory, install
bash completions file.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
CMake complains when building in cygwin unless you tell it
whether or not your project needs win32.  So tell it.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
Signed-off-by: Bob Copeland <copeland@lastpass.com>
Signed-off-by: Bob Copeland <copeland@lastpass.com>
For some use cases we may need to ask the user for one of several
options, not just yes or no.  Add a function that implements this,
taking the charset of options as a string and returning the selected
option.

Rewrite ask_yes_no to use the new function.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
This change adds the ability to retrieve attachments for secure notes.
The `lpass show` command now shows attachment ids and filenames if
a secure note has attachments.  The attachment id can then be passed
to `lpass show acct --attach=attachid` which will either print the
attachment (if non-binary) or offer the ability to save.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
In OpenSSL 1.1+, EVP_CIPHER_CTX can no longer be declared on
the stack; instead you have to declare a pointer and then
use _new()/_free() to allocate or free it.  These functions
continue to work on older OpenSSL, so switch to the new
method.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
struct pkcs8_priv_key_info_st is now opaque as of OpenSSL 1.1
so we cannot look directly at its flags going forward.

./cipher.c: In function ‘cipher_rsa_decrypt’: ./cipher.c:73:11: error: dereferencing pointer to incomplete type ‘PKCS8_PRIV_KEY_INFO {aka struct
pkcs8_priv_key_info_st}’
  if (p8inf->broken)
           ^

Signed-off-by: Bob Copeland <copeland@lastpass.com>
In OpenSSL 1.1, HMAC_CTX is now opaque and _init/_cleanup functions
are history.  Change the pbkdf2 implementation to conditionally
use HMAX_CTX_new()/_free() and use context pointers throughout.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
- The GNUInstallDirs package, unlike the builtin install() macro,
  doesn't handle DESTDIR for you. So specify DESTDIR by hand, wherever
  applicable.
- Specify the correct path of the manpage to install.
- Don't require the HTML doc to be built as a prerequisite of installing
  the manpage.
- Make targets "more correct", add uninstall target.

We would like to clean up the overly tortuous layer of indirection over
pkg-config, but on systems with ancient versions of CMake (i.e. Debian
stable) pkg_get_variable simply doesn't exist.

Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
waterkip and others added 25 commits March 26, 2019 10:16
Signed-off-by: Wesley Schwengle <wesley@schwengle.net>
…_display_time

Decrease the time for the cli app to do things by @waterkip
`lpass status` asks the agent to see if we are logged in or not. The
code for the logout bit checks the session and if a session has gone
stale it want to refresh it. Implement a similar logic as in
cmd-status.c where we ask the agent if we have a session, if we do,
proceed as always, else, wipe all the session data that we can find.
This removes the if-logic in session kill, to delete all config files
even if they for whatever reason do not exist. Since we want to kill it,
it seems logical to ignore these missing files.

Fixes: lastpass#477

Signed-off-by: Wesley Schwengle <wesley@schwengle.net>
…hould_not_require_a_login

Fix bug where logout requires login by @waterkip
PKG_CONFIG_PATH shouldn't be reset, only appended to or prepended to, so
that the user can still use non-default paths if they need to.
Additionally, package managers other than Homebrew (such as Nix) still
need to be able to provide their own versions of packages, and aren't
going to use Homebrew's default path to do so.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Fix non-default PKG_CONFIG_PATH on macOS by @alyssais
Signed-off-by: Wesley Schwengle <wesley@schwengle.net>
Change credits to Wesley Schwengle for 1.3.3 release
Refactor agent.c for socket initialisation by @waterkip
add lastpass attachment export script by @mindrunner
wl-copy appears to have become the de-facto standard command line
program for copying to the clipboard on Wayland, with multiple
implementations of the same interface[1][2].

I think it makes sense for wl-copy to be preferred over xclip if both
are installed, since Wayland should generally be preferred over X11.

[1]: https://github.com/bugaevc/wl-clipboard
[2]: https://github.com/YaLTeR/wl-clipboard-rs

Signed-off-by: Alyssa Ross <hi@alyssa.is>
MS Authenticator is currently incompatible with this tool (lastpass#442). I noticed that MFA errors are mapped in an array of `multifactor_type`, which I've updated with the appropriate error codes for MS Authenticator (tested running through a debugger).

Signed-off-by: John Hammerlund johnhammerlund@gmail.com
Add MFA support for Microsoft Authenticator
Merge pull request lastpass#637 from gder91/updating_post_parameter
Fixes the export by including the full file name in the output path instead of truncating at the first whitespace.

Signed-off-by: Niels Saurer <me@nielssaurer.com>
@0xdevalias
Copy link

@mateusmartins-lp It's good 'open source courtesy' to give context when closing an issue/PR, not just closing it with no explanation.

@0xdevalias
Copy link

@mateusmartins-lp It's good 'open source courtesy' to give context when closing an issue/PR, not just closing it with no explanation.

Hello @0xdevalias. The Pull Requests were closed unintentionally. By tomorrow I will be sure to leave a message on how to proceed. My sincere apologies for the inconvenience.

Originally posted by @mateusmartins-lp in #553 (comment)

@mateusmartins-lp
Copy link
Contributor

Regrettably, your PR submission was unintentionally closed during an operation, before we could complete our review and respond accordingly. Unable to revert it to 'Open' status, we invite you to resubmit your contribution at your earliest convenience. We apologize for this mishap. Rest assured, we value all contributions and remain dedicated to providing transparency and closure to the community. Thank you for your understanding.

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.